pub struct ControlFlowGraph { /* private fields */ }Expand description
Control Flow Graph for a function.
Implementations§
Source§impl ControlFlowGraph
impl ControlFlowGraph
Sourcepub fn add_edge(
&mut self,
from: usize,
to: usize,
label: impl Into<String>,
) -> AnalysisResult<()>
pub fn add_edge( &mut self, from: usize, to: usize, label: impl Into<String>, ) -> AnalysisResult<()>
Add an edge from one block to another.
Sourcepub fn add_statement(
&mut self,
block_id: usize,
stmt: Statement,
) -> AnalysisResult<()>
pub fn add_statement( &mut self, block_id: usize, stmt: Statement, ) -> AnalysisResult<()>
Add a statement to a block.
Sourcepub fn mark_exit(&mut self, block_id: usize) -> AnalysisResult<()>
pub fn mark_exit(&mut self, block_id: usize) -> AnalysisResult<()>
Mark a block as an exit block.
Sourcepub fn compute_dominance(&mut self) -> AnalysisResult<()>
pub fn compute_dominance(&mut self) -> AnalysisResult<()>
Compute dominance relationships.
Sourcepub fn detect_loops(&mut self) -> AnalysisResult<Vec<Loop>>
pub fn detect_loops(&mut self) -> AnalysisResult<Vec<Loop>>
Detect loops in the CFG.
Sourcepub fn reachable(&self, from: usize) -> AnalysisResult<Vec<usize>>
pub fn reachable(&self, from: usize) -> AnalysisResult<Vec<usize>>
Get all reachable blocks from a starting block.
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Get block count.
Trait Implementations§
Source§impl Clone for ControlFlowGraph
impl Clone for ControlFlowGraph
Source§fn clone(&self) -> ControlFlowGraph
fn clone(&self) -> ControlFlowGraph
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ControlFlowGraph
impl Debug for ControlFlowGraph
Auto Trait Implementations§
impl Freeze for ControlFlowGraph
impl RefUnwindSafe for ControlFlowGraph
impl Send for ControlFlowGraph
impl Sync for ControlFlowGraph
impl Unpin for ControlFlowGraph
impl UnsafeUnpin for ControlFlowGraph
impl UnwindSafe for ControlFlowGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more