java.lang.Object
net.covers1624.coffeegrinder.bytecode.flow.Dominance

public class Dominance extends Object
Created by covers1624 on 20/4/21.
  • Constructor Details

    • Dominance

      public Dominance()
  • Method Details

    • computeDominance

      public static void computeDominance(ControlFlowNode entryPoint)
      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

      public static ControlFlowNode findCommonDominator(ControlFlowNode a, ControlFlowNode b)
      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

      public static void computeReachableExits(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].

      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.

      Parameters:
      bits - The bitset to store the exits in.
      cfg - The CFG.