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§
Sourcefn prepend_statement(&mut self, stmt: Cfg::Statement)
fn prepend_statement(&mut self, stmt: Cfg::Statement)
Add the given statement to the front of the basic block.
Sourcefn statements<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Cfg::Statement> + 'a>
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)
Sourcefn statements_mut<'a>(
&'a mut self,
) -> Box<dyn Iterator<Item = &'a mut Cfg::Statement> + 'a>
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§
Sourcefn variables_written(&self) -> HashSet<Cfg::Variable>
fn variables_written(&self) -> HashSet<Cfg::Variable>
Returns the set of variables written by the basic block.
Sourcefn has_phi_statement(&self, var: &Cfg::Variable) -> bool
fn has_phi_statement(&self, var: &Cfg::Variable) -> bool
Returns true if the basic block has a phi statement for the given variable.
Sourcefn insert_phi_statement(&mut self, var: &Cfg::Variable, env: &Cfg::Environment)
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.
Sourcefn update_phi_statements(&mut self, env: &Cfg::Environment)
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.
Sourcefn insert_ssa_variables(&mut self, env: &mut Cfg::Environment) -> SSAResult<()>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".