pub struct DominatorTree<'m> { /* private fields */ }
Expand description

The dominator tree for a particular function.

To construct a DominatorTree, use FunctionAnalysis, which you can get from ModuleAnalysis.

Implementations§

source§

impl<'m> DominatorTree<'m>

source

pub fn idom(&self, block: &'m Name) -> Option<&'m Name>

Get the immediate dominator of the basic block with the given Name.

This will be None for the entry block or for any unreachable blocks, and Some for all other blocks.

A block bbX is the immediate dominator of bbY if and only if:

  • bbX strictly dominates bbY, i.e., bbX appears on every control-flow path from the entry block to bbY (but bbX =/= bbY)
  • Of the blocks that strictly dominate bbY, bbX is the closest to bbY (farthest from entry) along paths from the entry block to bbY
source

pub fn idom_of_return(&self) -> Option<&'m Name>

Get the immediate dominator of CFGNode::Return.

This will be the block bbX such that:

  • bbX strictly dominates CFGNode::Return, i.e., bbX appears on every control-flow path through the function (but bbX =/= CFGNode::Return)
  • Of the blocks that strictly dominate CFGNode::Return, bbX is the closest to CFGNode::Return (farthest from entry) along paths through the function

If the return node is unreachable (e.g., due to an infinite loop in the function), then the return node has no immediate dominator, and None will be returned.

source

pub fn children<'s>( &'s self, block: &'m Name ) -> impl Iterator<Item = CFGNode<'m>> + 's

Get the children of the given basic block in the dominator tree, i.e., get all the blocks which are immediately dominated by block.

See notes on idom().

source

pub fn dominates(&self, node_a: CFGNode<'m>, node_b: CFGNode<'m>) -> bool

Does node_a dominate node_b?

Note that every node dominates itself by definition, so if node_a == node_b, this returns true. See also strictly_dominates()

source

pub fn strictly_dominates( &self, node_a: CFGNode<'m>, node_b: CFGNode<'m> ) -> bool

Does node_a strictly dominate node_b?

This is the same as dominates(), except that if node_a == node_b, this returns false.

source

pub fn entry(&self) -> &'m Name

Get the Name of the entry block for the function

Auto Trait Implementations§

§

impl<'m> RefUnwindSafe for DominatorTree<'m>

§

impl<'m> Send for DominatorTree<'m>

§

impl<'m> Sync for DominatorTree<'m>

§

impl<'m> Unpin for DominatorTree<'m>

§

impl<'m> UnwindSafe for DominatorTree<'m>

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>,

§

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>,

§

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.