HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includi ...
, a
node In general, a node is a localized swelling (a "knot") or a point of intersection (a vertex). Node may refer to: In mathematics * Vertex (graph theory), a vertex in a mathematical graph *Vertex (geometry), a point where two or more curves, lines ...
of a
control-flow graph In computer science, a control-flow graph (CFG) is a representation, using graph notation, of all paths that might be traversed through a program during its execution. The control-flow graph was discovered by Frances E. Allen, who noted that ...
dominates a node if every path from the ''entry node'' to must go through . Notationally, this is written as (or sometimes ). By definition, every node dominates itself. There are a number of related concepts: * A node ''strictly dominates'' a node if dominates and does not equal . * The ''immediate dominator'' or idom of a node is the unique node that strictly dominates but does not strictly dominate any other node that strictly dominates . Every node, except the entry node, has an immediate dominator. * The ''dominance frontier'' of a node is the set of all nodes such that dominates an immediate predecessor of , but does not strictly dominate . It is the set of nodes where 's dominance stops. * A ''dominator tree'' is a
tree In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, including only woody plants with secondary growth, plants that are ...
where each node's children are those nodes it immediately dominates. The start node is the root of the tree.


History

Dominance was first introduced by Reese T. Prosser in a 1959 paper on analysis of flow diagrams. Prosser did not present an algorithm for computing dominance, which had to wait ten years for Edward S. Lowry and C. W. Medlock. Ron Cytron ''et al.'' rekindled interest in dominance in 1989 when they applied it to the problem of efficiently computing the placement of φ functions, which are used in
static single assignment form In compiler design, static single assignment form (often abbreviated as SSA form or simply SSA) is a property of an intermediate representation (IR) that requires each variable to be assigned exactly once and defined before it is used. Existing var ...
.


Applications

Dominators, and dominance frontiers particularly, have applications in
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s for computing
static single assignment form In compiler design, static single assignment form (often abbreviated as SSA form or simply SSA) is a property of an intermediate representation (IR) that requires each variable to be assigned exactly once and defined before it is used. Existing var ...
. A number of compiler optimizations can also benefit from dominators. The flow graph in this case comprises
basic block In compiler construction, a basic block is a straight-line code sequence with no branches in except to the entry and no branches out except at the exit. This restricted form makes a basic block highly amenable to analysis. Compilers usually deco ...
s. Automatic parallelization benefits from postdominance frontiers. This is an efficient method of computing control dependence, which is critical to the analysis. Memory usage analysis can benefit from the dominator tree to easily find leaks and identify high memory usage. In hardware systems, dominators are used for computing signal probabilities for test generation, estimating switching activities for power and noise analysis, and selecting cut points in equivalence checking. In software systems, they are used for reducing the size of the test set in structural testing techniques such as statement and branch coverage.


Algorithms

Let n_0 be the source node on the
Control-flow graph In computer science, a control-flow graph (CFG) is a representation, using graph notation, of all paths that might be traversed through a program during its execution. The control-flow graph was discovered by Frances E. Allen, who noted that ...
. The dominators of a node n are given by the maximal solution to the following data-flow equations: : \operatorname(n) = \begin \left \ & \mbox n = n_0 \\ \left \ \cup \left ( \bigcap_^ \operatorname(p) \right ) & \mbox n \neq n_0 \end The dominator of the start node is the start node itself. The set of dominators for any other node n is the intersection of the set of dominators for all predecessors p of n. The node n is also in the set of dominators for n. An algorithm for the direct solution is: // dominator of the start node is the start itself Dom(n0) = // for all other nodes, set all nodes as the dominators for each n in N - Dom(n) = N; // iteratively eliminate nodes that are not dominators while changes in any Dom(n) for each n in N - : Dom(n) = union with intersection over Dom(p) for all p in pred(n) The direct solution is quadratic in the number of nodes, or O(''n''2). Lengauer and Tarjan developed an algorithm which is almost linear, and in practice, except for a few artificial graphs, the algorithm and a simplified version of it are as fast or faster than any other known algorithm for graphs of all sizes and its advantage increases with graph size. Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy of
Rice University William Marsh Rice University (Rice University) is a private research university in Houston, Texas. It is on a 300-acre campus near the Houston Museum District and adjacent to the Texas Medical Center. Rice is ranked among the top universities ...
describe an algorithm that essentially solves the above data flow equations but uses well engineered data structures to improve performance.


Postdominance

Analogous to the definition of dominance above, a node ''z'' is said to post-dominate a node ''n'' if all paths to the exit node of the graph starting at ''n'' must go through ''z''. Similarly, the immediate post-dominator of a node ''n'' is the postdominator of ''n'' that doesn't strictly postdominate any other strict postdominators of ''n''.


See also

*
Control-flow graph In computer science, a control-flow graph (CFG) is a representation, using graph notation, of all paths that might be traversed through a program during its execution. The control-flow graph was discovered by Frances E. Allen, who noted that ...
*
Interval (graph theory) This is a glossary of graph theory. Graph theory is the study of graphs, systems of nodes or vertices connected in pairs by lines or edges. Symbols A B ...
*
Static single assignment form In compiler design, static single assignment form (often abbreviated as SSA form or simply SSA) is a property of an intermediate representation (IR) that requires each variable to be assigned exactly once and defined before it is used. Existing var ...


References


External links


The Machine-SUIF Control Flow Analysis Library
{{DEFAULTSORT:Dominator (Graph Theory) Graph theory Compiler construction