SandMark version 2.0


sandmark.obfuscate.boolsplitter.dcfg
Class Block

java.lang.Object
  |
  +--EDU.purdue.cs.bloat.util.GraphNode
        |
        +--sandmark.obfuscate.boolsplitter.dcfg.Block

public class Block
extends EDU.purdue.cs.bloat.util.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
(package private)  int blockType
           
 boolean built
           
(package private)  java.util.Set domChildren
           
(package private)  java.util.Set domFrontier
           
(package private)  Block domParent
           
(package private)  FlowGraph graph
           
(package private)  Block header
           
static int IRREDUCIBLE
           
(package private)  EDU.purdue.cs.bloat.editor.Label label
           
static int NON_HEADER
           
(package private)  java.util.Set pdomChildren
           
(package private)  java.util.Set pdomFrontier
           
(package private)  Block pdomParent
           
static int REDUCIBLE
           
(package private)  StackOptimizer stackOptimizer
           
 Subroutine sub
           
(package private)  Tree tree
           
 
Fields inherited from class EDU.purdue.cs.bloat.util.GraphNode
postIndex, preds, preIndex, succs
 
Constructor Summary
(package private) Block(EDU.purdue.cs.bloat.editor.Label label, FlowGraph graph)
          Constructor.
 
Method Summary
(package private)  int blockType()
          Returns the type of this Block.
(package private)  java.util.Collection domChildren()
          Returns the basic blocks that this Block immediately dominates.
(package private)  java.util.Collection domFrontier()
          Returns the blocks that are in this block's dominance frontier.
 boolean dominates(Block block)
          Returns whether or this Block dominates another given Block.
(package private)  Block domParent()
          Returns the immediate dominator of this Block.
 FlowGraph graph()
          Returns the CFG containing the block.
 Block header()
           
 EDU.purdue.cs.bloat.editor.Label label()
          Returns the label associated with this block.
(package private)  java.util.Collection pdomChildren()
          Returns the children of this Block in the CFG's postdominator tree.
(package private)  java.util.Collection pdomFrontier()
          Returns the postdominance frontier for this node.
(package private)  Block pdomParent()
          Returns the parent of this Block in the CFG's postdominator tree.
 boolean postdominates(Block block)
          Determines whether or not this block postdominates a given block.
(package private)  void setBlockType(int blockType)
          Sets the type of this Block.
(package private)  void setDomParent(Block block)
          Specifies that Block dominates this Block (parent in the dominator tree, the immediate dominator).
 void setHeader(Block header)
           
(package private)  void setPdomParent(Block block)
          Sets this Block's parent in the postdominator tree.
 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
See Also:
Constant Field Values

IRREDUCIBLE

public static final int IRREDUCIBLE
See Also:
Constant Field Values

REDUCIBLE

public static final int REDUCIBLE
See Also:
Constant Field Values

graph

FlowGraph graph

label

EDU.purdue.cs.bloat.editor.Label label

tree

Tree tree

domParent

Block domParent

pdomParent

Block pdomParent

domChildren

java.util.Set domChildren

pdomChildren

java.util.Set pdomChildren

domFrontier

java.util.Set domFrontier

pdomFrontier

java.util.Set pdomFrontier

blockType

int blockType

header

Block header

stackOptimizer

StackOptimizer stackOptimizer

built

public boolean built

sub

public Subroutine sub
Constructor Detail

Block

Block(EDU.purdue.cs.bloat.editor.Label label,
      FlowGraph graph)
Constructor.

Parameters:
label - The block's label. The label may be thought of as the line of code at which the block begins.
graph - The CFG containing the block.
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 EDU.purdue.cs.bloat.editor.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)

setBlockType

void setBlockType(int blockType)
Sets the type of this Block. A Block may have one of three types: A loop is a strongly connected component of a control flow graph. A loop's header is the block that dominates all other blocks in the loop. A loop is reducible if the only way to enter the loop is through the header.


blockType

int blockType()
Returns the type of this Block.


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

domChildren

java.util.Collection domChildren()
Returns the basic blocks that this Block immediately dominates. That is, it returns this Block's children in the dominator tree for the CFG.


domParent

Block domParent()
Returns the immediate dominator of this Block. That is, it returns the Block's parent in the dominator tree, its immediate dominator.


setDomParent

void setDomParent(Block block)
Specifies that Block dominates this Block (parent in the dominator tree, the immediate dominator).

Parameters:
block - Block that dominates this Block.

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.


pdomChildren

java.util.Collection pdomChildren()
Returns the children of this Block in the CFG's postdominator tree.


pdomParent

Block pdomParent()
Returns the parent of this Block in the CFG's postdominator tree.


setPdomParent

void setPdomParent(Block block)
Sets this Block's parent in the postdominator tree.


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

domFrontier

java.util.Collection domFrontier()
Returns the blocks that are in this block's dominance frontier. The dominance frontier of a node X in a CFG is the set of all nodes Y such that X dominates a predacessor of Y, but does not strictly dominate Y. Nodes in the dominance frontier always have more than one parent (a join).

See Also:
DominanceFrontier

pdomFrontier

java.util.Collection pdomFrontier()
Returns the postdominance frontier for this node. A postdominace frontier is essentially the same as a dominace frontier, but the postdominance relationship is used instead of the dominance relationship.


SandMark version 2.0

Mon Jun 17 12:30:47 MST 2002