struct Inliner<'tcx> {
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    codegen_fn_attrs: &'tcx CodegenFnAttrs,
    history: Vec<DefId>,
    changed: bool,
}

Fields§

§tcx: TyCtxt<'tcx>§param_env: ParamEnv<'tcx>§codegen_fn_attrs: &'tcx CodegenFnAttrs

Caller codegen attributes.

§history: Vec<DefId>

Stack of inlined instances. We only check the DefId and not the args because we want to avoid inlining cases of polymorphic recursion. The number of DefIds is finite, so checking history is enough to ensure that we do not loop endlessly while inlining.

§changed: bool

Indicates that the caller body has been modified.

Implementations§

source§

impl<'tcx> Inliner<'tcx>

source

fn process_blocks( &mut self, caller_body: &mut Body<'tcx>, blocks: Range<BasicBlock> )

source

fn try_inlining( &self, caller_body: &mut Body<'tcx>, callsite: &CallSite<'tcx> ) -> Result<Range<BasicBlock>, &'static str>

Attempts to inline a callsite into the caller body. When successful returns basic blocks containing the inlined body. Otherwise returns an error describing why inlining didn’t take place.

source

fn check_mir_is_available( &self, caller_body: &Body<'tcx>, callee: &Instance<'tcx> ) -> Result<(), &'static str>

source

fn resolve_callsite( &self, caller_body: &Body<'tcx>, bb: BasicBlock, bb_data: &BasicBlockData<'tcx> ) -> Option<CallSite<'tcx>>

source

fn check_codegen_attributes( &self, callsite: &CallSite<'tcx>, callee_attrs: &CodegenFnAttrs ) -> Result<(), &'static str>

Returns an error if inlining is not possible based on codegen attributes alone. A success indicates that inlining decision should be based on other criteria.

source

fn check_mir_body( &self, callsite: &CallSite<'tcx>, callee_body: &Body<'tcx>, callee_attrs: &CodegenFnAttrs ) -> Result<(), &'static str>

Returns inlining decision that is based on the examination of callee MIR body. Assumes that codegen attributes have been checked for compatibility already.

source

fn inline_call( &self, caller_body: &mut Body<'tcx>, callsite: &CallSite<'tcx>, callee_body: Body<'tcx> )

source

fn make_call_args( &self, args: Vec<Operand<'tcx>>, callsite: &CallSite<'tcx>, caller_body: &mut Body<'tcx>, callee_body: &Body<'tcx> ) -> Vec<Local>

source

fn create_temp_if_necessary( &self, arg: Operand<'tcx>, callsite: &CallSite<'tcx>, caller_body: &mut Body<'tcx> ) -> Local

If arg is already a temporary, returns it. Otherwise, introduces a fresh temporary T and an instruction T = arg, and returns T.

source

fn new_call_temp( &self, caller_body: &mut Body<'tcx>, callsite: &CallSite<'tcx>, ty: Ty<'tcx> ) -> Local

Introduces a new temporary into the caller body that is live for the duration of the call.

Auto Trait Implementations§

§

impl<'tcx> !RefUnwindSafe for Inliner<'tcx>

§

impl<'tcx> !Send for Inliner<'tcx>

§

impl<'tcx> !Sync for Inliner<'tcx>

§

impl<'tcx> Unpin for Inliner<'tcx>

§

impl<'tcx> !UnwindSafe for Inliner<'tcx>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 56 bytes