pub struct Cfg { /* private fields */ }

Implementations§

Source§

impl Cfg

Source

pub fn entry_block(&self) -> &BasicBlock

Returns the entry (first) block of the CFG.

Source

pub fn get_basic_block(&self, index: Index) -> Option<&BasicBlock>

Source

pub fn len(&self) -> usize

Returns the number of basic blocks in the CFG.

Source

pub fn is_empty(&self) -> bool

Returns true if the CFG is empty.

Source

pub fn into_ssa(self) -> SSAResult<Cfg>

Convert the CFG into SSA form.

Source

pub fn name(&self) -> &str

Get the name of the corresponding function or template.

Source

pub fn file_id(&self) -> &Option<FileID>

Get the file ID for the corresponding function or template.

Source

pub fn definition_type(&self) -> &DefinitionType

Source

pub fn constants(&self) -> &UsefulConstants

Source

pub fn parameters(&self) -> &Parameters

Returns the parameter data for the corresponding function or template.

Source

pub fn declarations(&self) -> &Declarations

Returns the variable declaration for the CFG.

Source

pub fn variables(&self) -> impl Iterator<Item = &VariableName>

Returns an iterator over the set of variables defined by the CFG.

Source

pub fn input_signals(&self) -> impl Iterator<Item = &VariableName>

Returns an iterator over the input signals of the CFG.

Source

pub fn output_signals(&self) -> impl Iterator<Item = &VariableName>

Returns an iterator over the output signals of the CFG.

Source

pub fn get_declaration(&self, name: &VariableName) -> Option<&Declaration>

Returns the declaration of the given variable.

Source

pub fn get_type(&self, name: &VariableName) -> Option<&VariableType>

Returns the type of the given variable.

Source

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.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BasicBlock>

Returns a mutable iterator over the basic blocks in the CFG.

Source

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.)

Source

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.

Source

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.)

Source

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.)

Source

pub fn get_predecessors(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>

Returns the predecessors of the given basic block.

Source

pub fn get_successors(&self, basic_block: &BasicBlock) -> Vec<&BasicBlock>

Returns the successors of the given basic block.

Source

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.

Source

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.

Source

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§

Source§

impl Debug for Cfg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Cfg

§

impl RefUnwindSafe for Cfg

§

impl Send for Cfg

§

impl Sync for Cfg

§

impl Unpin for Cfg

§

impl UnwindSafe for Cfg

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V