EDU.purdue.cs.bloat.cfg
Class Block

java.lang.Object
  |
  +--EDU.purdue.cs.bloat.util.GraphNode
        |
        +--EDU.purdue.cs.bloat.cfg.Block

public class Block
extends GraphNode

Block represents a basic block of code used in control flow graphs. A basic block is always entered at its beginning and exits at its end. That is, its first statement is a label and its last statement is a jump. There are no other labels or jumps in between.

Each Block knows its parent block and its children in the dominator and postdominator trees. It also knows which blocks are in its dominance frontier and its postdominance frontier.

See Also:
FlowGraph, DominatorTree, DominanceFrontier

Field Summary
static int IRREDUCIBLE
           
static int NON_HEADER
           
static int REDUCIBLE
           
 
Fields inherited from class EDU.purdue.cs.bloat.util.GraphNode
postIndex, preds, preIndex, succs
 
Method Summary
 boolean dominates(Block block)
          Returns whether or this Block dominates another given Block.
 FlowGraph graph()
          Returns the CFG containing the block.
 Block header()
           
 Label label()
          Returns the label associated with this block.
 boolean postdominates(Block block)
          Determines whether or not this block postdominates a given block.
 void setHeader(Block header)
           
 void setTree(Tree tree)
          Sets the expression tree for this block.
 StackOptimizer stackOptimizer()
          Returns the stack optimizer for this block.
 java.lang.String toString()
          Returns a string representation of this block.
 Tree tree()
          Returns the expression tree for this block.
 void visit(TreeVisitor visitor)
           
 void visitChildren(TreeVisitor visitor)
          Visits the expression tree contained in this block.
 
Methods inherited from class EDU.purdue.cs.bloat.util.GraphNode
preds, succs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NON_HEADER

public static final int NON_HEADER

IRREDUCIBLE

public static final int IRREDUCIBLE

REDUCIBLE

public static final int REDUCIBLE
Method Detail

stackOptimizer

public StackOptimizer stackOptimizer()
Returns the stack optimizer for this block.
Returns:
The stack optimizer.

tree

public Tree tree()
Returns the expression tree for this block.
Returns:
The tree.

setTree

public void setTree(Tree tree)
Sets the expression tree for this block.

graph

public FlowGraph graph()
Returns the CFG containing the block.
Returns:
The CFG.

label

public Label label()
Returns the label associated with this block.

visitChildren

public void visitChildren(TreeVisitor visitor)
Visits the expression tree contained in this block.

visit

public void visit(TreeVisitor visitor)

setHeader

public void setHeader(Block header)

header

public Block header()

toString

public java.lang.String toString()
Returns a string representation of this block.
Overrides:
toString in class java.lang.Object

dominates

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

postdominates

public boolean postdominates(Block block)
Determines whether or not this block postdominates a given block. A block X is said to postdominate a block Y when every path from Y to the last node in the CFG (Exit) passes through X. This relationship can be thought of as the reverse of dominance. That is, X dominates Y in the reverse CFG.
See Also:
DominatorTree