coins.aflow
Class SetRefReprHirEImpl

java.lang.Object
  extended bycoins.aflow.SetRefReprImpl
      extended bycoins.aflow.SetRefReprHirImpl
          extended bycoins.aflow.SetRefReprHirEImpl
All Implemented Interfaces:
SetRefRepr, SetRefReprHir

public class SetRefReprHirEImpl
extends SetRefReprHirImpl
implements SetRefReprHir

Implementation of the SetRefRepr interface for HIR


Field Summary
protected  java.util.Set fAllSubexps
          fAllSubexps: ExpId's of all subexpressions under the node corresponding to this.
protected  boolean fCallWithSideEffectIncluded
          fCallIncluded: True if call with side effect is included in the subtree fIR, false if call with side effect is not included.
protected  java.util.Set fLeafOperands
          fLeafOperands: Symbols of subexpressions used as operands by the node corresponding to this.
protected  java.util.Set fModSyms
          fModSyms: Symbols that may be modified by the node corresponding to this.
protected  java.util.Set fModSymsStmt
          fModSymsStmt: Symbols that may be modified by the simple statement containing the subtree corresponding to this SetRefRepr.
protected  java.util.Set fOperandExp
          fOperandExp: ExpId's of subexpressions used as direct operands by the node corresponding to this.
 
Fields inherited from class coins.aflow.SetRefReprHirImpl
flow, fStmt, hirRoot
 
Fields inherited from class coins.aflow.SetRefReprImpl
fBBlock, fDefSym, fFlags, fIR, flowRoot, fOpCode, fResults, fUseExpIdList, fUseNodeList, symRoot
 
Fields inherited from interface coins.aflow.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()
          Returns the Stmt node that originated this SetRefReprHir.
 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.aflow.SetRefReprHirImpl
callNodes, checkWhetherBranch, defSym, exps, exps, expsUnder, flowAnalSymNodesUnder, flowAnalSymsUnder, hasDefiniteValue, lhsSyms, modSyms00, modSymsUnder, symsModifiedForLhsExp, useNodeList, useNodeList, writesToDefiniteAddress
 
Methods inherited from class coins.aflow.SetRefReprImpl
allFalse, defFlowExpId, expIterator, expListIterator, expListIterator, expListIteratorFromBottom, getBBlock, getDAvailIn, getDDefIn, getDDefined, getDefSym, getDExposed, getDKill, getDReach, getDUsed, getFlag, getFlowExpIds, getIR, getPDefined, getPEKill, getPExposed, getPKill, getPLiveOut, getPReach, getPUsed, getUseFlowExpIds, hasControl, isReturn, nodeIterator, nodeListIterator, nodeListIterator, setFlag, sets, topUseNode, toString, useNodeIterator, useSyms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface coins.aflow.SetRefRepr
allFalse, callNodes, defFlowExpId, defSym, expIterator, expListIterator, expListIterator, getBBlock, getDAvailIn, getDDefIn, getDDefined, getDefSym, getDExposed, getDKill, getDReach, getDUsed, getFlag, getIR, getPDefined, getPEKill, getPExposed, getPKill, getPLiveOut, getPReach, getPUsed, hasControl, isReturn, lhsSyms, modSyms00, nodeIterator, nodeListIterator, nodeListIterator, setFlag, sets, topUseNode, toString, useNodeIterator, useNodeList, useSyms, writesToDefiniteAddress
 

Field Detail

fModSyms

protected java.util.Set fModSyms
fModSyms: Symbols that may be modified by the node corresponding to this. ExpId's for intermediate results are excluded but ExpId for compound variable in LHS of AssignStmt is included.


fModSymsStmt

protected java.util.Set fModSymsStmt
fModSymsStmt: Symbols that may be modified by the simple statement containing the subtree corresponding to this SetRefRepr. It is allocated for each simple statement and refered from all subexpressions in the simple statement.


fLeafOperands

protected java.util.Set fLeafOperands
fLeafOperands: Symbols of subexpressions used as operands by the node corresponding to this. ExpId's for intermediate results are excluded.


fOperandExp

protected java.util.Set fOperandExp
fOperandExp: ExpId's of subexpressions used as direct operands by the node corresponding to this. Leaf operands are excluded.


fAllSubexps

protected java.util.Set fAllSubexps
fAllSubexps: ExpId's of all subexpressions under the node corresponding to this. Leaf operands are excluded.


fCallWithSideEffectIncluded

protected boolean fCallWithSideEffectIncluded
fCallIncluded: True if call with side effect is included in the subtree fIR, false if call with side effect is not included.

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).

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.


getStmt

public Stmt getStmt()
Description copied from interface: SetRefReprHir
Returns the Stmt node that originated this SetRefReprHir. This is usually same as getIR(), but is differnet when this SetRefReprHir originates from an IfStmt.

Specified by:
getStmt in interface SetRefReprHir
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