LLVM  4.0.0
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  /// LLVM IR allows to use arbitrary numbers as calling convention identifiers.
24  typedef unsigned ID;
25 
26  /// A set of enums which specify the assigned numeric values for known llvm
27  /// calling conventions.
28  /// @brief LLVM Calling Convention Representation
29  enum {
30  /// C - The default llvm calling convention, compatible with C. This
31  /// convention is the only calling convention that supports varargs calls.
32  /// As with typical C calling conventions, the callee/caller have to
33  /// tolerate certain amounts of prototype mismatch.
34  C = 0,
35 
36  // Generic LLVM calling conventions. None of these calling conventions
37  // support varargs calls, and all assume that the caller and callee
38  // prototype exactly match.
39 
40  /// Fast - This calling convention attempts to make calls as fast as
41  /// possible (e.g. by passing things in registers).
42  Fast = 8,
43 
44  // Cold - This calling convention attempts to make code in the caller as
45  // efficient as possible under the assumption that the call is not commonly
46  // executed. As such, these calls often preserve all registers so that the
47  // call does not break any live ranges in the caller side.
48  Cold = 9,
49 
50  // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
51  GHC = 10,
52 
53  // HiPE - Calling convention used by the High-Performance Erlang Compiler
54  // (HiPE).
55  HiPE = 11,
56 
57  // WebKit JS - Calling convention for stack based JavaScript calls
58  WebKit_JS = 12,
59 
60  // AnyReg - Calling convention for dynamic register based calls (e.g.
61  // stackmap and patchpoint intrinsics).
62  AnyReg = 13,
63 
64  // PreserveMost - Calling convention for runtime calls that preserves most
65  // registers.
67 
68  // PreserveAll - Calling convention for runtime calls that preserves
69  // (almost) all registers.
71 
72  // Swift - Calling convention for Swift.
73  Swift = 16,
74 
75  // CXX_FAST_TLS - Calling convention for access functions.
77 
78  // Target - This is the start of the target-specific calling conventions,
79  // e.g. fastcall and thiscall on X86.
81 
82  /// X86_StdCall - stdcall is the calling conventions mostly used by the
83  /// Win32 API. It is basically the same as the C convention with the
84  /// difference in that the callee is responsible for popping the arguments
85  /// from the stack.
87 
88  /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
89  /// in ECX:EDX registers, others - via stack. Callee is responsible for
90  /// stack cleaning.
92 
93  /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete,
94  /// but still used on some targets).
95  ARM_APCS = 66,
96 
97  /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling
98  /// convention (aka EABI). Soft float variant.
99  ARM_AAPCS = 67,
100 
101  /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
103 
104  /// MSP430_INTR - Calling convention used for MSP430 interrupt routines.
106 
107  /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX,
108  /// others via stack. Callee is responsible for stack cleaning. MSVC uses
109  /// this by default for methods in its ABI.
111 
112  /// PTX_Kernel - Call to a PTX kernel.
113  /// Passes all arguments in parameter space.
115 
116  /// PTX_Device - Call to a PTX device function.
117  /// Passes all arguments in register or parameter space.
119 
120  /// SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
121  /// No lowering or expansion of arguments.
122  /// Structures are passed as a pointer to a struct with the byval attribute.
123  /// Functions can only call SPIR_FUNC and SPIR_KERNEL functions.
124  /// Functions can only have zero or one return values.
125  /// Variable arguments are not allowed, except for printf.
126  /// How arguments/return values are lowered are not specified.
127  /// Functions are only visible to the devices.
128  SPIR_FUNC = 75,
129 
130  /// SPIR_KERNEL - Calling convention for SPIR kernel functions.
131  /// Inherits the restrictions of SPIR_FUNC, except
132  /// Cannot have non-void return values.
133  /// Cannot have variable arguments.
134  /// Can also be called by the host.
135  /// Is externally visible.
137 
138  /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins
140 
141  /// \brief The C convention as specified in the x86-64 supplement to the
142  /// System V ABI, used on most non-Windows systems.
144 
145  /// \brief The C convention as implemented on Windows/x86-64. This
146  /// convention differs from the more common \c X86_64_SysV convention
147  /// in a number of ways, most notably in that XMM registers used to pass
148  /// arguments are shadowed by GPRs, and vice versa.
150 
151  /// \brief MSVC calling convention that passes vectors and vector aggregates
152  /// in SSE registers.
154 
155  /// \brief Calling convention used by HipHop Virtual Machine (HHVM) to
156  /// perform calls to and from translation cache, and for calling PHP
157  /// functions.
158  /// HHVM calling convention supports tail/sibling call elimination.
159  HHVM = 81,
160 
161  /// \brief HHVM calling convention for invoking C/C++ helpers.
162  HHVM_C = 82,
163 
164  /// X86_INTR - x86 hardware interrupt context. Callee may take one or two
165  /// parameters, where the 1st represents a pointer to hardware context frame
166  /// and the 2nd represents hardware error code, the presence of the later
167  /// depends on the interrupt vector taken. Valid for both 32- and 64-bit
168  /// subtargets.
169  X86_INTR = 83,
170 
171  /// Used for AVR interrupt routines.
172  AVR_INTR = 84,
173 
174  /// Calling convention used for AVR signal routines.
176 
177  /// Calling convention used for special AVR rtlib functions
178  /// which have an "optimized" convention to preserve registers.
180 
181  /// Calling convention used for Mesa vertex shaders.
182  AMDGPU_VS = 87,
183 
184  /// Calling convention used for Mesa geometry shaders.
185  AMDGPU_GS = 88,
186 
187  /// Calling convention used for Mesa pixel shaders.
188  AMDGPU_PS = 89,
189 
190  /// Calling convention used for Mesa compute shaders.
191  AMDGPU_CS = 90,
192 
193  /// Calling convention for AMDGPU code object kernels.
195 
196  /// Register calling convention used for parameters transfer optimization
198 
199  /// The highest possible calling convention ID. Must be some 2^k - 1.
200  MaxID = 1023
201  };
202 } // End CallingConv namespace
203 
204 } // End llvm namespace
205 
206 #endif
The highest possible calling convention ID. Must be some 2^k - 1.
Definition: CallingConv.h:200
SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
Definition: CallingConv.h:128
Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins.
Definition: CallingConv.h:139
ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, but still used on some target...
Definition: CallingConv.h:95
MSP430_INTR - Calling convention used for MSP430 interrupt routines.
Definition: CallingConv.h:105
Calling convention used for Mesa vertex shaders.
Definition: CallingConv.h:182
Calling convention used by HipHop Virtual Machine (HHVM) to perform calls to and from translation cac...
Definition: CallingConv.h:159
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
X86_INTR - x86 hardware interrupt context.
Definition: CallingConv.h:169
PTX_Kernel - Call to a PTX kernel.
Definition: CallingConv.h:114
Register calling convention used for parameters transfer optimization.
Definition: CallingConv.h:197
X86_ThisCall - Similar to X86_StdCall.
Definition: CallingConv.h:110
X86_FastCall - 'fast' analog of X86_StdCall.
Definition: CallingConv.h:91
Calling convention used for special AVR rtlib functions which have an "optimized" convention to prese...
Definition: CallingConv.h:179
Calling convention for AMDGPU code object kernels.
Definition: CallingConv.h:194
C - The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
X86_StdCall - stdcall is the calling conventions mostly used by the Win32 API.
Definition: CallingConv.h:86
Used for AVR interrupt routines.
Definition: CallingConv.h:172
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
Definition: CallingConv.h:153
Calling convention used for Mesa pixel shaders.
Definition: CallingConv.h:188
Calling convention used for Mesa geometry shaders.
Definition: CallingConv.h:185
PTX_Device - Call to a PTX device function.
Definition: CallingConv.h:118
HHVM calling convention for invoking C/C++ helpers.
Definition: CallingConv.h:162
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
Definition: CallingConv.h:143
SPIR_KERNEL - Calling convention for SPIR kernel functions.
Definition: CallingConv.h:136
The C convention as implemented on Windows/x86-64.
Definition: CallingConv.h:149
Calling convention used for Mesa compute shaders.
Definition: CallingConv.h:191
Calling convention used for AVR signal routines.
Definition: CallingConv.h:175
ARM_AAPCS - ARM Architecture Procedure Calling Standard calling convention (aka EABI).
Definition: CallingConv.h:99
Fast - This calling convention attempts to make calls as fast as possible (e.g.
Definition: CallingConv.h:42
ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
Definition: CallingConv.h:102