coins.flow
Class SubpFlowImpl

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

public abstract class SubpFlowImpl
extends java.lang.Object
implements SubpFlow

SubpFlowImpl class Subprogram flow analysis class. Fields and methods are common between HIR and LIR.


Field Summary
protected  SubpFlow fAflowSubpFlow
           
protected  boolean failed
           
protected  AliasAnal fAlias
           
protected  SetRefReprList[] fArrayOfSetRefReprList
           
protected  int fAssignCount
           
protected  int fBBlockCount
           
protected  java.util.List fBBlockList
           
protected  BBlock[] fBBlockOfIR
           
protected  java.util.Map fBBlockOfLabel
           
protected  java.util.ArrayList fBBlockTable
           
protected  int fBBlockVectorBitCount
           
protected  int fBBlockVectorWordCount
           
protected  int fCallCount
           
protected  int fComplexity
           
protected  int[] fComputedFlag
           
 int fDbgLevel
           
protected  int fDefCount
           
protected  int[] fDefIndex
           
protected  java.util.Set fDefinedSyms
           
protected  java.util.List[] fDefNodeListOfSym
           
protected  IR[] fDefPoint
           
protected  int fDefRefCount
           
protected  int[] fDefRefIndex
           
protected  IR[] fDefRefPoint
           
protected  DefUseList fDefUseExhaustiveList
           
protected  DefUseList fDefUseList
           
protected  int fDefVectorBitCount
           
protected  int fDefVectorWordCount
           
protected  java.util.List fDfoList
           
protected  BBlockVector[] fDom
           
protected  java.util.List[] fDomList
           
protected  BBlock fEntryBBlock
           
protected  BBlock fExitBBlock
           
protected  java.util.List fExpIdList
           
protected  int fExpIdNumber
           
protected  ExpId[] fExpIdTable
           
protected  int fExpVectorBitCount
           
protected  int fExpVectorWordCount
           
protected  FlowAdapter fFlowAdapter
           
protected  FlowAnalSym[] fFlowAnalSymTable
           
protected  IR[] fFlowIrLink
           
protected  int fFlowIrLinkSize
           
protected  java.util.Set fGlobalSymsUsed
           
 boolean fHirAnalExtended
           
protected  java.util.List fInverseDfoList
           
protected  int fIrIndexMax
           
protected  int fIrIndexMin
           
 boolean fIteratorInitiated
           
protected  java.util.List fListOfBBlocksFromEntry
           
protected  java.util.List fListOfBBlocksFromExit
           
 Flow flow
           
 FlowRoot flowRoot
           
protected  java.util.Set fMaximalCompoundVars
           
 int fMaxIndexOfCopiedNode
           
 java.util.Map fMultipleSetRef
           
protected  int fNodeCount
           
protected  int fNodeCountLim1
           
protected  int fNodeCountLim2
           
protected  int fPointVectorBitCount
           
protected  int fPointVectorWordCount
           
protected  BBlockVector[] fPostDom
           
protected  java.util.List[] fPostDomList
           
protected  BBlock fPrevBBlockInSearch
           
protected  RecordAlias fRecordAlias
           
protected  java.util.Set fSetOfAddressTakenVariables
           
protected  java.util.Set fSetOfGlobalVariables
           
protected  SetRefRepr[] fSetRefReprTable
           
protected  SubpDefinition fSubpDefinition
           
 java.util.Set fSubtreesContainingCall
           
 java.util.List fSubtreesCopied
           
protected  int fSymCountLim1
           
protected  int fSymCountLim2
           
protected  int fSymExpCount
           
protected  FlowAnalSym[] fSymIndexTable
           
protected  java.util.Map fTempExpCorrespondence
           
protected  UseDefList fUseDefExhaustiveList
           
protected  UseDefList fUseDefList
           
protected  int fUsedGlobalSymCount
           
protected  int fUsedSymCount
           
protected  java.util.Set fUsedSymSet
           
protected  java.util.List[] fUseNodeListOfSym
           
 boolean[] hasCall
           
 boolean hasCallInSubp
           
 boolean[] hasPointerAssign
           
 boolean[] hasStructUnion
           
 boolean[] hasUsePointer
           
 HirRoot hirRoot
           
 IoRoot ioRoot
           
 SymRoot 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
SubpFlowImpl()
           
