joeq.Compiler.BytecodeAnalysis
Class ControlFlowGraph

java.lang.Object
  extended by joeq.Compiler.BytecodeAnalysis.ControlFlowGraph

public class ControlFlowGraph
extends Object

Control flow graph for a bytecode stream. The data structure is immutable and corresponds exactly to the underlying bytecodes.

Version:
$Id: ControlFlowGraph.java 2465 2006-06-07 23:03:17Z joewhaley $
Author:
John Whaley

Nested Class Summary
static interface ControlFlowGraph.BasicBlockIterator
           
static class ControlFlowGraph.InitialPass
          Visitor to perform the initial pass over the bytecode.
static class ControlFlowGraph.RPOBasicBlockIterator
           
 
Field Summary
static boolean TRACE
           
 
Method Summary
 void addJSRInfo(BasicBlock entry, BasicBlock exit, boolean[] locals)
          Add info about a JSR subroutine.
static ControlFlowGraph computeCFG(jq_Method method)
          Compute and return the control flow graph for the given method.
 BasicBlock getBasicBlock(int index)
          Returns the basic block with the given number.
 BasicBlock getBasicBlockByBytecodeIndex(int index)
          Returns the basic block that contains the given bytecode index.
 BasicBlock getEntry()
          Returns the entry basic block.
 BasicBlock getExit()
          Returns the exit basic block.
 JSRInfo getJSRInfo(BasicBlock b)
          Returns the JSR info about the JSR subroutine with the given entry/exit block, or null if there are none.
 int getNumberOfBasicBlocks()
          Returns the number of basic blocks.
 ControlFlowGraph.RPOBasicBlockIterator reversePostOrderIterator()
          Returns the basic blocks in reverse post-order.
 ControlFlowGraph.RPOBasicBlockIterator reversePostOrderIterator(BasicBlock start_bb)
          Returns the basic blocks in reverse post-order starting from the given block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE

public static final boolean TRACE
See Also:
Constant Field Values
Method Detail

getEntry

public BasicBlock getEntry()
Returns the entry basic block.


getExit

public BasicBlock getExit()
Returns the exit basic block.


getNumberOfBasicBlocks

public int getNumberOfBasicBlocks()
Returns the number of basic blocks.


getBasicBlock

public BasicBlock getBasicBlock(int index)
Returns the basic block with the given number.


addJSRInfo

public void addJSRInfo(BasicBlock entry,
                       BasicBlock exit,
                       boolean[] locals)
Add info about a JSR subroutine. The JSR subroutine has the given entry and exit blocks and modifies the given locals. This info is associated with the entry and exit blocks.

Parameters:
entry - entry block
exit - exit block
locals - which locals are modified

getJSRInfo

public JSRInfo getJSRInfo(BasicBlock b)
Returns the JSR info about the JSR subroutine with the given entry/exit block, or null if there are none.


getBasicBlockByBytecodeIndex

public BasicBlock getBasicBlockByBytecodeIndex(int index)
Returns the basic block that contains the given bytecode index.


reversePostOrderIterator

public ControlFlowGraph.RPOBasicBlockIterator reversePostOrderIterator()
Returns the basic blocks in reverse post-order.


reversePostOrderIterator

public ControlFlowGraph.RPOBasicBlockIterator reversePostOrderIterator(BasicBlock start_bb)
Returns the basic blocks in reverse post-order starting from the given block.


computeCFG

public static ControlFlowGraph computeCFG(jq_Method method)
Compute and return the control flow graph for the given method.



Copyright © 2001-2008 John Whaley. All Rights Reserved.