Struct cranelift_codegen::dominator_tree::DominatorTree [−][src]
pub struct DominatorTree { /* fields omitted */ }
Expand description
The dominator tree for a single function.
Implementations
impl DominatorTree
[src]
impl DominatorTree
[src]Methods for querying the dominator tree.
pub fn is_reachable(&self, block: Block) -> bool
[src]
pub fn is_reachable(&self, block: Block) -> bool
[src]Is block
reachable from the entry block?
pub fn cfg_postorder(&self) -> &[Block]ⓘ
[src]
pub fn cfg_postorder(&self) -> &[Block]ⓘ
[src]Get the CFG post-order of blocks that was used to compute the dominator tree.
Note that this post-order is not updated automatically when the CFG is modified. It is
computed from scratch and cached by compute()
.
pub fn idom(&self, block: Block) -> Option<Inst>
[src]
pub fn idom(&self, block: Block) -> Option<Inst>
[src]Returns the immediate dominator of block
.
The immediate dominator of a basic block is a basic block which we represent by the branch or jump instruction at the end of the basic block. This does not have to be the terminator of its block.
A branch or jump is said to dominate block
if all control flow paths from the function
entry to block
must go through the branch.
The immediate dominator is the dominator that is closest to block
. All other dominators
also dominate the immediate dominator.
This returns None
if block
is not reachable from the entry block, or if it is the entry block
which has no dominators.
pub fn rpo_cmp<A, B>(&self, a: A, b: B, layout: &Layout) -> Ordering where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]
pub fn rpo_cmp<A, B>(&self, a: A, b: B, layout: &Layout) -> Ordering where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]Compare two program points relative to a reverse post-order traversal of the control-flow graph.
Return Ordering::Less
if a
comes before b
in the RPO.
If a
and b
belong to the same block, compare their relative position in the block.
pub fn dominates<A, B>(&self, a: A, b: B, layout: &Layout) -> bool where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]
pub fn dominates<A, B>(&self, a: A, b: B, layout: &Layout) -> bool where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]Returns true
if a
dominates b
.
This means that every control-flow path from the function entry to b
must go through a
.
Dominance is ill defined for unreachable blocks. This function can always determine
dominance for instructions in the same block, but otherwise returns false
if either block
is unreachable.
An instruction is considered to dominate itself.
pub fn last_dominator<B>(&self, a: Block, b: B, layout: &Layout) -> Option<Inst> where
B: Into<ExpandedProgramPoint>,
[src]
pub fn last_dominator<B>(&self, a: Block, b: B, layout: &Layout) -> Option<Inst> where
B: Into<ExpandedProgramPoint>,
[src]Find the last instruction in a
that dominates b
.
If no instructions in a
dominate b
, return None
.
pub fn common_dominator(
&self,
a: BlockPredecessor,
b: BlockPredecessor,
layout: &Layout
) -> BlockPredecessor
[src]
pub fn common_dominator(
&self,
a: BlockPredecessor,
b: BlockPredecessor,
layout: &Layout
) -> BlockPredecessor
[src]Compute the common dominator of two basic blocks.
Both basic blocks are assumed to be reachable.
impl DominatorTree
[src]
impl DominatorTree
[src]pub fn new() -> Self
[src]
pub fn new() -> Self
[src]Allocate a new blank dominator tree. Use compute
to compute the dominator tree for a
function.
pub fn with_function(func: &Function, cfg: &ControlFlowGraph) -> Self
[src]
pub fn with_function(func: &Function, cfg: &ControlFlowGraph) -> Self
[src]Allocate and compute a dominator tree.
pub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph)
[src]
pub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph)
[src]Reset and compute a CFG post-order and dominator tree.