coins.flow
Class HirSubpFlowImpl

java.lang.Object
  extended bycoins.flow.SubpFlowImpl
      extended bycoins.flow.HirSubpFlowImpl
All Implemented Interfaces:
HirSubpFlow, SubpFlow
Direct Known Subclasses:
MySubpFlow

public class HirSubpFlowImpl
extends SubpFlowImpl
implements HirSubpFlow

HirSubpFlowImpl class HIR subprogram flow analysis class.


Field Summary
static int EXP_ID_HASH_SIZE
           
 int fStmtExpCount
           
 HIR[] fStmtExpSeq
           
 int[] fStmtExpSeqIndexForBBlock
           
 
Fields inherited from class coins.flow.SubpFlowImpl
fAflowSubpFlow, failed, fAlias, fArrayOfSetRefReprList, fAssignCount, fBBlockCount, fBBlockList, fBBlockOfIR, fBBlockOfLabel, fBBlockTable, fBBlockVectorBitCount, fBBlockVectorWordCount, fCallCount, fComplexity, fComputedFlag, fDbgLevel, fDefCount, fDefIndex, fDefinedSyms, fDefNodeListOfSym, fDefPoint, fDefRefCount, fDefRefIndex, fDefRefPoint, fDefUseExhaustiveList, fDefUseList, fDefVectorBitCount, fDefVectorWordCount, fDfoList, fDom, fDomList, fEntryBBlock, fExitBBlock, fExpIdList, fExpIdNumber, fExpIdTable, fExpVectorBitCount, fExpVectorWordCount, fFlowAdapter, fFlowAnalSymTable, fFlowIrLink, fFlowIrLinkSize, fGlobalSymsUsed, fHirAnalExtended, fInverseDfoList, fIrIndexMax, fIrIndexMin, fIteratorInitiated, fListOfBBlocksFromEntry, fListOfBBlocksFromExit, flow, flowRoot, fMaximalCompoundVars, fMaxIndexOfCopiedNode, fMultipleSetRef, fNodeCount, fNodeCountLim1, fNodeCountLim2, fPointVectorBitCount, fPointVectorWordCount, fPostDom, fPostDomList, fPrevBBlockInSearch, fRecordAlias, fSetOfAddressTakenVariables, fSetOfGlobalVariables, fSetRefReprTable, fSubpDefinition, fSubtreesContainingCall, fSubtreesCopied, fSymCountLim1, fSymCountLim2, fSymExpCount, fSymIndexTable, fTempExpCorrespondence, fUseDefExhaustiveList, fUseDefList, fUsedGlobalSymCount, fUsedSymCount, fUsedSymSet, fUseNodeListOfSym, hasCall, hasCallInSubp, hasPointerAssign, hasStructUnion, hasUsePointer, hirRoot, ioRoot, symRoot
 
Fields inherited from interface coins.flow.SubpFlow
CF_BBLOCK, CF_CFG, CF_DOMINATOR, CF_INDEXED, CF_POSTDOMINATOR, DF_AVAILIN, DF_AVAILOUT, DF_DEF, DF_DEFIN, DF_DEFINED, DF_DEFOUT, DF_DEFUSE, DF_DEFUSEEXHAUST, DF_DEFUSELIST, DF_EGEN, DF_EKILL, DF_EXPID, DF_EXPOSED, DF_KILL, DF_LIVEIN, DF_LIVEOUT, DF_MAX, DF_MIN, DF_REACH, DF_SETREFREPR, DF_TRSNSPARENT, DF_USED, DF_USEDEFEXHAUST, DF_USEDEFLIST, FLAG_EXPID_LHS
 
Constructor Summary
HirSubpFlowImpl(FlowRoot pFlowRoot, SubpDefinition pSubpDefinition)
           
 
Method Summary
 void allocateExpIdForSubp()
          Allocate ExpId for each data handling node.
 ExpInf allocateExpIdToNode(HIR pSubtree)
          Allocate ExpId to pSubtree and its descendents.
 void computeBBlockSetRefReprs()
           
