public class Dominators extends Object
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!!
Modifier and Type | Field and Description |
---|---|
(package private) static boolean |
COMPUTE_POST_DOMINATORS
Should we compute post-dominators instead of dominators?
|
(package private) static boolean |
DEBUG
Control for debug output
|
private Map<BasicBlock,DominatorInfo> |
dominatorInfo |
Constructor and Description |
---|
Dominators() |
Modifier and Type | Method and Description |
---|---|
void |
computeApproxDominators(IR ir)
Calculate the "approximate" dominators for an IR i.e., the
dominators in the factored CFG rather than the normal CFG.
|
void |
computeApproxPostdominators(IR ir)
Calculate the postdominators for an IR.
|
DominatorInfo |
getDominatorInfo(BasicBlock b) |
void |
perform(IR ir)
Calculate the dominators for an IR.
|
void |
printDominators(IR ir)
Print the (already calculated) dominators.
|
void |
updateBlocks(DF_Solution solution)
Creates a
DominatorInfo for each basic block
in the data flow system solution. |
static final boolean DEBUG
static boolean COMPUTE_POST_DOMINATORS
private Map<BasicBlock,DominatorInfo> dominatorInfo
public Dominators()
public void perform(IR ir)
ir
- the IR in questionpublic void computeApproxDominators(IR ir)
(No exception is thrown if the input IR has handler blocks.)
ir
- the IR in questionpublic void computeApproxPostdominators(IR ir)
ir
- the IR in questionpublic void updateBlocks(DF_Solution solution)
DominatorInfo
for each basic block
in the data flow system solution.solution
- the solution to the Dominators equationspublic void printDominators(IR ir)
ir
- the IRpublic DominatorInfo getDominatorInfo(BasicBlock b)