|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcoins.ir.hir.HIR_Impl
coins.ir.hir.StmtImpl
Statement
| Field Summary | |
protected boolean |
fMultiBlock
|
protected Stmt |
fNextStmt
|
protected Stmt |
fPrevStmt
|
| Fields inherited from class coins.ir.hir.HIR_Impl |
fAdditionalChild, fChildCount, fChildNode1, fChildNode2, fDbgLevel, fHirAnnex, fOperator, fParentNode, fType, hirRoot, inversionTable, machineParam, sourceLanguage |
| Fields inherited from interface coins.ir.hir.HIR |
OP_CODE_NAME, OP_CODE_NAME_DENSE |
| Fields inherited from interface coins.ir.IR |
OP_INF, OP_LIST, OP_PROG, OP_SUBP_DEF |
| Constructor Summary | |
|
StmtImpl()
Default constructor for subclasses. |
|
StmtImpl(HirRoot pHirRoot)
|
protected |
StmtImpl(HirRoot pHirRoot,
int pOperator)
|
| Method Summary | |
Stmt |
addNextStmt(Stmt pStatement)
addNextStmt Add a statement as the one next to this statement. |
Stmt |
addNextStmt(Stmt pStatement,
BlockStmt pBlock)
|
void |
adjustMultiBlockFlag()
|
void |
adjustMultiBlockFlag(Stmt pStmt)
|
Stmt |
ancestorControlStmtOfConditionalExp(HIR pHir)
Get the ancestor control statement (IfStmt, LoopStmt, SwitchStmt) containing pHir as conditional Exp or ExpStmt. |
LabeledStmt |
attachLabel(Label pLabel)
attachLabel Attach the definition of a label (pLabel) to this statement. |
LabeledStmt |
attachLabelAsFirstOne(Label pLabel)
attachLabelAsFirstOne Attach pLabel as the first label of this statement. |
LabeledStmt |
backTraceLabeledStmt()
|
java.lang.Object |
clone()
clone Override Object.clone in HIR. |
Stmt |
combineStmt(Stmt pStmt,
boolean pBeforeBranch)
combineStmt |
void |
combineWithConditionalExp(Stmt pStmt,
HIR pCond)
Combine pStmt with conditional expression part pCond of control statement so that pStmt should be executed before pCond. |
void |
copyPosition(Stmt pStmt)
Copy the file name and line number of pStatement to this statement. |
void |
cutLabelLinkOfStmt(Stmt pStmt)
cutLabelLinkOfStmt |
Stmt |
deleteNextStmt()
deleteNextStmt Delete the statement next to this statement and return the statement next ot the next statement, which may be null. |
Stmt |
deletePreviousStmt()
deletePreviousStmt Delete the statement that preceeds this statement and return a statement previous to the previous one. |
Stmt |
deleteThisStmt()
deleteThisStmt Delete this statement and return the next statement. |
BlockStmt |
getBlockStmt()
getBlockStmt Get the block statement containing this statement. |
java.lang.String |
getFileName()
Get the absolute path of the file containing this statement (see setFileName method). |
Label |
getLabel()
getLabel Get the label attached to this statement. |
IrList |
getLabelDefList()
|
LabeledStmt |
getLabeledStmt()
getLabeledStmt |
int |
getLineNumber()
Get the line number of this statement. |
Stmt |
getNextStmt()
getNextStmt Get the statement next to "this" one. |
Stmt |
getPreviousStmt()
getPreviousStmt Get the statement previous to this one. |
Stmt |
getStmtWithLabel(Label pLabel)
|
Stmt |
getUpperStmt()
Get the statement that includes this statement. |
Stmt |
insertPreviousStmt(Stmt pStatement)
insertPreviousStmt Insert a statement in front of "this" one. |
Stmt |
insertPreviousStmt(Stmt pStatement,
BlockStmt pBlock)
insertPreviousStmt |
boolean |
isBranchStmt()
isBranch Return true if this statement is either //##60 IfStmt, JumpStmt, SwitchStmt, CallStmt, ReturnStmt, JumpStmt, ReturnStmt, //##60 or LabeledStmt with one of above statement body. |
boolean |
isLoopStmt()
|
boolean |
isMultiBlock()
isMultiBlock true if this statement is composed of multiple basic blocks or a jump statement. |
void |
isolateThisStmt()
isolateThisStmt Cut previous/next link and parent link of this statement. |
void |
printLinkage(java.lang.String pHeader)
|
Stmt |
replaceThisStmtWith(Stmt pStmt)
replaceThisStmtWith |
void |
setFileName(java.lang.String pFileName)
Set the absolute path of the source program file containing this statement. |
void |
setLineNumber(int pLineNumber)
Set the line number of this statement within the file specified by setFileName. |
java.lang.String |
toStringDetail()
toStringDetail Get text string of this node showing detail information. |
Stmt |
traceFirstStmt()
|
Stmt |
traceLastStmt()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface coins.ir.hir.HIR |
addrExp, asmStmt, checkLinkage, conditionalExp, contains, copyInfListFrom, cutParentLink, exp, expList, expRepeat, forStmt, getExpId, getFlowAnalSym, getIndentSpace, getInfString, getIrName, getSourceNode, getSourceNode1, getSourceNode2, getSymOrExpId, getWork, hirNodeClone, hirSeq, hirSeq, indexedLoopStmt, indexedLoopStmt, infStmt, infStmt, intConstNode, irList, isEmpty, isStmt, isTree, nullNode, nullStmt, offsetConstNode, phiExp, repeatStmt, replaceSource, replaceSource1, replaceSource2, returnStmt, setChild1, setChild2, setChildren, setChildren, setDataStmt, setIndex, setIndexNumberToAllNodes, setParent, setType, setWork, subpDefinition, subpIterator, subscriptedExp, toString, toStringShort, toStringWithChildren, undecayExp, undecayExp, undecayExp, whileStmt |
| Methods inherited from interface coins.ir.IR |
addInf, getChild1, getChild2, getInf, getInfList, getParent, getSym, print, print, removeInf |
| Methods inherited from interface coins.ir.IR0 |
getChild, getChildCount, getIndex, getOperator, setChild |
| Methods inherited from interface coins.ir.hir.HIR0 |
accept, assignStmt, blockStmt, callStmt, constNode, contentsExp, convExp, copyWithOperands, copyWithOperandsChangingLabels, decayExp, elemNode, exp, exp, expStmt, falseNode, finishHir, forStmt, functionExp, getChildNumber, getFlag, getFlagBox, getStmtContainingThisNode, getType, hirClone, hirIterator, hirList, hirSeq, ifStmt, intConstNode, irList, isSameAs, jumpStmt, labelDef, labeledStmt, labelNode, pointedExp, print, program, qualifiedExp, repeatStmt, replaceThisNode, returnStmt, setFlag, setIndexNumberToAllNodes, sizeofExp, sizeofExp, subpDefinition, subpNode, subscriptedExp, switchStmt, symNode, trueNode, undecayExp, varNode, whileStmt |
| Field Detail |
protected Stmt fNextStmt
protected Stmt fPrevStmt
protected boolean fMultiBlock
| Constructor Detail |
public StmtImpl()
public StmtImpl(HirRoot pHirRoot)
protected StmtImpl(HirRoot pHirRoot,
int pOperator)
| Method Detail |
public Stmt addNextStmt(Stmt pStatement)
addNextStmt in interface StmtpStatement - statement subtree to be added.
public Stmt addNextStmt(Stmt pStatement,
BlockStmt pBlock)
public Stmt getNextStmt()
getNextStmt in interface HIR0getNextStmt in class HIR_Implpublic Stmt getUpperStmt()
Stmt
getUpperStmt in interface Stmtpublic Stmt insertPreviousStmt(Stmt pStatement)
insertPreviousStmt in interface StmtpStatement - statement subtree to be inserted.
public Stmt insertPreviousStmt(Stmt pStatement,
BlockStmt pBlock)
StmtInsert a statement in front of "this" one. It is not recommended to insert statement having non-null linkage (getNextStmt(), getPreviousStmt(), or getParent() are not null) because the addition will change these linkages. In such case, copy of the statement should be used (see copyWithOperands() of HIR).
insertPreviousStmt in interface StmtpStatement - statement subtree to be inserted.pBlock - Block statement containing this statement.
If it is unknown, give null.
public Stmt getPreviousStmt()
getPreviousStmt in interface Stmt
public Stmt combineStmt(Stmt pStmt,
boolean pBeforeBranch)
Stmt
Combine this statement and pStmt making them as one statement.
If this statement is a block, pStmt is added as the last statement
of the block.
If this statement is a labeled statement, then pStmt
is combined with its statement body
(((LabeledStmt)this).getStmt().combineStmt(pStmt, pBeforeBranch). //##65
In other case, a new block statement
including this and pStmt is created and pStmt is made
as the next one to this statement.
If pBeforeBranch is true and this statement has branch
as the last statement (if this is a block), then
pStatement is inserted before the branch statement.
If pStmt is null, do nothing.
It is not recommended to combine statement having non-null linkage
(getNextStmt(), getPreviousStmt(), or getParent() are not null)
because the addition will change these linkages. In such case,
copy of the statement should be used (see copyWithOperands() of HIR).
This method (combineStmt) changes statement linkages (linkages
get by getNextStmt(), getPreviousStmt(), getParent()) of this
statement. If these linkages are used later, then make copy and
use the copy in applying combineStmt.
combineStmt makes neither a copy of pStmt nore a copy of this Stmt. //##60
If copy is required, then make copy before calling combineStmt.
If label is to be changed so as not to make duplicated label,
it is necessary to change it before calling combineStmt (see
copyWithOperandsChangingLabels). //##60
The combined result replaces this statement and inherit its linkages.
It may be the same to
Stmt ltmt3 = lStmt1.combineStmt(
((Stmt)lStmt2.copyWithOperands(), true);
lStmt1.replaceThisStmtWith(lStmt3);
combineStmt in interface StmtpStmt - Statement to be combined as the next one to
this statement.pBeforeBranch - if true, insertion is done before the
branch statement.
public Stmt traceLastStmt()
public Stmt traceFirstStmt()
public Stmt deleteThisStmt()
deleteThisStmt in interface Stmtpublic void cutLabelLinkOfStmt(Stmt pStmt)
StmtFor labels defined in pStmt, execute setHirPosition(null) to prepare for deletion of pStmt. If pStmt is a compound statement, then all statements in pStmt are searched for labels defined in pStmt. If no label is defined by pStmt, no effect remains.
cutLabelLinkOfStmt in interface StmtpStmt - Statement to be searched for label definition
to cut definition point relation.public Stmt deleteNextStmt()
public Stmt deletePreviousStmt()
public void isolateThisStmt()
Stmt
isolateThisStmt in interface Stmtpublic Stmt replaceThisStmtWith(Stmt pStmt)
StmtReplace this statement with pStmt which is made to have the same linkage with other nodes as this statement and this statement is made isolated. pStmt should not be a statement contained in this statement as its subtree because this statement will be deleted in this method. If this statement is to be replaced with its subtree, then copy the subtree by copyWithOperandsChangingLabels(null) and replace by the copied subtree.
replaceThisStmtWith in interface StmtpStmt - statement used to replace this.
public LabeledStmt attachLabel(Label pLabel)
attachLabel in interface StmtpLabel - label to be attached to this statement.
Note: (##2)
Let attach label L1 to statement S and denote the resultant
statement as S1, and let attach label L2 to S1 and denote the
resultant statement as S2, then we say that S is attached with
labels L1 and L2, or S has set of labels L1 and L2.
In this case, L2 is the heading label of S and the label
next to L2 is L1. (In C notation, if "L2: L1: S", S has set of
labels L1 and L2, and the label next to L2 is L1.)
public LabeledStmt attachLabelAsFirstOne(Label pLabel)
Stmt
attachLabelAsFirstOne in interface Stmtpublic IrList getLabelDefList()
getLabelDefList in interface Stmtpublic Label getLabel()
getLabel in interface Stmtpublic Stmt getStmtWithLabel(Label pLabel)
public LabeledStmt getLabeledStmt()
Stmt
getLabeledStmt in interface Stmtpublic LabeledStmt backTraceLabeledStmt()
public BlockStmt getBlockStmt()
getBlockStmt in interface Stmtpublic boolean isMultiBlock()
Stmt
isMultiBlock in interface Stmtpublic void adjustMultiBlockFlag()
public void adjustMultiBlockFlag(Stmt pStmt)
public boolean isLoopStmt()
public boolean isBranchStmt()
Stmt
isBranchStmt in interface Stmtpublic Stmt ancestorControlStmtOfConditionalExp(HIR pHir)
ancestorControlStmtOfConditionalExp in interface Stmt
public void combineWithConditionalExp(Stmt pStmt,
HIR pCond)
combineWithConditionalExp in interface StmtpStmt - statement to be executed before pCond.pCond - conditional expression to be combined with pStmt.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
HIR_Impl
clone in class HIR_Impljava.lang.CloneNotSupportedExceptionpublic final void setFileName(java.lang.String pFileName)
StmtSet the absolute path of the source program file containing this statement. In C language, if this statement is included in a file specified by #include, then give the name of the file specified by #include (it may differ statement by statement within a subprogram). If setFileName is not called for this statement, then the name of compiler input file is taken as the default value by getFileName().
setFileName in interface StmtpFileName - name of the source program file
containing this statement.public final java.lang.String getFileName()
Stmt
getFileName in interface Stmtpublic final void setLineNumber(int pLineNumber)
Stmt
setLineNumber in interface StmtpLineNumber - the line number of this statement within
the source file.public final int getLineNumber()
Stmt
getLineNumber in interface Stmtpublic final void copyPosition(Stmt pStmt)
Stmt
copyPosition in interface StmtpStmt - statement from which file name and
line number are to be copied.public java.lang.String toStringDetail()
HIR
toStringDetail in interface HIRtoStringDetail in class HIR_Implpublic void printLinkage(java.lang.String pHeader)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||