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.