|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Object
|
+--coins.ir.hir.HIR_Impl
|
+--coins.ir.hir.StmtImpl
|
+--coins.ir.hir.LoopStmtImpl
Loop-statement class. // Components (children) of loop statement // child1: LoopInitPart. (Stmt) // This may be null. // getLoopInitPart returns this statement. // child2: ConditionalInitPart (This has been deleted. Give null.) // This is executed only once if loop condition is satisfied. // (At present, this is implemented by if-stmt attached to // LoopInitPart so that hir2lir has no need of // special treatment.) // child3: StartConditionPart with loopBackLabel. (LabeledStmt) // This should be given but its LabeledStmt may be null. // getLoopBackPoint() returns this LabeledStmt. // child4: LoopBody that is a LabeledStmt with loopBodyLabel. // StmtBody part of the LabeledStmt is BlockStmt // having LabeledStmt with loopStepLabel (LabeledStmt) // as the last statement of the loop-body BlockStmt. // An implementation of the LoopBody is // (labeledStmt // (list) // (block // sequence of statements given as pLoopBody parameter // of setChildrenOfLoop // (labeledStmt // (list ) // null))) // LoopBody should be given but its BlockStmt may have // no executable statements. // getLoopBodyPart() returns this LabeledStmt. // child5: EndCondition. (ExpStmt) // This may be null. // getLoopEndCondition() returns the expression of the ExpStmt. // child6: LoopStepPart jumping to loopBackLabel. (Stmt) // This may be null. // getLoopStepPart() returns this statement. // child7: LoopEndpart with loopEndLabel. (LabeledStmt) // This should be given but its LabeledStmt may be null. // getLoopEndPart() returns this LabeledStmt.
| フィールドの概要 | |
(パッケージプライベート) Label |
fLoopBackLabel
|
(パッケージプライベート) Label |
fLoopEndLabel
|
(パッケージプライベート) LoopInf |
fLoopInf
|
(パッケージプライベート) Label |
fLoopStepLabel
|
| クラス coins.ir.hir.StmtImpl から継承したフィールド |
fMultiBlock, fNextStmt, fPrevStmt |
| クラス coins.ir.hir.HIR_Impl から継承したフィールド |
fAdditionalChild, fChildCount, fChildNode1, fChildNode2, fDbgLevel, fHirAnnex, fOperator, fParentNode, fType, hirRoot, inversionTable, machineParam, sourceLanguage |
| インタフェース coins.ir.hir.HIR から継承したフィールド |
OP_CODE_NAME, OP_CODE_NAME_DENSE |
| インタフェース coins.ir.IR から継承したフィールド |
OP_INF, OP_LIST, OP_PROG, OP_SUBP_DEF |
| コンストラクタの概要 | |
LoopStmtImpl()
|
|
LoopStmtImpl(HirRoot pHirRoot)
|
|
| メソッドの概要 | |
void |
accept(HirVisitor pVisitor)
accept Acceptor used in HIR visitor. |
void |
addToConditionalInitPart(Stmt pStmt)
addToConditionalInitPart ConditionalInitPart is executed once if the LoopStartCondition is satisfied. |
void |
addToLoopBodyPart(Stmt pStmt)
|
void |
addToLoopEndPart(Stmt pStmt)
|
void |
addToLoopInitPart(Stmt pStmt)
Add pStmt as the last statement of loop-init-part. |
void |
addToLoopStepPart(Stmt pStmt)
|
java.lang.Object |
clone()
clone Override Object.clone in HIR. |
void |
combineWithConditionalExp(Stmt pStmt,
HIR pCond)
Combine pStmt with conditional expression part pCond of control statement so that pStmt should be executed before pCond. |
HIR |
copyWithOperandsChangingLabels(IrList pLabelCorrespondence)
copyWithOperandsChangingLabels Make a new subtree that is the same to this subtree. |
BlockStmt |
getConditionalInitPart()
getConditionalInitPart Get the BlockStmt containing the statements added by addToConditionalInitPart. |
Stmt |
getConditionalInitPart2()
|
Label |
getLoopBackLabel()
|
LabeledStmt |
getLoopBackPoint()
getLoopBackPoint Get the statement with loopBackLabel. |
Label |
getLoopBodyLabel()
|
Stmt |
getLoopBodyPart()
|
Exp |
getLoopEndCondition()
|
Label |
getLoopEndLabel()
|
LabeledStmt |
getLoopEndPart()
|
LoopInf |
getLoopInf()
|
Stmt |
getLoopInitPart()
|
Exp |
getLoopStartCondition()
|
Label |
getLoopStepLabel()
|
Stmt |
getLoopStepPart()
|
boolean |
isLoopStmt()
|
boolean |
isSimpleForLoop()
isSimpleForLoop Check if this is a simple for loop, that is, an instance of ForStmt and conditional init part is null and loop end condition is null. |
boolean |
isSimpleIndexedLoop()
isSimpleIndexedLoop Check if this is a simple indexed loop, that is, an instance of IndexedLoopStmt and conditional init part is null and loop end condition is null. |
boolean |
isSimpleRepeatLoop()
isSimpleRepeatLoop Check if this is a simple repeat-while-true loop, that is, an instance of RepeatStmt and conditional init part is null and loop start condition is null and loop step part is null. |
boolean |
isSimpleUntilLoop()
|
boolean |
isSimpleWhileLoop()
isSimpleWhileLoop Check if this is a simple while loop, that is, an instance of WhileStmt and conditional init part is null and loop step part is null and loop end condition is null. |
protected Stmt |
makeConditionalInitPart(Exp pStartCondition,
Stmt pConditionalInitPart)
|
void |
replaceBodyPart(LabeledStmt pNewStmt)
|
void |
replaceConditionalInitPart(LabeledStmt pNewStmt)
|
void |
setChildrenOfLoop(Stmt pInitPart,
Label pLoopBackLabel,
Stmt pConditionalInitPart,
Exp pStartCondition,
Stmt pLoopBody,
Label pLoopStepLabel,
Exp pEndCondition,
Stmt pLoopStepPart,
Label pLoopEndLabel,
Stmt pLoopEndPart)
|
void |
setLoopEndCondition(Exp pCondition)
|
void |
setLoopInf(LoopInf pLoopInf)
|
void |
setLoopStartCondition(Exp pCondition)
|
| クラス java.lang.Object から継承したメソッド |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| インタフェース coins.ir.IR から継承したメソッド |
addInf, getChild1, getChild2, getInf, getInfList, getParent, getSym, print, print, removeInf |
| インタフェース coins.ir.IR0 から継承したメソッド |
getChild, getChildCount, getIndex, getOperator, setChild |
| インタフェース coins.ir.hir.HIR0 から継承したメソッド |
assignStmt, blockStmt, callStmt, constNode, contentsExp, convExp, copyWithOperands, decayExp, elemNode, exp, exp, expStmt, falseNode, finishHir, forStmt, functionExp, getChildNumber, getFlag, getFlagBox, getNextStmt, 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 |
| フィールドの詳細 |
Label fLoopBackLabel
Label fLoopStepLabel
Label fLoopEndLabel
LoopInf fLoopInf
| コンストラクタの詳細 |
public LoopStmtImpl()
public LoopStmtImpl(HirRoot pHirRoot)
| メソッドの詳細 |
public void setChildrenOfLoop(Stmt pInitPart,
Label pLoopBackLabel,
Stmt pConditionalInitPart,
Exp pStartCondition,
Stmt pLoopBody,
Label pLoopStepLabel,
Exp pEndCondition,
Stmt pLoopStepPart,
Label pLoopEndLabel,
Stmt pLoopEndPart)
public Stmt getLoopInitPart()
LoopStmt 内の getLoopInitPartpublic BlockStmt getConditionalInitPart()
LoopStmt の記述:
LoopStmt 内の getConditionalInitPartpublic Stmt getConditionalInitPart2()
public Exp getLoopStartCondition()
LoopStmt 内の getLoopStartConditionpublic LabeledStmt getLoopBackPoint()
LoopStmt の記述:
LoopStmt 内の getLoopBackPointpublic Stmt getLoopBodyPart()
LoopStmt 内の getLoopBodyPartpublic Exp getLoopEndCondition()
LoopStmt 内の getLoopEndConditionpublic Stmt getLoopStepPart()
LoopStmt 内の getLoopStepPartpublic LabeledStmt getLoopEndPart()
LoopStmt 内の getLoopEndPartpublic Label getLoopBackLabel()
LoopStmt 内の getLoopBackLabelpublic Label getLoopBodyLabel()
LoopStmt 内の getLoopBodyLabelpublic Label getLoopStepLabel()
LoopStmt 内の getLoopStepLabelpublic Label getLoopEndLabel()
LoopStmt 内の getLoopEndLabelpublic LoopInf getLoopInf()
LoopStmt 内の getLoopInfpublic void setLoopInf(LoopInf pLoopInf)
LoopStmt 内の setLoopInfpublic void addToLoopInitPart(Stmt pStmt)
LoopStmt の記述:
LoopStmt 内の addToLoopInitPartpStmt - statement to be added to loop-init-part.public void addToConditionalInitPart(Stmt pStmt)
LoopStmt の記述:
ConditionalInitPart is executed once if the LoopStartCondition
is satisfied. It is a block to where loop invariant expressions
are to be moved so that they are executed only once. The
ConditionalInitPart is created by addToConditionalInitPart(pStmt)
as a block containing ConditionalInitBlock in the LoopInitPart
in the following way:
Case 1: LoopStartCondition is null:
LoopInitPart_ is changed as follows:
{
oroginal LoopInitPart_;
{ // ConditionalInitBlock.
// getConditionalInitPart() returns this else-block.
Sequence of statements added by addToConditionalInitPart;
}
}
The transformation procedure is:
If ConditionalInitBlock is not yet created,
create it as a BlockStmt and add it as the last statement
of LoopInitBlock
pStmt is added as the last statement of ConditionalInitBlock.
case 2: LoopStartCondition is not null and ConditionalInitPart
is not yet created:
LoopInitPart_ is changed as follows:
{
oroginal LoopInitPart_;
if (loopStartConditionExpression == false) {
jump to loopEndLabel;
}else { // ConditionalInitBlock.
// getConditionalInitPart() returns this else-block.
Sequence of statements added by addToConditionalInitPart;
jump to loopBodyLabel;
}
}
The else-part of above if-statement is called as
ConditionalInitBlock.
case 3: ConditionalInitBlock is already created:
pStmt is inserted before "goto loopBodyLabel" of ConditionalInitBlock.
Expressions to be executed only once for this loop
may be added to ConditionalInitBlock by calling
addToConditionalInitPart successively.
When ConditionalInitBlock with "jump to loopBodyLabel" is created,
setFlag(HIR.FLAG_LOOP_WITH_CONDITIONAL_INIT, true)
is executed to show that the loop became irreducible but
it is a tame loop that can be treated in many optimization/
parallelization procedures.
No special treatment is required for ConditionalInitPart in
HIR-to-LIR conversion, HIR-to-C conversion, HIR flow analysis,
etc. because it takes a form of normal HIR expression.
LoopStmt 内の addToConditionalInitPart
protected Stmt makeConditionalInitPart(Exp pStartCondition,
Stmt pConditionalInitPart)
public void addToLoopBodyPart(Stmt pStmt)
LoopStmt 内の addToLoopBodyPartpublic void addToLoopStepPart(Stmt pStmt)
LoopStmt 内の addToLoopStepPartpublic void addToLoopEndPart(Stmt pStmt)
LoopStmt 内の addToLoopEndPartpublic void setLoopStartCondition(Exp pCondition)
LoopStmt 内の setLoopStartConditionpublic void setLoopEndCondition(Exp pCondition)
LoopStmt 内の setLoopEndCondition
public void replaceConditionalInitPart(LabeledStmt pNewStmt)
throws CompileError
CompileErrorpublic void replaceBodyPart(LabeledStmt pNewStmt)
LoopStmt 内の replaceBodyPartpublic boolean isSimpleForLoop()
LoopStmt の記述:
LoopStmt 内の isSimpleForLooppublic boolean isSimpleWhileLoop()
LoopStmt の記述:
LoopStmt 内の isSimpleWhileLooppublic boolean isSimpleRepeatLoop()
LoopStmt の記述:
LoopStmt 内の isSimpleRepeatLooppublic boolean isSimpleUntilLoop()
public boolean isSimpleIndexedLoop()
LoopStmt の記述:
LoopStmt 内の isSimpleIndexedLooppublic boolean isLoopStmt()
StmtImpl 内の isLoopStmt
public void combineWithConditionalExp(Stmt pStmt,
HIR pCond)
Stmt 内の combineWithConditionalExpStmtImpl 内の combineWithConditionalExppStmt - 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 の記述:
StmtImpl 内の clonejava.lang.CloneNotSupportedExceptionpublic HIR copyWithOperandsChangingLabels(IrList pLabelCorrespondence)
HIR0 の記述:
HIR0 内の copyWithOperandsChangingLabelsHIR_Impl 内の copyWithOperandsChangingLabelspLabelCorrespondence - label correspondence list;
It is usually null; If label correspondence is to be
specified, it should be of the form
(IrList (IrList of original labels) (IrList of new labels) )
"this" subtree should not contain labels listed
in (IrList of new labels) so as escape from infinite
replacement loop; This restriction is satisfied when
pLabelCorrespondence is null;
If this parameter is null, it is computed in this method
and passed to HirModify subclass after calling copyWithOperands
(without changing label).
public void accept(HirVisitor pVisitor)
HIR0 の記述:
HIR0 内の acceptHIR_Impl 内の acceptpVisitor - HirVisitor
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||