DominatorTree
struct DominatorTree : Sendable
extension DominatorTree: CustomStringConvertible
A tree whose nodes are basic blocks and where a node immediately dominates its children.
Definitions:
- A block
b1in a control-flow graph dominates a blockb2if every path from the entry tob2must go throughb1. By definition, every node dominates itself. - A block
b1strictly dominates a blockb2ifb1dominatesb2andb1 != b2. - A block
b1immediately dominates a blockb2ifb1strictly dominatesb2and there is no blockb3that strictly dominatesb2.
A dominator tree encodes the dominance relation of a control graph as a tree where a node is a basic blocks and its children are those it immediately dominates.
-
A node in the tree.
Declaration
Swift
typealias Node = Function.Blocks.Address -
The root of the tree.
Declaration
Swift
let root: Node -
The immediate dominators of each basic block.
-
Creates the dominator tree of
f, which is inm, using the givencfg.Declaration
Swift
init(function f: Function.ID, cfg: ControlFlowGraph, in m: Module) -
A collection containing the blocks in this tree in breadth-first order.
Declaration
Swift
var bfs: [Node] { get } -
Returns the immediate dominator of
block, if any. -
Returns a collection containing the strict dominators of
block. -
Returns
trueifadominatesb. -
Returns
trueif the instruction identified bydefinitiondominatesuse.Requires
definitionandusereside in the function associated with the true.Declaration
Swift
func dominates(definition: InstructionID, use: Use, in module: Module) -> Bool -
The Graphviz (dot) representation of the tree.
Declaration
Swift
var description: String { get }
View on GitHub