coins.flow
Class SetRefReprHirImpl

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

public class SetRefReprHirImpl
extends SetRefReprImpl
implements SetRefRepr

Implementation of the SetRefRepr interface for HIR


Field Summary
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, flow, 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
SetRefReprHirImpl(HIR pSubtree, BBlock pBBlock)
           
SetRefReprHirImpl(IR pHir, SubpFlow pSubpFlow, ExpId pExpId)
           
 
Method Summary
 java.util.List callNodes()
           
protected static boolean checkWhetherBranch(Stmt pStmt)
           
 IR defNode()
          Returns the IR node which links to the definitely defined (set) symbol.
 FlowAnalSym defSym()
          Returns the symbol that is definitely defined in this SetRefRepr.
protected  java.util.Set expIdSet()
           
 java.util.List exps()
          Get the list of expressions (that have ExpId) under the associated subtree.
protected  java.util.List exps(boolean pFromTop, boolean pFromLeft)
           
protected  java.util.List expsUnder(HIR pSubtree)
           
protected  java.util.Set flowAnalSymsUnder(HIR pHIR)
           
 Stmt getStmt()
           
 boolean hasCallWithSideEffect()
           
protected static boolean hasDefiniteValue(Exp pExp)
           
 java.util.Set lhsSyms()
          Returns the set of symbols that correspond to the set of nodes that are within the LHS of this SetRefRepr.
 java.util.Set modSyms()
          modSyms //##25-1 Get the set of FlowAnalSym symbols whose value is set during the evaluation of the subtree corresponding to this SetRefRepr.
 java.util.Set modSyms00()
          Returns the set of symbols that are accessed by its name in the subprogram containing this SetRefRepr and possibly defined in this SetRefRepr.
protected  void modSymsUnder(HIR pHIR, java.util.Set pModSyms)
           
 NodeListIterator nodeListIterator()
          DFO iterator over the nodes under the subtree returned by getIR.
protected  void setInformation(HIR pSubtree)
           
protected  java.util.Set symsModifiedForLhsExp(Exp pExp)
          Get the set of symbols that may be modified when pExp is used as LHS (left hand side) expression.
 java.util.Iterator useNodeIterator()
          DFO iterator over the nodes under the subtree returned by getIR(), but the node returned by getDefNode() excluded.
 java.util.List useNodeList()
          Returns the List of nodes that are associated with a Sym that are used (read), in the depth first order that appears under the subtree returned by getIR().
protected  java.util.List useNodeList(boolean pFromTop, boolean pFromLeft)
          List up nodes using FlowAnalSym and Subp (exclude child1 of SUBS node)
 boolean 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, expIterator, expListIterator, expListIterator, getBBlock, getDefSym, getFlag, getIR, getUseFlowAnalSyms, hasControl, isReturn, setFlag, sets, topUseNode, toString, useSymList, useSyms
 

Field Detail

fStmt

protected Stmt fStmt

hirRoot

public final HirRoot hirRoot
Constructor Detail

SetRefReprHirImpl

public SetRefReprHirImpl(HIR pSubtree,
                         BBlock pBBlock)

SetRefReprHirImpl

public SetRefReprHirImpl(IR pHir,
                         SubpFlow pSubpFlow,
                         ExpId pExpId)
Method Detail

setInformation

protected void setInformation(HIR pSubtree)

getStmt

public Stmt getStmt()

useNodeList

public java.util.List useNodeList()
Returns the List of nodes that are associated with a Sym that are used (read), in the depth first order that appears under the subtree returned by getIR(). Sym may be FlowAnalSyms and Subp. Child 1 of SUBS node is excluded. ?? Nodes that correspond to Syms that are possibly used are included.

Specified by:
useNodeList in interface SetRefRepr

exps

public java.util.List exps()
Get the list of expressions (that have ExpId) under the associated subtree. defNode() expression is excluded.

Specified by:
exps in class SetRefReprImpl
Returns:
the list of expressions

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
Returns:
the IR node which links to the defined (set) symbol.

modSyms

public java.util.Set modSyms()
modSyms //##25-1 Get the set of FlowAnalSym symbols whose value is set during the evaluation of the subtree corresponding to this SetRefRepr.

Specified by:
modSyms in interface SetRefRepr
Returns:
the set of symbols to be modified.

modSymsUnder

protected void modSymsUnder(HIR pHIR,
                            java.util.Set pModSyms)

flowAnalSymsUnder

protected java.util.Set flowAnalSymsUnder(HIR pHIR)

symsModifiedForLhsExp

protected java.util.Set symsModifiedForLhsExp(Exp pExp)
Get the set of symbols that may be modified when pExp is used as LHS (left hand side) expression.

Parameters:
pExp - LHS expression that is used as LHS operand of AssignStmt, call-operand, etc.
Returns:
the set of symbols that may be modified.

expIdSet

protected java.util.Set expIdSet()

lhsSyms

public java.util.Set lhsSyms()
Description copied from interface: SetRefRepr
Returns the set of symbols that correspond to the set of nodes that are within the LHS of this SetRefRepr. Returns null if sets() returns false. The return value is a superset of the return value of getModSyms().

Specified by:
lhsSyms in interface SetRefRepr

expsUnder

protected java.util.List expsUnder(HIR pSubtree)

useNodeList

protected java.util.List useNodeList(boolean pFromTop,
                                     boolean pFromLeft)
List up nodes using FlowAnalSym and Subp (exclude child1 of SUBS node)

Parameters:
pFromTop - not used in this method.
pFromLeft - not used in this method.
Returns:
thelist of use-nodes.

exps

protected java.util.List exps(boolean pFromTop,
                              boolean pFromLeft)
Specified by:
exps in class SetRefReprImpl

hasCallWithSideEffect

public boolean hasCallWithSideEffect()
Specified by:
hasCallWithSideEffect in interface SetRefRepr

callNodes

public java.util.List callNodes()
Specified by:
callNodes in interface SetRefRepr

checkWhetherBranch

protected static boolean checkWhetherBranch(Stmt pStmt)

writesToDefiniteAddress

public boolean writesToDefiniteAddress()
Specified by:
writesToDefiniteAddress in interface SetRefRepr

hasDefiniteValue

protected static boolean hasDefiniteValue(Exp pExp)

defSym

public FlowAnalSym defSym()
Description copied from interface: SetRefRepr
Returns the symbol that is definitely defined in this SetRefRepr. (Neither consider the possibility of global variable modification by subprogram call nore consider modification by alias relations.) Returns null if sets() returns false, or, for example, in HIR, if this SetRefRepr corresponds to an assignment to an array element.

Specified by:
defSym in interface SetRefRepr

modSyms00

public java.util.Set modSyms00()
Description copied from interface: SetRefRepr
Returns the set of symbols that are accessed by its name in the subprogram containing this SetRefRepr and possibly defined in this SetRefRepr. Symbols that can be externally defined (i.e. via exteranl calls) are included as well (differs from modSym in this point). //##25-1 This is used in FindPEKill, FindDEGen, //##25-1 and findDefUseExhaustively(), findUseDefExhaustively(). //##73

Specified by:
modSyms00 in interface SetRefRepr

nodeListIterator

public NodeListIterator nodeListIterator()
Description copied from interface: SetRefRepr
DFO iterator over the nodes under the subtree returned by getIR.

Specified by:
nodeListIterator in interface SetRefRepr

useNodeIterator

public java.util.Iterator useNodeIterator()
Description copied from interface: SetRefRepr
DFO iterator over the nodes under the subtree returned by getIR(), but the node returned by getDefNode() excluded.

Specified by:
useNodeIterator in interface SetRefRepr