(package private)  int computeHashCodeOfNode(HIR pNode)
          computeHashCodeOfNode Compute hash code of node pNode taking into account the hash codes of its children so that any two subtrees have the same hash code if they have the same shape.
 boolean divideHirIntoBasicBlocks()
          Divide HIR into basic blocks assuming that nodes of this SubpDefinition are all numbered.
 void divideLirIntoBasicBlocks()
           
 IR[] getFlowIrLink()
           
 int getHashCodeOfIndexedNode(int pNodeIndex)
           
 boolean hasCall()
           
protected  boolean isSameTree(HIR pTree1, HIR pTree2)
          isSameTree
 void recordSetRefReprs()
          Records the SetRefReprs each BBlock contains.
 void recordSetRefReprs(BBlockHirImpl pBBlock)
          recordSetRefReprs Compute and record the SetRefReprs for each subtree (statement) in the given BBlock.
 void recordSetRefReprsForNode(HIR pSubtree, java.util.List pSetRefReprList, BBlock pBBlock)
          Make instance of SetRefReprHirEImpl if pSubtree is AssignStmt, ExpStmt (FunctionExp, conditional exp) or Retrun statement and record it to pSetRefReprList.
(package private)  ExpId selectExpId(HIR pSubtree, ExpInf pExpInf)
          selectExpId Select ExpId for pSubtree and assign it to pSubtree.
 void setHashCodeOfIndexedNode(int pNodeIndex, int pHashCode)
           
 
