coins.flow
Class SetRefReprHirEImpl

java.lang.Object
  extended bycoins.flow.SetRefReprImpl
      extended bycoins.flow.SetRefReprHirImpl
          extended bycoins.flow.SetRefReprHirEImpl
All Implemented Interfaces:
SetRefRepr

public class SetRefReprHirEImpl
extends SetRefReprHirImpl
implements SetRefRepr

Implementation of the SetRefRepr interface for HIR


Field Summary
 Flow flow
           
protected  Stmt fStmt
           
 HirRoot hirRoot
           
 
Fields inherited from class coins.flow.SetRefReprImpl
fAllSubexps, fBBlock, fCallNodes, fCallWithSideEffectIncluded, fCorrespondingExpId, fDbgLevel, fDefExpId, fDefSym, fExpIdSet, fExps, fFlags, fIR, fLeafOperands, fLhsSyms, flowRoot, fModSyms, fModSyms00, fModSymsStmt, fOpCode, fOperandExp, fSubpFlow, fUseFlowAnalSyms, fUseNodeList, fUseSymList, fUseSyms, symRoot
 
Fields inherited from interface coins.flow.SetRefRepr
HAS_CONTROL, IS_RETURN, SETS
 
Constructor Summary
SetRefReprHirEImpl(HIR pSubtree, BBlock pBBlock, boolean pDef, java.util.Set pModSymsStmt)
          SetRefReprHirEImpl instanciates SetRefRepr for the subtree pSubtree by computing SetRefRepr for child subtrees.
 
Method Summary
 java.util.Set allSubexps()
          operandExp ExpId's of all subexpressions of the subtree corresponding to this.
