LLVM 20.0.0git
Typedefs | Enumerations
llvm::CallingConv Namespace Reference

CallingConv Namespace - This namespace contains an enum with a value for the well-known calling conventions. More...

Typedefs

using ID = unsigned
 LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 

Enumerations

enum  {
  C = 0 , Fast = 8 , Cold = 9 , GHC = 10 ,
  HiPE = 11 , AnyReg = 13 , PreserveMost = 14 , PreserveAll = 15 ,
  Swift = 16 , CXX_FAST_TLS = 17 , Tail = 18 , CFGuard_Check = 19 ,
  SwiftTail = 20 , PreserveNone = 21 , FirstTargetCC = 64 , X86_StdCall = 64 ,
  X86_FastCall = 65 , ARM_APCS = 66 , ARM_AAPCS = 67 , ARM_AAPCS_VFP = 68 ,
  MSP430_INTR = 69 , X86_ThisCall = 70 , PTX_Kernel = 71 , PTX_Device = 72 ,
  SPIR_FUNC = 75 , SPIR_KERNEL = 76 , Intel_OCL_BI = 77 , X86_64_SysV = 78 ,
  Win64 = 79 , X86_VectorCall = 80 , DUMMY_HHVM = 81 , DUMMY_HHVM_C = 82 ,
  X86_INTR = 83 , AVR_INTR = 84 , AVR_SIGNAL = 85 , AVR_BUILTIN = 86 ,
  AMDGPU_VS = 87 , AMDGPU_GS = 88 , AMDGPU_PS = 89 , AMDGPU_CS = 90 ,
  AMDGPU_KERNEL = 91 , X86_RegCall = 92 , AMDGPU_HS = 93 , MSP430_BUILTIN = 94 ,
  AMDGPU_LS = 95 , AMDGPU_ES = 96 , AArch64_VectorCall = 97 , AArch64_SVE_VectorCall = 98 ,
  WASM_EmscriptenInvoke = 99 , AMDGPU_Gfx = 100 , M68k_INTR = 101 , AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0 = 102 ,
  AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2 = 103 , AMDGPU_CS_Chain = 104 , AMDGPU_CS_ChainPreserve = 105 , M68k_RTD = 106 ,
  GRAAL = 107 , ARM64EC_Thunk_X64 = 108 , ARM64EC_Thunk_Native = 109 , RISCV_VectorCall = 110 ,
  AArch64_SME_ABI_Support_Routines_PreserveMost_From_X1 = 111 , MaxID = 1023
}
 A set of enums which specify the assigned numeric values for known llvm calling conventions. More...
 

Detailed Description

CallingConv Namespace - This namespace contains an enum with a value for the well-known calling conventions.

Typedef Documentation

◆ ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

Definition at line 24 of file CallingConv.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

A set of enums which specify the assigned numeric values for known llvm calling conventions.

LLVM Calling Convention Representation

Enumerator

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 

Attempts to make calls as fast as possible (e.g.

by passing things in registers).

Cold 

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 

Used by the Glasgow Haskell Compiler (GHC).

HiPE 

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

AnyReg 

OBSOLETED - Used for stack based JavaScript calls.

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

PreserveMost 

Used for runtime calls that preserves most registers.

PreserveAll 

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

Swift 

Calling convention for Swift.

CXX_FAST_TLS 

Used for access functions.

Tail 

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

CFGuard_Check 

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 

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 

Used for runtime calls that preserves none general registers.

FirstTargetCC 

This is the start of the target-specific calling conventions, e.g.

fastcall and thiscall on X86.

X86_StdCall 

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.

X86_FastCall 

'fast' analog of X86_StdCall.

Passes first two arguments in ECX:EDX registers, others - via stack. Callee is responsible for stack cleaning.

ARM_APCS 

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

ARM_AAPCS 

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

Soft float variant.

ARM_AAPCS_VFP 

Same as ARM_AAPCS, but uses hard floating point ABI.

MSP430_INTR 

Used for MSP430 interrupt routines.

X86_ThisCall 

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.

PTX_Kernel 

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

PTX_Device 

Call to a PTX device function.

Passes all arguments in register or parameter space.

SPIR_FUNC 

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.

SPIR_KERNEL 

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.

Intel_OCL_BI 

Used for Intel OpenCL built-ins.

X86_64_SysV 

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

Win64 

The C convention as implemented on Windows/x86-64 and AArch64.

It differs from the more common 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.

X86_VectorCall 

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

DUMMY_HHVM 

Placeholders for HHVM calling conventions (deprecated, removed).

DUMMY_HHVM_C 
X86_INTR 

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.

AVR_INTR 

Used for AVR interrupt routines.

AVR_SIGNAL 

Used for AVR signal routines.

AVR_BUILTIN 

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

AMDGPU_VS 

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).

AMDGPU_GS 

Used for Mesa/AMDPAL geometry shaders.

AMDGPU_PS 

Used for Mesa/AMDPAL pixel shaders.

AMDGPU_CS 

Used for Mesa/AMDPAL compute shaders.

AMDGPU_KERNEL 

Used for AMDGPU code object kernels.

X86_RegCall 

Register calling convention used for parameters transfer optimization.

AMDGPU_HS 

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

MSP430_BUILTIN 

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

AMDGPU_LS 

Used for AMDPAL vertex shader if tessellation is in use.

AMDGPU_ES 

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.

AArch64_VectorCall 

Used between AArch64 Advanced SIMD functions.

AArch64_SVE_VectorCall 

Used between AArch64 SVE functions.

WASM_EmscriptenInvoke 

For emscripten __invoke_* functions.

The first argument is required to be the function ptr being indirectly called. The remainder matches the regular calling convention.

AMDGPU_Gfx 

Used for AMD graphics targets.

M68k_INTR 

Used for M68k interrupt routines.

AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0 

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

AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2 

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

AMDGPU_CS_Chain 

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

AMDGPU_CS_ChainPreserve 

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

Preserves active lane values for input VGPRs.

M68k_RTD 

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

GRAAL 

Used by GraalVM. Two additional registers are reserved.

ARM64EC_Thunk_X64 

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.

ARM64EC_Thunk_Native 

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.

RISCV_VectorCall 

Calling convention used for RISC-V V-extension.

AArch64_SME_ABI_Support_Routines_PreserveMost_From_X1 

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

MaxID 

The highest possible ID. Must be some 2^k - 1.

Definition at line 29 of file CallingConv.h.