LLVM API Documentation

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