pub struct LICMPass { /* private fields */ }Expand description
The main Loop Invariant Code Motion pass.
Implementations§
Source§impl LICMPass
impl LICMPass
Sourcepub fn new(config: LICMConfig) -> Self
pub fn new(config: LICMConfig) -> Self
Create a new LICM pass with the given configuration.
Sourcepub fn run(&mut self, decls: &mut [LcnfFunDecl])
pub fn run(&mut self, decls: &mut [LcnfFunDecl])
Run the LICM pass over all function declarations, mutating them in-place to hoist loop-invariant bindings.
Sourcepub fn find_loops(&self, decl: &LcnfFunDecl) -> Vec<LoopStructure>
pub fn find_loops(&self, decl: &LcnfFunDecl) -> Vec<LoopStructure>
Identify all loops in a function declaration by scanning for
recursive Let bindings (self-referencing variables).
Sourcepub fn is_loop_invariant(
&self,
value: &LcnfLetValue,
lp: &LoopStructure,
) -> bool
pub fn is_loop_invariant( &self, value: &LcnfLetValue, lp: &LoopStructure, ) -> bool
Check whether a LcnfLetValue is loop-invariant with respect to
the given loop structure (i.e., none of its free variables are
defined inside the loop body).
Sourcepub fn hoist_invariants(&mut self, decl: &mut LcnfFunDecl, lp: &LoopStructure)
pub fn hoist_invariants(&mut self, decl: &mut LcnfFunDecl, lp: &LoopStructure)
Hoist all loop-invariant bindings from lp into a preheader and
update decl.body accordingly.
Sourcepub fn report(&self) -> LICMReport
pub fn report(&self) -> LICMReport
Return a copy of the accumulated statistics report.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LICMPass
impl RefUnwindSafe for LICMPass
impl Send for LICMPass
impl Sync for LICMPass
impl Unpin for LICMPass
impl UnsafeUnpin for LICMPass
impl UnwindSafe for LICMPass
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