coins.opt
Class LoopExpansion

java.lang.Object
  extended bycoins.opt.LoopExpansion
Direct Known Subclasses:
LoopUnrolling, LoopUnswitching

public abstract class LoopExpansion
extends java.lang.Object

title: LoopExpansion class.

description: Abstract class for Loop Expansion implement class.


Field Summary
protected  int fDbgLevel
           
protected  FlowRoot flowRoot
           
protected  int fMaxAllowableNodesInLoopBody
           
protected  int fNumberOfGeneralRegisters
           
protected  java.util.Map fOptionMap
           
protected  CoinsOptions fOptions
           
protected  HirRoot hirRoot
           
protected  IoRoot ioRoot
           
protected  SymRoot symRoot
           
 
Constructor Summary
protected LoopExpansion(HirRoot phirRoot)
          Construct this object
 
Method Summary
protected  int calcStatementCount(Stmt pStmt)
          Calculate Stmt count in pStmt.
abstract  boolean doSubprogram(SubpDefinition pSubpDef)
          Do Optimize in subprogram.
protected  Var getArrayVar(SubscriptedExp Subs)
          Get array Var SubscriptedExp has.
protected  Debug getDebug()
          Get Debug this object refer.
 int getMaxAllowableStmtsInLoopBody()
          Get max statement count in loopbody of which allow expand.
protected  Exp getSimpleExp(Exp pExp)
          Get simple Exp for Conv'ed, or Undecay'ed Exp.
protected  java.util.Set getSubscriptVar(SubscriptedExp Subs)
          Get subscript Vars SubscriptedExp has.
protected  boolean hasBadElement(Stmt pStmt)
          Check whether Stmt contains bad element.
protected  boolean isBadElement(HIR hirElement)
          Check whether hir element is bad for loop optimizations, is follows at least.
 void setMaxAllowableStmtsInLoopBody(int pMaxAllowableStmtCount)
          Set max statement count in loopbody of which allow expand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hirRoot

protected HirRoot hirRoot

flowRoot

protected FlowRoot flowRoot

symRoot

protected SymRoot symRoot

ioRoot

protected IoRoot ioRoot

fOptionMap

protected java.util.Map fOptionMap

fOptions

protected CoinsOptions fOptions

fNumberOfGeneralRegisters

protected int fNumberOfGeneralRegisters

fMaxAllowableNodesInLoopBody

protected int fMaxAllowableNodesInLoopBody

fDbgLevel

protected int fDbgLevel
Constructor Detail

LoopExpansion

protected LoopExpansion(HirRoot phirRoot)
Construct this object

Parameters:
phirRoot - HIR root object.
Method Detail

getMaxAllowableStmtsInLoopBody

public int getMaxAllowableStmtsInLoopBody()
Get max statement count in loopbody of which allow expand.

Returns:
max statement count in loopbody of which allow expand.

setMaxAllowableStmtsInLoopBody

public void setMaxAllowableStmtsInLoopBody(int pMaxAllowableStmtCount)
Set max statement count in loopbody of which allow expand.

Parameters:
pMaxAllowableStmtCount - max statement count in loopbody of which allow expand.

doSubprogram

public abstract boolean doSubprogram(SubpDefinition pSubpDef)
Do Optimize in subprogram.

Parameters:
pSubpDef - SubpDefinition to do optimization.
Returns:
true if optimized, false if else.

getDebug

protected Debug getDebug()
Get Debug this object refer.

Returns:
Debug this object refer

getSimpleExp

protected Exp getSimpleExp(Exp pExp)
Get simple Exp for Conv'ed, or Undecay'ed Exp.

Parameters:
pExp - Exp object.
Returns:
Simple Exp for Conv'ed, or Undecay'ed Exp.

isBadElement

protected boolean isBadElement(HIR hirElement)
Check whether hir element is bad for loop optimizations, is follows at least. CallStmt volatiled sym

Returns:
true if Stmt contains CallStmt, false if else.

hasBadElement

protected boolean hasBadElement(Stmt pStmt)
Check whether Stmt contains bad element.

Parameters:
pStmt - Stmt object.
Returns:
true if Stmt contains CallStmt, false if else.

calcStatementCount

protected int calcStatementCount(Stmt pStmt)
Calculate Stmt count in pStmt. but exclude follows: LabeledStmt BlockStmt

Parameters:
pStmt - Stmt object.
Returns:
Stmt count of pStmt has.

getArrayVar

protected Var getArrayVar(SubscriptedExp Subs)
Get array Var SubscriptedExp has.

Parameters:
Subs - SubscriptedExp object
Returns:
Var that is array var of array.

getSubscriptVar

protected java.util.Set getSubscriptVar(SubscriptedExp Subs)
Get subscript Vars SubscriptedExp has. which is counted SubscriptedExp that is child of Parent SubscriptedExp.

Parameters:
Subs - SubscriptedExp object
Returns:
Set of Var that is subscript exp of array.