org.quilt.cl
Class ControlFlowGraph

java.lang.Object
  |
  +--org.quilt.graph.Directed
        |
        +--org.quilt.cl.ControlFlowGraph

public class ControlFlowGraph
extends Directed

Directed graph extended for use in analyzing method instruction lists.

Author:
Jim Dixon

Field Summary
protected  java.util.Map endHandles
          Key code vertex, value handle on last instruction.
protected  java.util.Map gotoFixMeUps
          Key source vertex, value target vertex where connecting instruction is GotoInstruction.
protected  org.apache.bcel.generic.InstructionList ilist
          Instruction list built in walking the graph.
protected  java.util.Map startHandles
          Key code vertex, value handle on first instruction.
 
Fields inherited from class org.quilt.graph.Directed
graphIndex
 
Constructor Summary
  ControlFlowGraph()
          Create a new top level control flow graph.
protected ControlFlowGraph(ControlFlowGraph parent)
          Create a control flow graph without connecting it to this parent graph but sharing protected data structures.
 
Method Summary
 java.util.Map getEndHandles()
          Get a reference to the map of handles on last instructions.
 java.util.Map getGotoFixMeUps()
          Get a reference to the source/target vertex map where the connecting instruction is a GotoInstruction.
 org.apache.bcel.generic.InstructionList getInstructionList()
          Get a reference to the instruction list built while walking the graph.
 java.util.Map getStartHandles()
          Get a reference to the map of handles on first instructions.
 CodeVertex insertCodeVertex(CodeVertex v, Edge e)
          Insert a pre-existing CodeVertex along an edge.
 CodeVertex insertCodeVertex(Edge e)
          Insert a code vertex along an edge, retargeting the edge to the vertex inserted.
 Directed subgraph(Edge e, int n)
          Create a control flow graph, connecting it to this graph as its parent by inserting it along the directed edge e (the Entry first, followed by the subgraph Exit.
 
Methods inherited from class org.quilt.graph.Directed
anotherEdge, anotherVertex, checkForNull, closestEntry, connectSubgraph, getDepth, getEntry, getExit, getIndex, getParent, insertVertex, insertVertex, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startHandles

protected java.util.Map startHandles
Key code vertex, value handle on first instruction.


endHandles

protected java.util.Map endHandles
Key code vertex, value handle on last instruction.


gotoFixMeUps

protected java.util.Map gotoFixMeUps
Key source vertex, value target vertex where connecting instruction is GotoInstruction.


ilist

protected org.apache.bcel.generic.InstructionList ilist
Instruction list built in walking the graph.

Constructor Detail

ControlFlowGraph

public ControlFlowGraph()
Create a new top level control flow graph.


ControlFlowGraph

protected ControlFlowGraph(ControlFlowGraph parent)
Create a control flow graph without connecting it to this parent graph but sharing protected data structures.

Parameters:
parent - The cfg one level up.
Method Detail

getStartHandles

public java.util.Map getStartHandles()
Get a reference to the map of handles on first instructions.


getEndHandles

public java.util.Map getEndHandles()
Get a reference to the map of handles on last instructions.


getGotoFixMeUps

public java.util.Map getGotoFixMeUps()
Get a reference to the source/target vertex map where the connecting instruction is a GotoInstruction.


getInstructionList

public org.apache.bcel.generic.InstructionList getInstructionList()
Get a reference to the instruction list built while walking the graph.


subgraph

public Directed subgraph(Edge e,
                         int n)
Create a control flow graph, connecting it to this graph as its parent by inserting it along the directed edge e (the Entry first, followed by the subgraph Exit.

Overrides:
subgraph in class Directed
Parameters:
e - Edge along which the subgraph is to be inserted.
n - Number of extra edges on the ComplexConnector in the subgraph's Entry vertex (must be at least 1).
Returns:
A reference to the subgraph.

insertCodeVertex

public CodeVertex insertCodeVertex(Edge e)
Insert a code vertex along an edge, retargeting the edge to the vertex inserted. The vertex is created by this method.

Parameters:
e - Edge along which the vertex is inserted.
Returns:
The CodeVertex created.

insertCodeVertex

public CodeVertex insertCodeVertex(CodeVertex v,
                                   Edge e)
Insert a pre-existing CodeVertex along an edge. The edge and the vertex must be in the same graph.

Parameters:
v - CodeVertex being inserted.
e - Edge in which it is to be inserted.


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.