pub struct NaturalLoopsResult {
pub loops: AHashMap<i64, NaturalLoop>,
}Expand description
Natural loop detection result.
Contains all natural loops found in the CFG, indexed by their header nodes.
Fields§
§loops: AHashMap<i64, NaturalLoop>Map from header to its natural loop.
Each key is a loop header, and the value is the complete loop information including back-edges and body nodes.
Implementations§
Source§impl NaturalLoopsResult
impl NaturalLoopsResult
Sourcepub fn loop_with_header(&self, header: i64) -> Option<&NaturalLoop>
pub fn loop_with_header(&self, header: i64) -> Option<&NaturalLoop>
Sourcepub fn is_loop_header(&self, node: i64) -> bool
pub fn is_loop_header(&self, node: i64) -> bool
Sourcepub fn nesting_depth(&self, node: i64) -> usize
pub fn nesting_depth(&self, node: i64) -> usize
Sourcepub fn loops_at_depth(&self, depth: usize) -> Vec<&NaturalLoop>
pub fn loops_at_depth(&self, depth: usize) -> Vec<&NaturalLoop>
Sourcepub fn nesting_tree(&self) -> AHashMap<i64, Vec<i64>>
pub fn nesting_tree(&self) -> AHashMap<i64, Vec<i64>>
Builds loop nesting tree (parent headers -> child headers).
Returns a map where each key is a parent loop header and the value is a vector of child loop headers. This represents the direct nesting relationships (not transitive).
§Returns
Map from parent header to vector of child headers.
§Example
ⓘ
let tree = loops.nesting_tree();
for (&parent, children) in &tree {
println!("Loop {} contains inner loops: {:?}", parent, children);
}Trait Implementations§
Source§impl Clone for NaturalLoopsResult
impl Clone for NaturalLoopsResult
Source§fn clone(&self) -> NaturalLoopsResult
fn clone(&self) -> NaturalLoopsResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NaturalLoopsResult
impl RefUnwindSafe for NaturalLoopsResult
impl Send for NaturalLoopsResult
impl Sync for NaturalLoopsResult
impl Unpin for NaturalLoopsResult
impl UnwindSafe for NaturalLoopsResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more