Class Dominance
java.lang.Object
net.covers1624.coffeegrinder.bytecode.flow.Dominance
Created by covers1624 on 20/4/21.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcomputeDominance(ControlFlowNode entryPoint) Computes the dominator tree of a ControlFlow graph.static voidcomputeReachableExits(BitSet bits, ControlFlowNode[] cfg) Computes a bitset wherebits.get(i) == trueifcfg[i]is reachable and there is some node that is reachable fromcfg[i]but not dominated bycfg[i].static ControlFlowNodeReturns the common ancestor of a and b in the dominator tree.
-
Constructor Details
-
Dominance
public Dominance()
-
-
Method Details
-
computeDominance
Computes the dominator tree of a ControlFlow graph.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.
- Parameters:
entryPoint- The entry point.
-
findCommonDominator
Returns the common ancestor of a and b in the dominator tree. Both a and b must be part of the same dominator tree.- Parameters:
a- The a node.b- The b node.- Returns:
- The common ancestor.
-
computeReachableExits
Computes a bitset wherebits.get(i) == trueifcfg[i]is reachable and there is some node that is reachable fromcfg[i]but not dominated bycfg[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 == ifor all i.- Parameters:
bits- The bitset to store the exits in.cfg- The CFG.
-