de.rwth.dfa.jvm
Class BasicBlockGraph

java.lang.Object
  |
  +--de.rwth.graph.Graph
        |
        +--de.rwth.graph.RootedGraph
              |
              +--de.rwth.dfa.jvm.FactorisedFlowGraph
                    |
                    +--de.rwth.dfa.jvm.BasicBlockGraph

public class BasicBlockGraph
extends FactorisedFlowGraph

A class for the basic block graph of JVM methods. A basic block is a sequence of instructions in a method, where the control flow is linear, i.e. no jumps (or exceptions) can occur inside. For each basic block of a method, there is a node in the graph. The label of the node is an InstructionHandleVector of the instructions.. For each possible control flow between two basic blocks, there is an edge from the first to the second instruction.

The roots of this graph are those nodes, where the first instruction is a root in the flow graph.

The leafs of this graph are those nodes, where the last instruction is a leaf in the flow graph.

Version:
$Id: BasicBlockGraph.java,v 1.3 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen

Inner classes inherited from class de.rwth.graph.RootedGraph
RootedGraph.Node
 
Inner classes inherited from class de.rwth.graph.Graph
Graph.Node, Graph.NodeDyer
 
Field Summary
protected  java.util.Hashtable blockNodes
          Associates the nodes in the flow graph with the corresponding nodes in this graph.
protected  java.util.Hashtable flowNodess
          Associates a node in this graph with a vector of corresponding nodes in the flow graph.
 
Fields inherited from class de.rwth.graph.RootedGraph
leafs, roots
 
Fields inherited from class de.rwth.graph.Graph
curNumber, label, nodes, sizeEdges
 
Constructor Summary
BasicBlockGraph(FactorisedFlowGraph flowGraph)
          Creates a new BasicBlockGraph instance from a (factorised) flow graph.
 
Method Summary
 Graph.Node blockNode(Graph.Node flowNode)
          Returns the corresponding node in this graph for a node in the underlying flow graph.
protected  void findBasicBlocks(FactorisedFlowGraph flowGraph, Graph.Node startNode, Graph.NodeDyer visitedNodes, Graph.Node newNode)
          Finds the basic blocks starting at a node in a flow graph.
 java.util.Vector flowNodes(Graph.Node blockNode)
          Returns a vector of corresponding nodes in the flow graph for a node in this graph.
 
Methods inherited from class de.rwth.dfa.jvm.FactorisedFlowGraph
makeFactorisedFlowGraph
 
Methods inherited from class de.rwth.graph.RootedGraph
addLeaf, addRoot, getLeafArray, getLeafs, getRootArray, getRoots, isLeaf, isRoot, removeLeaf, removeRoot
 
Methods inherited from class de.rwth.graph.Graph
getLabel, getNodes, main, setLabel, sizeEdges, sizeNodes, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

blockNodes

protected java.util.Hashtable blockNodes
Associates the nodes in the flow graph with the corresponding nodes in this graph.

flowNodess

protected java.util.Hashtable flowNodess
Associates a node in this graph with a vector of corresponding nodes in the flow graph.
Constructor Detail

BasicBlockGraph

public BasicBlockGraph(FactorisedFlowGraph flowGraph)
Creates a new BasicBlockGraph instance from a (factorised) flow graph.
Parameters:
flowGraph - a FactorisedFlowGraph value
Method Detail

findBasicBlocks

protected void findBasicBlocks(FactorisedFlowGraph flowGraph,
                               Graph.Node startNode,
                               Graph.NodeDyer visitedNodes,
                               Graph.Node newNode)
Finds the basic blocks starting at a node in a flow graph.
Parameters:
flowGraph - a FactorisedFlowGraph value
startNode - a Graph.Node value
visitedNodes - a Graph.NodeDyer value
newNode - a Graph.Node value: An already created node in this graph.

blockNode

public Graph.Node blockNode(Graph.Node flowNode)
Returns the corresponding node in this graph for a node in the underlying flow graph.
Parameters:
flowNode - a Graph.Node value
Returns:
a Graph.Node value

flowNodes

public java.util.Vector flowNodes(Graph.Node blockNode)
Returns a vector of corresponding nodes in the flow graph for a node in this graph.
Parameters:
blockNode - a Graph.Node value
Returns:
a Vector value