coins.flow
クラス FlowUtil

java.lang.Object
  |
  +--coins.flow.FlowUtil

public class FlowUtil
extends java.lang.Object

Collection of utility methods. Many of these methods simply wrap the difference in interface/behavior of HIR and LIR.


コンストラクタの概要
FlowUtil()
           
 
メソッドの概要
static java.util.List bfSearch(BBlock pEntry, BBlock pExit, boolean pForward)
          Breadth first search.
static FlowAnalSym derefedFlowAnalSym(IR pIR)
           
static FlowAnalSym flowAnalSym(IR pIR)
           
static HIR getAncestorAssign(HIR pHir)
           
static IR getChild1(IR pIR)
          Returns the first child.
static IR getChild2(IR pIR)
          Returns the second child.
static int getChildCount(IR pIR)
          Returns the number of children of the given node.
static HIR getComplexNode(HIR pNode)
           
static HIR getQualVarNode(HIR pNode)
           
static FlowAnalSymVector globalSymVector(SubpFlow pSubpFlow)
          Returns a FlowAnalSymVector that corresponds to the global symbols that appear in that given SubpFlow object.
static HirIterator hirIterator(HIR pSubtree)
          Iterator that iterates HIR nodes from top to left to right in depth first order.
static boolean isAssignLHS(HIR pHir)
          Return true if pHir is a left hand side variable of AssignStmt.
static boolean isCall(IR pIR)
           
static boolean isCommonQUAL(HIR pNode)
           
static boolean isComplexElemNode(HIR pNode)
           
static boolean isComplexNode(HIR pNode)
           
static boolean isComplexQUAL(HIR pNode)
           
static boolean isConstNode(IR pIR)
           
static boolean isDefSymNode(IR pIR)
           
static boolean isLvalue(IR pIR)
           
static boolean isUnder(IR pAncestor, IR pDescendant)
           
static boolean IsVarSyms(Sym pSym)
           
static boolean IsVarSymType(Type pType)
           
static boolean isVolatile(IR pIR)
           
static boolean mayBeExternalAddress(IR pIR)
          Returns true if the given IR node has as its decendant a call node.
static NodeIterator nodeIterator(IR pIR)
          Iterator that iterates IR nodes from top to left to right in depth first order.
static NodeListIterator nodeListIterator(IR pIR)
          Iterator that iterates IR nodes from top to left to right in depth first order.
static NodeListIterator nodeListIterator(IR pIR, boolean pFromTop, boolean pFromLeft)
          Iterator that iterates IR nodes.
static boolean notDereferenced(IR pIR)
           
static boolean readsFromIndefiniteAddress(IR pIR)
           
static boolean shouldAssignFlowExpId(IR pIR)
          Returns true if the given node should be assigned a FlowExpId.
static java.util.List sortSetOfNodesByIndex(java.util.Set pSetOfNodes, int pMaxIndex)
          Sort HIR nodes in pSetOfNodes by node index and return the list of nodes sorted in ascending order.
static FlowAnalSymVector staticSymVector(SubpFlow pSubpFlow)
           
static java.lang.String toString(HIR pHIR)
           
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

FlowUtil

public FlowUtil()
メソッドの詳細

getChild1

public static IR getChild1(IR pIR)
Returns the first child.


getChild2

public static IR getChild2(IR pIR)
Returns the second child.


flowAnalSym

public static FlowAnalSym flowAnalSym(IR pIR)

derefedFlowAnalSym

public static FlowAnalSym derefedFlowAnalSym(IR pIR)

getChildCount

public static int getChildCount(IR pIR)
Returns the number of children of the given node.


isConstNode

public static boolean isConstNode(IR pIR)

globalSymVector

public static FlowAnalSymVector globalSymVector(SubpFlow pSubpFlow)
Returns a FlowAnalSymVector that corresponds to the global symbols that appear in that given SubpFlow object.


staticSymVector

public static FlowAnalSymVector staticSymVector(SubpFlow pSubpFlow)

bfSearch

public static java.util.List bfSearch(BBlock pEntry,
                                      BBlock pExit,
                                      boolean pForward)
Breadth first search. Returns the List of BBlocks in the breadth-first order from pEntry up to pExit. BBlocks unreachable from pEntry or strictly dominated by pExit (when considering the dominator tree rooted at pEntry) will not be included in the returned list. If pExit is not reachable from pEntry, then simply all the BBlocks reachable from pEntry are searched.

パラメータ:
pForward - if true, the search is in the forward direction of the control flow, otherwise, the direction is opposite of that of the control flow.

hirIterator

public static HirIterator hirIterator(HIR pSubtree)
Iterator that iterates HIR nodes from top to left to right in depth first order.


nodeIterator

public static NodeIterator nodeIterator(IR pIR)
Iterator that iterates IR nodes from top to left to right in depth first order.


nodeListIterator

public static NodeListIterator nodeListIterator(IR pIR)
Iterator that iterates IR nodes from top to left to right in depth first order.


nodeListIterator

public static NodeListIterator nodeListIterator(IR pIR,
                                                boolean pFromTop,
                                                boolean pFromLeft)
Iterator that iterates IR nodes. If pFromTop is true, it iterates from top to bottom. If pFromLeft is true, it iterates from left to right. In either case, the order is depth-first (or reverse depth-first, for that matter).


isUnder

public static boolean isUnder(IR pAncestor,
                              IR pDescendant)

toString

public static java.lang.String toString(HIR pHIR)

shouldAssignFlowExpId

public static boolean shouldAssignFlowExpId(IR pIR)
Returns true if the given node should be assigned a FlowExpId.


isDefSymNode

public static boolean isDefSymNode(IR pIR)

isCall

public static boolean isCall(IR pIR)

isLvalue

public static boolean isLvalue(IR pIR)

notDereferenced

public static boolean notDereferenced(IR pIR)

mayBeExternalAddress

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


readsFromIndefiniteAddress

public static boolean readsFromIndefiniteAddress(IR pIR)

isVolatile

public static boolean isVolatile(IR pIR)

IsVarSyms

public static boolean IsVarSyms(Sym pSym)

getQualVarNode

public static HIR getQualVarNode(HIR pNode)

isCommonQUAL

public static boolean isCommonQUAL(HIR pNode)

isComplexQUAL

public static boolean isComplexQUAL(HIR pNode)

getComplexNode

public static HIR getComplexNode(HIR pNode)

isComplexNode

public static boolean isComplexNode(HIR pNode)

isComplexElemNode

public static boolean isComplexElemNode(HIR pNode)

IsVarSymType

public static boolean IsVarSymType(Type pType)

sortSetOfNodesByIndex

public static java.util.List sortSetOfNodesByIndex(java.util.Set pSetOfNodes,
                                                   int pMaxIndex)
Sort HIR nodes in pSetOfNodes by node index and return the list of nodes sorted in ascending order.

パラメータ:
pSetOfNodes - set of HIR nodes to be sorted.
pMaxIndex - maximum value of node indexes.
戻り値:
the list of sorted nodes.

isAssignLHS

public static boolean isAssignLHS(HIR pHir)
Return true if pHir is a left hand side variable of AssignStmt. A left hand side variable is an instance of either Var or node with SUBS, QUAL, ARROW operator.

パラメータ:
pHir - HIR subtree to be examined.
戻り値:
true if LHS, false otherwise.

getAncestorAssign

public static HIR getAncestorAssign(HIR pHir)