edu.uci.eecs.doc.cascade.graph
Class BasicBlock

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.graph.Vertex
      extended by edu.uci.eecs.doc.cascade.graph.BasicBlock
Direct Known Subclasses:
CacheMiss, Invoke, LoopBlock

public class BasicBlock
extends Vertex

Represents a sequence of bytecode instructions with at most one branch. If a branch exists, it occurs at the end of the block.

Author:
Trevor Harmon

Field Summary
protected  List<InstructionHandle> instructions
           
protected  Node node
           
 
Fields inherited from class edu.uci.eecs.doc.cascade.graph.Vertex
graph
 
Constructor Summary
BasicBlock(Graph graph, Node node)
          Creates a new BasicBlock object.
BasicBlock(Graph graph, Node node, List<InstructionHandle> instructions)
          Creates a new BasicBlock object.
 
Method Summary
 List<InstructionHandle> getInstructions()
          Returns the list of instructions represented by this basic block.
 Node getNode()
          Returns the control flow tree node corresponding to this basic block.
 boolean isReturn()
          Returns whether this basic block contains a return instruction.
 String toString()
          Converts the basic block to a string representation
 
Methods inherited from class edu.uci.eecs.doc.cascade.graph.Vertex
asList, getGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

node

protected Node node

instructions

protected List<InstructionHandle> instructions
Constructor Detail

BasicBlock

public BasicBlock(Graph graph,
                  Node node)
Creates a new BasicBlock object.

Parameters:
graph - the control flow graph to which this basic block belongs
node - a control flow tree node that corresponds to the basic block

BasicBlock

public BasicBlock(Graph graph,
                  Node node,
                  List<InstructionHandle> instructions)
Creates a new BasicBlock object.

Parameters:
graph - the control flow graph to which this basic block belongs
node - the control flow tree node that corresponds to the basic block
instructions - the list of bytecode instructions represented by this basic block
Method Detail

getNode

public Node getNode()
Returns the control flow tree node corresponding to this basic block.

Returns:
a control flow tree node

getInstructions

public List<InstructionHandle> getInstructions()
Returns the list of instructions represented by this basic block.

Returns:
a list of instructions

isReturn

public boolean isReturn()
Returns whether this basic block contains a return instruction.

Returns:
true if the last instruction in the block is a return instruction; false otherwise

toString

public String toString()
Converts the basic block to a string representation

Overrides:
toString in class Object
Returns:
a string representing the basic block