Class Dominators<T>

java.lang.Object
com.ibm.wala.util.graph.dominators.Dominators<T>
Direct Known Subclasses:
GenericDominators, NumberedDominators

public abstract class Dominators<T> extends Object
Calculate dominators using Lengauer and Tarjan's fastest algorithm. TOPLAS 1(1), July 1979. This implementation uses path compression and results in a O(e * alpha(e,n)) complexity, where e is the number of edges in the CFG and n is the number of nodes.

Sources: TOPLAS article, Muchnick book

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected final class 
    LOOK-ASIDE TABLE FOR PER-NODE STATE AND ITS ACCESSORS
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Graph<T>
    a convenient place to locate the graph to avoid passing it internally
    protected int
    the number of nodes reachable from the root
    protected final T
    the root node from which to build dominators
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dominators(Graph<T> G, T root)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    analyze dominators
    dominators(T node)
    return an Iterator over all nodes that dominate node
    Returns a graph with an edge from each immediate dominator to the node it dominates.
    @Nullable T
    getIdom(@Nullable T node)
    Returns the immediate dominator of node, or null for the root, an unreachable node, or a null argument.
    protected abstract Dominators<T>.DominatorInfo
    getInfo(T node)
     
    boolean
    isDominatedBy(T node, T master)
    is node dominated by master?
    static <T> Dominators<T>
    make(Graph<T> G, T root)
     
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • G

      protected final Graph<T> G
      a convenient place to locate the graph to avoid passing it internally
    • root

      protected final T root
      the root node from which to build dominators
    • reachableNodeCount

      protected int reachableNodeCount
      the number of nodes reachable from the root
  • Constructor Details

  • Method Details

    • make

      public static <T> Dominators<T> make(Graph<T> G, T root)
    • isDominatedBy

      public boolean isDominatedBy(T node, T master)
      is node dominated by master?
    • getIdom

      public @Nullable T getIdom(@Nullable T node)
      Returns the immediate dominator of node, or null for the root, an unreachable node, or a null argument.
    • dominators

      public Iterator<T> dominators(T node)
      return an Iterator over all nodes that dominate node
    • dominatorTree

      public Graph<T> dominatorTree()
      Returns a graph with an edge from each immediate dominator to the node it dominates. Nodes unreachable from the root are isolated, with no predecessors or successors.
    • analyze

      protected void analyze()
      analyze dominators
    • getInfo

      protected abstract Dominators<T>.DominatorInfo getInfo(T node)
    • toString

      public String toString()
      Overrides:
      toString in class Object