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 {
23 /// LLVM IR allows to use arbitrary numbers as calling convention identifiers.
26 /// A set of enums which specify the assigned numeric values for known llvm
27 /// calling conventions.
28 /// @brief LLVM Calling Convention Representation
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.
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.
40 /// Fast - This calling convention attempts to make calls as fast as
41 /// possible (e.g. by passing things in registers).
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.
50 // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
53 // HiPE - Calling convention used by the High-Performance Erlang Compiler
57 // WebKit JS - Calling convention for stack based JavaScript calls
60 // AnyReg - Calling convention for dynamic register based calls (e.g.
61 // stackmap and patchpoint intrinsics).
64 // PreserveMost - Calling convention for runtime calls that preserves most
68 // PreserveAll - Calling convention for runtime calls that preserves
69 // (almost) all registers.
72 // Target - This is the start of the target-specific calling conventions,
73 // e.g. fastcall and thiscall on X86.
76 /// X86_StdCall - stdcall is the calling conventions mostly used by the
77 /// Win32 API. It is basically the same as the C convention with the
78 /// difference in that the callee is responsible for popping the arguments
82 /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
83 /// in ECX:EDX registers, others - via stack. Callee is responsible for
87 /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete,
88 /// but still used on some targets).
91 /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling
92 /// convention (aka EABI). Soft float variant.
95 /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
98 /// MSP430_INTR - Calling convention used for MSP430 interrupt routines.
101 /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX,
102 /// others via stack. Callee is responsible for stack cleaning. MSVC uses
103 /// this by default for methods in its ABI.
106 /// PTX_Kernel - Call to a PTX kernel.
107 /// Passes all arguments in parameter space.
110 /// PTX_Device - Call to a PTX device function.
111 /// Passes all arguments in register or parameter space.
114 /// SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
115 /// No lowering or expansion of arguments.
116 /// Structures are passed as a pointer to a struct with the byval attribute.
117 /// Functions can only call SPIR_FUNC and SPIR_KERNEL functions.
118 /// Functions can only have zero or one return values.
119 /// Variable arguments are not allowed, except for printf.
120 /// How arguments/return values are lowered are not specified.
121 /// Functions are only visible to the devices.
124 /// SPIR_KERNEL - Calling convention for SPIR kernel functions.
125 /// Inherits the restrictions of SPIR_FUNC, except
126 /// Cannot have non-void return values.
127 /// Cannot have variable arguments.
128 /// Can also be called by the host.
129 /// Is externally visible.
132 /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins
135 /// \brief The C convention as specified in the x86-64 supplement to the
136 /// System V ABI, used on most non-Windows systems.
139 /// \brief The C convention as implemented on Windows/x86-64. This
140 /// convention differs from the more common \c X86_64_SysV convention
141 /// in a number of ways, most notably in that XMM registers used to pass
142 /// arguments are shadowed by GPRs, and vice versa.
145 /// \brief MSVC calling convention that passes vectors and vector aggregates
146 /// in SSE registers.
149 } // End CallingConv namespace
151 } // End llvm namespace