Trait cranelift_codegen::machinst::abi::ABICaller[][src]

pub trait ABICaller {
    type I: VCodeInst;
    fn num_args(&self) -> usize;
fn emit_copy_regs_to_arg<C: LowerCtx<I = Self::I>>(
        &self,
        ctx: &mut C,
        idx: usize,
        from_reg: ValueRegs<Reg>
    );
fn emit_copy_retval_to_regs<C: LowerCtx<I = Self::I>>(
        &self,
        ctx: &mut C,
        idx: usize,
        into_reg: ValueRegs<Writable<Reg>>
    );
fn emit_stack_pre_adjust<C: LowerCtx<I = Self::I>>(&self, ctx: &mut C);
fn emit_stack_post_adjust<C: LowerCtx<I = Self::I>>(&self, ctx: &mut C);
fn accumulate_outgoing_args_size<C: LowerCtx<I = Self::I>>(
        &self,
        ctx: &mut C
    );
fn emit_call<C: LowerCtx<I = Self::I>>(&mut self, ctx: &mut C); }

Trait implemented by an object that tracks ABI-related state and can generate code while emitting a call to a function.

An instance of this trait returns information for a particular callsite. It will usually be computed from the called function’s signature.

Unlike ABICallee above, methods on this trait are not invoked directly by the machine-independent code. Rather, the machine-specific lowering code will typically create an ABICaller when creating machine instructions for an IR call instruction inside lower(), directly emit the arg and and retval copies, and attach the register use/def info to the call.

This trait is thus provided for convenience to the backends.

Associated Types

type I: VCodeInst[src]

The instruction type for the ISA associated with this ABI.

Loading content...

Required methods

fn num_args(&self) -> usize[src]

Get the number of arguments expected.

fn emit_copy_regs_to_arg<C: LowerCtx<I = Self::I>>(
    &self,
    ctx: &mut C,
    idx: usize,
    from_reg: ValueRegs<Reg>
)
[src]

Emit a copy of an argument value from a source register, prior to the call.

fn emit_copy_retval_to_regs<C: LowerCtx<I = Self::I>>(
    &self,
    ctx: &mut C,
    idx: usize,
    into_reg: ValueRegs<Writable<Reg>>
)
[src]

Emit a copy a return value into a destination register, after the call returns.

fn emit_stack_pre_adjust<C: LowerCtx<I = Self::I>>(&self, ctx: &mut C)[src]

Emit code to pre-adjust the stack, prior to argument copies and call.

fn emit_stack_post_adjust<C: LowerCtx<I = Self::I>>(&self, ctx: &mut C)[src]

Emit code to post-adjust the satck, after call return and return-value copies.

fn accumulate_outgoing_args_size<C: LowerCtx<I = Self::I>>(&self, ctx: &mut C)[src]

Accumulate outgoing arguments. This ensures that the caller (as identified via the CTX argument) allocates enough space in the prologue to hold all arguments and return values for this call. There is no code emitted at the call site, everything is done in the caller’s function prologue.

fn emit_call<C: LowerCtx<I = Self::I>>(&mut self, ctx: &mut C)[src]

Emit the call itself.

The returned instruction should have proper use- and def-sets according to the argument registers, return-value registers, and clobbered registers for this function signature in this ABI.

(Arg registers are uses, and retval registers are defs. Clobbered registers are also logically defs, but should never be read; their values are “defined” (to the regalloc) but “undefined” in every other sense.)

This function should only be called once, as it is allowed to re-use parts of the ABICaller object in emitting instructions.

Loading content...

Implementors

impl<M: ABIMachineSpec> ABICaller for ABICallerImpl<M>[src]

type I = M::I

Loading content...