protected  void computeSetRefRepr(HIR pHir, BBlock pBBlock, boolean pDef, java.util.Set pModSymsStmt)
          computeSetRefRepr Compute defined symbols (fDefSym) and set of possibly modified variables (fModSyms), variables used as leaf operand (fLeafOperands).
 IR defNode()
          Returns the IR node which links to the definitely defined (set) symbol.
 Stmt getStmt()
           
 boolean hasCallWithSideEffect()
           
 java.util.Set leafOperands()
          leafOperands Get the set of symbols used as operands gathered from all leaf nodes of the subtree corresponding to this.
 java.util.Set modSyms()
          modSyms returns the set of symbols that are possibly defined in this SetRefRepr.
 java.util.Set modSyms0()
          modSyms0 returns the set of symbols that are possibly defined in this SetRefRepr as modSyms() and symbols externally defined (i.e.
 java.util.Set modSymsStmt()
          modSymsStmt returns the set of symbols that are possibly defined in the this SetRefRepr.
 java.util.Set operandExp()
          operandExp ExpId's of subexpressions used as direct operands by the node corresponding to this.
 
Methods inherited from class coins.flow.SetRefReprHirImpl
callNodes, checkWhetherBranch, defSym, expIdSet, exps, exps, expsUnder, flowAnalSymsUnder, hasDefiniteValue, lhsSyms, modSyms00, modSymsUnder, nodeListIterator, setInformation, symsModifiedForLhsExp, useNodeIterator, useNodeList, useNodeList, writesToDefiniteAddress
 
Methods inherited from class coins.flow.SetRefReprImpl
allFalse, defExpId, expIterator, expListIterator, expListIterator, expListIteratorFromBottom, getBBlock, getCorrespondingExpId, getDefFlowAnalSym, getDefSym, getFlag, getIR, getUseFlowAnalSyms, hasControl, isReturn, setFlag, sets, topUseNode, toString, useSymList, useSyms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface coins.flow.SetRefRepr
allFalse, callNodes, defSym, expIterator, expListIterator, expListIterator, getBBlock, getDefSym, getFlag, getIR, getUseFlowAnalSyms, hasControl, isReturn, lhsSyms, modSyms00, nodeListIterator, setFlag, sets, topUseNode, toString, useNodeIterator, useNodeList, useSymList, useSyms, writesToDefiniteAddress
 

Field Detail

fStmt

protected Stmt fStmt

hirRoot

public final HirRoot hirRoot

flow

public final Flow flow
Constructor Detail

SetRefReprHirEImpl

public SetRefReprHirEImpl(HIR pSubtree,
                          BBlock pBBlock,
                          boolean pDef,
                          java.util.Set pModSymsStmt)
SetRefReprHirEImpl instanciates SetRefRepr for the subtree pSubtree by computing SetRefRepr for child subtrees. For leaf children, SetRefRepr is not created. Required information fSetRefReprTable, fIrIndexMin, fIrIndexMax, and each item of fSetRefReprTable are set by HirSubpFlowImpl (and LirSubpFlowImpl). DataFlowImpl.recordSetRefRepr() eventually instanctiates this.

Parameters:
pSubtree - HIR subtree for which SetRefRepr is to be computed.
pBBlock - Basic block containing pSubtree.
pDef - true if pSubtree defines a symbol, false otherwise.
Method Detail

computeSetRefRepr

protected void computeSetRefRepr(HIR pHir,
                                 BBlock pBBlock,
                                 boolean pDef,
                                 java.util.Set pModSymsStmt)
computeSetRefRepr Compute defined symbols (fDefSym) and set of possibly modified variables (fModSyms), variables used as leaf operand (fLeafOperands). for the HIR subtree pHir within the basic block pBBlock. Fields fDefSym, fModSyms, fLeafOperands are computed and and SETS flag of fFlags are set true if some symbol is defined. The branchs outside pBBlock are not processed. Traverse should be in the sequence of evaluation at execution time.

Parameters:
pHir - subtree to be processed.
pBBlock - basic block within which variables are scanned.
pDef - true if traversing in define mode, false otherwise.
pModSymsStmt - set of symbols whose value may be modified by the simple statement containing pHir.

getStmt

public Stmt getStmt()
Overrides:
getStmt in class SetRefReprHirImpl

defNode

public IR defNode()
Description copied from interface: SetRefRepr
Returns the IR node which links to the definitely defined (set) symbol. Returns null if sets() returns false.

Specified by:
defNode in interface SetRefRepr
Overrides:
defNode in class SetRefReprHirImpl

modSyms

public java.util.Set modSyms()
modSyms returns the set of symbols that are possibly defined in this SetRefRepr. Symbols externally defined (i.e. via external calls) are not included. LHS symbol or ExpId if AssignStmt; ExpId if Exp; array symbol if SubscriptedExp; all variables if pointed var assignment;

Specified by:
modSyms in interface SetRefRepr
Overrides:
modSyms in class SetRefReprHirImpl
Returns:
the set of symbols that are possibly defined.

modSymsStmt

public java.util.Set modSymsStmt()
modSymsStmt returns the set of symbols that are possibly defined in the this SetRefRepr. Symbols externally defined (i.e. via external calls) are not included. LHS symbol or ExpId if AssignStmt; ExpId if Exp; array symbol if SubscriptedExp; all variables if pointed var assignment;

Returns:
the set of symbols that are possibly defined.

modSyms0

public java.util.Set modSyms0()
modSyms0 returns the set of symbols that are possibly defined in this SetRefRepr as modSyms() and symbols externally defined (i.e. via external calls) if call is included.

Returns:
the set of symbols that are possibly defined including external symbols if call is included.

leafOperands

public java.util.Set leafOperands()
leafOperands Get the set of symbols used as operands gathered from all leaf nodes of the subtree corresponding to this. ExpId's for intermediate results are excluded.


operandExp

public java.util.Set operandExp()
operandExp ExpId's of subexpressions used as direct operands by the node corresponding to this. Leaf operands are excluded.


allSubexps

public java.util.Set allSubexps()
operandExp ExpId's of all subexpressions of the subtree corresponding to this. Leaf operands are excluded.


hasCallWithSideEffect

public boolean hasCallWithSideEffect()
Specified by:
hasCallWithSideEffect in interface SetRefRepr
Overrides:
hasCallWithSideEffect in class SetRefReprHirImpl