coins.flow
Class SetRefReprImpl

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

public abstract class SetRefReprImpl
extends java.lang.Object
implements SetRefRepr

Implementation of the SetRefRepr interface


Field Summary
protected  java.util.Set fAllSubexps
          fAllSubexps contains ExpId's of all subexpressions under the node corresponding to this.
protected  BBlock fBBlock
           
protected  java.util.List fCallNodes
           
protected  boolean fCallWithSideEffectIncluded
          fCallIncluded is True if call with side effect is included in the subtree fIR, false otherwize;
protected  ExpId fCorrespondingExpId
           
 int fDbgLevel
           
protected  ExpId fDefExpId
           
protected  FlowAnalSym fDefSym
          Symbol or ExpId defined by this SetRefRepr.
protected  java.util.Set fExpIdSet
           
protected  java.util.List fExps
           
protected  FlagBox fFlags
           
protected  IR fIR
           
protected  java.util.Set fLeafOperands
          fLeafOperands contains symbols of subexpressions used as operands by the subtree corresponding to this.
protected  java.util.Set fLhsSyms
           
 Flow flow
           
 FlowRoot flowRoot
           
protected  java.util.Set fModSyms
          fModSyms contains Symbols that may be modified by the node corresponding to this.
protected  java.util.Set fModSyms00
          fModSYms00 contains symbols in fModSyms and symbols that may be modified by subprogram is hasCall() is true for this SetRefRepr.
protected  java.util.Set fModSymsStmt
          fModSymsStmt contains Symbols that may be modified by the simple statement containing the subtree corresponding to this SetRefRepr.
protected  int fOpCode
           
protected  java.util.Set fOperandExp
          fOperandExp contains ExpId's of subexpressions used as direct operands by the subtree corresponding to this.
 SubpFlow fSubpFlow
           
protected  java.util.Set fUseFlowAnalSyms
           
protected  java.util.List fUseNodeList
           
protected  java.util.List fUseSymList
           
protected  java.util.Set fUseSyms
           
 SymRoot symRoot
           
 
Fields inherited from interface coins.flow.SetRefRepr
HAS_CONTROL, IS_RETURN, SETS
 
Constructor Summary
SetRefReprImpl(IR pIR, SubpFlow pSubpFlow, ExpId pExpId)
           
 
Method Summary
 boolean allFalse()
           
 ExpId defExpId()
           
 java.util.Iterator expIterator()
          Returns the Set of nodes that have FlowAnalSym attached and are not a Def node.
 java.util.ListIterator expListIterator()
          Returns a DFO iterator that iterates over nodes that have a FlowExpId attached, and, if "this" is value-setting, is not a Def node.
 java.util.ListIterator expListIterator(boolean pFromTop, boolean pFromLeft)
          Returns an DFO iterator that iterates over nodes that have a FlowExpId attached, and, if "this" is value-setting, is not a Def node.
 java.util.ListIterator expListIteratorFromBottom()
           
abstract  java.util.List exps()
          Get the list of expressions (that have ExpId) under the associated subtree.
(package private) abstract  java.util.List exps(boolean pFromTop, boolean pFromLeft)
           
 BBlock getBBlock()
           
 ExpId getCorrespondingExpId()
           
 FlowAnalSym getDefFlowAnalSym()
           
 FlowAnalSym getDefSym()
           
 boolean getFlag(int pFlagNumber)
           
 IR getIR()
          Returns the IR node this SetRefRepr represents.
 java.util.Set getUseFlowAnalSyms()
           
 boolean hasControl()
          Does this SetRefRepr is at the end of the BBlock and has a role to determine the flow of control after this SetRefRepr?
 boolean isReturn()
           
 void setFlag(int pFlagNumber, boolean pYesNo)
           
 boolean sets()
          Returns true if this SetRefRepr involves value-setting, other than via the external call.
 IR topUseNode()
          If this is a value-setting node, returns the top node of the RHS.
 java.lang.String toString()
          Converts to a String object.
 java.util.List useSymList()
          Returns the List of FlowAnalSyms used in this SetRefRepr.
 java.util.Set useSyms()
          Returns the Set of the FlowAnalSyms used in this SetRefRepr.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface coins.flow.SetRefRepr
callNodes, defNode, defSym, hasCallWithSideEffect, lhsSyms, modSyms, modSyms00, nodeListIterator, useNodeIterator, useNodeList, writesToDefiniteAddress
 

Field Detail

flowRoot

public final FlowRoot flowRoot

symRoot

public final SymRoot symRoot

fSubpFlow

public final SubpFlow fSubpFlow

flow

public final Flow flow

fIR

protected IR fIR

fUseNodeList

protected java.util.List fUseNodeList

fOpCode

protected int fOpCode

fFlags

protected FlagBox fFlags

fBBlock

protected BBlock fBBlock

fDefSym

protected FlowAnalSym fDefSym
Symbol or ExpId defined by this SetRefRepr.


fModSyms

protected java.util.Set fModSyms
fModSyms contains 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 contains 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.


fModSyms00

