pub struct Cfg { /* private fields */ }Implementations
sourceimpl Cfg
impl Cfg
sourcepub fn entry_block(&self) -> &BasicBlock
pub fn entry_block(&self) -> &BasicBlock
Returns the entry (first) block of the CFG.
pub fn get_basic_block(&self, index: Index) -> Option<&BasicBlock>
sourcepub fn file_id(&self) -> &Option<FileID>
pub fn file_id(&self) -> &Option<FileID>
Get the file ID for the corresponding function or template.
pub fn definition_type(&self) -> &DefinitionType
pub fn constants(&self) -> &UsefulConstants
sourcepub fn parameters(&self) -> &Parameters
pub fn parameters(&self) -> &Parameters
Returns the parameter data for the corresponding function or template.
sourcepub fn declarations(&self) -> &Declarations
pub fn declarations(&self) -> &Declarations
Returns the variable declaration for the CFG.
sourcepub fn variables(&self) -> impl Iterator<Item = &VariableName>
pub fn variables(&self) -> impl Iterator<Item = &VariableName>
Returns an iterator over the set of variables defined by the CFG.
sourcepub fn get_declaration(&self, name: &VariableName) -> Option<&Declaration>
pub fn get_declaration(&self, name: &VariableName) -> Option<&Declaration>
Returns the declaration of the given variable.
sourcepub fn get_type(&self, name: &VariableName) -> Option<&VariableType>
pub fn get_type(&self, name: &VariableName) -> Option<&VariableType>
Returns the type of the given variable.
sourcepub fn iter(&self) -> impl Iterator<Item = &BasicBlock>
pub fn iter(&self) -> impl Iterator<Item = &BasicBlock>
Returns an iterator over the basic blocks in the CFG. This iterator
guarantees that if i dominates j, then i comes before j.
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BasicBlock>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BasicBlock>
Returns a mutable iterator over the basic blocks in the CFG.
sourcepub fn get_dominators(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>
pub fn get_dominators(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>
Returns the dominators of the given basic block. The basic block i
dominates j if any path from the entry point to j must contain i.
(Note that this relation is reflexive, so i always dominates itself.)
sourcepub fn get_immediate_dominator(
&self,
basic_block: &BasicBlock
) -> Option<&BasicBlock>
pub fn get_immediate_dominator(
&self,
basic_block: &BasicBlock
) -> Option<&BasicBlock>
Returns the immediate dominator of the basic block (that is, the predecessor of the node in the CFG dominator tree), if it exists.
sourcepub fn get_dominator_successors(
&self,
basic_block: &BasicBlock
) -> Vec<&BasicBlock>
pub fn get_dominator_successors(
&self,
basic_block: &BasicBlock
) -> Vec<&BasicBlock>
Get immediate successors of the basic block in the CFG dominator tree.
(For a definition of the dominator relation, see CFG::get_dominators.)
sourcepub fn get_dominance_frontier(
&self,
basic_block: &BasicBlock
) -> Vec<&BasicBlock>
pub fn get_dominance_frontier(
&self,
basic_block: &BasicBlock
) -> Vec<&BasicBlock>
Returns the dominance frontier of the basic block. The dominance
frontier of i is defined as all basic blocks j such that i
dominates an immediate predecessor of j, but i does not strictly
dominate j. (j is where is dominance ends.)
sourcepub fn get_predecessors(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>
pub fn get_predecessors(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>
Returns the predecessors of the given basic block.
sourcepub fn get_successors(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>
pub fn get_successors(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>
Returns the successors of the given basic block.
sourcepub fn get_interval(
&self,
start_block: &BasicBlock,
end_block: &BasicBlock
) -> Vec<&BasicBlock>
pub fn get_interval(
&self,
start_block: &BasicBlock,
end_block: &BasicBlock
) -> Vec<&BasicBlock>
Returns all block in the interval [start_block, end_block). That is, all successors of the starting block (including the starting block) which are also predecessors of the end block.
sourcepub fn get_true_branch(&self, header_block: &BasicBlock) -> Vec<&BasicBlock>
pub fn get_true_branch(&self, header_block: &BasicBlock) -> Vec<&BasicBlock>
Returns the basic blocks corresponding to the true branch of the if-statement at the end of the given header block.
Panics
This method panics if the given block does not end with an if-statement node.
sourcepub fn get_false_branch(&self, header_block: &BasicBlock) -> Vec<&BasicBlock>
pub fn get_false_branch(&self, header_block: &BasicBlock) -> Vec<&BasicBlock>
Returns the basic blocks corresponding to the false branch of the if-statement at the end of the given header block.
Panics
This method panics if the given block does not end with an if-statement node.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Cfg
impl Send for Cfg
impl Sync for Cfg
impl Unpin for Cfg
impl UnwindSafe for Cfg
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more