Struct rustc_mir_transform::inline::Inliner
source · 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 DefId
s 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>
impl<'tcx> Inliner<'tcx>
fn process_blocks( &mut self, caller_body: &mut Body<'tcx>, blocks: Range<BasicBlock> )
sourcefn try_inlining(
&self,
caller_body: &mut Body<'tcx>,
callsite: &CallSite<'tcx>
) -> Result<Range<BasicBlock>, &'static str>
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.
fn check_mir_is_available( &self, caller_body: &Body<'tcx>, callee: &Instance<'tcx> ) -> Result<(), &'static str>
fn resolve_callsite( &self, caller_body: &Body<'tcx>, bb: BasicBlock, bb_data: &BasicBlockData<'tcx> ) -> Option<CallSite<'tcx>>
sourcefn check_codegen_attributes(
&self,
callsite: &CallSite<'tcx>,
callee_attrs: &CodegenFnAttrs
) -> Result<(), &'static str>
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.
sourcefn check_mir_body(
&self,
callsite: &CallSite<'tcx>,
callee_body: &Body<'tcx>,
callee_attrs: &CodegenFnAttrs
) -> Result<(), &'static str>
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.
fn inline_call( &self, caller_body: &mut Body<'tcx>, callsite: &CallSite<'tcx>, callee_body: Body<'tcx> )
fn make_call_args( &self, args: Vec<Operand<'tcx>>, callsite: &CallSite<'tcx>, caller_body: &mut Body<'tcx>, callee_body: &Body<'tcx> ) -> Vec<Local>
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> 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
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