Methods inherited from class coins.flow.SubpFlowImpl
addDefNode, addUseNode, allocateBBlockOfIR, bblock, bblock, bblockNodeIterator, bblockStmtIterator, bblockSubtreeIterator, bblockVector, cfgFromExitIterator, cfgIterator, changeListOfFlowBBlocksToListOfAflowBBlocks, clearControlFlow, clearDataFlow, computeSetOfAddressTakenVariables, computeSetOfAddressTakenVariables, computeSetOfGlobalVariables, copyFlowAnalData, correlateBBlockAndIR, defVector, defVectorIterator, expVector, expVectorIterator, flowAnalSymVector, generateExpIdName, getAflowSubpFlow, getAssignCount, getBBlock, getBBlock, getBBlock0, getBBlockForLabel, getBBlockFromNodeIndex, getBBlockList, getBBlockOfIR, getBBlockTable, getBBlockVectorBitCount, getBBlockVectorWordCount, getCallCount, getComplexityLevel, getDefCount, getDefIndex, getDefinedSyms, getDefNodeList, getDefPoint, getDefUseExhaustiveList, getDefUseList, getDefVectorBitCount, getDefVectorWordCount, getDominatorList, getDominators, getEntryBBlock, getExitBBlock, getExpId, getExpId, getExpIdList, getExpOfTemp, getExpVectorBitCount, getExpVectorWordCount, getFlowAdapter, getFlowAnalStateLevel, getFlowAnalSymTable, getFlowRoot, getIndexedNode, getIndexedSym, getIrIndexMax, getIrIndexMin, getLinkedSubtreeOfExpId, getListOfBBlocksFromEntry, getListOfBBlocksFromExit, getListOfDefUseExhaustiveList, getListOfDefUseList, getListOfUseDefExhaustiveList, getListOfUseDefList, getMaximalCompoundVars, getNumberOfBBlocks, getNumberOfDefUsedGlobalSymbols, getNumberOfNodes, getPointVectorBitCount, getPointVectorWordCount, getPostDominatorList, getPostDominators, getPrevBBlockInSearch, getReachableBBlocks, getRecordAlias, getRefPoint, getRestructureFlag, getSetRefReprList, getSetRefReprOfIR, getSubpDefinition, getSubpSym, getSymExpCount, getUseDefExhaustiveList, getUseDefList, getUsedSymCount, getUsedSyms, geUseNodeList, hasCallUnder, initiateControlFlowAnal, initiateDataFlowAnal, isComputed, isComputedOrUnderComputation, isFailed, pointVector, pointVectorIterator, printComputedFlag, printExpIdAndIrCorrespondence, recordBBlock, recordDefPoint, recordDefRefPoint, recordSym, resetComputedFlag, resetControlAndDataFlowInformation, resetExpId, resetFlowSymLink, resetFlowSymLinkForRecordedSym, resetFlowSymLinkForTable, resetGlobalFlowSymLink, setBBlock, setBBlock, setBBlockOfIR, setBBlockVectorBitCount, setComputedFlag, setDefVectorBitCount, setEntryBBlock, setExitBBlock, setExpId, setExpOfTemp, setExpVectorBitCount, setFlowAnalStateLevel, setNumberOfNodes, setOfAddressTakenVariables, setOfGlobalVariables, setPointVectorBitCount, setPrevBBlockInSearch, setRecordAlias, setRestructureFlag, setSetRefReprList, setSetRefReprOfIR, setUnderComputation, sortExpIdCollection, subtreesContainingCall, summarize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface coins.flow.SubpFlow
bblock, bblock, bblockNodeIterator, bblockStmtIterator, bblockSubtreeIterator, cfgFromExitIterator, cfgIterator, changeListOfFlowBBlocksToListOfAflowBBlocks, clearControlFlow, clearDataFlow, computeSetOfAddressTakenVariables, computeSetOfGlobalVariables, copyFlowAnalData, defVector, defVectorIterator, expVector, expVectorIterator, flowAnalSymVector, generateExpIdName, getAssignCount, getBBlock, getBBlock, getBBlock0, getBBlockForLabel, getBBlockFromNodeIndex, getBBlockList, getBBlockOfIR, getBBlockTable, getBBlockVectorBitCount, getBBlockVectorWordCount, getCallCount, getComplexityLevel, getDefCount, getDefIndex, getDefinedSyms, getDefNodeList, getDefPoint, getDefUseExhaustiveList, getDefUseList, getDefVectorBitCount, getDefVectorWordCount, getDominatorList, getDominators, getEntryBBlock, getExitBBlock, getExpId, getExpId, getExpIdList, getExpOfTemp, getExpVectorBitCount, getExpVectorWordCount, getFlowAdapter, getFlowAnalStateLevel, getFlowAnalSymTable, getFlowRoot, getIndexedNode, getIndexedSym, getIrIndexMax, getIrIndexMin, getLinkedSubtreeOfExpId, getListOfBBlocksFromEntry, getListOfBBlocksFromExit, getMaximalCompoundVars, getNumberOfBBlocks, getNumberOfDefUsedGlobalSymbols, getNumberOfNodes, getPointVectorBitCount, getPointVectorWordCount, getPostDominatorList, getPostDominators, getPrevBBlockInSearch, getReachableBBlocks, getRecordAlias, getRefPoint, getRestructureFlag, getSetRefReprList, getSetRefReprOfIR, getSubpDefinition, getSubpSym, getSymExpCount, getUseDefExhaustiveList, getUseDefList, getUsedSymCount, getUsedSyms, geUseNodeList, hasCallUnder, initiateControlFlowAnal, initiateDataFlowAnal, isComputed, isComputedOrUnderComputation, isFailed, pointVector, pointVectorIterator, printExpIdAndIrCorrespondence, recordBBlock, recordDefPoint, recordDefRefPoint, resetComputedFlag, resetControlAndDataFlowInformation, resetFlowSymLink, resetFlowSymLinkForRecordedSym, resetGlobalFlowSymLink, setBBlock, setBBlock, setBBlockVectorBitCount, setComputedFlag, setDefVectorBitCount, setEntryBBlock, setExitBBlock, setExpId, setExpOfTemp, setExpVectorBitCount, setFlowAnalStateLevel, setNumberOfNodes, setOfAddressTakenVariables, setOfGlobalVariables, setPointVectorBitCount, setPrevBBlockInSearch, setRecordAlias, setRestructureFlag, setSetRefReprList, setSetRefReprOfIR, setUnderComputation, sortExpIdCollection, subtreesContainingCall, summarize
 

Field Detail

