Struct cranelift_codegen::machinst::abi_impl::ABICalleeImpl
source · [−]pub struct ABICalleeImpl<M: ABIMachineSpec> { /* private fields */ }
Expand description
ABI object for a function body.
Implementations
sourceimpl<M: ABIMachineSpec> ABICalleeImpl<M>
impl<M: ABIMachineSpec> ABICalleeImpl<M>
sourcepub fn new(f: &Function, flags: Flags) -> CodegenResult<Self>
pub fn new(f: &Function, flags: Flags) -> CodegenResult<Self>
Create a new body ABI instance.
Trait Implementations
sourceimpl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M>
impl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M>
sourcefn load_stackslot(
&self,
slot: StackSlot,
offset: u32,
ty: Type,
into_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
fn load_stackslot(
&self,
slot: StackSlot,
offset: u32,
ty: Type,
into_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
Load from a stackslot.
sourcefn store_stackslot(
&self,
slot: StackSlot,
offset: u32,
ty: Type,
from_regs: ValueRegs<Reg>
) -> SmallInstVec<Self::I>
fn store_stackslot(
&self,
slot: StackSlot,
offset: u32,
ty: Type,
from_regs: ValueRegs<Reg>
) -> SmallInstVec<Self::I>
Store to a stackslot.
sourcefn stackslot_addr(
&self,
slot: StackSlot,
offset: u32,
into_reg: Writable<Reg>
) -> Self::I
fn stackslot_addr(
&self,
slot: StackSlot,
offset: u32,
into_reg: Writable<Reg>
) -> Self::I
Produce an instruction that computes a stackslot address.
sourcefn load_spillslot(
&self,
slot: SpillSlot,
ty: Type,
into_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
fn load_spillslot(
&self,
slot: SpillSlot,
ty: Type,
into_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
Load from a spillslot.
sourcefn store_spillslot(
&self,
slot: SpillSlot,
ty: Type,
from_regs: ValueRegs<Reg>
) -> SmallInstVec<Self::I>
fn store_spillslot(
&self,
slot: SpillSlot,
ty: Type,
from_regs: ValueRegs<Reg>
) -> SmallInstVec<Self::I>
Store to a spillslot.
sourcefn temp_needed(&self) -> Option<Type>
fn temp_needed(&self) -> Option<Type>
Does the ABI-body code need a temp reg (and if so, of what type)? One
will be provided to init()
as the maybe_tmp
arg if so. Read more
sourcefn init(&mut self, maybe_tmp: Option<Writable<Reg>>)
fn init(&mut self, maybe_tmp: Option<Writable<Reg>>)
Initialize. This is called after the ABICallee is constructed because it may be provided with a temp vreg, which can only be allocated once the lowering context exists. Read more
sourcefn accumulate_outgoing_args_size(&mut self, size: u32)
fn accumulate_outgoing_args_size(&mut self, size: u32)
Accumulate outgoing arguments. This ensures that at least SIZE bytes are allocated in the prologue to be available for use in function calls to hold arguments and/or return values. If this function is called multiple times, the maximum of all SIZE values will be available. Read more
sourcefn num_retvals(&self) -> usize
fn num_retvals(&self) -> usize
Number of return values.
sourcefn num_stackslots(&self) -> usize
fn num_stackslots(&self) -> usize
Number of stack slots (not spill slots).
sourcefn gen_copy_arg_to_regs(
&self,
idx: usize,
into_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
fn gen_copy_arg_to_regs(
&self,
idx: usize,
into_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
Generate an instruction which copies an argument to a destination register. Read more
sourcefn arg_is_needed_in_body(&self, idx: usize) -> bool
fn arg_is_needed_in_body(&self, idx: usize) -> bool
Is the given argument needed in the body (as opposed to, e.g., serving only as a special ABI-specific placeholder)? This controls whether lowering will copy it to a virtual reg use by CLIF instructions. Read more
sourcefn gen_copy_regs_to_retval(
&self,
idx: usize,
from_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
fn gen_copy_regs_to_retval(
&self,
idx: usize,
from_regs: ValueRegs<Writable<Reg>>
) -> SmallInstVec<Self::I>
Generate an instruction which copies a source register to a return value slot.
sourcefn gen_retval_area_setup(&self) -> Option<Self::I>
fn gen_retval_area_setup(&self) -> Option<Self::I>
Generate any setup instruction needed to save values to the return-value area. This is usually used when were are multiple return values or an otherwise large return value that must be passed on the stack; typically the ABI specifies an extra hidden argument that is a pointer to that memory. Read more
sourcefn gen_epilogue_placeholder(&self) -> Self::I
fn gen_epilogue_placeholder(&self) -> Self::I
Generate an epilogue placeholder. The returned instruction should return true
from
is_epilogue_placeholder()
; this is used to indicate to the lowering driver when
the epilogue should be inserted. Read more
sourcefn set_num_spillslots(&mut self, slots: usize)
fn set_num_spillslots(&mut self, slots: usize)
Update with the number of spillslots, post-regalloc.
sourcefn set_clobbered(&mut self, clobbered: Set<Writable<RealReg>>)
fn set_clobbered(&mut self, clobbered: Set<Writable<RealReg>>)
Update with the clobbered registers, post-regalloc.
sourcefn spillslots_to_stack_map(
&self,
slots: &[SpillSlot],
state: &<Self::I as MachInstEmit>::State
) -> StackMap
fn spillslots_to_stack_map(
&self,
slots: &[SpillSlot],
state: &<Self::I as MachInstEmit>::State
) -> StackMap
Generate a stack map, given a list of spillslots and the emission state at a given program point (prior to emission fo the safepointing instruction). Read more
sourcefn gen_prologue(&mut self) -> SmallInstVec<Self::I>
fn gen_prologue(&mut self) -> SmallInstVec<Self::I>
Generate a prologue, post-regalloc. This should include any stack
frame or other setup necessary to use the other methods (load_arg
,
store_retval
, and spillslot accesses.) self
is mutable so that we
can store information in it which will be useful when creating the
epilogue. Read more
sourcefn gen_epilogue(&self) -> SmallInstVec<M::I>
fn gen_epilogue(&self) -> SmallInstVec<M::I>
Generate an epilogue, post-regalloc. Note that this must generate the actual return instruction (rather than emitting this in the lowering logic), because the epilogue code comes before the return and the two are likely closely related. Read more
sourcefn frame_size(&self) -> u32
fn frame_size(&self) -> u32
Returns the full frame size for the given function, after prologue emission has run. This comprises the spill slots and stack-storage slots (but not storage for clobbered callee-save registers, arguments pushed at callsites within this function, or other ephemeral pushes). This is used for ABI variants where the client generates prologue/epilogue code, as in Baldrdash (SpiderMonkey integration). Read more
sourcefn stack_args_size(&self) -> u32
fn stack_args_size(&self) -> u32
Returns the size of arguments expected on the stack.
sourcefn get_spillslot_size(&self, rc: RegClass, ty: Type) -> u32
fn get_spillslot_size(&self, rc: RegClass, ty: Type) -> u32
Get the spill-slot size.
sourcefn gen_spill(
&self,
to_slot: SpillSlot,
from_reg: RealReg,
ty: Option<Type>
) -> Self::I
fn gen_spill(
&self,
to_slot: SpillSlot,
from_reg: RealReg,
ty: Option<Type>
) -> Self::I
Generate a spill. The type, if known, is given; this can be used to generate a store instruction optimized for the particular type rather than the RegClass (e.g., only F64 that resides in a V128 register). If no type is given, the implementation should spill the whole register. Read more
sourcefn gen_reload(
&self,
to_reg: Writable<RealReg>,
from_slot: SpillSlot,
ty: Option<Type>
) -> Self::I
fn gen_reload(
&self,
to_reg: Writable<RealReg>,
from_slot: SpillSlot,
ty: Option<Type>
) -> Self::I
Generate a reload (fill). As for spills, the type may be given to allow a more optimized load instruction to be generated. Read more
sourcefn unwind_info_kind(&self) -> UnwindInfoKind
fn unwind_info_kind(&self) -> UnwindInfoKind
Desired unwind info type.
Auto Trait Implementations
impl<M> RefUnwindSafe for ABICalleeImpl<M> where
M: RefUnwindSafe,
<M as ABIMachineSpec>::I: RefUnwindSafe,
impl<M> Send for ABICalleeImpl<M> where
M: Send,
<M as ABIMachineSpec>::I: Send,
impl<M> Sync for ABICalleeImpl<M> where
M: Sync,
<M as ABIMachineSpec>::I: Sync,
impl<M> Unpin for ABICalleeImpl<M> where
M: Unpin,
<M as ABIMachineSpec>::I: Unpin,
impl<M> UnwindSafe for ABICalleeImpl<M> where
M: UnwindSafe,
<M as ABIMachineSpec>::I: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more