cranelift_codegen::dominator_tree

Struct DominatorTreePreorder

Source
pub struct DominatorTreePreorder { /* private fields */ }
Expand description

Optional pre-order information that can be computed for a dominator tree.

This data structure is computed from a DominatorTree and provides:

  • A forward traversable dominator tree through the children() iterator.
  • An ordering of blocks according to a dominator tree pre-order.
  • Constant time dominance checks at the block granularity.

The information in this auxiliary data structure is not easy to update when the control flow graph changes, which is why it is kept separate.

Implementations§

Source§

impl DominatorTreePreorder

Creating and computing the dominator tree pre-order.

Source

pub fn new() -> Self

Create a new blank DominatorTreePreorder.

Source

pub fn compute(&mut self, domtree: &DominatorTree, layout: &Layout)

Recompute this data structure to match domtree.

Source§

impl DominatorTreePreorder

Query interface for the dominator tree pre-order.

Source

pub fn children(&self, block: Block) -> ChildIter<'_>

Get an iterator over the direct children of block in the dominator tree.

These are the block’s whose immediate dominator is an instruction in block, ordered according to the CFG reverse post-order.

Source

pub fn dominates(&self, a: Block, b: Block) -> bool

Fast, constant time dominance check with block granularity.

This computes the same result as domtree.dominates(a, b), but in guaranteed fast constant time. This is less general than the DominatorTree method because it only works with block program points.

A block is considered to dominate itself.

Source

pub fn pre_cmp_block(&self, a: Block, b: Block) -> Ordering

Compare two blocks according to the dominator pre-order.

Source

pub fn pre_cmp<A, B>(&self, a: A, b: B, layout: &Layout) -> Ordering

Compare two program points according to the dominator tree pre-order.

This ordering of program points have the property that given a program point, pp, all the program points dominated by pp follow immediately and contiguously after pp in the order.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.