coins.aflow
Class HashBasedFlowExpId

java.lang.Object
  extended bycoins.aflow.HashBasedFlowExpId
All Implemented Interfaces:
FlowExpId
Direct Known Subclasses:
HashBasedFlowExpIdHir

public abstract class HashBasedFlowExpId
extends java.lang.Object
implements FlowExpId

An implementation of FlowExpId. Subtrees that have exactly the same structure have the same HashBasedFlowExpId.


Field Summary
protected  ExpId fExpId
          Creates new HaseBasedFlowExpId
protected  boolean fHasCall
           
(package private)  int fIndex
           
protected  boolean fLHS
          fLHS is true if corresponding expression is left hand side expression of AssignStmt.
(package private)  java.util.Set fOperandSet
           
(package private)  java.util.Set fOperandSet0
           
(package private)  int fOperationCount
           
protected  FlowResults fResults
           
protected  SubpFlow fSubpFlow
           
protected  IR fTree
           
protected  IoRoot ioRoot
           
protected  SymRoot symRoot
           
 
Constructor Summary
(package private) HashBasedFlowExpId(IR pNode, int pIndex, SubpFlow pSubpFlow)
           
 
Method Summary
protected  java.lang.String generateExpIdName(int pIndex)
          generateExpIdName: //##41 Generate ExpId name of the form xIdnnn where nnn is the string representing pIndex.
 DefUseList getDefUseList()
           
 ExpId getExpId()
           
 int getIndex()
          Returns the index attached to this FlowExpId.
 IR getLinkedNode()
          Returns an instance of the IR node whose associated FlowExpId is this.
protected  HashBasedFlowExpId getNextInChain()
           
 int getNumberOfOperations()
          Returns the number of operations this FlowExpId involves.
 java.util.Set getOperandSet()
          Returns the set of FlowAnalSyms that are operands of this FlowExpId.
 java.util.Set getOperandSet0()
          Returns the set of FlowAnalSyms that are operands of this FlowExpId, and that hold the value that may contribute to the result of the computation of this FlowExpId.
 SubpFlow getSubpFlow()
           
 IR getTree()
          Returns a copy of the tree structure this FlowExpId represents.
 UDList getUDList()
           
 boolean hasCall()
           
 boolean isLHS()
          Return true if the corresponding expression is left hand side expression of AssignStmt.
abstract  void operandInfo(IR pIr)
           
 void setLHSFlag()
          Set flag showing that corresponding expression is left hand side expression of AssignStmt.
protected  void setNextInChain(HashBasedFlowExpId pNext)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface coins.aflow.FlowExpId
toStringShort
 

Field Detail

fIndex

final int fIndex

fResults

protected FlowResults fResults

ioRoot

protected final IoRoot ioRoot

symRoot

protected final SymRoot symRoot

fOperationCount

int fOperationCount

fOperandSet

final java.util.Set fOperandSet

fOperandSet0

final java.util.Set fOperandSet0

fSubpFlow

protected SubpFlow fSubpFlow

fTree

protected IR fTree

fHasCall

protected boolean fHasCall

fLHS

protected boolean fLHS
fLHS is true if corresponding expression is left hand side expression of AssignStmt.


fExpId

protected ExpId fExpId
Creates new HaseBasedFlowExpId

Constructor Detail

HashBasedFlowExpId

HashBasedFlowExpId(IR pNode,
                   int pIndex,
                   SubpFlow pSubpFlow)
Method Detail

getNextInChain

protected HashBasedFlowExpId getNextInChain()

setNextInChain

protected void setNextInChain(HashBasedFlowExpId pNext)

getLinkedNode

public IR getLinkedNode()
Description copied from interface: FlowExpId
Returns an instance of the IR node whose associated FlowExpId is this. Such a node is likely a part of the program tree so should not be modified.

Specified by:
getLinkedNode in interface FlowExpId

getTree

public IR getTree()
Description copied from interface: FlowExpId
Returns a copy of the tree structure this FlowExpId represents. "Copy" means the node returned is not part of the main IR tree. Each invocation of this method returns the same copy created when this FlowExpId was created, and does not return a fresh copy of the IR tree each time.

Specified by:
getTree in interface FlowExpId

getIndex

public int getIndex()
Description copied from interface: FlowExpId
Returns the index attached to this FlowExpId. The indexing scope is the same as the scope of this FlowExpId.

Specified by:
getIndex in interface FlowExpId

getOperandSet

public java.util.Set getOperandSet()
Description copied from interface: FlowExpId
Returns the set of FlowAnalSyms that are operands of this FlowExpId. An operand of a FlowExpId is simply a FlowAnalSym that is attached to one of the nodes that comprise the tree represented by the FlowExpId.

Specified by:
getOperandSet in interface FlowExpId

getOperandSet0

public java.util.Set getOperandSet0()
Description copied from interface: FlowExpId
Returns the set of FlowAnalSyms that are operands of this FlowExpId, and that hold the value that may contribute to the result of the computation of this FlowExpId. For example, in HIR, if a symbol node is operated by the addressOf operator, and there is no contentsOf operator operating at all afterwards, the symbol attached to the symbol node is not included in the set returned by this method.

Specified by:
getOperandSet0 in interface FlowExpId

operandInfo

public abstract void operandInfo(IR pIr)

toString

public java.lang.String toString()

getNumberOfOperations

public int getNumberOfOperations()
Description copied from interface: FlowExpId
Returns the number of operations this FlowExpId involves. This is not more than but roughly equal to the number of this FlowExpId's linked node's descendant nodes.

Specified by:
getNumberOfOperations in interface FlowExpId

getDefUseList

public DefUseList getDefUseList()
Specified by:
getDefUseList in interface FlowExpId

getUDList

public UDList getUDList()
Specified by:
getUDList in interface FlowExpId

getSubpFlow

public SubpFlow getSubpFlow()

hasCall

public boolean hasCall()
Specified by:
hasCall in interface FlowExpId

generateExpIdName

protected java.lang.String generateExpIdName(int pIndex)
generateExpIdName: //##41 Generate ExpId name of the form xIdnnn where nnn is the string representing pIndex. If xIdnnn conflicts with other symbol, then xIdnnn_mm where mm is one of 1, 2, 3, ... .

Returns:
the generated ExpId name.

getExpId

public ExpId getExpId()
Specified by:
getExpId in interface FlowExpId

setLHSFlag

public void setLHSFlag()
Description copied from interface: FlowExpId
Set flag showing that corresponding expression is left hand side expression of AssignStmt.

Specified by:
setLHSFlag in interface FlowExpId

isLHS

public boolean isLHS()
Description copied from interface: FlowExpId
Return true if the corresponding expression is left hand side expression of AssignStmt. left hand side expression is not treated as common subexpression in usual case.

Specified by:
isLHS in interface FlowExpId
Returns:
true if setLHSFlag() is called, false otherwise.