Class ExplodedControlFlowGraph
java.lang.Object
com.ibm.wala.ssa.analysis.ExplodedControlFlowGraph
- All Implemented Interfaces:
ControlFlowGraph<SSAInstruction, IExplodedBasicBlock>, MinimalCFG<IExplodedBasicBlock>, EdgeManager<IExplodedBasicBlock>, Graph<IExplodedBasicBlock>, NodeManager<IExplodedBasicBlock>, NumberedEdgeManager<IExplodedBasicBlock>, NumberedGraph<IExplodedBasicBlock>, NumberedNodeManager<IExplodedBasicBlock>, Iterable<IExplodedBasicBlock>
public class ExplodedControlFlowGraph
extends Object
implements ControlFlowGraph<SSAInstruction, IExplodedBasicBlock>
A view of a control flow graph where each basic block corresponds to exactly one SSA instruction
index.
Prototype: Not terribly efficient.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEdge(IExplodedBasicBlock src, IExplodedBasicBlock dst) voidadd a node to this graphbooleanentry()Return the entry basic block in the CFGexit()getBlockForInstruction(int index) The order of blocks returned should be arbitrary but deterministic.The order of blocks returned must indicate the exception-handling scope.getIR()intgetNode(int number) The order of blocks returned should be arbitrary but deterministic.The order of blocks returned should be arbitrary but deterministic.intintintReturn the number ofimmediate predecessornodes of nReturn anIteratorover the immediate predecessor nodes of nintgetProgramCounter(int index) TODO: move this into IR?intReturn the number ofimmediate successornodes of this Node in the GraphReturn an Iterator over the immediate successor nodes of nbooleanhasEdge(IExplodedBasicBlock src, IExplodedBasicBlock dst) iterator()static ExplodedControlFlowGraphvoidvoidremoveEdge(IExplodedBasicBlock src, IExplodedBasicBlock dst) voidvoidremove a node from this graphvoidremove a node and all its incident edgesvoidstream()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
make
-
entry
Description copied from interface:MinimalCFGReturn the entry basic block in the CFG- Specified by:
entryin interfaceMinimalCFG<IExplodedBasicBlock>
-
exit
- Specified by:
exitin interfaceMinimalCFG<IExplodedBasicBlock>- Returns:
- the synthetic exit block for the cfg
-
getBlockForInstruction
- Specified by:
getBlockForInstructionin interfaceControlFlowGraph<SSAInstruction, IExplodedBasicBlock>- Parameters:
index- an instruction index- Returns:
- the basic block which contains this instruction.
-
getCatchBlocks
- Specified by:
getCatchBlocksin interfaceControlFlowGraph<SSAInstruction, IExplodedBasicBlock>- Returns:
- the indices of the catch blocks, as a bit vector
-
getExceptionalPredecessors
Description copied from interface:MinimalCFGThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getExceptionalPredecessorsin interfaceMinimalCFG<IExplodedBasicBlock>- Returns:
- the basic blocks from which b may be reached via exceptional control flow
-
getExceptionalSuccessors
Description copied from interface:MinimalCFGThe 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 interfaceMinimalCFG<IExplodedBasicBlock>- Returns:
- the basic blocks which may be reached from b via exceptional control flow
-
getInstructions
- Specified by:
getInstructionsin interfaceControlFlowGraph<SSAInstruction, IExplodedBasicBlock>- Returns:
- the instructions of this CFG, as an array.
-
getMethod
- Specified by:
getMethodin interfaceControlFlowGraph<SSAInstruction, IExplodedBasicBlock>- Returns:
- the Method this CFG represents
- Throws:
UnimplementedError
-
getNormalPredecessors
Description copied from interface:MinimalCFGThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getNormalPredecessorsin interfaceMinimalCFG<IExplodedBasicBlock>- Returns:
- the basic blocks from which b may be reached via normal control flow
-
getNormalSuccessors
Description copied from interface:MinimalCFGThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getNormalSuccessorsin interfaceMinimalCFG<IExplodedBasicBlock>- Returns:
- the basic blocks which may be reached from b via normal control flow
-
getProgramCounter
Description copied from interface:ControlFlowGraphTODO: move this into IR?- Specified by:
getProgramCounterin interfaceControlFlowGraph<SSAInstruction, IExplodedBasicBlock>- Parameters:
index- an instruction index- Returns:
- the program counter (bytecode index) corresponding to that instruction
- Throws:
UnimplementedError
-
removeNodeAndEdges
Description copied from interface:Graphremove a node and all its incident edges- Specified by:
removeNodeAndEdgesin interfaceGraph<IExplodedBasicBlock>- Throws:
UnsupportedOperationException- if the graph implementation does not allow removal
-
addNode
Description copied from interface:NodeManageradd a node to this graph- Specified by:
addNodein interfaceNodeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
containsNode
- Specified by:
containsNodein interfaceNodeManager<IExplodedBasicBlock>- Returns:
- true iff the graph contains the specified node
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodesin interfaceNodeManager<IExplodedBasicBlock>- Returns:
- the number of nodes in this graph
-
iterator
- Specified by:
iteratorin interfaceIterable<IExplodedBasicBlock>- Specified by:
iteratorin interfaceNodeManager<IExplodedBasicBlock>- Returns:
- an
Iteratorof the nodes in this graph
-
stream
- Specified by:
streamin interfaceNodeManager<IExplodedBasicBlock>- Returns:
- a
Streamof the nodes in this graph
-
removeNode
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
addEdge
public void addEdge(IExplodedBasicBlock src, IExplodedBasicBlock dst) throws UnsupportedOperationException - Specified by:
addEdgein interfaceEdgeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
getPredNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<IExplodedBasicBlock>- Returns:
- the number of immediate predecessors of n.
- Throws:
IllegalArgumentException
-
getPredNodes
public Iterator<IExplodedBasicBlock> getPredNodes(IExplodedBasicBlock bb) throws IllegalArgumentException Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of nThis method never returns
null.- Specified by:
getPredNodesin interfaceEdgeManager<IExplodedBasicBlock>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
-
getSuccNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceEdgeManager<IExplodedBasicBlock>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
UnimplementedError
-
getSuccNodes
Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<IExplodedBasicBlock>- Returns:
- an Iterator over the immediate successor nodes of n
- See Also:
-
hasEdge
- Specified by:
hasEdgein interfaceEdgeManager<IExplodedBasicBlock>- Throws:
UnimplementedError
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
removeEdge
public void removeEdge(IExplodedBasicBlock src, IExplodedBasicBlock dst) throws UnsupportedOperationException - Specified by:
removeEdgein interfaceEdgeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
removeIncomingEdges
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<IExplodedBasicBlock>- Throws:
UnsupportedOperationException
-
getMaxNumber
public int getMaxNumber()- Specified by:
getMaxNumberin interfaceNumberedNodeManager<IExplodedBasicBlock>
-
getNode
- Specified by:
getNodein interfaceNumberedNodeManager<IExplodedBasicBlock>
-
getNumber
- Specified by:
getNumberin interfaceNumberedNodeManager<IExplodedBasicBlock>- Throws:
IllegalArgumentException
-
iterateNodes
- Specified by:
iterateNodesin interfaceNumberedNodeManager<IExplodedBasicBlock>- Returns:
- iterator of nodes with the numbers in set s
- Throws:
UnimplementedError
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<IExplodedBasicBlock>- Returns:
- the numbers identifying the immediate predecessors of node
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<IExplodedBasicBlock>- Returns:
- the numbers identifying the immediate successors of node
- Throws:
UnimplementedError
-
toString
-
getIR
-