Trait wasmer_compiler_llvm::abi::Abi
source · pub trait Abi {
// Required methods
fn get_vmctx_ptr_param<'ctx>(
&self,
func_value: &FunctionValue<'ctx>,
) -> PointerValue<'ctx>;
fn func_type_to_llvm<'ctx>(
&self,
context: &'ctx Context,
intrinsics: &Intrinsics<'ctx>,
offsets: Option<&VMOffsets>,
sig: &FuncSig,
) -> Result<(FunctionType<'ctx>, Vec<(Attribute, AttributeLoc)>), CompileError>;
fn args_to_call<'ctx>(
&self,
alloca_builder: &Builder<'ctx>,
func_sig: &FuncSig,
llvm_fn_ty: &FunctionType<'ctx>,
ctx_ptr: PointerValue<'ctx>,
values: &[BasicValueEnum<'ctx>],
intrinsics: &Intrinsics<'ctx>,
) -> Result<Vec<BasicValueEnum<'ctx>>, CompileError>;
fn rets_from_call<'ctx>(
&self,
builder: &Builder<'ctx>,
intrinsics: &Intrinsics<'ctx>,
call_site: CallSiteValue<'ctx>,
func_sig: &FuncSig,
) -> Result<Vec<BasicValueEnum<'ctx>>, CompileError>;
fn is_sret(&self, func_sig: &FuncSig) -> Result<bool, CompileError>;
fn pack_values_for_register_return<'ctx>(
&self,
intrinsics: &Intrinsics<'ctx>,
builder: &Builder<'ctx>,
values: &[BasicValueEnum<'ctx>],
func_type: &FunctionType<'ctx>,
) -> Result<BasicValueEnum<'ctx>, CompileError>;
}
Expand description
We need to produce different LLVM IR for different platforms. (Contrary to popular knowledge LLVM IR is not intended to be portable in that way.) This trait deals with differences between function signatures on different targets.
Required Methods§
sourcefn get_vmctx_ptr_param<'ctx>(
&self,
func_value: &FunctionValue<'ctx>,
) -> PointerValue<'ctx>
fn get_vmctx_ptr_param<'ctx>( &self, func_value: &FunctionValue<'ctx>, ) -> PointerValue<'ctx>
Given a function definition, retrieve the parameter that is the vmctx pointer.
sourcefn func_type_to_llvm<'ctx>(
&self,
context: &'ctx Context,
intrinsics: &Intrinsics<'ctx>,
offsets: Option<&VMOffsets>,
sig: &FuncSig,
) -> Result<(FunctionType<'ctx>, Vec<(Attribute, AttributeLoc)>), CompileError>
fn func_type_to_llvm<'ctx>( &self, context: &'ctx Context, intrinsics: &Intrinsics<'ctx>, offsets: Option<&VMOffsets>, sig: &FuncSig, ) -> Result<(FunctionType<'ctx>, Vec<(Attribute, AttributeLoc)>), CompileError>
Given a wasm function type, produce an llvm function declaration.
sourcefn args_to_call<'ctx>(
&self,
alloca_builder: &Builder<'ctx>,
func_sig: &FuncSig,
llvm_fn_ty: &FunctionType<'ctx>,
ctx_ptr: PointerValue<'ctx>,
values: &[BasicValueEnum<'ctx>],
intrinsics: &Intrinsics<'ctx>,
) -> Result<Vec<BasicValueEnum<'ctx>>, CompileError>
fn args_to_call<'ctx>( &self, alloca_builder: &Builder<'ctx>, func_sig: &FuncSig, llvm_fn_ty: &FunctionType<'ctx>, ctx_ptr: PointerValue<'ctx>, values: &[BasicValueEnum<'ctx>], intrinsics: &Intrinsics<'ctx>, ) -> Result<Vec<BasicValueEnum<'ctx>>, CompileError>
Marshall wasm stack values into function parameters.
sourcefn rets_from_call<'ctx>(
&self,
builder: &Builder<'ctx>,
intrinsics: &Intrinsics<'ctx>,
call_site: CallSiteValue<'ctx>,
func_sig: &FuncSig,
) -> Result<Vec<BasicValueEnum<'ctx>>, CompileError>
fn rets_from_call<'ctx>( &self, builder: &Builder<'ctx>, intrinsics: &Intrinsics<'ctx>, call_site: CallSiteValue<'ctx>, func_sig: &FuncSig, ) -> Result<Vec<BasicValueEnum<'ctx>>, CompileError>
Given a CallSite, extract the returned values and return them in a Vec.
sourcefn is_sret(&self, func_sig: &FuncSig) -> Result<bool, CompileError>
fn is_sret(&self, func_sig: &FuncSig) -> Result<bool, CompileError>
Whether the llvm equivalent of this wasm function has an sret
attribute.
sourcefn pack_values_for_register_return<'ctx>(
&self,
intrinsics: &Intrinsics<'ctx>,
builder: &Builder<'ctx>,
values: &[BasicValueEnum<'ctx>],
func_type: &FunctionType<'ctx>,
) -> Result<BasicValueEnum<'ctx>, CompileError>
fn pack_values_for_register_return<'ctx>( &self, intrinsics: &Intrinsics<'ctx>, builder: &Builder<'ctx>, values: &[BasicValueEnum<'ctx>], func_type: &FunctionType<'ctx>, ) -> Result<BasicValueEnum<'ctx>, CompileError>
Pack LLVM IR values representing individual wasm values into the return type for the function.