Class MutableCFG<X,T extends IBasicBlock<X>>

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 Details

    • copyFrom

      public static <I, T extends IBasicBlock<I>> MutableCFG<I,T> copyFrom(ControlFlowGraph<I,T> cfg)
    • entry

      public T entry()
      Description copied from interface: MinimalCFG
      Return the entry basic block in the CFG
      Specified by:
      entry in interface MinimalCFG<X>
    • exit

      public T exit()
      Specified by:
      exit in interface MinimalCFG<X>
      Returns:
      the synthetic exit block for the cfg
    • getCatchBlocks

      public BitVector getCatchBlocks()
      Specified by:
      getCatchBlocks in interface ControlFlowGraph<X,T extends IBasicBlock<X>>
      Returns:
      the indices of the catch blocks, as a bit vector
    • getBlockForInstruction

      public T getBlockForInstruction(int index)
      Specified by:
      getBlockForInstruction in interface ControlFlowGraph<X,T extends IBasicBlock<X>>
      Parameters:
      index - an instruction index
      Returns:
      the basic block which contains this instruction.
    • getInstructions

      public X[] getInstructions()
      Specified by:
      getInstructions in interface ControlFlowGraph<X,T extends IBasicBlock<X>>
      Returns:
      the instructions of this CFG, as an array.
    • getProgramCounter

      public int getProgramCounter(int index)
      Description copied from interface: ControlFlowGraph
      TODO: move this into IR?
      Specified by:
      getProgramCounter in interface ControlFlowGraph<X,T extends IBasicBlock<X>>
      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<X,T extends IBasicBlock<X>>
      Returns:
      the Method this CFG represents
    • getExceptionalSuccessors

      public List<T> getExceptionalSuccessors(T b)
      Description copied from interface: MinimalCFG
      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.
      Specified by:
      getExceptionalSuccessors in interface MinimalCFG<X>
      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: MinimalCFG
      The order of blocks returned should be arbitrary but deterministic.
      Specified by:
      getNormalSuccessors in interface MinimalCFG<X>
      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: MinimalCFG
      The order of blocks returned should be arbitrary but deterministic.
      Specified by:
      getExceptionalPredecessors in interface MinimalCFG<X>
      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: MinimalCFG
      The order of blocks returned should be arbitrary but deterministic.
      Specified by:
      getNormalPredecessors in interface MinimalCFG<X>
      Returns:
      the basic blocks from which b may be reached via normal control flow