Class MutableCFG<X, T extends IBasicBlock<X>>
java.lang.Object
com.ibm.wala.util.graph.AbstractGraph<T>
com.ibm.wala.util.graph.AbstractNumberedGraph<T>
com.ibm.wala.util.graph.impl.SparseNumberedGraph<T>
com.ibm.wala.cfg.exc.intra.MutableCFG<X,T>
- All Implemented Interfaces:
ControlFlowGraph<X,T>, MinimalCFG<T>, EdgeManager<T>, Graph<T>, NodeManager<T>, NumberedEdgeManager<T>, NumberedGraph<T>, NumberedNodeManager<T>, Iterable<T>
public class MutableCFG<X, T extends IBasicBlock<X>>
extends SparseNumberedGraph<T>
implements ControlFlowGraph<X,T>
A modifiable control flow graph.
- Author:
- Juergen Graf <graf@kit.edu>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <I, T extends IBasicBlock<I>>
MutableCFG<I, T> copyFrom(ControlFlowGraph<I, T> cfg) entry()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.X[]The order of blocks returned should be arbitrary but deterministic.The order of blocks returned should be arbitrary but deterministic.intgetProgramCounter(int index) TODO: move this into IR?Methods inherited from class SparseNumberedGraph
getEdgeManager, getNodeManagerModifier and TypeMethodDescriptionprotected NumberedEdgeManager<T> protected NumberedNodeManager<T> Methods inherited from class AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodesModifier and TypeMethodDescriptionintgetNode(int number) intgetPredNodeNumbers(T node) getSuccNodeNumbers(T node) Methods inherited from class AbstractGraph
addEdge, addNode, containsNode, edgeString, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, nodeString, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, stream, toStringModifier and TypeMethodDescriptionvoidvoidadd a node to this graphbooleancontainsNode(T n) protected StringedgeString(T from, T to) intintReturn the number ofimmediate predecessornodes of ngetPredNodes(T n) Return anIteratorover the immediate predecessor nodes of nintReturn the number ofimmediate successornodes of this Node in the GraphgetSuccNodes(T n) Return an Iterator over the immediate successor nodes of nbooleaniterator()protected StringnodeString(T n, boolean forEdge) voidremoveAllIncidentEdges(T node) voidremoveEdge(T src, T dst) voidremoveIncomingEdges(T node) voidremoveNode(T n) remove a node from this graphvoidremove a node and all its incident edgesvoidremoveOutgoingEdges(T node) stream()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
copyFrom
-
entry
Description copied from interface:MinimalCFGReturn the entry basic block in the CFG- Specified by:
entryin interfaceMinimalCFG<X>
-
exit
- Specified by:
exitin interfaceMinimalCFG<X>- Returns:
- the synthetic exit block for the cfg
-
getCatchBlocks
- Specified by:
getCatchBlocksin interfaceControlFlowGraph<X, T extends IBasicBlock<X>>- Returns:
- the indices of the catch blocks, as a bit vector
-
getBlockForInstruction
- Specified by:
getBlockForInstructionin interfaceControlFlowGraph<X, T extends IBasicBlock<X>>- Parameters:
index- an instruction index- Returns:
- the basic block which contains this instruction.
-
getInstructions
- Specified by:
getInstructionsin interfaceControlFlowGraph<X, T extends IBasicBlock<X>>- 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<X, T extends IBasicBlock<X>>- Parameters:
index- an instruction index- Returns:
- the program counter (bytecode index) corresponding to that instruction
-
getMethod
- Specified by:
getMethodin interfaceControlFlowGraph<X, T extends IBasicBlock<X>>- Returns:
- the Method this CFG represents
-
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<X>- Returns:
- the basic blocks which may be reached from b via exceptional control flow
-
getNormalSuccessors
Description copied from interface:MinimalCFGThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getNormalSuccessorsin interfaceMinimalCFG<X>- Returns:
- the basic blocks which may be reached from b via normal control flow
-
getExceptionalPredecessors
Description copied from interface:MinimalCFGThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getExceptionalPredecessorsin interfaceMinimalCFG<X>- Returns:
- the basic blocks from which b may be reached via exceptional control flow
-
getNormalPredecessors
Description copied from interface:MinimalCFGThe order of blocks returned should be arbitrary but deterministic.- Specified by:
getNormalPredecessorsin interfaceMinimalCFG<X>- Returns:
- the basic blocks from which b may be reached via normal control flow
-