coins.opt
クラス LoopUnrolling

java.lang.Object
  |
  +--coins.opt.LoopExpansion
        |
        +--coins.opt.LoopUnrolling

public class LoopUnrolling
extends LoopExpansion

title: LoopUnrolling class. description: Expand LoopStmt.


フィールドの概要
protected  int fExpRate
          Optimize option: Rate of loop unrolling; expand count of loop body.
protected  int fNodeCountMultipliedByExpFactor
           
protected  int fUpperLimitOfExpansionFactor
           
 
クラス coins.opt.LoopExpansion から継承したフィールド
fDbgLevel, flowRoot, fMaxAllowableNodesInLoopBody, fNumberOfGeneralRegisters, fOptionMap, fOptions, hirRoot, ioRoot, symRoot
 
コンストラクタの概要
LoopUnrolling(HirRoot phirRoot)
          Construct this object.
LoopUnrolling(HirRoot pHirRoot, int pExpansionFactor, int pMaxAllowableNodesInLoopBody, int pNodeCountMultipliedByExpFactor)
          Constructor specifying loop unrolling parameters.
 
メソッドの概要
protected  int computeExpansionFactor(LoopStmt pLoopStmt)
           
 boolean doSubprogram(SubpDefinition pSubpDef)
          Do Loop Expansion optimization in subprogram.
protected  void expandLoop(ForStmt pForStmt)
           
 int getExpRate()
          Get the rate of loop unrolling; expand count of loop body.
protected  Exp getStepExp(Stmt pStmt)
          Generate Exp of step in pBlock it is called to get Exp which represents amount of increase of Loop-control-variable in Loop-step-part.
protected  Exp integralPromotion(int pOperator, Exp pOperand1)
           
protected  Exp integralPromotion(int pOperator, Exp pOperand1, Exp pOperand2)
           
protected  boolean isBadElement(HIR hirElement)
          Check whether hir element is bad for loop expansion, is follows CallStmt volatiled sym and JumpStmt at loop expand optimization.
protected  boolean isExpansible(ForStmt pForStmt)
          Check whether loop-unrolling optimization can be applied to pForStmt The Loop-control-variable is set to fLoopVar.
 boolean isSIMD()
          Get Optimize option considering SIMD environment.
protected  AssignStmt makeAssignStmt(Var pVariable, Exp pExp)
           
protected  Stmt mergeAssignStmt(Stmt pStmt, Const pStepConst)
          Applies merge-assingment optimization to pStepConst.
protected  void pickUpVariables(ForStmt pForStmt)
          Analyze variables contained in ForStmt to get information to doing Loop expansion optimization.
protected  HIR replaceExpAdjustingType(Exp lOld, Exp lNew)
          Replace expression lOld by lNew adjusting type to that of lOld.
 void setExpRate(int pRate)
          Set the rate of loop unrolling; expand count of loop body.
 void setSIMD_Environment(boolean isSIMD)
          Set Optimize option by Considering SIMD environment.
protected  Type typeForArithmeticExp(Type pType)
           
 
クラス coins.opt.LoopExpansion から継承したメソッド
calcStatementCount, getArrayVar, getDebug, getMaxAllowableStmtsInLoopBody, getSimpleExp, getSubscriptVar, hasBadElement, setMaxAllowableStmtsInLoopBody
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

fExpRate

protected int fExpRate
Optimize option: Rate of loop unrolling; expand count of loop body.


fUpperLimitOfExpansionFactor

protected int fUpperLimitOfExpansionFactor

fNodeCountMultipliedByExpFactor

protected int fNodeCountMultipliedByExpFactor
コンストラクタの詳細

LoopUnrolling

public LoopUnrolling(HirRoot phirRoot)
Construct this object.

パラメータ:
phirRoot - HirRoot object.

LoopUnrolling

public LoopUnrolling(HirRoot pHirRoot,
                     int pExpansionFactor,
                     int pMaxAllowableNodesInLoopBody,
                     int pNodeCountMultipliedByExpFactor)