EXP_ID_HASH_SIZE

public static final int EXP_ID_HASH_SIZE
See Also:
Constant Field Values

fStmtExpSeq

public HIR[] fStmtExpSeq

fStmtExpSeqIndexForBBlock

public int[] fStmtExpSeqIndexForBBlock

fStmtExpCount

public int fStmtExpCount
Constructor Detail

HirSubpFlowImpl

public HirSubpFlowImpl(FlowRoot pFlowRoot,
                       SubpDefinition pSubpDefinition)
Method Detail

divideHirIntoBasicBlocks

public boolean divideHirIntoBasicBlocks()
Divide HIR into basic blocks assuming that nodes of this SubpDefinition are all numbered. Make fFlowIrLink, fBBlockOfIR fUsedSymSet fSetOfGlobalVariables fHirNodeArray and set index to FlowAnalSyms apperaed in SubpDefinition.

Specified by:
divideHirIntoBasicBlocks in interface HirSubpFlow
Returns:
false if failed (by bad node index), otherwise return true. //##78

divideLirIntoBasicBlocks

public void divideLirIntoBasicBlocks()
Specified by:
divideLirIntoBasicBlocks in interface HirSubpFlow

allocateExpIdForSubp

public void allocateExpIdForSubp()
Allocate ExpId for each data handling node. ExpId allocation is required for SetRefRepr computation and data flow analysis. The method allocateExpIdForSubp computes also fExpIdTable fExpIdList fSymIndexTable fDefRefIndex fDefIndex fDefRefPoint fDefPoint fDefinedSyms fFlowAnalSymTable

Specified by:
allocateExpIdForSubp in interface HirSubpFlow

allocateExpIdToNode

public ExpInf allocateExpIdToNode(HIR pSubtree)
Allocate ExpId to pSubtree and its descendents. If pSubtree is allocated an ExpId, then it is returned. If pSubtree is not allocated ExpId, then (representative) ExpId of its descendents is returned.

Parameters:
pSubtree - to which ExpId is to be assigned.
Returns:
ExpId of pSubtree or its descendent.

selectExpId

ExpId selectExpId(HIR pSubtree,
                  ExpInf pExpInf)
selectExpId Select ExpId for pSubtree and assign it to pSubtree.


getHashCodeOfIndexedNode

public int getHashCodeOfIndexedNode(int pNodeIndex)

setHashCodeOfIndexedNode

public void setHashCodeOfIndexedNode(int pNodeIndex,
                                     int pHashCode)

computeHashCodeOfNode

int computeHashCodeOfNode(HIR pNode)
computeHashCodeOfNode Compute hash code of node pNode taking into account the hash codes of its children so that any two subtrees have the same hash code if they have the same shape.


isSameTree

protected boolean isSameTree(HIR pTree1,
                             HIR pTree2)
isSameTree

Returns:
true if pTree1 and pTree2 have the same shape, false otherwise.

computeBBlockSetRefReprs

public void computeBBlockSetRefReprs()
Specified by:
computeBBlockSetRefReprs in interface SubpFlow
Overrides:
computeBBlockSetRefReprs in class SubpFlowImpl

hasCall

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

getFlowIrLink

public IR[] getFlowIrLink()

recordSetRefReprs

public void recordSetRefReprs()
Records the SetRefReprs each BBlock contains.


recordSetRefReprs

public void recordSetRefReprs(BBlockHirImpl pBBlock)
recordSetRefReprs Compute and record the SetRefReprs for each subtree (statement) in the given BBlock. Only supports HIR so far.

Parameters:
pBBlock - BBlock whose SetRefReprs will be recorded.

recordSetRefReprsForNode

public void recordSetRefReprsForNode(HIR pSubtree,
                                     java.util.List pSetRefReprList,
                                     BBlock pBBlock)
Make instance of SetRefReprHirEImpl if pSubtree is AssignStmt, ExpStmt (FunctionExp, conditional exp) or Retrun statement and record it to pSetRefReprList.

Parameters:
pSubtree -
pSetRefReprList -
pBBlock -