Returns the iterated dominance frontier of nodes, in ascending order.
The result can contain given nodes, such as the header of a natural loop, which is in its own dominance frontier. Nodes that the entries do not reach are ignored, and so are duplicates.
Time: O(number of nodes + e + (s + k) log(s + k)), where e is the number of nodes and edges the query explores, at most nodeCount + edgeCount; s is the number of distinct given nodes that the entries reach, and k the size of the result. Memory: 4 x k bytes for the result; while it runs, up to about 60 bytes per node the query explores, and nothing sized by the whole graph.
node IDs in 0..nodeCount-1, such as the blocks that assign a variable
the iterated dominance frontier
StaticofReturns the iterated dominance frontiers of the graph that dominators were computed on, ready
for queries.
They are prepared anew on every call, not cached: keep the result and query it for every variable.
Time: O(nodeCount). Memory: 16 x nodeCount bytes for the result; while it runs, 8 x nodeCount bytes more.
the dominators of the control-flow graph
the iterated dominance frontiers
The iterated dominance frontiers of a control-flow graph, which tell where SSA (static single assignment) form places phi-nodes.
In SSA form, every assignment to a variable creates a new version of it, and a phi-node merges the versions where paths of control flow meet. The phi-nodes of a variable go into the iterated dominance frontier of the blocks that assign it: the dominance frontier of these blocks, then the dominance frontier of the result, and so on until nothing new is added. A compiler asks this once per variable, so IteratedDominanceFrontier.of prepares the queries once per control-flow graph, and IteratedDominanceFrontier.frontierOf answers them. Here, for the loop variable
iof a methodload, whose control flowcfghas the blocksentryandnext:Uses the algorithm of Sreedhar and Gao. A query walks the subtrees of the dominator tree below the nodes it is given and the nodes it adds, so its cost depends on the part of the graph it explores, not on the whole graph. It never builds the dominance frontiers themselves, which can grow quadratically with the node count; ControlFlow.dominanceFrontiers returns them as a graph.
Instances are immutable.
Memory: 16 x nodeCount bytes, plus the
Dominatorsit was built from, which stay reachable as long as it is held.