pub trait SSABasicBlock<Cfg: SSAConfig>: DirectedGraphNode {
    // Required methods
    fn prepend_statement(&mut self, stmt: Cfg::Statement);
    fn statements<'a>(
        &'a self,
    ) -> Box<dyn Iterator<Item = &'a Cfg::Statement> + 'a>;
    fn statements_mut<'a>(
        &'a mut self,
    ) -> Box<dyn Iterator<Item = &'a mut Cfg::Statement> + 'a>;

    // Provided methods
    fn variables_written(&self) -> HashSet<Cfg::Variable> { ... }
    fn has_phi_statement(&self, var: &Cfg::Variable) -> bool { ... }
    fn insert_phi_statement(
        &mut self,
        var: &Cfg::Variable,
        env: &Cfg::Environment,
    ) { ... }
    fn update_phi_statements(&mut self, env: &Cfg::Environment) { ... }
    fn insert_ssa_variables(
        &mut self,
        env: &mut Cfg::Environment,
    ) -> SSAResult<()> { ... }
}
Expand description

A basic block containing a (possibly empty) list of statements.

Required Methods§

Source

fn prepend_statement(&mut self, stmt: Cfg::Statement)

Add the given statement to the front of the basic block.

Source

fn statements<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Cfg::Statement> + 'a>

Returns an iterator over the statements of the basic block.

Note: We have to use dynamic dispatch here because returning impl Trait from trait methods is not a thing yet. For details, see rust-lang.github.io/impl-trait-initiative/RFCs/rpit-in-traits.html)

Source

fn statements_mut<'a>( &'a mut self, ) -> Box<dyn Iterator<Item = &'a mut Cfg::Statement> + 'a>

Returns an iterator over mutable references to the statements of the basic block.

Note: We have to use dynamic dispatch here because returning impl Trait from trait methods is not a thing yet. For details, see rust-lang.github.io/impl-trait-initiative/RFCs/rpit-in-traits.html)

Provided Methods§

Source

fn variables_written(&self) -> HashSet<Cfg::Variable>

Returns the set of variables written by the basic block.

Source

fn has_phi_statement(&self, var: &Cfg::Variable) -> bool

Returns true if the basic block has a phi statement for the given variable.

Source

fn insert_phi_statement(&mut self, var: &Cfg::Variable, env: &Cfg::Environment)

Inserts a new phi statement for the given variable at the top of the basic block.

Source

fn update_phi_statements(&mut self, env: &Cfg::Environment)

Updates the RHS of each phi statement in the basic block with the SSA variable versions from the given environment.

Source

fn insert_ssa_variables(&mut self, env: &mut Cfg::Environment) -> SSAResult<()>

Updates each variable to the corresponding SSA variable, in each statement in the basic block.

Implementors§