[−][src]Struct cranelift_codegen::dominator_tree::DominatorTree
The dominator tree for a single function.
Methods
impl DominatorTree
[src]
Methods for querying the dominator tree.
pub fn is_reachable(&self, ebb: Ebb) -> bool
[src]
Is ebb
reachable from the entry block?
pub fn cfg_postorder(&self) -> &[Ebb]
[src]
Get the CFG post-order of EBBs 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, ebb: Ebb) -> Option<Inst>
[src]
Returns the immediate dominator of ebb
.
The immediate dominator of an extended 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 EBB.
A branch or jump is said to dominate ebb
if all control flow paths from the function
entry to ebb
must go through the branch.
The immediate dominator is the dominator that is closest to ebb
. All other dominators
also dominate the immediate dominator.
This returns None
if ebb
is not reachable from the entry EBB, or if it is the entry EBB
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]
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
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 EBB, compare their relative position in the EBB.
pub fn dominates<A, B>(&self, a: A, b: B, layout: &Layout) -> bool where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
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 EBB, but otherwise returns false
if either block
is unreachable.
An instruction is considered to dominate itself.
pub fn last_dominator<B>(&self, a: Ebb, b: B, layout: &Layout) -> Option<Inst> where
B: Into<ExpandedProgramPoint>,
[src]
B: Into<ExpandedProgramPoint>,
Find the last instruction in a
that dominates b
.
If no instructions in a
dominate b
, return None
.
pub fn common_dominator(
&self,
a: BasicBlock,
b: BasicBlock,
layout: &Layout
) -> BasicBlock
[src]
&self,
a: BasicBlock,
b: BasicBlock,
layout: &Layout
) -> BasicBlock
Compute the common dominator of two basic blocks.
Both basic blocks are assumed to be reachable.
impl DominatorTree
[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]
Allocate and compute a dominator tree.
pub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph)
[src]
Reset and compute a CFG post-order and dominator tree.
pub fn clear(&mut self)
[src]
Clear the data structures used to represent the dominator tree. This will leave the tree in
a state where is_valid()
returns false.
pub fn is_valid(&self) -> bool
[src]
Check if the dominator tree is in a valid state.
Note that this doesn't perform any kind of validity checks. It simply checks if the
compute()
method has been called since the last clear()
. It does not check that the
dominator tree is consistent with the CFG.
impl DominatorTree
[src]
pub fn recompute_split_ebb(
&mut self,
old_ebb: Ebb,
new_ebb: Ebb,
split_jump_inst: Inst
)
[src]
&mut self,
old_ebb: Ebb,
new_ebb: Ebb,
split_jump_inst: Inst
)
When splitting an Ebb
using Layout::split_ebb
, you can use this method to update
the dominator tree locally rather than recomputing it.
old_ebb
is the Ebb
before splitting, and new_ebb
is the Ebb
which now contains
the second half of old_ebb
. split_jump_inst
is the terminator jump instruction of
old_ebb
that points to new_ebb
.
Auto Trait Implementations
impl Send for DominatorTree
impl Sync for DominatorTree
impl Unpin for DominatorTree
impl RefUnwindSafe for DominatorTree
impl UnwindSafe for DominatorTree
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,