public class Dominance
extends java.lang.Object
| Constructor and Description |
|---|
Dominance() |
| Modifier and Type | Method and Description |
|---|---|
static void |
computeDominance(ControlFlowNode entryPoint)
Computes the dominator tree of a ControlFlow graph.
|
static void |
computeReachableExits(java.util.BitSet bits,
ControlFlowNode[] cfg)
Computes a bitset where
bits.get(i) == true if cfg[i] is reachable and there is some node
that is reachable from cfg[i] but not dominated by cfg[i]. |
static ControlFlowNode |
findCommonDominator(ControlFlowNode a,
ControlFlowNode b)
Returns the common ancestor of a and b in the dominator tree.
|
public static void computeDominance(ControlFlowNode entryPoint)
Precondition: the dominance tree is not already computed for some nodes reachable from entryPoint (i.e. ImmediateDominator and DominatorTreeChildren are both null), and the visited flag is false for any nodes reachable from entryPoint.
Postcondition: a dominator tree is constructed for all nodes reachable from entryPoint, and the visited flag remains false.
entryPoint - The entry point.public static ControlFlowNode findCommonDominator(ControlFlowNode a, ControlFlowNode b)
a - The a node.b - The b node.public static void computeReachableExits(java.util.BitSet bits,
ControlFlowNode[] cfg)
bits.get(i) == true if cfg[i] is reachable and there is some node
that is reachable from cfg[i] but not dominated by cfg[i].
This is similar to "does cfg[i] have a non-empty dominance frontier?" except that it uses non-strict dominance where the definition of dominance frontiers uses "strictly dominates".
Precondition:
- Dominance was computed for cfg and cfg[i].cfgIndex == i for all i.
bits - The bitset to store the exits in.cfg - The CFG.