pub struct CSEPass { /* private fields */ }Expand description
Common Subexpression Elimination pass.
Usage:
use oxilean_codegen::opt_cse::{CSEPass, CseConfig};
let mut pass = CSEPass::new(CseConfig::default());
// pass.run(&mut decls);Implementations§
Source§impl CSEPass
impl CSEPass
Sourcepub fn run(&mut self, decls: &mut [LcnfFunDecl])
pub fn run(&mut self, decls: &mut [LcnfFunDecl])
Run CSE over all function declarations, modifying them in place.
Sourcepub fn global_cse(&mut self, decl: &LcnfFunDecl) -> LcnfFunDecl
pub fn global_cse(&mut self, decl: &LcnfFunDecl) -> LcnfFunDecl
Perform CSE on a single function declaration.
Sourcepub fn local_cse(&mut self, expr: &LcnfExpr) -> LcnfExpr
pub fn local_cse(&mut self, expr: &LcnfExpr) -> LcnfExpr
Perform local CSE on a single expression (no cross-branch sharing).
Sourcepub fn hash_expr(&self, value: &LcnfLetValue) -> Option<ExprKey>
pub fn hash_expr(&self, value: &LcnfLetValue) -> Option<ExprKey>
Compute the canonical hash key for a let-bound value.
Sourcepub fn find_available(
&self,
avail: &AvailableSet,
value: &LcnfLetValue,
) -> Option<LcnfVarId>
pub fn find_available( &self, avail: &AvailableSet, value: &LcnfLetValue, ) -> Option<LcnfVarId>
Look up expr in the available set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CSEPass
impl RefUnwindSafe for CSEPass
impl Send for CSEPass
impl Sync for CSEPass
impl Unpin for CSEPass
impl UnsafeUnpin for CSEPass
impl UnwindSafe for CSEPass
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