pub struct InlinePass {
pub config: InlineConfig,
pub fn_map: HashMap<String, LcnfFunDecl>,
pub profile: InlineProfile,
pub inlined_count: usize,
/* private fields */
}Expand description
The main inlining optimization pass.
Fields§
§config: InlineConfigConfiguration controlling inlining behaviour.
fn_map: HashMap<String, LcnfFunDecl>Map from function name to its LCNF declaration (for look-up during inlining).
profile: InlineProfileCall-frequency profile used for hot-path decisions.
inlined_count: usizeTotal number of inlinings performed so far.
Implementations§
Source§impl InlinePass
impl InlinePass
Sourcepub fn new(config: InlineConfig) -> Self
pub fn new(config: InlineConfig) -> Self
Create a new pass with the given configuration.
Sourcepub fn run(&mut self, decls: &mut [LcnfFunDecl])
pub fn run(&mut self, decls: &mut [LcnfFunDecl])
Main entry point: run the inlining pass over all declarations.
Sourcepub fn build_fn_map(&mut self, decls: &[LcnfFunDecl])
pub fn build_fn_map(&mut self, decls: &[LcnfFunDecl])
Build the internal function map from the current declaration list.
Sourcepub fn inline_decl(&mut self, decl: &mut LcnfFunDecl, ctx: &mut InliningContext)
pub fn inline_decl(&mut self, decl: &mut LcnfFunDecl, ctx: &mut InliningContext)
Inline call sites within a single function declaration.
Sourcepub fn inline_expr(&mut self, expr: &mut LcnfExpr, ctx: &mut InliningContext)
pub fn inline_expr(&mut self, expr: &mut LcnfExpr, ctx: &mut InliningContext)
Recursively walk an expression and inline call sites.
Sourcepub fn try_inline_call(
&mut self,
callee: &str,
args: &[LcnfArg],
) -> Option<LcnfExpr>
pub fn try_inline_call( &mut self, callee: &str, args: &[LcnfArg], ) -> Option<LcnfExpr>
Produce an inlined copy of callee applied to args (pure, no side-effects on self
except for the fresh-var counter).
Sourcepub fn report(&self) -> &InlineReport
pub fn report(&self) -> &InlineReport
Return the accumulated report for this pass.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InlinePass
impl RefUnwindSafe for InlinePass
impl Send for InlinePass
impl Sync for InlinePass
impl Unpin for InlinePass
impl UnsafeUnpin for InlinePass
impl UnwindSafe for InlinePass
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