org.jikesrvm.compilers.opt.controlflow
Class DominatorSystem

java.lang.Object
  extended by org.jikesrvm.compilers.opt.dfsolver.DF_System
      extended by org.jikesrvm.compilers.opt.controlflow.DominatorSystem

 class DominatorSystem
extends DF_System

Implementation of the dataflow equation system to calculate dominators.


Field Summary
private  IR ir
          The governing IR.
 
Fields inherited from class org.jikesrvm.compilers.opt.dfsolver.DF_System
cells, workList
 
Constructor Summary
DominatorSystem(IR ir)
          Default constructor.
 
Method Summary
(package private)  DF_LatticeCell[] getCellsForPredecessors(BasicBlock bb)
          Return a list of lattice cells corresponding to the predecessors of a basic block.
(package private)  Object getKey(BasicBlock bb)
          Get the DF_LatticeCell key corresponding to a basic block
protected  void initializeLatticeCells()
          Initialize the lattice variables (Dominator sets) for each basic block.
protected  void initializeWorkList()
          Initialize the work list for the dataflow equation system.
protected  DF_LatticeCell makeCell(Object key)
          Make a new DF_LatticeCell key corresponding to a basic block
(package private)  void setupEquations()
          Go through each basic block in the IR, and add equations to the system as required.
 
Methods inherited from class org.jikesrvm.compilers.opt.dfsolver.DF_System
addAllEquationsToWorkList, addCellAppearancesToWorkList, addNewEquationsToWorkList, addToWorkList, changedCell, findOrCreateCell, getCell, getEquations, getNumberOfEquations, getSolution, newEquation, newEquation, solve, toString, updateWorkList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ir

private final IR ir
The governing IR.

Constructor Detail

DominatorSystem

public DominatorSystem(IR ir)
Default constructor.

Parameters:
ir - the governing IR
Method Detail

setupEquations

void setupEquations()
Go through each basic block in the IR, and add equations to the system as required.

Uses the algorithm contained in Dragon book, pg. 670-1.

     D(n0) := { n0 }
     for n in N - { n0 } do D(n) := N;
     while changes to any D(n) occur do
       for n in N - {n0} do
           D(n) := {n} U (intersect of D(p) over all predecessors p of n)
 


initializeLatticeCells

protected void initializeLatticeCells()
Initialize the lattice variables (Dominator sets) for each basic block.

Specified by:
initializeLatticeCells in class DF_System

initializeWorkList

protected void initializeWorkList()
Initialize the work list for the dataflow equation system.

The initial work list is every equation containing the start node.

Specified by:
initializeWorkList in class DF_System

getKey

Object getKey(BasicBlock bb)
Get the DF_LatticeCell key corresponding to a basic block

Parameters:
bb - the basic block
Returns:
the key (just the block itself)

makeCell

protected DF_LatticeCell makeCell(Object key)
Make a new DF_LatticeCell key corresponding to a basic block

Specified by:
makeCell in class DF_System
Parameters:
key - the basic block
Returns:
the new cell

getCellsForPredecessors

DF_LatticeCell[] getCellsForPredecessors(BasicBlock bb)
Return a list of lattice cells corresponding to the predecessors of a basic block.

Parameters:
bb - the basic block