Skip to main content

InlinePass

Struct InlinePass 

Source
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: InlineConfig

Configuration controlling inlining behaviour.

§fn_map: HashMap<String, LcnfFunDecl>

Map from function name to its LCNF declaration (for look-up during inlining).

§profile: InlineProfile

Call-frequency profile used for hot-path decisions.

§inlined_count: usize

Total number of inlinings performed so far.

Implementations§

Source§

impl InlinePass

Source

pub fn new(config: InlineConfig) -> Self

Create a new pass with the given configuration.

Source

pub fn run(&mut self, decls: &mut [LcnfFunDecl])

Main entry point: run the inlining pass over all declarations.

Source

pub fn build_fn_map(&mut self, decls: &[LcnfFunDecl])

Build the internal function map from the current declaration list.

Source

pub fn inline_decl(&mut self, decl: &mut LcnfFunDecl, ctx: &mut InliningContext)

Inline call sites within a single function declaration.

Source

pub fn inline_expr(&mut self, expr: &mut LcnfExpr, ctx: &mut InliningContext)

Recursively walk an expression and inline call sites.

Source

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).

Source

pub fn report(&self) -> &InlineReport

Return the accumulated report for this pass.

Trait Implementations§

Source§

impl Default for InlinePass

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.