Struct PostDominatorTree

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

The postdominator tree for a particular function.

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

Implementations§

Source§

impl<'m> PostDominatorTree<'m>

Source

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

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

This will be None for unreachable blocks (or, in some cases, when the function return is unreachable, e.g. due to an infinite loop), and Some for all other blocks.

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

  • bbX strictly postdominates bbY, i.e., bbX appears on every control-flow path from bbY to the function exit (but bbX =/= bbY)
  • Of the blocks that strictly postdominate bbY, bbX is the closest to bbY (farthest from exit) along paths from bbY to the function exit

If the immediate postdominator is CFGNode::Return, that indicates that there is no single basic block that postdominates the given block.

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 postdominator tree, i.e., get all the blocks which are immediately postdominated by block.

See notes on ipostdom().

Source

pub fn children_of_return<'s>(&'s self) -> impl Iterator<Item = &'m Name> + 's

Get the children of CFGNode::Return in the postdominator tree, i.e., get all the blocks which are immediately postdominated by CFGNode::Return.

See notes on ipostdom().

Source

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

Does node_a postdominate node_b?

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

Source

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

Does node_a strictly postdominate node_b?

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

Auto Trait Implementations§

§

impl<'m> Freeze for PostDominatorTree<'m>

§

impl<'m> RefUnwindSafe for PostDominatorTree<'m>

§

impl<'m> Send for PostDominatorTree<'m>

§

impl<'m> Sync for PostDominatorTree<'m>

§

impl<'m> Unpin for PostDominatorTree<'m>

§

impl<'m> UnwindSafe for PostDominatorTree<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.