Constructor specifying loop unrolling parameters.

パラメータ:
pHirRoot - HirRoot instance.
pExpansionFactor - upper limit of loop expansion factor.
pMaxAllowableNodesInLoopBody - maximum number of allowable nodes in loop body.
pNodeCountMultipliedByExpFactor - upper limit of the number of nodes in loop body after loop expansion.
メソッドの詳細

isSIMD

public boolean isSIMD()
Get Optimize option considering SIMD environment.

戻り値:
true if Optimize is to be considered SIMD environment, false if else.

setSIMD_Environment

public void setSIMD_Environment(boolean isSIMD)
Set Optimize option by Considering SIMD environment.

パラメータ:
isSIMD - Optimize by considering SIMD environment.

getExpRate

public int getExpRate()
Get the rate of loop unrolling; expand count of loop body.

戻り値:
Rate of loop unrolling; expand count of loop body.

setExpRate

public void setExpRate(int pRate)
Set the rate of loop unrolling; expand count of loop body.

パラメータ:
pRate - Rate of loop unrolling; expand count of loop body. it is allowed more than 2.

doSubprogram

public boolean doSubprogram(SubpDefinition pSubpDef)
Do Loop Expansion optimization in subprogram.

定義:
クラス LoopExpansion 内の doSubprogram
パラメータ:
pSubpDef - SubpDefinition to do optimization.
戻り値:
true if optimized, false if else.

pickUpVariables

protected void pickUpVariables(ForStmt pForStmt)
Analyze variables contained in ForStmt to get information to doing Loop expansion optimization.

パラメータ:
pForStmt - ForStmt to be analyzed.

isExpansible

protected boolean isExpansible(ForStmt pForStmt)
Check whether loop-unrolling optimization can be applied to pForStmt The Loop-control-variable is set to fLoopVar. if Loop-control-variable is not found, it is set to null.

パラメータ:
pForStmt - ForStmt object.
戻り値:
true pForStmt may be optimized by Loop-if expansion. false pForStmt is not optimized by Loop-if expansion.

expandLoop

protected void expandLoop(ForStmt pForStmt)

getStepExp

protected Exp getStepExp(Stmt pStmt)
Generate Exp of step in pBlock it is called to get Exp which represents amount of increase of Loop-control-variable in Loop-step-part.

戻り値:
Exp which represents amount of increase of Loop-control-variable in Loop-step-part.

mergeAssignStmt

protected Stmt mergeAssignStmt(Stmt pStmt,
                               Const pStepConst)
Applies merge-assingment optimization to pStepConst. 'a + i' to 'a + i + ( i + step ) + ( i + step*2 ) + ...'

パラメータ:
pStmt - Stmt object
pStepConst - Const object which represents increase in loop step
戻り値:
Stmt which is marged assginments.

isBadElement

protected boolean isBadElement(HIR hirElement)
Check whether hir element is bad for loop expansion, is follows CallStmt volatiled sym and JumpStmt at loop expand optimization.

オーバーライド:
クラス LoopExpansion 内の isBadElement
戻り値:
true if Stmt contains CallStmt, false if else.

computeExpansionFactor

protected int computeExpansionFactor(LoopStmt pLoopStmt)

integralPromotion

protected Exp integralPromotion(int pOperator,
                                Exp pOperand1,
                                Exp pOperand2)

integralPromotion

protected Exp integralPromotion(int pOperator,
                                Exp pOperand1)

makeAssignStmt

protected AssignStmt makeAssignStmt(Var pVariable,
                                    Exp pExp)

typeForArithmeticExp

protected Type typeForArithmeticExp(Type pType)

replaceExpAdjustingType

protected HIR replaceExpAdjustingType(Exp lOld,
                                      Exp lNew)
Replace expression lOld by lNew adjusting type to that of lOld.

パラメータ:
lOld - old expression to be replaced.
lNew - new expression for replacement.
戻り値:
replaced expression.