LLVM  8.0.1
CallingConv.h
Go to the documentation of this file.
1 //===- llvm/CallingConv.h - LLVM Calling Conventions ------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines LLVM's set of calling conventions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_CALLINGCONV_H
15 #define LLVM_IR_CALLINGCONV_H
16 
17 namespace llvm {
18 
19 /// CallingConv Namespace - This namespace contains an enum with a value for
20 /// the well-known calling conventions.
21 ///
22 namespace CallingConv {
23 
24  /// LLVM IR allows to use arbitrary numbers as calling convention identifiers.
25  using ID = unsigned;
26 
27  /// A set of enums which specify the assigned numeric values for known llvm
28  /// calling conventions.
29  /// LLVM Calling Convention Representation
30  enum {
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.
35  C = 0,
36 
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.
40 
41  /// Fast - This calling convention attempts to make calls as fast as
42  /// possible (e.g. by passing things in registers).
43  Fast = 8,
44 
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.
49  Cold = 9,
50 
51  // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
52  GHC = 10,
53 
54  // HiPE - Calling convention used by the High-Performance Erlang Compiler
55  // (HiPE).
56  HiPE = 11,
57 
58  // WebKit JS - Calling convention for stack based JavaScript calls
59  WebKit_JS = 12,
60 
61  // AnyReg - Calling convention for dynamic register based calls (e.g.
62  // stackmap and patchpoint intrinsics).
63  AnyReg = 13,
64 
65  // PreserveMost - Calling convention for runtime calls that preserves most
66  // registers.
68 
69  // PreserveAll - Calling convention for runtime calls that preserves
70  // (almost) all registers.
72 
73  // Swift - Calling convention for Swift.
74  Swift = 16,
75 
76  // CXX_FAST_TLS - Calling convention for access functions.
78 
79  // Target - This is the start of the target-specific calling conventions,
80  // e.g. fastcall and thiscall on X86.
82 
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
86  /// from the stack.
88 
89  /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
90  /// in ECX:EDX registers, others - via stack. Callee is responsible for
91  /// stack cleaning.
93 
94  /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete,
95  /// but still used on some targets).
96  ARM_APCS = 66,
97 
98  /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling
99  /// convention (aka EABI). Soft float variant.
100  ARM_AAPCS = 67,
101 
102  /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
104 
105  /// MSP430_INTR - Calling convention used for MSP430 interrupt routines.
107 
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.
112 
113  /// PTX_Kernel - Call to a PTX kernel.
114  /// Passes all arguments in parameter space.
116 
117  /// PTX_Device - Call to a PTX device function.
118  /// Passes all arguments in register or parameter space.
120 
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.
129  SPIR_FUNC = 75,
130 
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.
138 
139  /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins
141 
142  /// The C convention as specified in the x86-64 supplement to the
143  /// System V ABI, used on most non-Windows systems.
145 
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,
150  /// and vice versa.
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.
154  Win64 = 79,
155 
156  /// MSVC calling convention that passes vectors and vector aggregates
157  /// in SSE registers.
159 
160  /// Calling convention used by HipHop Virtual Machine (HHVM) to
161  /// perform calls to and from translation cache, and for calling PHP
162  /// functions.
163  /// HHVM calling convention supports tail/sibling call elimination.
164  HHVM = 81,
165 
166  /// HHVM calling convention for invoking C/C++ helpers.
167  HHVM_C = 82,
168 
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
173  /// subtargets.
174  X86_INTR = 83,
175 
176  /// Used for AVR interrupt routines.
177  AVR_INTR = 84,
178 
179  /// Calling convention used for AVR signal routines.
181 
182  /// Calling convention used for special AVR rtlib functions
183  /// which have an "optimized" convention to preserve registers.
185 
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).
189  AMDGPU_VS = 87,
190 
191  /// Calling convention used for Mesa/AMDPAL geometry shaders.
192  AMDGPU_GS = 88,
193 
194  /// Calling convention used for Mesa/AMDPAL pixel shaders.
195  AMDGPU_PS = 89,
196 
197  /// Calling convention used for Mesa/AMDPAL compute shaders.
198  AMDGPU_CS = 90,
199 
200  /// Calling convention for AMDGPU code object kernels.
202 
203  /// Register calling convention used for parameters transfer optimization
205 
206  /// Calling convention used for Mesa/AMDPAL hull shaders (= tessellation
207  /// control shaders).
208  AMDGPU_HS = 93,
209 
210  /// Calling convention used for special MSP430 rtlib functions
211  /// which have an "optimized" convention using additional registers.
213 
214  /// Calling convention used for AMDPAL vertex shader if tessellation is in
215  /// use.
216  AMDGPU_LS = 95,
217 
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.
221  AMDGPU_ES = 96,
222 
223  // Calling convention between AArch64 Advanced SIMD functions
225 
226  /// The highest possible calling convention ID. Must be some 2^k - 1.
227  MaxID = 1023
228  };
229 
230 } // end namespace CallingConv
231 
232 } // end namespace llvm
233 
234 #endif // LLVM_IR_CALLINGCONV_H
Used for AVR interrupt routines.
Definition: CallingConv.h:177
ARM_AAPCS - ARM Architecture Procedure Calling Standard calling convention (aka EABI).
Definition: CallingConv.h:100
C - The default llvm calling convention, compatible with C.
Definition: CallingConv.h:35
This class represents lattice values for constants.
Definition: AllocatorList.h:24
HHVM calling convention for invoking C/C++ helpers.
Definition: CallingConv.h:167
Register calling convention used for parameters transfer optimization.
Definition: CallingConv.h:204
The C convention as implemented on Windows/x86-64 and AArch64.
Definition: CallingConv.h:154
Calling convention used for special MSP430 rtlib functions which have an "optimized" convention using...
Definition: CallingConv.h:212
Calling convention used for Mesa/AMDPAL geometry shaders.
Definition: CallingConv.h:192
Calling convention used for Mesa/AMDPAL compute shaders.
Definition: CallingConv.h:198
SPIR_KERNEL - Calling convention for SPIR kernel functions.
Definition: CallingConv.h:137
The highest possible calling convention ID. Must be some 2^k - 1.
Definition: CallingConv.h:227
Fast - This calling convention attempts to make calls as fast as possible (e.g.
Definition: CallingConv.h:43
Calling convention used for AMDPAL shader stage before geometry shader if geometry is in use...
Definition: CallingConv.h:221
Calling convention used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (ve...
Definition: CallingConv.h:189
ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
Definition: CallingConv.h:103
Calling convention used for special AVR rtlib functions which have an "optimized" convention to prese...
Definition: CallingConv.h:184
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
Definition: CallingConv.h:158
PTX_Kernel - Call to a PTX kernel.
Definition: CallingConv.h:115
ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, but still used on some target...
Definition: CallingConv.h:96
Calling convention used for AMDPAL vertex shader if tessellation is in use.
Definition: CallingConv.h:216
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
Definition: CallingConv.h:144
Calling convention used for Mesa/AMDPAL pixel shaders.
Definition: CallingConv.h:195
X86_ThisCall - Similar to X86_StdCall.
Definition: CallingConv.h:111
Calling convention used for AVR signal routines.
Definition: CallingConv.h:180
X86_FastCall - 'fast' analog of X86_StdCall.
Definition: CallingConv.h:92
Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins.
Definition: CallingConv.h:140
PTX_Device - Call to a PTX device function.
Definition: CallingConv.h:119
Calling convention used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
Definition: CallingConv.h:208
SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
Definition: CallingConv.h:129
Calling convention used by HipHop Virtual Machine (HHVM) to perform calls to and from translation cac...
Definition: CallingConv.h:164
X86_INTR - x86 hardware interrupt context.
Definition: CallingConv.h:174
X86_StdCall - stdcall is the calling conventions mostly used by the Win32 API.
Definition: CallingConv.h:87
Calling convention for AMDGPU code object kernels.
Definition: CallingConv.h:201
MSP430_INTR - Calling convention used for MSP430 interrupt routines.
Definition: CallingConv.h:106