pub struct PostDominatorTree { /* private fields */ }Expand description
The post-dominator tree for a single function.
Implementations§
Source§impl PostDominatorTree
impl PostDominatorTree
Sourcepub fn new() -> Self
pub fn new() -> Self
Allocate a new blank post-dominator tree.
Use compute to compute the post-dominator tree for a function.
Sourcepub fn with_function(func: &Function, cfg: &ControlFlowGraph) -> Self
pub fn with_function(func: &Function, cfg: &ControlFlowGraph) -> Self
Allocate and compute a post-dominator tree.
Sourcepub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph)
pub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph)
Reset and compute the post-dominator tree for func, using the
control-flow graph cfg.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the data structures used to represent the post-dominator tree.
This will leave the tree in a state where is_valid() returns false.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Check if the post-dominator tree is in a valid state.
Note that this doesn’t perform any kind of validity checks. It simply
checks if the compute() method has been called since the last
clear(). It does not check that the post-dominator tree is consistent
with the CFG.
Sourcepub fn immediate_post_dominator(&self, block: Block) -> Option<Block>
pub fn immediate_post_dominator(&self, block: Block) -> Option<Block>
Returns the immediate post-dominator of block.
block_a is said to post-dominate block_b if all control-flow paths
from block_b out of this function (via return or trap) must go through
block_a.
The immediate post-dominator is the post-dominator that is closest to
block. All other post-dominators also post-dominate the immediate
post-dominator.
This returns None if block diverges and cannot exit the function, or
if block directly exits the function (returns or traps).
Sourcepub fn post_dominates<A, B>(&self, a: A, b: B, layout: &Layout) -> bool
pub fn post_dominates<A, B>(&self, a: A, b: B, layout: &Layout) -> bool
Returns true if every path from b out of this function (via return
or trap) must go through a.
Sourcepub fn block_post_dominates(&self, block_a: Block, block_b: Block) -> bool
pub fn block_post_dominates(&self, block_a: Block, block_b: Block) -> bool
Returns true if every path from b to a function exit (return or
trap) must go through a.