SandMark version 3.0


sandmark.util.controlflowgraph
Class BasicBlock

java.lang.Object
  |
  +--sandmark.util.controlflowgraph.GraphNode
        |
        +--sandmark.util.controlflowgraph.BasicBlock

public class BasicBlock
extends GraphNode

BasicBlock represents a basic block in a control flow graph. Some of the ideas in this class are based upon the BLOAT project from Purdue. Written by Ginger Myles, 6/6/02.


Field Summary
(package private)  java.util.ArrayList domChildren
           
(package private)  java.util.ArrayList domFrontier
           
(package private)  BasicBlock dominator
           
(package private)  BasicBlock fallthroughFrom
           
(package private)  BasicBlock fallthroughTo
           
(package private)  BasicBlock header
           
(package private)  de.fub.bytecode.generic.InstructionHandle ih
           
(package private)  java.util.ArrayList instructions
           
(package private)  java.util.ArrayList pdomChildren
           
(package private)  java.util.ArrayList pdomFrontier
           
(package private)  BasicBlock postDominator
           
 
Fields inherited from class sandmark.util.controlflowgraph.GraphNode
mBlockNum, postIndex, predecessors, preIndex, sBlockNum, successors
 
Constructor Summary
BasicBlock(de.fub.bytecode.generic.InstructionHandle ih, MethodCFG graph)
          Constructor.
BasicBlock(MethodCFG graph)
           
 
Method Summary
 void addInst(de.fub.bytecode.generic.InstructionHandle inst)
          Adds an instruction to this basic block's instruction list.
 void addPred(BasicBlock pred)
          Adds a basic block to this basic block's predecessor list.
 void addSucc(BasicBlock succ)
          Adds a basic block to this basic block's successor list.
 boolean dominates(BasicBlock block)
          Returns whether or not this block dominates a given block.
 BasicBlock fallthrough()
           
 BasicBlock fallthroughFrom()
           
(package private)  java.util.ArrayList getDomChildren()
           
 java.util.ArrayList getDomFrontier()
           
 BasicBlock getDominator()
           
 BasicBlock getHeader()
          Returns the header associated with the block.
 de.fub.bytecode.generic.InstructionHandle getIH()
          Returns the instruction handler associated with this block.
 java.util.ArrayList getInstList()
          Returns this blocks instruction list.
 de.fub.bytecode.generic.InstructionHandle getLastInstruction()
          Returns the instruction handler associated with the last instruction in the block.
(package private)  java.util.ArrayList getPDomChildren()
           
 java.util.ArrayList getPDomFrontier()
           
 BasicBlock getPostDominator()
           
 boolean postDominates(BasicBlock block)
          Returns whether or not this block post dominates a given block.
(package private)  void setDominator(BasicBlock block)
           
 void setFallthrough(BasicBlock fallthrough)
           
 void setGraph(Graph g)
          Set the graph that contains this node
 void setHeader(BasicBlock header)
          Sets the header of a basic block.
 void setInstructions(java.util.ArrayList instructionList)
           
(package private)  void setPostDominator(BasicBlock block)
           
 java.lang.String toString()
          Returns a string representation of the block.
 
Methods inherited from class sandmark.util.controlflowgraph.GraphNode
getPredecessors, getSuccessors, graph, onRemoveFromGraph, postOrderIndex, preOrderIndex, setPostOrderIndex, setPreOrderIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ih

de.fub.bytecode.generic.InstructionHandle ih

instructions

java.util.ArrayList instructions

dominator

BasicBlock dominator

postDominator

BasicBlock postDominator

domChildren

java.util.ArrayList domChildren

pdomChildren

java.util.ArrayList pdomChildren

domFrontier

java.util.ArrayList domFrontier

pdomFrontier

java.util.ArrayList pdomFrontier

header

BasicBlock header

fallthroughTo

BasicBlock fallthroughTo

fallthroughFrom

BasicBlock fallthroughFrom
Constructor Detail

BasicBlock

public BasicBlock(de.fub.bytecode.generic.InstructionHandle ih,
                  MethodCFG graph)
Constructor.


BasicBlock

public BasicBlock(MethodCFG graph)
Method Detail

setGraph

public void setGraph(Graph g)
Description copied from class: GraphNode
Set the graph that contains this node

Overrides:
setGraph in class GraphNode

setFallthrough

public void setFallthrough(BasicBlock fallthrough)

fallthrough

public BasicBlock fallthrough()

fallthroughFrom

public BasicBlock fallthroughFrom()

getIH

public de.fub.bytecode.generic.InstructionHandle getIH()
Returns the instruction handler associated with this block.

Returns:
The instruction handle.

getLastInstruction

public de.fub.bytecode.generic.InstructionHandle getLastInstruction()
Returns the instruction handler associated with the last instruction in the block.

Returns:
The instruction handle.

setHeader

public void setHeader(BasicBlock header)
Sets the header of a basic block.


getHeader

public BasicBlock getHeader()
Returns the header associated with the block.

Returns:
The header.

addSucc

public void addSucc(BasicBlock succ)
Adds a basic block to this basic block's successor list.


addPred

public void addPred(BasicBlock pred)
Adds a basic block to this basic block's predecessor list.


addInst

public void addInst(de.fub.bytecode.generic.InstructionHandle inst)
Adds an instruction to this basic block's instruction list.


setInstructions

public void setInstructions(java.util.ArrayList instructionList)

getInstList

public java.util.ArrayList getInstList()
Returns this blocks instruction list.

Returns:
The instruction list.

toString

public java.lang.String toString()
Returns a string representation of the block.

Overrides:
toString in class GraphNode

getDomChildren

java.util.ArrayList getDomChildren()

getPDomChildren

java.util.ArrayList getPDomChildren()

getDominator

public BasicBlock getDominator()

getPostDominator

public BasicBlock getPostDominator()

setDominator

void setDominator(BasicBlock block)

setPostDominator

void setPostDominator(BasicBlock block)

dominates

public boolean dominates(BasicBlock block)
Returns whether or not this block dominates a given block. A node X dominates a node Y when every path from the first node in the CFG to Y must pass through X.


postDominates

public boolean postDominates(BasicBlock block)
Returns whether or not this block post dominates a given block. A node X is said to postdominate a node Y when every path from Y to the last node in the CFG passes through Y.


getDomFrontier

public java.util.ArrayList getDomFrontier()

getPDomFrontier

public java.util.ArrayList getPDomFrontier()

SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003