protected java.util.Set fModSyms00
fModSYms00 contains symbols in fModSyms and symbols that may be modified by subprogram is hasCall() is true for this SetRefRepr. (It is computed only when modSyms00() is called at the first time.


fLeafOperands

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


fOperandExp

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


fAllSubexps

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


fCallWithSideEffectIncluded

protected boolean fCallWithSideEffectIncluded
fCallIncluded is True if call with side effect is included in the subtree fIR, false otherwize;


fLhsSyms

protected java.util.Set fLhsSyms

fUseSyms

protected java.util.Set fUseSyms

fUseFlowAnalSyms

protected java.util.Set fUseFlowAnalSyms

fExpIdSet

protected java.util.Set fExpIdSet

fExps

protected java.util.List fExps

fCallNodes

protected java.util.List fCallNodes

fUseSymList

protected java.util.List fUseSymList

fDefExpId

protected ExpId fDefExpId

fCorrespondingExpId

protected ExpId fCorrespondingExpId

fDbgLevel

public final int fDbgLevel
Constructor Detail

SetRefReprImpl

public SetRefReprImpl(IR pIR,
                      SubpFlow pSubpFlow,
                      ExpId pExpId)
Method Detail

getIR

public IR getIR()
Description copied from interface: SetRefRepr
Returns the IR node this SetRefRepr represents. getIR() usually refers to the top subtree corresponding to this SetRefREpr, but in case of IfStmt it refers to if-condition expression, and in case of SwitchStmt, it refers to selection-expression. The top subtree corresponding to this SetRefRepr can be get by subpFlow.getLinkedSubtreeOfExpId(getCorrespondingExpId()). //##62

Specified by:
getIR in interface SetRefRepr
Returns:
the node this SetRefRepr represents.

useSyms

public java.util.Set useSyms()
Description copied from interface: SetRefRepr
Returns the Set of the FlowAnalSyms used in this SetRefRepr. All symbols whose values can be possibly referred within this SetRefRepr are included, but those that can be referred to through the external calls (i.e. global symbols) within this SetRefRepr are not considered.

Specified by:
useSyms in interface SetRefRepr

useSymList

public java.util.List useSymList()
Description copied from interface: SetRefRepr
Returns the List of FlowAnalSyms used in this SetRefRepr. All symbols whose values can be possibly referred within this SetRefRepr are included, but those that can be referred to through the external calls (i.e. global symbols) within this SetRefRepr are not considered.

Specified by:
useSymList in interface SetRefRepr

getUseFlowAnalSyms

public java.util.Set getUseFlowAnalSyms()
Specified by:
getUseFlowAnalSyms in interface SetRefRepr

topUseNode

public IR topUseNode()
Description copied from interface: SetRefRepr
If this is a value-setting node, returns the top node of the RHS. If not, returns the same node as getIR().

Specified by:
topUseNode in interface SetRefRepr

defExpId

public ExpId defExpId()

getDefSym

public FlowAnalSym getDefSym()
Specified by:
getDefSym in interface SetRefRepr

getDefFlowAnalSym

public FlowAnalSym getDefFlowAnalSym()

toString

public java.lang.String toString()
Description copied from interface: SetRefRepr
Converts to a String object.

Specified by:
toString in interface SetRefRepr

expIterator

public java.util.Iterator expIterator()
Returns the Set of nodes that have FlowAnalSym attached and are not a Def node. Returns the Set of nodes that have FlowAnalSym attached and are not a Def node.

Specified by:
expIterator in interface SetRefRepr
See Also:
SetRefRepr.defNode()

expListIterator

public java.util.ListIterator expListIterator()
Description copied from interface: SetRefRepr
Returns a DFO iterator that iterates over nodes that have a FlowExpId attached, and, if "this" is value-setting, is not a Def node. // NEEDED

Specified by:
expListIterator in interface SetRefRepr

expListIteratorFromBottom

public java.util.ListIterator expListIteratorFromBottom()

exps

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

Returns:
the list of expressions

exps

abstract java.util.List exps(boolean pFromTop,
                             boolean pFromLeft)

expListIterator

public java.util.ListIterator expListIterator(boolean pFromTop,
                                              boolean pFromLeft)
Description copied from interface: SetRefRepr
Returns an DFO iterator that iterates over nodes that have a FlowExpId attached, and, if "this" is value-setting, is not a Def node. // NEEDED

Specified by:
expListIterator in interface SetRefRepr
Parameters:
pFromTop - iterate from top?
pFromLeft - iterate from left?

getFlag

public boolean getFlag(int pFlagNumber)
Specified by:
getFlag in interface SetRefRepr

setFlag

public void setFlag(int pFlagNumber,
                    boolean pYesNo)
Specified by:
setFlag in interface SetRefRepr

allFalse

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

sets

public boolean sets()
Description copied from interface: SetRefRepr
Returns true if this SetRefRepr involves value-setting, other than via the external call.

Specified by:
sets in interface SetRefRepr

hasControl

public boolean hasControl()
Description copied from interface: SetRefRepr
Does this SetRefRepr is at the end of the BBlock and has a role to determine the flow of control after this SetRefRepr?

Specified by:
hasControl in interface SetRefRepr

isReturn

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

getBBlock

public BBlock getBBlock()
Specified by:
getBBlock in interface SetRefRepr

getCorrespondingExpId

public ExpId getCorrespondingExpId()