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>
impl<'m> PostDominatorTree<'m>
Sourcepub fn ipostdom(&self, block: &'m Name) -> Option<CFGNode<'m>>
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.
Sourcepub fn children<'s>(
&'s self,
block: &'m Name,
) -> impl Iterator<Item = CFGNode<'m>> + 's
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()
.
Sourcepub fn children_of_return<'s>(&'s self) -> impl Iterator<Item = &'m Name> + 's
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()
.
Sourcepub fn postdominates(&self, node_a: CFGNode<'m>, node_b: CFGNode<'m>) -> bool
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()
Sourcepub fn strictly_postdominates(
&self,
node_a: CFGNode<'m>,
node_b: CFGNode<'m>,
) -> bool
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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