org.jikesrvm.compilers.opt.controlflow
Class Dominators

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

public class Dominators
extends Object

Calculate dominators for basic blocks.

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)
 

TODO: we do not support IRs with exception handlers!!


Field Summary
(package private) static boolean COMPUTE_POST_DOMINATORS
          Should we compute post-dominators instead of dominators?
(package private) static boolean DEBUG
          Control for debug output
 
Constructor Summary
Dominators()
           
 
Method Summary
static void computeApproxDominators(IR ir)
          Calculate the "approximate" dominators for an IR i.e., the dominators in the factored CFG rather than the normal CFG.
static void computeApproxPostdominators(IR ir)
          Calculate the postdominators for an IR.
static void perform(IR ir)
          Calculate the dominators for an IR.
static void printDominators(IR ir)
          Print the (already calculated) dominators.
static void updateBlocks(DF_Solution solution)
          For each basic block in the data flow system solution, create an DominatorInfo and store it in the basic blocks scratchObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

static final boolean DEBUG
Control for debug output

See Also:
Constant Field Values

COMPUTE_POST_DOMINATORS

static boolean COMPUTE_POST_DOMINATORS
Should we compute post-dominators instead of dominators? This is false by default.

Constructor Detail

Dominators

public Dominators()
Method Detail

perform

public static void perform(IR ir)
Calculate the dominators for an IR.

After this pass, each basic block's scrach field points to an DominatorInfo object, which holds the dominators of the basic block.

Parameters:
ir - the IR in question

computeApproxDominators

public static void computeApproxDominators(IR ir)
Calculate the "approximate" dominators for an IR i.e., the dominators in the factored CFG rather than the normal CFG.

(No exception is thrown if the input IR has handler blocks.)

After this pass, each basic block's scratch field points to an DominatorInfo object, which holds the dominators of the basic block.

Parameters:
ir - the IR in question

computeApproxPostdominators

public static void computeApproxPostdominators(IR ir)
Calculate the postdominators for an IR.

After this pass, each basic block's scrach field points to an DominatorInfo object, which holds the postdominators of the basic block.

Parameters:
ir - the IR in question

updateBlocks

public static void updateBlocks(DF_Solution solution)
For each basic block in the data flow system solution, create an DominatorInfo and store it in the basic blocks scratchObject

Parameters:
solution - the solution to the Dominators equations

printDominators

public static void printDominators(IR ir)
Print the (already calculated) dominators.

Parameters:
ir - the IR