com.ibm.wala.cast.ir.cfg
Class PrunedCFG

java.lang.Object
  extended by com.ibm.wala.util.graph.AbstractGraph<T>
      extended by com.ibm.wala.util.graph.AbstractNumberedGraph<IBasicBlock>
          extended by com.ibm.wala.cast.ir.cfg.PrunedCFG
All Implemented Interfaces:
ControlFlowGraph, EdgeManager<IBasicBlock>, Graph<IBasicBlock>, NodeManager<IBasicBlock>, NumberedEdgeManager<IBasicBlock>, NumberedGraph<IBasicBlock>, NumberedNodeManager<IBasicBlock>, java.lang.Iterable<IBasicBlock>

public class PrunedCFG
extends AbstractNumberedGraph<IBasicBlock>
implements ControlFlowGraph


Nested Class Summary
static interface PrunedCFG.EdgeFilter
           
 
Constructor Summary
PrunedCFG(ControlFlowGraph cfg, PrunedCFG.EdgeFilter filter)
           
 
Method Summary
 IBasicBlock entry()
          Return the entry basic block in the CFG
 IBasicBlock exit()
           
 IBasicBlock getBlockForInstruction(int index)
           
 BitVector getCatchBlocks()
           
protected  EdgeManager<IBasicBlock> getEdgeManager()
           
 java.util.Collection<IBasicBlock> getExceptionalPredecessors(IBasicBlock N)
          The order of blocks returned should be arbitrary but deterministic.
 java.util.Collection<IBasicBlock> getExceptionalSuccessors(IBasicBlock N)
          The order of blocks returned should be arbitrary but deterministic.
 IInstruction[] getInstructions()
           
 IMethod getMethod()
           
protected  NodeManager<IBasicBlock> getNodeManager()
           
 java.util.Collection<IBasicBlock> getNormalPredecessors(IBasicBlock N)
          The order of blocks returned should be arbitrary but deterministic.
 java.util.Collection<IBasicBlock> getNormalSuccessors(IBasicBlock N)
          The order of blocks returned should be arbitrary but deterministic.
 int getProgramCounter(int index)
           
 
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.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
 

Constructor Detail

PrunedCFG

public PrunedCFG(ControlFlowGraph cfg,
                 PrunedCFG.EdgeFilter filter)
Method Detail

getNodeManager

protected NodeManager<IBasicBlock> getNodeManager()
Specified by:
getNodeManager in class AbstractGraph<IBasicBlock>
Returns:
the object which manages nodes in the graph

getEdgeManager

protected EdgeManager<IBasicBlock> getEdgeManager()
Specified by:
getEdgeManager in class AbstractGraph<IBasicBlock>
Returns:
the object which manages edges in the graph

getExceptionalSuccessors

public java.util.Collection<IBasicBlock> getExceptionalSuccessors(IBasicBlock N)
Description copied from interface: ControlFlowGraph
The order of blocks returned should be arbitrary but deterministic.

Specified by:
getExceptionalSuccessors in interface ControlFlowGraph
Returns:
the basic blocks which may be reached from b via exceptional control flow

getNormalSuccessors

public java.util.Collection<IBasicBlock> getNormalSuccessors(IBasicBlock N)
Description copied from interface: ControlFlowGraph
The order of blocks returned should be arbitrary but deterministic.

Specified by:
getNormalSuccessors in interface ControlFlowGraph
Returns:
the basic blocks which may be reached from b via normal control flow

getExceptionalPredecessors

public java.util.Collection<IBasicBlock> getExceptionalPredecessors(IBasicBlock N)
Description copied from interface: ControlFlowGraph
The order of blocks returned should be arbitrary but deterministic.

Specified by:
getExceptionalPredecessors in interface ControlFlowGraph
Returns:
the basic blocks from which b may be reached via exceptional control flow

getNormalPredecessors

public java.util.Collection<IBasicBlock> getNormalPredecessors(IBasicBlock N)
Description copied from interface: ControlFlowGraph
The order of blocks returned should be arbitrary but deterministic.

Specified by:
getNormalPredecessors in interface ControlFlowGraph
Returns:
the basic blocks from which b may be reached via normal control flow

entry

public IBasicBlock entry()
Description copied from interface: ControlFlowGraph
Return the entry basic block in the CFG

Specified by:
entry in interface ControlFlowGraph

exit

public IBasicBlock exit()
Specified by:
exit in interface ControlFlowGraph
Returns:
the synthetic exit block for the cfg

getBlockForInstruction

public IBasicBlock getBlockForInstruction(int index)
Specified by:
getBlockForInstruction in interface ControlFlowGraph
Parameters:
index - an instruction index
Returns:
the basic block which contains this instruction.

getInstructions

public IInstruction[] getInstructions()
Specified by:
getInstructions in interface ControlFlowGraph
Returns:
the instructions of this CFG, as an array.

getProgramCounter

public int getProgramCounter(int index)
Specified by:
getProgramCounter in interface ControlFlowGraph
Parameters:
index - an instruction index
Returns:
the program counter (bytecode index) corresponding to that instruction

getMethod

public IMethod getMethod()
Specified by:
getMethod in interface ControlFlowGraph
Returns:
the Method this CFG represents

getCatchBlocks

public BitVector getCatchBlocks()
Specified by:
getCatchBlocks in interface ControlFlowGraph
Returns:
the indices of the catch blocks, as a bit vector