1 //===- llvm/CallingConv.h - LLVM Calling Conventions ------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines LLVM's set of calling conventions.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_IR_CALLINGCONV_H
15 #define LLVM_IR_CALLINGCONV_H
19 /// CallingConv Namespace - This namespace contains an enum with a value for
20 /// the well-known calling conventions.
22 namespace CallingConv {
24 /// LLVM IR allows to use arbitrary numbers as calling convention identifiers.
27 /// A set of enums which specify the assigned numeric values for known llvm
28 /// calling conventions.
29 /// LLVM Calling Convention Representation
31 /// C - The default llvm calling convention, compatible with C. This
32 /// convention is the only calling convention that supports varargs calls.
33 /// As with typical C calling conventions, the callee/caller have to
34 /// tolerate certain amounts of prototype mismatch.
37 // Generic LLVM calling conventions. None of these calling conventions
38 // support varargs calls, and all assume that the caller and callee
39 // prototype exactly match.
41 /// Fast - This calling convention attempts to make calls as fast as
42 /// possible (e.g. by passing things in registers).
45 // Cold - This calling convention attempts to make code in the caller as
46 // efficient as possible under the assumption that the call is not commonly
47 // executed. As such, these calls often preserve all registers so that the
48 // call does not break any live ranges in the caller side.
51 // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
54 // HiPE - Calling convention used by the High-Performance Erlang Compiler
58 // WebKit JS - Calling convention for stack based JavaScript calls
61 // AnyReg - Calling convention for dynamic register based calls (e.g.
62 // stackmap and patchpoint intrinsics).
65 // PreserveMost - Calling convention for runtime calls that preserves most
69 // PreserveAll - Calling convention for runtime calls that preserves
70 // (almost) all registers.
73 // Swift - Calling convention for Swift.
76 // CXX_FAST_TLS - Calling convention for access functions.
79 // Target - This is the start of the target-specific calling conventions,
80 // e.g. fastcall and thiscall on X86.
83 /// X86_StdCall - stdcall is the calling conventions mostly used by the
84 /// Win32 API. It is basically the same as the C convention with the
85 /// difference in that the callee is responsible for popping the arguments
89 /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
90 /// in ECX:EDX registers, others - via stack. Callee is responsible for
94 /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete,
95 /// but still used on some targets).
98 /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling
99 /// convention (aka EABI). Soft float variant.
102 /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
105 /// MSP430_INTR - Calling convention used for MSP430 interrupt routines.
108 /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX,
109 /// others via stack. Callee is responsible for stack cleaning. MSVC uses
110 /// this by default for methods in its ABI.
113 /// PTX_Kernel - Call to a PTX kernel.
114 /// Passes all arguments in parameter space.
117 /// PTX_Device - Call to a PTX device function.
118 /// Passes all arguments in register or parameter space.
121 /// SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
122 /// No lowering or expansion of arguments.
123 /// Structures are passed as a pointer to a struct with the byval attribute.
124 /// Functions can only call SPIR_FUNC and SPIR_KERNEL functions.
125 /// Functions can only have zero or one return values.
126 /// Variable arguments are not allowed, except for printf.
127 /// How arguments/return values are lowered are not specified.
128 /// Functions are only visible to the devices.
131 /// SPIR_KERNEL - Calling convention for SPIR kernel functions.
132 /// Inherits the restrictions of SPIR_FUNC, except
133 /// Cannot have non-void return values.
134 /// Cannot have variable arguments.
135 /// Can also be called by the host.
136 /// Is externally visible.
139 /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins
142 /// The C convention as specified in the x86-64 supplement to the
143 /// System V ABI, used on most non-Windows systems.
146 /// The C convention as implemented on Windows/x86-64 and
147 /// AArch64. This convention differs from the more common
148 /// \c X86_64_SysV convention in a number of ways, most notably in
149 /// that XMM registers used to pass arguments are shadowed by GPRs,
151 /// On AArch64, this is identical to the normal C (AAPCS) calling
152 /// convention for normal functions, but floats are passed in integer
153 /// registers to variadic functions.
156 /// MSVC calling convention that passes vectors and vector aggregates
157 /// in SSE registers.
160 /// Calling convention used by HipHop Virtual Machine (HHVM) to
161 /// perform calls to and from translation cache, and for calling PHP
163 /// HHVM calling convention supports tail/sibling call elimination.
166 /// HHVM calling convention for invoking C/C++ helpers.
169 /// X86_INTR - x86 hardware interrupt context. Callee may take one or two
170 /// parameters, where the 1st represents a pointer to hardware context frame
171 /// and the 2nd represents hardware error code, the presence of the later
172 /// depends on the interrupt vector taken. Valid for both 32- and 64-bit
176 /// Used for AVR interrupt routines.
179 /// Calling convention used for AVR signal routines.
182 /// Calling convention used for special AVR rtlib functions
183 /// which have an "optimized" convention to preserve registers.
186 /// Calling convention used for Mesa vertex shaders, or AMDPAL last shader
187 /// stage before rasterization (vertex shader if tessellation and geometry
188 /// are not in use, or otherwise copy shader if one is needed).
191 /// Calling convention used for Mesa/AMDPAL geometry shaders.
194 /// Calling convention used for Mesa/AMDPAL pixel shaders.
197 /// Calling convention used for Mesa/AMDPAL compute shaders.
200 /// Calling convention for AMDGPU code object kernels.
203 /// Register calling convention used for parameters transfer optimization
206 /// Calling convention used for Mesa/AMDPAL hull shaders (= tessellation
207 /// control shaders).
210 /// Calling convention used for special MSP430 rtlib functions
211 /// which have an "optimized" convention using additional registers.
214 /// Calling convention used for AMDPAL vertex shader if tessellation is in
218 /// Calling convention used for AMDPAL shader stage before geometry shader
219 /// if geometry is in use. So either the domain (= tessellation evaluation)
220 /// shader if tessellation is in use, or otherwise the vertex shader.
223 /// The highest possible calling convention ID. Must be some 2^k - 1.
227 } // end namespace CallingConv
229 } // end namespace llvm
231 #endif // LLVM_IR_CALLINGCONV_H