LLVM API Documentation
00001 //===-- llvm/CallingConv.h - LLVM Calling Conventions -----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines LLVM's set of calling conventions. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_IR_CALLINGCONV_H 00015 #define LLVM_IR_CALLINGCONV_H 00016 00017 namespace llvm { 00018 00019 /// CallingConv Namespace - This namespace contains an enum with a value for 00020 /// the well-known calling conventions. 00021 /// 00022 namespace CallingConv { 00023 /// LLVM IR allows to use arbitrary numbers as calling convention identifiers. 00024 typedef unsigned ID; 00025 00026 /// A set of enums which specify the assigned numeric values for known llvm 00027 /// calling conventions. 00028 /// @brief LLVM Calling Convention Representation 00029 enum { 00030 /// C - The default llvm calling convention, compatible with C. This 00031 /// convention is the only calling convention that supports varargs calls. 00032 /// As with typical C calling conventions, the callee/caller have to 00033 /// tolerate certain amounts of prototype mismatch. 00034 C = 0, 00035 00036 // Generic LLVM calling conventions. None of these calling conventions 00037 // support varargs calls, and all assume that the caller and callee 00038 // prototype exactly match. 00039 00040 /// Fast - This calling convention attempts to make calls as fast as 00041 /// possible (e.g. by passing things in registers). 00042 Fast = 8, 00043 00044 // Cold - This calling convention attempts to make code in the caller as 00045 // efficient as possible under the assumption that the call is not commonly 00046 // executed. As such, these calls often preserve all registers so that the 00047 // call does not break any live ranges in the caller side. 00048 Cold = 9, 00049 00050 // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC). 00051 GHC = 10, 00052 00053 // HiPE - Calling convention used by the High-Performance Erlang Compiler 00054 // (HiPE). 00055 HiPE = 11, 00056 00057 // WebKit JS - Calling convention for stack based JavaScript calls 00058 WebKit_JS = 12, 00059 00060 // AnyReg - Calling convention for dynamic register based calls (e.g. 00061 // stackmap and patchpoint intrinsics). 00062 AnyReg = 13, 00063 00064 // PreserveMost - Calling convention for runtime calls that preserves most 00065 // registers. 00066 PreserveMost = 14, 00067 00068 // PreserveAll - Calling convention for runtime calls that preserves 00069 // (almost) all registers. 00070 PreserveAll = 15, 00071 00072 // Target - This is the start of the target-specific calling conventions, 00073 // e.g. fastcall and thiscall on X86. 00074 FirstTargetCC = 64, 00075 00076 /// X86_StdCall - stdcall is the calling conventions mostly used by the 00077 /// Win32 API. It is basically the same as the C convention with the 00078 /// difference in that the callee is responsible for popping the arguments 00079 /// from the stack. 00080 X86_StdCall = 64, 00081 00082 /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments 00083 /// in ECX:EDX registers, others - via stack. Callee is responsible for 00084 /// stack cleaning. 00085 X86_FastCall = 65, 00086 00087 /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, 00088 /// but still used on some targets). 00089 ARM_APCS = 66, 00090 00091 /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling 00092 /// convention (aka EABI). Soft float variant. 00093 ARM_AAPCS = 67, 00094 00095 /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI. 00096 ARM_AAPCS_VFP = 68, 00097 00098 /// MSP430_INTR - Calling convention used for MSP430 interrupt routines. 00099 MSP430_INTR = 69, 00100 00101 /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX, 00102 /// others via stack. Callee is responsible for stack cleaning. MSVC uses 00103 /// this by default for methods in its ABI. 00104 X86_ThisCall = 70, 00105 00106 /// PTX_Kernel - Call to a PTX kernel. 00107 /// Passes all arguments in parameter space. 00108 PTX_Kernel = 71, 00109 00110 /// PTX_Device - Call to a PTX device function. 00111 /// Passes all arguments in register or parameter space. 00112 PTX_Device = 72, 00113 00114 /// SPIR_FUNC - Calling convention for SPIR non-kernel device functions. 00115 /// No lowering or expansion of arguments. 00116 /// Structures are passed as a pointer to a struct with the byval attribute. 00117 /// Functions can only call SPIR_FUNC and SPIR_KERNEL functions. 00118 /// Functions can only have zero or one return values. 00119 /// Variable arguments are not allowed, except for printf. 00120 /// How arguments/return values are lowered are not specified. 00121 /// Functions are only visible to the devices. 00122 SPIR_FUNC = 75, 00123 00124 /// SPIR_KERNEL - Calling convention for SPIR kernel functions. 00125 /// Inherits the restrictions of SPIR_FUNC, except 00126 /// Cannot have non-void return values. 00127 /// Cannot have variable arguments. 00128 /// Can also be called by the host. 00129 /// Is externally visible. 00130 SPIR_KERNEL = 76, 00131 00132 /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins 00133 Intel_OCL_BI = 77, 00134 00135 /// \brief The C convention as specified in the x86-64 supplement to the 00136 /// System V ABI, used on most non-Windows systems. 00137 X86_64_SysV = 78, 00138 00139 /// \brief The C convention as implemented on Windows/x86-64. This 00140 /// convention differs from the more common \c X86_64_SysV convention 00141 /// in a number of ways, most notably in that XMM registers used to pass 00142 /// arguments are shadowed by GPRs, and vice versa. 00143 X86_64_Win64 = 79 00144 }; 00145 } // End CallingConv namespace 00146 00147 } // End llvm namespace 00148 00149 #endif