org.jikesrvm.compilers.opt.controlflow
Class LTDominatorInfo

java.lang.Object
  extended by org.jikesrvm.compilers.opt.controlflow.LTDominatorInfo

 class LTDominatorInfo
extends Object

This class holds data associated with a basic block as computed by the Lengauer-Tarjan dominator calculation.

See Also:
LTDominators

Field Summary
private  BasicBlock ancestor
           
private  Enumeration<BasicBlock> bbEnum
           
private  HashSet<BasicBlock> bucket
           
private  BasicBlock child
           
(package private) static boolean DEBUG
           
private  BasicBlock dominator
          the immediate dominator
private  BasicBlock label
           
private  BasicBlock parent
           
private  int semiDominator
           
private  int size
           
 
Constructor Summary
LTDominatorInfo(BasicBlock block)
           
 
Method Summary
 void addToBucket(BasicBlock block)
          Adds the passed block from the bucket for this node
 BitVector dominators(BasicBlock block, IR ir)
          This method returns the set of blocks that dominates the passed block, i.e., it answers the question "Who dominates me?"
 BasicBlock getAncestor()
          Returns the ancestor for this block
 Iterator<BasicBlock> getBucketIterator()
          Returns an iterator over this block's bucket
 BasicBlock getChild()
          returns the child
 BasicBlock getDominator()
          Returns the immediate dominator for this node
 Enumeration<BasicBlock> getEnum()
          Helper method to return the Info field associated with a block
static BasicBlock getIdom(BasicBlock bb)
          return the immediate dominator of a basic block.
static LTDominatorInfo getInfo(BasicBlock block)
          Helper method to return the Info field associated with a block
 BasicBlock getLabel()
          returns the label
 BasicBlock getParent()
          Returns the parent of this block
 int getSemiDominator()
          Returns the semidomintor for this node
 int getSize()
          returns the size
static boolean isDominatedBy(BasicBlock block, BasicBlock master)
          This method determines if the 1st parameter (block) is dominated by the 2nd parameter (master), i.e., must control pass through "master" before reaching "block"
 void removeFromBucket(BasicBlock block)
          Removes the passed block from the bucket for this node
 void setAncestor(BasicBlock value)
          Sets the ancestor for the value passed
 void setChild(BasicBlock value)
          sets the child field
 void setDominator(BasicBlock value)
          Sets the immediate dominator for this node
 void setEnum(Enumeration<BasicBlock> bbEnum)
          set the basic block enum field
 void setLabel(BasicBlock value)
          sets the label
 void setParent(BasicBlock value)
          Sets the parent of this block
 void setSemiDominator(int value)
          Sets the semidominator for this node
 void setSize(int value)
          sets the size
 String toString()
          Prints a string version of objection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

static final boolean DEBUG
See Also:
Constant Field Values

semiDominator

private int semiDominator

dominator

private BasicBlock dominator
the immediate dominator


parent

private BasicBlock parent

bucket

private final HashSet<BasicBlock> bucket

label

private BasicBlock label

ancestor

private BasicBlock ancestor

size

private int size

child

private BasicBlock child

bbEnum

private Enumeration<BasicBlock> bbEnum
Constructor Detail

LTDominatorInfo

LTDominatorInfo(BasicBlock block)
Parameters:
block - the basic block this info is associated with
Method Detail

dominators

public BitVector dominators(BasicBlock block,
                            IR ir)
This method returns the set of blocks that dominates the passed block, i.e., it answers the question "Who dominates me?"

Parameters:
block - the block of interest
ir - the governing ir
Returns:
a BitVector containing those blocks that dominate the passed one

isDominatedBy

public static boolean isDominatedBy(BasicBlock block,
                                    BasicBlock master)
This method determines if the 1st parameter (block) is dominated by the 2nd parameter (master), i.e., must control pass through "master" before reaching "block"

Parameters:
block - the block we care about
master - the potential dominating block
Returns:
whether master dominates block

setSemiDominator

public void setSemiDominator(int value)
Sets the semidominator for this node

Parameters:
value - the new value

getSemiDominator

public int getSemiDominator()
Returns the semidomintor for this node

Returns:
the semidomintor for this node

setDominator

public void setDominator(BasicBlock value)
Sets the immediate dominator for this node

Parameters:
value - the value to set

getDominator

public BasicBlock getDominator()
Returns the immediate dominator for this node

Returns:
the immediate dominator for this node

setParent

public void setParent(BasicBlock value)
Sets the parent of this block

Parameters:
value - the value

getParent

public BasicBlock getParent()
Returns the parent of this block

Returns:
the parent of this block

getBucketIterator

public Iterator<BasicBlock> getBucketIterator()
Returns an iterator over this block's bucket

Returns:
an iterator over this block's bucket

removeFromBucket

public void removeFromBucket(BasicBlock block)
Removes the passed block from the bucket for this node

Parameters:
block - the block to remove from the bucket

addToBucket

public void addToBucket(BasicBlock block)
Adds the passed block from the bucket for this node

Parameters:
block - the block to add to our bucket

setAncestor

public void setAncestor(BasicBlock value)
Sets the ancestor for the value passed

Parameters:
value - the ancestor value

getAncestor

public BasicBlock getAncestor()
Returns the ancestor for this block

Returns:
the ancestor for this block

setLabel

public void setLabel(BasicBlock value)
sets the label

Parameters:
value - the label

getLabel

public BasicBlock getLabel()
returns the label

Returns:
the label

setSize

public void setSize(int value)
sets the size

Parameters:
value - the size

getSize

public int getSize()
returns the size

Returns:
the size

setChild

public void setChild(BasicBlock value)
sets the child field

Parameters:
value - the child value

getChild

public BasicBlock getChild()
returns the child

Returns:
the child

getEnum

public Enumeration<BasicBlock> getEnum()
Helper method to return the Info field associated with a block

Returns:
the basic block enumeration, could be null

setEnum

public void setEnum(Enumeration<BasicBlock> bbEnum)
set the basic block enum field

Parameters:
bbEnum - basic block enum

getInfo

public static LTDominatorInfo getInfo(BasicBlock block)
Helper method to return the Info field associated with a block

Parameters:
block - the block of interest
Returns:
the LTInfo info

getIdom

public static BasicBlock getIdom(BasicBlock bb)
return the immediate dominator of a basic block. Note: the dominator info must be pre-calculated

Parameters:
bb - the basic block in question
Returns:
bb's immediate dominator

toString

public String toString()
Prints a string version of objection

Overrides:
toString in class Object