Package com.ibm.wala.cast.ir.cfg
Class DelegatingCFG<I,T extends IBasicBlock<I>>
- java.lang.Object
-
- com.ibm.wala.util.graph.AbstractGraph<T>
-
- com.ibm.wala.util.graph.AbstractNumberedGraph<T>
-
- com.ibm.wala.cast.ir.cfg.DelegatingCFG<I,T>
-
- All Implemented Interfaces:
ControlFlowGraph<I,T>,EdgeManager<T>,Graph<T>,NodeManager<T>,NumberedEdgeManager<T>,NumberedGraph<T>,NumberedNodeManager<T>,Iterable<T>
public class DelegatingCFG<I,T extends IBasicBlock<I>> extends AbstractNumberedGraph<T> implements ControlFlowGraph<I,T>
-
-
Field Summary
Fields Modifier and Type Field Description protected ControlFlowGraph<I,T>parent
-
Constructor Summary
Constructors Constructor Description DelegatingCFG(ControlFlowGraph<I,T> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tentry()Return the entry basic block in the CFGTexit()TgetBlockForInstruction(int index)BitVectorgetCatchBlocks()protected NumberedEdgeManager<T>getEdgeManager()Collection<T>getExceptionalPredecessors(T b)The order of blocks returned should be arbitrary but deterministic.List<T>getExceptionalSuccessors(T b)The order of blocks returned must indicate the exception-handling scope.I[]getInstructions()IMethodgetMethod()protected NumberedNodeManager<T>getNodeManager()Collection<T>getNormalPredecessors(T b)The order of blocks returned should be arbitrary but deterministic.Collection<T>getNormalSuccessors(T b)The order of blocks returned should be arbitrary but deterministic.intgetProgramCounter(int index)TODO: move this into IR?-
Methods inherited from class com.ibm.wala.util.graph.AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodes
-
Methods inherited from class com.ibm.wala.util.graph.AbstractGraph
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
-
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode
-
Methods inherited from interface com.ibm.wala.util.graph.NumberedEdgeManager
getPredNodeNumbers, getSuccNodeNumbers
-
Methods inherited from interface com.ibm.wala.util.graph.NumberedNodeManager
getMaxNumber, getNode, getNumber, iterateNodes
-
-
-
-
Field Detail
-
parent
protected final ControlFlowGraph<I,T extends IBasicBlock<I>> parent
-
-
Constructor Detail
-
DelegatingCFG
public DelegatingCFG(ControlFlowGraph<I,T> parent)
-
-
Method Detail
-
getNodeManager
protected NumberedNodeManager<T> getNodeManager()
- Specified by:
getNodeManagerin classAbstractNumberedGraph<T extends IBasicBlock<I>>- Returns:
- the object which manages nodes in the graph
-
getEdgeManager
protected NumberedEdgeManager<T> getEdgeManager()
- Specified by:
getEdgeManagerin classAbstractNumberedGraph<T extends IBasicBlock<I>>- Returns:
- the object which manages edges in the graph
-
entry
public T entry()
Description copied from interface:ControlFlowGraphReturn the entry basic block in the CFG- Specified by:
entryin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>
-
exit
public T exit()
- Specified by:
exitin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the synthetic exit block for the cfg
-
getCatchBlocks
public BitVector getCatchBlocks()
- Specified by:
getCatchBlocksin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the indices of the catch blocks, as a bit vector
-
getBlockForInstruction
public T getBlockForInstruction(int index)
- Specified by:
getBlockForInstructionin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Parameters:
index- an instruction index- Returns:
- the basic block which contains this instruction.
-
getInstructions
public I[] getInstructions()
- Specified by:
getInstructionsin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the instructions of this CFG, as an array.
-
getProgramCounter
public int getProgramCounter(int index)
Description copied from interface:ControlFlowGraphTODO: move this into IR?- Specified by:
getProgramCounterin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Parameters:
index- an instruction index- Returns:
- the program counter (bytecode index) corresponding to that instruction
-
getMethod
public IMethod getMethod()
- Specified by:
getMethodin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the Method this CFG represents
-
getExceptionalSuccessors
public List<T> getExceptionalSuccessors(T b)
Description copied from interface:ControlFlowGraphThe order of blocks returned must indicate the exception-handling scope. So the first block is the first candidate catch block, and so on. With this invariant one can compute the exceptional control flow for a given exception type.- Specified by:
getExceptionalSuccessorsin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the basic blocks which may be reached from b via exceptional control flow
-
getNormalSuccessors
public Collection<T> getNormalSuccessors(T b)
Description copied from interface:ControlFlowGraphThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getNormalSuccessorsin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the basic blocks which may be reached from b via normal control flow
-
getExceptionalPredecessors
public Collection<T> getExceptionalPredecessors(T b)
Description copied from interface:ControlFlowGraphThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getExceptionalPredecessorsin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the basic blocks from which b may be reached via exceptional control flow
-
getNormalPredecessors
public Collection<T> getNormalPredecessors(T b)
Description copied from interface:ControlFlowGraphThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getNormalPredecessorsin interfaceControlFlowGraph<I,T extends IBasicBlock<I>>- Returns:
- the basic blocks from which b may be reached via normal control flow
-
-