SubpFlowImpl(FlowRoot pFlowRoot, SubpDefinition pSubpDefinition)
           
 
Method Summary
 void addDefNode(FlowAnalSym pSym, IR pDefNode)
           
 void addUseNode(FlowAnalSym pSym, IR pUseNode)
           
 void allocateBBlockOfIR()
           
 BBlock bblock()
          Create dummy basic block.
 BBlock bblock(LabeledStmt pLabeledStmt)
          Create new basic block corresponding to the HIR labeled statement pLabeledStmt.
 BBlockNodeIterator bblockNodeIterator(BBlock pBBlock)
          bblockNodeItrator Get iterator that traverse all nodes of the basic block pBBlock.
 BBlockStmtIterator bblockStmtIterator(BBlockHir pBBlock)
          bblockStmtIterator get iterator to traverse statements in the basic block pBBlock.
 BBlockSubtreeIterator bblockSubtreeIterator(BBlock pBBlock)
          bblockSubtreeItrator Get iterator that traverse top subtrees of the basic block pBBlock.
 BBlockVector bblockVector()
           
 java.util.Iterator cfgFromExitIterator()
          cfgFromExitIterator Traverse basic blocks in CFG (control flow graph) in inverse depth first order from the exit BBlock.
 java.util.Iterator cfgIterator()
          cfgIterator Traverse basic blocks in CFG (control flow graph) in depth first order.
 java.util.List changeListOfFlowBBlocksToListOfAflowBBlocks(java.util.List pListOfFlowBBlocks)
           
 void clearControlFlow()
          Clear all control/data flow analysis information.
 void clearDataFlow()
          Clear data flow information.
 void computeBBlockSetRefReprs()
           
 java.util.Set computeSetOfAddressTakenVariables()
          computeSetOfAddressTakenVariables Compute the set of variables whose address is taken (e.g.
 void computeSetOfAddressTakenVariables(HIR pHir, java.util.Set pSet, boolean pAddrOperand)
          computeSetOfAddressTakenVariables Compute the set of variables whose address is taken (e.g.
 java.util.Set computeSetOfGlobalVariables()
          computeSetOfGlobalVariables Compute the set of global variables and record it in fSetOfGlobalVariables.
 void copyFlowAnalData(SubpFlow pSubpFlow)
           
 void correlateBBlockAndIR()
           
 DefVector defVector()
           
 DefVectorIterator defVectorIterator(DefVector pDefVector)
           
 ExpVector expVector()
           
 ExpVectorIterator expVectorIterator(ExpVector pExpVector)
           
 FlowAnalSymVector flowAnalSymVector()
           
 java.lang.String generateExpIdName()
          generateExpIdName Generate a name of expression identifier _xId1, _xId2, _xId3, ...
 SubpFlow getAflowSubpFlow(FlowResults pFlowResults)
           
 int getAssignCount()
           
 BBlock getBBlock(HIR pHir)
           
 BBlock getBBlock(int pBlockNumber)
          getBBlock Get the basic block whose block number is pBlockNumber.
 BBlock getBBlock0(Label pLabel)
           
 BBlock getBBlockForLabel(Label pLabel)
           
 BBlock getBBlockFromNodeIndex(int pNodeIndex)
           
 java.util.List getBBlockList()
          Returns the List of BBlocks in the flow excluding null and 0-numbered BBlock.
 BBlock getBBlockOfIR(int pIndex)
           
 java.util.ArrayList getBBlockTable()
          Get BBlockTable of this subprogram.
 int getBBlockVectorBitCount()
           
 int getBBlockVectorWordCount()
           
 int getCallCount()
           
 int getComplexityLevel()
          Get the complexity level of this subprogram.
 int getDefCount()
           
 int getDefIndex(int pNodeIndex)
          Get def-index from node index.
 java.util.Set getDefinedSyms()
          getDefinedSyms Set of all symbols whose value is set in this subprogram.
 java.util.List getDefNodeList(FlowAnalSym pSym)
           
 IR getDefPoint(int pIndex)
          Get IR node from def-index
 DefUseList getDefUseExhaustiveList()
           
 DefUseList getDefUseList()
           
 int getDefVectorBitCount()
           
 int getDefVectorWordCount()
           
 java.util.List getDominatorList(BBlock pBBlock)
          Get the list of dominators of pBBlock.
 BBlockVector getDominators(BBlock pBBlock)
          Get BBlockVector representing dominators of pBBlock.
 BBlock getEntryBBlock()
          Get the entry basic block.
 BBlock getExitBBlock()
           
 ExpId getExpId(IR pIr)
           
 ExpId getExpId(IR pIr, int pIndex)
           
 java.util.List getExpIdList()
           
 Exp getExpOfTemp(Var pTempVar)
          Get the expression represented by the temporal variable pTempVar.
 int getExpVectorBitCount()
           
 int getExpVectorWordCount()
           
 FlowAdapter getFlowAdapter()
           
 int getFlowAnalStateLevel()
           
 FlowAnalSym[] getFlowAnalSymTable()
           
 FlowRoot getFlowRoot()
           
 IR getIndexedNode(int pNodeIndex)
           
 FlowAnalSym getIndexedSym(int pSymIndex)
           
 int getIrIndexMax()
           
 int getIrIndexMin()
           
 HIR getLinkedSubtreeOfExpId(ExpId pExpId)
           
 java.util.List getListOfBBlocksFromEntry()
           
 java.util.List getListOfBBlocksFromExit()
           
 DefUseList getListOfDefUseExhaustiveList()
           
 DefUseList getListOfDefUseList()
           
 UseDefList getListOfUseDefExhaustiveList()
           
 UseDefList getListOfUseDefList()
           
 java.util.Set getMaximalCompoundVars()
          Get the set of maximal compound variables.
 int getNumberOfBBlocks()
           
 int getNumberOfDefUsedGlobalSymbols()
           
 int getNumberOfNodes()
           
 int getPointVectorBitCount()
           
 int getPointVectorWordCount()
           
 java.util.List getPostDominatorList(BBlock pBBlock)
          Get the list of post dominators of pBBlock.
 BBlockVector getPostDominators(BBlock pBBlock)
          Get BBlockVector representing post dominators of pBBlock.
 BBlock getPrevBBlockInSearch()
           
 java.util.List getReachableBBlocks()
          Get list of BBlocks reachable from entry BBLock.
 RecordAlias getRecordAlias()
          If returned value is not null, then alias is considered in data flow analysis.
 IR getRefPoint(int pIndex)
          Get IR node from ref-index
 boolean getRestructureFlag()
           
 SetRefReprList getSetRefReprList(BBlock pBBlock)
           
 SetRefRepr getSetRefReprOfIR(IR pIR)
           
 SubpDefinition getSubpDefinition()
           
 Subp getSubpSym()
           
 int getSymExpCount()
           
 UseDefList getUseDefExhaustiveList()
           
 UseDefList getUseDefList()
           
 int getUsedSymCount()
           
 java.util.Set getUsedSyms()
          getUsed Set of all symbols whose value is used in this subprogram.
 java.util.List geUseNodeList(FlowAnalSym pSym)
           
 boolean hasCallUnder(IR pIR)
          Returns true if the given IR node has as its decendant a call node.
 void initiateControlFlowAnal(SubpDefinition pSubpDefinition, int pIndexMin, int pIndexMax)
           
 void initiateDataFlowAnal(SubpDefinition pSubpDefinition)
          initiateDataFlowAnal Initiate bit vectors, and initiate fields in SetRefRepls, etc.
 boolean isComputed(int pItemIndex)
          Test if a control/data flow item is already computed or not.
 boolean isComputedOrUnderComputation(int pItemIndex)
           
 boolean isFailed()
           
 PointVector pointVector()
           
 PointVectorIterator pointVectorIterator(PointVector pPointVector)
           
(package private)  void printComputedFlag()
           
 void printExpIdAndIrCorrespondence()
           
 void recordBBlock(BBlock pBlock, int pBlockNumber)
           
 int recordDefPoint(IR pIR)
           
 int recordDefRefPoint(IR pIR)
           
protected  int recordSym(FlowAnalSym pSym)
           
 void resetComputedFlag(int pItemIndex)
          Reset computed flag for all items whose item numbers are greater or equal to pItemIndex.
 void resetControlAndDataFlowInformation()
          Clear all control/data flow analysis information after executing setIndexNumberTOAllNodes.
 void resetExpId()
           
 void resetFlowSymLink(SymTable pSymTable)
          resetFlowSymLink Reset all flow analysis information of symbols in pSymTable and its descendents.
 void resetFlowSymLinkForRecordedSym()
          linkLirWithDataFlowForSubp Reset links between flow information and LIR nodes, symbols, etc.
 void resetFlowSymLinkForTable(SymTable pSymTable)
           
 void resetGlobalFlowSymLink()
          resetGlobalFlowSymLink Reset all flow analysis information of symbols that are contained in ancestor symbol table (symTableRoot, etc) without traversing its descendents.
 void setBBlock(HIR pHir, BBlock pBBlock)
           
 void setBBlock(Label pLabel, BBlock pBBlock)
           
 void setBBlockOfIR(BBlock pBBlock, int pIndex)
           
 void setBBlockVectorBitCount(int pBitCount)
           
 void setComputedFlag(int pItemIndex)
          Set the control/data flow item to be computed as true.
 void setDefVectorBitCount(int pBitCount)
           
 void setEntryBBlock(BBlock pBlock)
           
 void setExitBBlock(BBlock pBlock)
           
 void setExpId(IR pIr, ExpId pExpId)
           
 void setExpOfTemp(Var pTempVar, Exp pExp)
          Record pExp as the expression represented by the temporal variable pTempVar.
 void setExpVectorBitCount(int pBitCount)
           
 void setFlowAnalStateLevel(int pState)
           
 void setNumberOfNodes(int pCount)
           
 java.util.Set setOfAddressTakenVariables()
           
 java.util.Set setOfGlobalVariables()
           
 void setPointVectorBitCount(int pBitCount)
           
 void setPrevBBlockInSearch(BBlock pPrev)
          setPrevBBlockInSearch getPrevBBlockInSearch Methods used in linking basic blocks in depth first order, etc.
 void setRecordAlias(RecordAlias pRecordAlias)
          Record a RecordAlias instance in order to indicate that alias is considered in data flow analysis.
 void setRestructureFlag()
           
 void setSetRefReprList(BBlock pBBlock, SetRefReprList pSetRefReprList)
           
 void setSetRefReprOfIR(SetRefRepr pSetRefRepr, IR pIR)
           
 void setUnderComputation(int pItemIndex)
          Set computed flag for the item indicated by pItemIndex.
 java.util.List sortExpIdCollection(java.util.Collection pExpIdCollection)
          Sort the list or set of FLowAnalSyms (pExpIdCollection) so that non-ExpId symbols come first and then ExpIds sorted in the ascending order of suffix (nn of of the name of ExpId _xIdnn).
 java.util.Set subtreesContainingCall()
           
 void summarize()
          Compute fDefinedSyms showing symbols used in this subprogram ?? and print if dbgLevel >= 4.
 
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
hasCall
 

Field Detail

flowRoot

public final FlowRoot flowRoot

ioRoot

public final IoRoot ioRoot

symRoot

public final SymRoot symRoot

hirRoot

public final HirRoot hirRoot

flow

public Flow flow

fUsedGlobalSymCount

protected int fUsedGlobalSymCount

fPointVectorBitCount

protected int fPointVectorBitCount

fPointVectorWordCount

protected int fPointVectorWordCount

fExpVectorBitCount

protected int fExpVectorBitCount

fExpVectorWordCount

protected int fExpVectorWordCount

fDefVectorBitCount

protected int fDefVectorBitCount

fDefVectorWordCount

protected int fDefVectorWordCount

fBBlockVectorBitCount

protected int fBBlockVectorBitCount

fBBlockVectorWordCount

protected int fBBlockVectorWordCount

fSubpDefinition

protected SubpDefinition fSubpDefinition

fPrevBBlockInSearch

protected BBlock fPrevBBlockInSearch

fNodeCount

protected int fNodeCount

fFlowIrLink

protected IR[] fFlowIrLink

fFlowIrLinkSize

protected int fFlowIrLinkSize

fBBlockCount

protected int fBBlockCount

fUsedSymCount

protected int fUsedSymCount

fSymExpCount

protected int fSymExpCount

fDefRefCount

protected int fDefRefCount

fDefCount

protected int fDefCount

fEntryBBlock

protected BBlock fEntryBBlock

fAssignCount

protected int fAssignCount

fCallCount

protected int fCallCount

fExitBBlock

protected BBlock fExitBBlock

fBBlockTable

protected java.util.ArrayList fBBlockTable

fBBlockList

protected java.util.List fBBlockList

fListOfBBlocksFromEntry

protected java.util.List fListOfBBlocksFromEntry

fListOfBBlocksFromExit

protected java.util.List fListOfBBlocksFromExit

fUsedSymSet

protected java.util.Set fUsedSymSet

fSymIndexTable

protected FlowAnalSym[] fSymIndexTable

fDfoList

protected java.util.List fDfoList

fInverseDfoList

protected java.util.List fInverseDfoList

fExpIdNumber

protected int fExpIdNumber

fDefinedSyms

protected java.util.Set fDefinedSyms

fFlowAnalSymTable

protected FlowAnalSym[] fFlowAnalSymTable

fBBlockOfIR

protected BBlock[] fBBlockOfIR

fDefRefIndex

protected int[] fDefRefIndex

fDefIndex

protected int[] fDefIndex

fBBlockOfLabel

protected java.util.Map fBBlockOfLabel

fExpIdList

protected java.util.List fExpIdList

fMaximalCompoundVars

protected java.util.Set fMaximalCompoundVars

fGlobalSymsUsed

protected java.util.Set fGlobalSymsUsed

fDefUseList

protected DefUseList fDefUseList

fUseDefList

protected UseDefList fUseDefList

fDefUseExhaustiveList

protected DefUseList fDefUseExhaustiveList

fUseDefExhaustiveList

protected UseDefList fUseDefExhaustiveList

fDefNodeListOfSym

protected java.util.List[] fDefNodeListOfSym

fUseNodeListOfSym

protected java.util.List[] fUseNodeListOfSym

fHirAnalExtended

public boolean fHirAnalExtended

fSetRefReprTable

protected SetRefRepr[] fSetRefReprTable

fIrIndexMin

protected int fIrIndexMin

fIrIndexMax

protected int fIrIndexMax

fExpIdTable

protected ExpId[] fExpIdTable

fMaxIndexOfCopiedNode

public int fMaxIndexOfCopiedNode

fSubtreesCopied

public java.util.List fSubtreesCopied

fSetOfGlobalVariables

protected java.util.Set fSetOfGlobalVariables

fSetOfAddressTakenVariables

protected java.util.Set fSetOfAddressTakenVariables

fTempExpCorrespondence

protected java.util.Map fTempExpCorrespondence

fAlias

protected AliasAnal fAlias

fRecordAlias

protected RecordAlias fRecordAlias

fDefRefPoint

protected IR[] fDefRefPoint

fDefPoint

protected IR[] fDefPoint

hasCall

public boolean[] hasCall

hasCallInSubp

public boolean hasCallInSubp

hasUsePointer

public boolean[] hasUsePointer

hasStructUnion

public boolean[] hasStructUnion

hasPointerAssign

public boolean[] hasPointerAssign

fArrayOfSetRefReprList

protected SetRefReprList[] fArrayOfSetRefReprList

fDom

protected BBlockVector[] fDom

fPostDom

protected BBlockVector[] fPostDom

fDomList

protected java.util.List[] fDomList

fPostDomList

protected java.util.List[] fPostDomList

fSubtreesContainingCall

public java.util.Set fSubtreesContainingCall

fComputedFlag

protected int[] fComputedFlag

fDbgLevel

public final int fDbgLevel

fComplexity

protected int fComplexity

fNodeCountLim1

protected final int fNodeCountLim1
See Also:
Constant Field Values

fNodeCountLim2

protected final int fNodeCountLim2
See Also:
Constant Field Values

fSymCountLim1

protected final int fSymCountLim1
See Also:
Constant Field Values

fSymCountLim2

protected final int fSymCountLim2
See Also:
Constant Field Values

fFlowAdapter

protected FlowAdapter fFlowAdapter

fIteratorInitiated

public boolean fIteratorInitiated

fMultipleSetRef

public java.util.Map fMultipleSetRef

failed

protected boolean failed

fAflowSubpFlow

protected SubpFlow fAflowSubpFlow
Constructor Detail

SubpFlowImpl

public SubpFlowImpl(FlowRoot pFlowRoot,
                    SubpDefinition pSubpDefinition)

SubpFlowImpl

public SubpFlowImpl()
Method Detail

getEntryBBlock

public BBlock getEntryBBlock()
Description copied from interface: SubpFlow
Get the entry basic block. The entry BBlock is started by a statement having entry label (sually has block number 1.

Specified by:
getEntryBBlock in interface SubpFlow
Returns:
the entry BBlock

setEntryBBlock

public void setEntryBBlock(BBlock pBlock)
Specified by:
setEntryBBlock in interface SubpFlow

getExitBBlock

public BBlock getExitBBlock()
Specified by:
getExitBBlock in interface SubpFlow

setExitBBlock

public void setExitBBlock(BBlock pBlock)
Specified by:
setExitBBlock in interface SubpFlow

copyFlowAnalData

public void copyFlowAnalData(SubpFlow pSubpFlow)
Specified by:
copyFlowAnalData in interface SubpFlow

bblock

public BBlock bblock(LabeledStmt pLabeledStmt)
Description copied from interface: SubpFlow
Create new basic block corresponding to the HIR labeled statement pLabeledStmt.

Specified by:
bblock in interface SubpFlow

bblock

public BBlock bblock()
Description copied from interface: SubpFlow
Create dummy basic block. (see linkHirWithFlowForSubp)

Specified by:
bblock in interface SubpFlow

expVector

public ExpVector expVector()
Specified by:
expVector in interface SubpFlow

pointVector

public PointVector pointVector()
Specified by:
pointVector in interface SubpFlow

defVector

public DefVector defVector()
Specified by:
defVector in interface SubpFlow

resetFlowSymLinkForRecordedSym

public void resetFlowSymLinkForRecordedSym()
Description copied from interface: SubpFlow
linkLirWithDataFlowForSubp Reset links between flow information and LIR nodes, symbols, etc. Set index to each LIR node in the subprogram under analysis. Assign index number to symbols actually used in the current subprogram. Create basic blocks and make link between BBlock and LIR node and create FlowIrLink table showing the link to LIR node.

Specified by:
resetFlowSymLinkForRecordedSym in interface SubpFlow

resetFlowSymLink

public void resetFlowSymLink(SymTable pSymTable)
Description copied from interface: SubpFlow
resetFlowSymLink Reset all flow analysis information of symbols in pSymTable and its descendents. Symbols to be reset are those ones that are recorded as accessed symbols (getAccessedSyms()) in a subprogram, and so, this method is effective to reset the effect of previous flow analysis for a subprogram. For global symbols, use resetGlobalFlowSymLink().

Specified by:
resetFlowSymLink in interface SubpFlow

resetGlobalFlowSymLink

public void resetGlobalFlowSymLink()
Description copied from interface: SubpFlow
resetGlobalFlowSymLink Reset all flow analysis information of symbols that are contained in ancestor symbol table (symTableRoot, etc) without traversing its descendents.

Specified by:
resetGlobalFlowSymLink in interface SubpFlow

resetFlowSymLinkForTable

public void resetFlowSymLinkForTable(SymTable pSymTable)

getBBlock

public BBlock getBBlock(int pBlockNumber)
Description copied from interface: SubpFlow
getBBlock Get the basic block whose block number is pBlockNumber.

Specified by:
getBBlock in interface SubpFlow
Parameters:
pBlockNumber - block number of the basic block to be got.
Returns:
basic block that has pBlockNumber as its block number. If the BBlock having pBlocknumber is deleted (has IS_DELETED flag) then return null.

recordBBlock

public void recordBBlock(BBlock pBlock,
                         int pBlockNumber)
Specified by:
recordBBlock in interface SubpFlow

getIndexedSym

public FlowAnalSym getIndexedSym(int pSymIndex)
Specified by:
getIndexedSym in interface SubpFlow

recordSym

protected int recordSym(FlowAnalSym pSym)

getIndexedNode

public IR getIndexedNode(int pNodeIndex)
Specified by:
getIndexedNode in interface SubpFlow

getBBlockFromNodeIndex

public BBlock getBBlockFromNodeIndex(int pNodeIndex)
Specified by:
getBBlockFromNodeIndex in interface SubpFlow

getNumberOfBBlocks

public int getNumberOfBBlocks()
Specified by:
getNumberOfBBlocks in interface SubpFlow

getNumberOfNodes

public int getNumberOfNodes()
Specified by:
getNumberOfNodes in interface SubpFlow

setNumberOfNodes

public void setNumberOfNodes(int pCount)
Specified by:
setNumberOfNodes in interface SubpFlow

getSymExpCount

public int getSymExpCount()
Specified by:
getSymExpCount in interface SubpFlow

getUsedSymCount

public int getUsedSymCount()
Specified by:
getUsedSymCount in interface SubpFlow

generateExpIdName

public java.lang.String generateExpIdName()
Description copied from interface: SubpFlow
generateExpIdName Generate a name of expression identifier _xId1, _xId2, _xId3, ... using SymExpCount as trailing index. If a symbol having the name is not found in symTableCurrent, then it is returned, else if the name is ExpId, then it is reused after calling resetFlowAnalInf(). If the symbol other than ExpId is found, then SymExpCount is incremented and new name is generated. The SymExpCount is incremented when a new name is generated.

Specified by:
generateExpIdName in interface SubpFlow
Returns:
the name with SymExpCount as the trailing index.

getSubpDefinition

public SubpDefinition getSubpDefinition()
Specified by:
getSubpDefinition in interface SubpFlow

getSubpSym

public Subp getSubpSym()
Specified by:
getSubpSym in interface SubpFlow

getNumberOfDefUsedGlobalSymbols

public int getNumberOfDefUsedGlobalSymbols()
Specified by:
getNumberOfDefUsedGlobalSymbols in interface SubpFlow

getPointVectorBitCount

public int getPointVectorBitCount()
Specified by:
getPointVectorBitCount in interface SubpFlow

setPointVectorBitCount

public void setPointVectorBitCount(int pBitCount)
Specified by:
setPointVectorBitCount in interface SubpFlow

getPointVectorWordCount

public int getPointVectorWordCount()
Specified by:
getPointVectorWordCount in interface SubpFlow

getExpVectorBitCount

public int getExpVectorBitCount()
Specified by:
getExpVectorBitCount in interface SubpFlow

setExpVectorBitCount

public void setExpVectorBitCount(int pBitCount)
Specified by:
setExpVectorBitCount in interface SubpFlow

getExpVectorWordCount

public int getExpVectorWordCount()
Specified by:
getExpVectorWordCount in interface SubpFlow

getDefVectorBitCount

public int getDefVectorBitCount()
Specified by:
getDefVectorBitCount in interface SubpFlow

setDefVectorBitCount

public void setDefVectorBitCount(int pBitCount)
Specified by:
setDefVectorBitCount in interface SubpFlow

getDefVectorWordCount

public int getDefVectorWordCount()
Specified by:
getDefVectorWordCount in interface SubpFlow

getBBlockVectorBitCount

public int getBBlockVectorBitCount()
Specified by:
getBBlockVectorBitCount in interface SubpFlow

setBBlockVectorBitCount

public void setBBlockVectorBitCount(int pBitCount)
Specified by:
setBBlockVectorBitCount in interface SubpFlow

getBBlockVectorWordCount

public int getBBlockVectorWordCount()
Specified by:
getBBlockVectorWordCount in interface SubpFlow

setPrevBBlockInSearch

public void setPrevBBlockInSearch(BBlock pPrev)
Description copied from interface: SubpFlow
setPrevBBlockInSearch getPrevBBlockInSearch Methods used in linking basic blocks in depth first order, etc.

Specified by:
setPrevBBlockInSearch in interface SubpFlow
Parameters:
pPrev - previous BBlock from which this BBlock is to be linked.

getPrevBBlockInSearch

public BBlock getPrevBBlockInSearch()
Specified by:
getPrevBBlockInSearch in interface SubpFlow

getDefinedSyms

public java.util.Set getDefinedSyms()
Description copied from interface: SubpFlow
getDefinedSyms Set of all symbols whose value is set in this subprogram.

Specified by:
getDefinedSyms in interface SubpFlow

getUsedSyms

public java.util.Set getUsedSyms()
Description copied from interface: SubpFlow
getUsed Set of all symbols whose value is used in this subprogram.

Specified by:
getUsedSyms in interface SubpFlow

summarize

public void summarize()
Compute fDefinedSyms showing symbols used in this subprogram ?? and print if dbgLevel >= 4. (fDefinedSyms can be get from fUsedSymSet without recomputing.) ??

Specified by:
summarize in interface SubpFlow

cfgIterator

public java.util.Iterator cfgIterator()
cfgIterator Traverse basic blocks in CFG (control flow graph) in depth first order. Available methods: next(), hasNext().

Specified by:
cfgIterator in interface SubpFlow

cfgFromExitIterator

public java.util.Iterator cfgFromExitIterator()
Description copied from interface: SubpFlow
cfgFromExitIterator Traverse basic blocks in CFG (control flow graph) in inverse depth first order from the exit BBlock. Available methods: next(), hasNext().

Specified by:
cfgFromExitIterator in interface SubpFlow

pointVectorIterator

public PointVectorIterator pointVectorIterator(PointVector pPointVector)
Specified by:
pointVectorIterator in interface SubpFlow

defVectorIterator

public DefVectorIterator defVectorIterator(DefVector pDefVector)
Specified by:
defVectorIterator in interface SubpFlow

expVectorIterator

public ExpVectorIterator expVectorIterator(ExpVector pExpVector)
Specified by:
expVectorIterator in interface SubpFlow

bblockSubtreeIterator

public BBlockSubtreeIterator bblockSubtreeIterator(BBlock pBBlock)
Description copied from interface: SubpFlow
bblockSubtreeItrator Get iterator that traverse top subtrees of the basic block pBBlock. For HIR, all top subtrees are to be traversed. For LIR, all LIRTrees are to be traversed. IR tree should not be changed after instanciation of BBlockSubtreeIteratorImpl until all invocations of hasNext() and next() are finished. Traversed top-subtrees are LabeledStmt, AssignStmt, ExpStmt, ReturnStmt, IfStmt, LoopStmt, SwitchStmt Conditional expression in IfStmt and LoopStmt Case-selection expression in SwitchStmt Call subtree (irrespective of contained in ExpStmt or Exp)

Specified by:
bblockSubtreeIterator in interface SubpFlow

bblockStmtIterator

public BBlockStmtIterator bblockStmtIterator(BBlockHir pBBlock)
Description copied from interface: SubpFlow
bblockStmtIterator get iterator to traverse statements in the basic block pBBlock. IR tree should not be changed after instanciation of BBlockStmtIteratorImpl until all invocations of hasNext() and next() are finished.

Specified by:
bblockStmtIterator in interface SubpFlow

bblockNodeIterator

public BBlockNodeIterator bblockNodeIterator(BBlock pBBlock)
bblockNodeItrator Get iterator that traverse all nodes of the basic block pBBlock.

Specified by:
bblockNodeIterator in interface SubpFlow

getFlowAnalStateLevel

public int getFlowAnalStateLevel()
Specified by:
getFlowAnalStateLevel in interface SubpFlow

setFlowAnalStateLevel

public void setFlowAnalStateLevel(int pState)
Specified by:
setFlowAnalStateLevel in interface SubpFlow

getBBlockTable

public java.util.ArrayList getBBlockTable()
Description copied from interface: SubpFlow
Get BBlockTable of this subprogram. Use getBBlockList() instead of this method.

Specified by:
getBBlockTable in interface SubpFlow
Returns:
BBlockTable

getBBlockList

public java.util.List getBBlockList()
Returns the List of BBlocks in the flow excluding null and 0-numbered BBlock. (Moved from DataFlowImpl.) //##63

Specified by:
getBBlockList in interface SubpFlow
Returns:
the List of BBlocks in the flow.

getReachableBBlocks

public java.util.List getReachableBBlocks()
Description copied from interface: SubpFlow
Get list of BBlocks reachable from entry BBLock.

Specified by:
getReachableBBlocks in interface SubpFlow
Returns:
teh list of reachable BBlocks.

initiateControlFlowAnal

public void initiateControlFlowAnal(SubpDefinition pSubpDefinition,
                                    int pIndexMin,
                                    int pIndexMax)
Specified by:
initiateControlFlowAnal in interface SubpFlow

initiateDataFlowAnal

public void initiateDataFlowAnal(SubpDefinition pSubpDefinition)
Description copied from interface: SubpFlow
initiateDataFlowAnal Initiate bit vectors, and initiate fields in SetRefRepls, etc.

Specified by:
initiateDataFlowAnal in interface SubpFlow
Parameters:
pSubpDefinition - definition of subprogram to be analyzed.

getBBlock

public BBlock getBBlock(HIR pHir)
Specified by:
getBBlock in interface SubpFlow

setBBlock

public void setBBlock(HIR pHir,
                      BBlock pBBlock)
Specified by:
setBBlock in interface SubpFlow

getBBlock0

public BBlock getBBlock0(Label pLabel)
Specified by:
getBBlock0 in interface SubpFlow

getBBlockForLabel

public BBlock getBBlockForLabel(Label pLabel)
Specified by:
getBBlockForLabel in interface SubpFlow

setBBlock

public void setBBlock(Label pLabel,
                      BBlock pBBlock)
Specified by:
setBBlock in interface SubpFlow

getLinkedSubtreeOfExpId

public HIR getLinkedSubtreeOfExpId(ExpId pExpId)
Specified by:
getLinkedSubtreeOfExpId in interface SubpFlow

getDefUseList

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

getListOfDefUseList

public DefUseList getListOfDefUseList()

getDefUseExhaustiveList

public DefUseList getDefUseExhaustiveList()
Specified by:
getDefUseExhaustiveList in interface SubpFlow

getListOfDefUseExhaustiveList

public DefUseList getListOfDefUseExhaustiveList()

getDefNodeList

public java.util.List getDefNodeList(FlowAnalSym pSym)
Specified by:
getDefNodeList in interface SubpFlow

addDefNode

public void addDefNode(FlowAnalSym pSym,
                       IR pDefNode)

getUseDefList

public UseDefList getUseDefList()
Specified by:
getUseDefList in interface SubpFlow

getListOfUseDefList

public UseDefList getListOfUseDefList()

getUseDefExhaustiveList

public UseDefList getUseDefExhaustiveList()
Specified by:
getUseDefExhaustiveList in interface SubpFlow

getListOfUseDefExhaustiveList

public UseDefList getListOfUseDefExhaustiveList()

geUseNodeList

public java.util.List geUseNodeList(FlowAnalSym pSym)
Specified by:
geUseNodeList in interface SubpFlow

addUseNode

public void addUseNode(FlowAnalSym pSym,
                       IR pUseNode)

bblockVector

public BBlockVector bblockVector()

flowAnalSymVector

public FlowAnalSymVector flowAnalSymVector()
Specified by:
flowAnalSymVector in interface SubpFlow

setOfGlobalVariables

public java.util.Set setOfGlobalVariables()
Specified by:
setOfGlobalVariables in interface SubpFlow

setOfAddressTakenVariables

public java.util.Set setOfAddressTakenVariables()
Specified by:
setOfAddressTakenVariables in interface SubpFlow

clearControlFlow

public void clearControlFlow()
Description copied from interface: SubpFlow
Clear all control/data flow analysis information.

Specified by:
clearControlFlow in interface SubpFlow

clearDataFlow

public void clearDataFlow()
Description copied from interface: SubpFlow
Clear data flow information. Before calling clearDataFlow, clearControlFlow should be called. clearDataFlow may be called after CFG creation (after flow.controlFlowAnal(SubpFlow)) in which case, CFG information is not cleared.

Specified by:
clearDataFlow in interface SubpFlow

resetControlAndDataFlowInformation

public void resetControlAndDataFlowInformation()
Description copied from interface: SubpFlow
Clear all control/data flow analysis information after executing setIndexNumberTOAllNodes.

Specified by:
resetControlAndDataFlowInformation in interface SubpFlow

resetExpId

public void resetExpId()

computeSetOfGlobalVariables

public java.util.Set computeSetOfGlobalVariables()
computeSetOfGlobalVariables Compute the set of global variables and record it in fSetOfGlobalVariables.

Specified by:
computeSetOfGlobalVariables in interface SubpFlow
Returns:
the set of global variables.

computeSetOfAddressTakenVariables

public java.util.Set computeSetOfAddressTakenVariables()
computeSetOfAddressTakenVariables Compute the set of variables whose address is taken (e.g. (addr (var )), (addr (subs (var ) ... ) ) for this subprogram definition.

Specified by:
computeSetOfAddressTakenVariables in interface SubpFlow

computeSetOfAddressTakenVariables

public void computeSetOfAddressTakenVariables(HIR pHir,
                                              java.util.Set pSet,
                                              boolean pAddrOperand)
computeSetOfAddressTakenVariables Compute the set of variables whose address is taken (e.g. (addr (var )), (addr (subs (var ) ... ) ) within the given HIR subtree.

Parameters:
pHir - HIR subtree to be computed.
pSet - Set in which variables are recorded.
pAddrOperand - true if address is to be taken, false otherwise.

setRestructureFlag

public void setRestructureFlag()
Specified by:
setRestructureFlag in interface SubpFlow

getRestructureFlag

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

setRecordAlias

public void setRecordAlias(RecordAlias pRecordAlias)
Description copied from interface: SubpFlow
Record a RecordAlias instance in order to indicate that alias is considered in data flow analysis. If pRecordAlias is not null, alias is considered. If pRecordAlias is null, alias is not considered.

Specified by:
setRecordAlias in interface SubpFlow
Parameters:
pRecordAlias - is an instance of RecordAlias keeping the the result of alias analysis for this subprogram.

getRecordAlias

public RecordAlias getRecordAlias()
Description copied from interface: SubpFlow
If returned value is not null, then alias is considered in data flow analysis. If it is null, then alias is not considered. The returned value is used to get alias information for data flow analysis.

Specified by:
getRecordAlias in interface SubpFlow
Returns:
RecordAlias instance set by setRecordAlias method.

getSetRefReprOfIR

public SetRefRepr getSetRefReprOfIR(IR pIR)
Specified by:
getSetRefReprOfIR in interface SubpFlow

setSetRefReprOfIR

public void setSetRefReprOfIR(SetRefRepr pSetRefRepr,
                              IR pIR)
Specified by:
setSetRefReprOfIR in interface SubpFlow

correlateBBlockAndIR

public void correlateBBlockAndIR()

allocateBBlockOfIR

public void allocateBBlockOfIR()

getBBlockOfIR

public BBlock getBBlockOfIR(int pIndex)
Specified by:
getBBlockOfIR in interface SubpFlow

setBBlockOfIR

public void setBBlockOfIR(BBlock pBBlock,
                          int pIndex)

getIrIndexMin

public int getIrIndexMin()
Specified by:
getIrIndexMin in interface SubpFlow

getIrIndexMax

public int getIrIndexMax()
Specified by:
getIrIndexMax in interface SubpFlow

getDefCount

public int getDefCount()
Specified by:
getDefCount in interface SubpFlow

getExpId

public ExpId getExpId(IR pIr)
Specified by:
getExpId in interface SubpFlow

getExpId

public ExpId getExpId(IR pIr,
                      int pIndex)
Specified by:
getExpId in interface SubpFlow

setExpId

public void setExpId(IR pIr,
                     ExpId pExpId)
Specified by:
setExpId in interface SubpFlow

getRefPoint

public IR getRefPoint(int pIndex)
Get IR node from ref-index

Specified by:
getRefPoint in interface SubpFlow
Parameters:
pIndex - ref index (fSubpFlow.fRefIndex[nodeIndex])
Returns:
the corresponding node.

getDefPoint

public IR getDefPoint(int pIndex)
Get IR node from def-index

Specified by:
getDefPoint in interface SubpFlow
Parameters:
pIndex - def index (fSubpFlow.fDefIndex[nodeIndex])
Returns:
the corresponding node.

getDefIndex

public int getDefIndex(int pNodeIndex)
Description copied from interface: SubpFlow
Get def-index from node index.

Specified by:
getDefIndex in interface SubpFlow
Parameters:
pNodeIndex - IR node index.
Returns:
def-index

recordDefRefPoint

public int recordDefRefPoint(IR pIR)
Specified by:
recordDefRefPoint in interface SubpFlow

recordDefPoint

public int recordDefPoint(IR pIR)
Specified by:
recordDefPoint in interface SubpFlow

getAssignCount

public int getAssignCount()
Specified by:
getAssignCount in interface SubpFlow

getCallCount

public int getCallCount()
Specified by:
getCallCount in interface SubpFlow

computeBBlockSetRefReprs

public void computeBBlockSetRefReprs()
Specified by:
computeBBlockSetRefReprs in interface SubpFlow

getSetRefReprList

public SetRefReprList getSetRefReprList(BBlock pBBlock)
Specified by:
getSetRefReprList in interface SubpFlow

setSetRefReprList

public void setSetRefReprList(BBlock pBBlock,
                              SetRefReprList pSetRefReprList)
Specified by:
setSetRefReprList in interface SubpFlow

subtreesContainingCall

public java.util.Set subtreesContainingCall()
Specified by:
subtreesContainingCall in interface SubpFlow

setExpOfTemp

public void setExpOfTemp(Var pTempVar,
                         Exp pExp)
Description copied from interface: SubpFlow
Record pExp as the expression represented by the temporal variable pTempVar.

Specified by:
setExpOfTemp in interface SubpFlow
Parameters:
pTempVar - variable introduced to represent an expression (in process of optimization, etc.).
pExp -

getExpOfTemp

public Exp getExpOfTemp(Var pTempVar)
Description copied from interface: SubpFlow
Get the expression represented by the temporal variable pTempVar.

Specified by:
getExpOfTemp in interface SubpFlow
Parameters:
pTempVar - variable introduced to represent an expression (in process of optimization, etc.).
Returns:
the expression represented by the temporal variable.

getListOfBBlocksFromEntry

public java.util.List getListOfBBlocksFromEntry()
Specified by:
getListOfBBlocksFromEntry in interface SubpFlow

getListOfBBlocksFromExit

public java.util.List getListOfBBlocksFromExit()
Specified by:
getListOfBBlocksFromExit in interface SubpFlow

getFlowRoot

public FlowRoot getFlowRoot()
Specified by:
getFlowRoot in interface SubpFlow

isComputed

public boolean isComputed(int pItemIndex)
Description copied from interface: SubpFlow
Test if a control/data flow item is already computed or not. Control flow items are reset by initiateControlFlowAnal, data flow items are reset by initiateDataFlowAnal of SubpFlow.

Specified by:
isComputed in interface SubpFlow
Parameters:
pItemIndex - item index CF_INDEXED .. DF_DEFUSELIST.
Returns:
true if the item specified by pItemIndex is already computed.

setComputedFlag

public void setComputedFlag(int pItemIndex)
Description copied from interface: SubpFlow
Set the control/data flow item to be computed as true. The result can be seen by isComputed.

Specified by:
setComputedFlag in interface SubpFlow
Parameters:
pItemIndex - item index CF_INDEXED .. DF_DEFUSELIST.

resetComputedFlag

public void resetComputedFlag(int pItemIndex)
Description copied from interface: SubpFlow
Reset computed flag for all items whose item numbers are greater or equal to pItemIndex.

Specified by:
resetComputedFlag in interface SubpFlow
Parameters:
pItemIndex -

setUnderComputation

public void setUnderComputation(int pItemIndex)
Description copied from interface: SubpFlow
Set computed flag for the item indicated by pItemIndex.

Specified by:
setUnderComputation in interface SubpFlow
Parameters:
pItemIndex -

isComputedOrUnderComputation

public boolean isComputedOrUnderComputation(int pItemIndex)
Specified by:
isComputedOrUnderComputation in interface SubpFlow

printComputedFlag

void printComputedFlag()

getExpIdList

public java.util.List getExpIdList()
Specified by:
getExpIdList in interface SubpFlow

printExpIdAndIrCorrespondence

public void printExpIdAndIrCorrespondence()
Specified by:
printExpIdAndIrCorrespondence in interface SubpFlow

getComplexityLevel

public int getComplexityLevel()
Description copied from interface: SubpFlow
Get the complexity level of this subprogram. 1: simple. Do full analysis. 2: medium. Alias analysis is simplified. 3: complex. Alias analysis and data flow analysis are simplified.

Specified by:
getComplexityLevel in interface SubpFlow
Returns:
the complexity level.

hasCallUnder

public boolean hasCallUnder(IR pIR)
Returns true if the given IR node has as its decendant a call node.

Specified by:
hasCallUnder in interface SubpFlow

getFlowAdapter

public FlowAdapter getFlowAdapter()
Specified by:
getFlowAdapter in interface SubpFlow

changeListOfFlowBBlocksToListOfAflowBBlocks

public java.util.List changeListOfFlowBBlocksToListOfAflowBBlocks(java.util.List pListOfFlowBBlocks)
Specified by:
changeListOfFlowBBlocksToListOfAflowBBlocks in interface SubpFlow

getMaximalCompoundVars

public java.util.Set getMaximalCompoundVars()
Description copied from interface: SubpFlow
Get the set of maximal compound variables. A maximal compound variable is either subscripted variable, maximal struct/union element whose parent is not QuarifiedExp, maximal pointer qualification whose parent is not PpointedExp. This set is computed when ExpIds are allocated.

Specified by:
getMaximalCompoundVars in interface SubpFlow
Returns:
the set of maximal compound variable expressions.

getFlowAnalSymTable

public FlowAnalSym[] getFlowAnalSymTable()
Specified by:
getFlowAnalSymTable in interface SubpFlow

getDominators

public BBlockVector getDominators(BBlock pBBlock)
Description copied from interface: SubpFlow
Get BBlockVector representing dominators of pBBlock. As for immediate dominators, see getImmediateDominator() of BBlock interface.

Specified by:
getDominators in interface SubpFlow
Parameters:
pBBlock - Basic block.
Returns:
BBlockVector representing dominators of pBBlock.

getPostDominators

public BBlockVector getPostDominators(BBlock pBBlock)
Description copied from interface: SubpFlow
Get BBlockVector representing post dominators of pBBlock. As for immediate post dominators, see getImmediateDominator() of BBlock interface.

Specified by:
getPostDominators in interface SubpFlow
Parameters:
pBBlock - Basic block.
Returns:
BBlockVector representing post dominators of pBBlock.

getDominatorList

public java.util.List getDominatorList(BBlock pBBlock)
Description copied from interface: SubpFlow
Get the list of dominators of pBBlock.

Specified by:
getDominatorList in interface SubpFlow
Parameters:
pBBlock - Basic block.
Returns:
the list representing dominators of pBBlock.

getPostDominatorList

public java.util.List getPostDominatorList(BBlock pBBlock)
Description copied from interface: SubpFlow
Get the list of post dominators of pBBlock.

Specified by:
getPostDominatorList in interface SubpFlow
Parameters:
pBBlock - Basic block.
Returns:
the list representing post dominators of pBBlock.

getAflowSubpFlow

public SubpFlow getAflowSubpFlow(FlowResults pFlowResults)

sortExpIdCollection

public java.util.List sortExpIdCollection(java.util.Collection pExpIdCollection)
Sort the list or set of FLowAnalSyms (pExpIdCollection) so that non-ExpId symbols come first and then ExpIds sorted in the ascending order of suffix (nn of of the name of ExpId _xIdnn).

Specified by:
sortExpIdCollection in interface SubpFlow
Parameters:
pExpIdCollection - list or set of FlowAnalSyms.
Returns:
the sorted list of FlowAnalSyms.

isFailed

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