Struct cranelift_codegen::loop_analysis::LoopAnalysis
source · pub struct LoopAnalysis { /* private fields */ }
Expand description
Loop tree information for a single function.
Loops are referenced by the Loop object, and for each loop you can access its header block, its eventual parent in the loop tree and all the block belonging to the loop.
Implementations§
source§impl LoopAnalysis
impl LoopAnalysis
Methods for querying the loop analysis.
sourcepub fn new() -> Self
pub fn new() -> Self
Allocate a new blank loop analysis struct. Use compute
to compute the loop analysis for
a function.
sourcepub fn loop_header(&self, lp: Loop) -> Block
pub fn loop_header(&self, lp: Loop) -> Block
Returns the header block of a particular loop.
The characteristic property of a loop header block is that it dominates some of its predecessors.
sourcepub fn loop_parent(&self, lp: Loop) -> Option<Loop>
pub fn loop_parent(&self, lp: Loop) -> Option<Loop>
Return the eventual parent of a loop in the loop tree.
sourcepub fn is_in_loop(&self, block: Block, lp: Loop) -> bool
pub fn is_in_loop(&self, block: Block, lp: Loop) -> bool
Determine if a Block belongs to a loop by running a finger along the loop tree.
Returns true
if block
is in loop lp
.
sourcepub fn is_child_loop(&self, child: Loop, parent: Loop) -> bool
pub fn is_child_loop(&self, child: Loop, parent: Loop) -> bool
Determines if a loop is contained in another loop.
is_child_loop(child,parent)
returns true
if and only if child
is a child loop of
parent
(or child == parent
).
source§impl LoopAnalysis
impl LoopAnalysis
sourcepub fn compute(
&mut self,
func: &Function,
cfg: &ControlFlowGraph,
domtree: &DominatorTree
)
pub fn compute( &mut self, func: &Function, cfg: &ControlFlowGraph, domtree: &DominatorTree )
Detects the loops in a function. Needs the control flow graph and the dominator tree.