pub struct ControlFlowGraph {
pub blocks: IndexVec<BasicBlockId, BasicBlock>,
/* private fields */
}Fields§
§blocks: IndexVec<BasicBlockId, BasicBlock>Implementations§
Source§impl ControlFlowGraph
impl ControlFlowGraph
pub fn new(blocks: IndexVec<BasicBlockId, BasicBlock>, mir: &Mir) -> Self
pub fn start(&self) -> BasicBlockId
pub const fn end(&self) -> BasicBlockId
pub fn postorder(&self) -> Postorder
pub fn postorder_iter(&self) -> PostorderIter<'_> ⓘ
pub fn postorder_itermut(&mut self) -> PostorderIterMut<'_> ⓘ
pub fn reverse_postorder(&self) -> ReversePostorder ⓘ
pub fn reverse_postorder_iter(&self) -> ReversePostorderIter<'_> ⓘ
pub fn reverse_postorder_itermut(&mut self) -> ReversePostorderIterMut<'_> ⓘ
pub fn predecessors(&self, bb: BasicBlockId) -> &[BasicBlockId]
pub fn containing_block(&self, stmt: StatementId) -> Option<BasicBlockId>
pub fn successors(&self, bb: BasicBlockId) -> Successors ⓘ
pub fn simplify(&mut self)
pub fn remove_dead_code(&mut self, dead_blocks: &BitSet<BasicBlockId>)
Source§impl ControlFlowGraph
impl ControlFlowGraph
pub fn constant_fold( &mut self, fold: &mut impl ConstantFolder, udg: &mut UseDefGraph, known_values: &mut ConstantFoldState, write_intermediate: bool, )
Source§impl ControlFlowGraph
impl ControlFlowGraph
pub fn backward_variable_slice( &mut self, var: VariableId, pdg: &ProgramDependenceGraph, )
pub fn backward_variable_slice_assuming_input( &mut self, input: BitSet<StatementId>, var: VariableId, pdg: &ProgramDependenceGraph, )
pub fn backward_variable_slice_with_variables_as_input( &mut self, input: impl Iterator<Item = VariableId>, var: VariableId, pdg: &ProgramDependenceGraph, )
pub fn backward_slice( &mut self, relevant_stmts: BitSet<StatementId>, assumed_stmts: BitSet<StatementId>, pdg: &ProgramDependenceGraph, )
Source§impl ControlFlowGraph
impl ControlFlowGraph
Sourcepub fn control_dependence_graph(&self) -> ControlDependenceGraph
pub fn control_dependence_graph(&self) -> ControlDependenceGraph
Calculates the Control Dependence Graph of a CFG. A basic block is control dependent on a statement if this statements decides whether the block is executed (for example an if statement). Statements that cause control flow are not represented as statements but as basic block terminators in the cfg. As such the control dependence Graph simply maps basic blocks to all basics block whos terminator affats whether a statements is executed
Sourcepub fn control_dependence_graph_from_ipdom(
&self,
ipdom: &IPDOM,
) -> ControlDependenceGraph
pub fn control_dependence_graph_from_ipdom( &self, ipdom: &IPDOM, ) -> ControlDependenceGraph
The backend for [control_dependence_graph] which can be used when ipdom(bb has already been calcualted to avoid recalculation
Source§impl ControlFlowGraph
impl ControlFlowGraph
Sourcepub fn post_dominators(&self) -> IPDOM
pub fn post_dominators(&self) -> IPDOM
An implementation of the simple fast algorithm by [Keith 2006].
It is adobted for post dominance (simply the dominance of the reverse cfg).
returns - immediate Post_dominator for every cfg node (ipdom(n))
Trait Implementations§
Source§impl Clone for ControlFlowGraph
impl Clone for ControlFlowGraph
Source§fn clone(&self) -> ControlFlowGraph
fn clone(&self) -> ControlFlowGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more