Skip to main content

CallConv

Enum CallConv 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum CallConv {
Show 76 variants C = 0, Fast = 8, Cold = 9, Ghc = 10, HiPE = 11, AnyReg = 13, PreserveMost = 14, PreserveAll = 15, Swift = 16, CxxFastTls = 17, Tail = 18, CfGuardCheck = 19, SwiftTail = 20, PreserveNone = 21, X86StdCall = 64, X86FastCall = 65, ArmApcs = 66, ArmAapcs = 67, ArmAapcsVfp = 68, Msp430Intr = 69, X86ThisCall = 70, PtxKernel = 71, PtxDevice = 72, SpirFunc = 75, SpirKernel = 76, IntelOclBi = 77, X8664SysV = 78, Win64 = 79, X86VectorCall = 80, DummyHhvm = 81, DummyHhvmC = 82, X86Intr = 83, AvrIntr = 84, AvrSignal = 85, AvrBuiltin = 86, AmdGpuVs = 87, AmdGpuGs = 88, AmdGpuPs = 89, AmdGpuCs = 90, AmdGpuKernel = 91, X86RegCall = 92, AmdGpuHs = 93, Msp430Builtin = 94, AmdGpuLs = 95, AmdGpuEs = 96, AArch64VectorCall = 97, AArch64SveVectorCall = 98, WasmEmscriptenInvoke = 99, AmdGpuGfx = 100, M68kIntr = 101, AArch64SmeAbiSupportRoutinesPreserveMostFromX0 = 102, AArch64SmeAbiSupportRoutinesPreserveMostFromX2 = 103, AmdGpuCsChain = 104, AmdGpuCsChainPreserve = 105, M68kRtd = 106, Graal = 107, Arm64ecThunkX64 = 108, Arm64ecThunkNative = 109, RiscVVectorCall = 110, AArch64SmeAbiSupportRoutinesPreserveMostFromX1 = 111, RiscVVlsCall32 = 112, RiscVVlsCall64 = 113, RiscVVlsCall128 = 114, RiscVVlsCall256 = 115, RiscVVlsCall512 = 116, RiscVVlsCall1024 = 117, RiscVVlsCall2048 = 118, RiscVVlsCall4096 = 119, RiscVVlsCall8192 = 120, RiscVVlsCall16384 = 121, RiscVVlsCall32768 = 122, RiscVVlsCall65536 = 123, AmdGpuGfxWholeWave = 124, CHERIoTCompartmentCall = 125, CHERIoTCompartmentCallee = 126, CHERIoTLibraryCall = 127,
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

C = 0

The default llvm calling convention, compatible with C. This convention is the only one that supports varargs calls. As with typical C calling conventions, the callee/caller have to tolerate certain amounts of prototype mismatch.

§

Fast = 8

Attempts to make calls as fast as possible (e.g. by passing things in registers).

§

Cold = 9

Attempts to make code in the caller as efficient as possible under the assumption that the call is not commonly executed. As such, these calls often preserve all registers so that the call does not break any live ranges in the caller side.

§

Ghc = 10

Used by the Glasgow Haskell Compiler (GHC).

§

HiPE = 11

Used by the High-Performance Erlang Compiler (HiPE).

§

AnyReg = 13

Used for dynamic register based calls (e.g. stackmap and patchpoint intrinsics).

§

PreserveMost = 14

Used for runtime calls that preserves most registers.

§

PreserveAll = 15

Used for runtime calls that preserves (almost) all registers.

§

Swift = 16

Calling convention for Swift.

§

CxxFastTls = 17

Used for access functions.

§

Tail = 18

Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always be performed.

§

CfGuardCheck = 19

Special calling convention on Windows for calling the Control Guard Check ICall funtion. The function takes exactly one argument (address of the target function) passed in the first argument register, and has no return value. All register values are preserved.

§

SwiftTail = 20

This follows the Swift calling convention in how arguments are passed but guarantees tail calls will be made by making the callee clean up their stack.

§

PreserveNone = 21

Used for runtime calls that preserves none general registers.

§

X86StdCall = 64

stdcall is mostly used by the Win32 API. It is basically the same as the C convention with the difference in that the callee is responsible for popping the arguments from the stack.

§

X86FastCall = 65

‘fast’ analog of X86_StdCall. Passes first two arguments in ECX:EDX registers, others - via stack. Callee is responsible for stack cleaning.

§

ArmApcs = 66

ARM Procedure Calling Standard (obsolete, but still used on some targets).

§

ArmAapcs = 67

ARM Architecture Procedure Calling Standard calling convention (aka EABI). Soft float variant.

§

ArmAapcsVfp = 68

Same as ARM_AAPCS, but uses hard floating point ABI.

§

Msp430Intr = 69

Used for MSP430 interrupt routines.

§

X86ThisCall = 70

Similar to X86_StdCall. Passes first argument in ECX, others via stack. Callee is responsible for stack cleaning. MSVC uses this by default for methods in its ABI.

§

PtxKernel = 71

Call to a PTX kernel. Passes all arguments in parameter space.

§

PtxDevice = 72

Call to a PTX device function. Passes all arguments in register or parameter space.

§

SpirFunc = 75

Used for SPIR non-kernel device functions. No lowering or expansion of arguments. Structures are passed as a pointer to a struct with the byval attribute. Functions can only call SPIR_FUNC and SPIR_KERNEL functions. Functions can only have zero or one return values. Variable arguments are not allowed, except for printf. How arguments/return values are lowered are not specified. Functions are only visible to the devices.

§

SpirKernel = 76

Used for SPIR kernel functions. Inherits the restrictions of SPIR_FUNC, except it cannot have non-void return values, it cannot have variable arguments, it can also be called by the host or it is externally visible.

§

IntelOclBi = 77

Used for Intel OpenCL built-ins.

§

X8664SysV = 78

The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows systems.

§

Win64 = 79

The C convention as implemented on Windows/x86-64 and AArch64. It differs from the more common \c X86_64_SysV convention in a number of ways, most notably in that XMM registers used to pass arguments are shadowed by GPRs, and vice versa. On AArch64, this is identical to the normal C (AAPCS) calling convention for normal functions, but floats are passed in integer registers to variadic functions.

§

X86VectorCall = 80

MSVC calling convention that passes vectors and vector aggregates in SSE registers.

§

DummyHhvm = 81

👎Deprecated

Placeholders for HHVM calling conventions (deprecated, removed).

§

DummyHhvmC = 82

§

X86Intr = 83

x86 hardware interrupt context. Callee may take one or two parameters, where the 1st represents a pointer to hardware context frame and the 2nd represents hardware error code, the presence of the later depends on the interrupt vector taken. Valid for both 32- and 64-bit subtargets.

§

AvrIntr = 84

Used for AVR interrupt routines.

§

AvrSignal = 85

Used for AVR signal routines.

§

AvrBuiltin = 86

Used for special AVR rtlib functions which have an “optimized” convention to preserve registers.

§

AmdGpuVs = 87

Used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (vertex shader if tessellation and geometry are not in use, or otherwise copy shader if one is needed).

§

AmdGpuGs = 88

Used for Mesa/AMDPAL geometry shaders.

§

AmdGpuPs = 89

Used for Mesa/AMDPAL pixel shaders.

§

AmdGpuCs = 90

Used for Mesa/AMDPAL compute shaders.

§

AmdGpuKernel = 91

Used for AMDGPU code object kernels.

§

X86RegCall = 92

Register calling convention used for parameters transfer optimization

§

AmdGpuHs = 93

Used for Mesa/AMDPAL hull shaders (= tessellation control shaders).

§

Msp430Builtin = 94

Used for special MSP430 rtlib functions which have an “optimized” convention using additional registers.

§

AmdGpuLs = 95

Used for AMDPAL vertex shader if tessellation is in use.

§

AmdGpuEs = 96

Used for AMDPAL shader stage before geometry shader if geometry is in use. So either the domain (= tessellation evaluation) shader if tessellation is in use, or otherwise the vertex shader.

§

AArch64VectorCall = 97

Used between AArch64 Advanced SIMD functions

§

AArch64SveVectorCall = 98

Used between AArch64 SVE functions

§

WasmEmscriptenInvoke = 99

For emscripten _invoke* functions. The first argument is required to be the function ptr being indirectly called. The remainder matches the regular calling convention.

§

AmdGpuGfx = 100

Used for AMD graphics targets.

§

M68kIntr = 101

Used for M68k interrupt routines.

§

AArch64SmeAbiSupportRoutinesPreserveMostFromX0 = 102

Preserve X0-X13, X19-X29, SP, Z0-Z31, P0-P15.

§

AArch64SmeAbiSupportRoutinesPreserveMostFromX2 = 103

Preserve X2-X15, X19-X29, SP, Z0-Z31, P0-P15.

§

AmdGpuCsChain = 104

Used on AMDGPUs to give the middle-end more control over argument placement.

§

AmdGpuCsChainPreserve = 105

Used on AMDGPUs to give the middle-end more control over argument placement. Preserves active lane values for input VGPRs.

§

M68kRtd = 106

Used for M68k rtd-based CC (similar to X86’s stdcall).

§

Graal = 107

Used by GraalVM. Two additional registers are reserved.

§

Arm64ecThunkX64 = 108

Calling convention used in the ARM64EC ABI to implement calls between x64 code and thunks. This is basically the x64 calling convention using ARM64 register names. The first parameter is mapped to x9.

§

Arm64ecThunkNative = 109

Calling convention used in the ARM64EC ABI to implement calls between ARM64 code and thunks. This is just the ARM64 calling convention, except that the first parameter is mapped to x9.

§

RiscVVectorCall = 110

Calling convention used for RISC-V V-extension.

§

AArch64SmeAbiSupportRoutinesPreserveMostFromX1 = 111

Preserve X1-X15, X19-X29, SP, Z0-Z31, P0-P15.

§

RiscVVlsCall32 = 112

Calling convention used for RISC-V V-extension fixed vectors.

§

RiscVVlsCall64 = 113

§

RiscVVlsCall128 = 114

§

RiscVVlsCall256 = 115

§

RiscVVlsCall512 = 116

§

RiscVVlsCall1024 = 117

§

RiscVVlsCall2048 = 118

§

RiscVVlsCall4096 = 119

§

RiscVVlsCall8192 = 120

§

RiscVVlsCall16384 = 121

§

RiscVVlsCall32768 = 122

§

RiscVVlsCall65536 = 123

§

AmdGpuGfxWholeWave = 124

§

CHERIoTCompartmentCall = 125

Calling convention used for CHERIoT when crossing a protection boundary.

§

CHERIoTCompartmentCallee = 126

Calling convention used for the callee of CHERIoT_CompartmentCall. Ignores the first two capability arguments and the first integer argument, zeroes all unused return registers on return.

§

CHERIoTLibraryCall = 127

Calling convention used for CHERIoT for cross-library calls to a stateless compartment.

Implementations§

Source§

impl CallConv

call conv field in bitcode is often mixed with flags

Source

pub fn from_call_flags(ccinfo_flags: u64) -> Option<Self>

Extract calling convention from CALL/CALLBR CCInfo flags.

Source

pub fn from_invoke_flags(ccinfo_flags: u64) -> Option<Self>

Extract calling convention from INVOKE CCInfo flags.

Trait Implementations§

Source§

impl Debug for CallConv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TryFrom<u8> for CallConv

Source§

type Error = TryFromPrimitiveError<CallConv>

The type returned in the event of a conversion error.
Source§

fn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>

Performs the conversion.
Source§

impl TryFromPrimitive for CallConv

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Source§

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.