com.ibm.wala.cfg
Interface ControlFlowGraph<I,T extends IBasicBlock<I>>

All Superinterfaces:
EdgeManager<T>, Graph<T>, java.lang.Iterable<T>, NodeManager<T>, NumberedEdgeManager<T>, NumberedGraph<T>, NumberedNodeManager<T>
All Known Implementing Classes:
AbstractCFG, AstInducedCFG, AstTranslator.AstCFG, DelegatingCFG, ExplodedControlFlowGraph, InducedCFG, JSInducedCFG, PrunedCFG, ShrikeCFG, SSACFG

public interface ControlFlowGraph<I,T extends IBasicBlock<I>>
extends NumberedGraph<T>

An interface that is common to the Shrike and SSA CFG implementations.


Method Summary
 T entry()
          Return the entry basic block in the CFG
 T exit()
           
 T getBlockForInstruction(int index)
           
 BitVector getCatchBlocks()
           
 java.util.Collection<T> getExceptionalPredecessors(T b)
          The order of blocks returned should be arbitrary but deterministic.
 java.util.List<T> getExceptionalSuccessors(T b)
          The order of blocks returned must indicate the exception-handling scope.
 I[] getInstructions()
           
 IMethod getMethod()
           
 java.util.Collection<T> getNormalPredecessors(T b)
          The order of blocks returned should be arbitrary but deterministic.
 java.util.Collection<T> getNormalSuccessors(T b)
          The order of blocks returned should be arbitrary but deterministic.
 int getProgramCounter(int index)
          TODO: move this into IR?
 
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
 
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode
 
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.NumberedNodeManager
getMaxNumber, getNode, getNumber, iterateNodes
 
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.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
 

Method Detail

entry

T entry()
Return the entry basic block in the CFG


exit

T exit()
Returns:
the synthetic exit block for the cfg

getCatchBlocks

BitVector getCatchBlocks()
Returns:
the indices of the catch blocks, as a bit vector

getBlockForInstruction

T getBlockForInstruction(int index)
Parameters:
index - an instruction index
Returns:
the basic block which contains this instruction.

getInstructions

I[] getInstructions()
Returns:
the instructions of this CFG, as an array.

getProgramCounter

int getProgramCounter(int index)
TODO: move this into IR?

Parameters:
index - an instruction index
Returns:
the program counter (bytecode index) corresponding to that instruction

getMethod

IMethod getMethod()
Returns:
the Method this CFG represents

getExceptionalSuccessors

java.util.List<T> getExceptionalSuccessors(T b)
The 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.

Returns:
the basic blocks which may be reached from b via exceptional control flow

getNormalSuccessors

java.util.Collection<T> getNormalSuccessors(T b)
The order of blocks returned should be arbitrary but deterministic.

Returns:
the basic blocks which may be reached from b via normal control flow

getExceptionalPredecessors

java.util.Collection<T> getExceptionalPredecessors(T b)
The order of blocks returned should be arbitrary but deterministic.

Returns:
the basic blocks from which b may be reached via exceptional control flow

getNormalPredecessors

java.util.Collection<T> getNormalPredecessors(T b)
The order of blocks returned should be arbitrary but deterministic.

Returns:
the basic blocks from which b may be reached via normal control flow