pub struct Cfg { /* private fields */ }Implementations§
Source§impl 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 input_signals(&self) -> impl Iterator<Item = &VariableName>
pub fn input_signals(&self) -> impl Iterator<Item = &VariableName>
Returns an iterator over the input signals of the CFG.
Sourcepub fn output_signals(&self) -> impl Iterator<Item = &VariableName>
pub fn output_signals(&self) -> impl Iterator<Item = &VariableName>
Returns an iterator over the output signals of 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.