pub trait SSABasicBlock<Cfg: SSAConfig>: DirectedGraphNode {
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>;
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.