1a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner//===-- llvm/CallingConv.h - LLVM Calling Conventions -----------*- C++ -*-===// 2a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner// 3a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner// The LLVM Compiler Infrastructure 4a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner// 57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source 67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details. 7a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner// 8a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner//===----------------------------------------------------------------------===// 9a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner// 10534771fc4f99a8c69802f58ce97e566fd0942f70Che-Liang Chiou// This file defines LLVM's set of calling conventions. 11a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner// 12a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner//===----------------------------------------------------------------------===// 13a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 14a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner#ifndef LLVM_CALLINGCONV_H 15a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner#define LLVM_CALLINGCONV_H 16a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 17a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattnernamespace llvm { 18a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 19a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner/// CallingConv Namespace - This namespace contains an enum with a value for 20a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner/// the well-known calling conventions. 21a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner/// 22a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattnernamespace CallingConv { 23534771fc4f99a8c69802f58ce97e566fd0942f70Che-Liang Chiou /// A set of enums which specify the assigned numeric values for known llvm 24bddcb9427cb36ac6609fef233eaac3c9b5e5a8f4Reid Spencer /// calling conventions. 25bddcb9427cb36ac6609fef233eaac3c9b5e5a8f4Reid Spencer /// @brief LLVM Calling Convention Representation 26a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner enum ID { 27bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// C - The default llvm calling convention, compatible with C. This 28bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// convention is the only calling convention that supports varargs calls. 29534771fc4f99a8c69802f58ce97e566fd0942f70Che-Liang Chiou /// As with typical C calling conventions, the callee/caller have to 3002b2a4c77a7146f434a74d3db44ebaf79be3a5e7Reid Spencer /// tolerate certain amounts of prototype mismatch. 31a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner C = 0, 32534771fc4f99a8c69802f58ce97e566fd0942f70Che-Liang Chiou 33a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // Generic LLVM calling conventions. None of these calling conventions 34a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // support varargs calls, and all assume that the caller and callee 35a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // prototype exactly match. 36a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 37534771fc4f99a8c69802f58ce97e566fd0942f70Che-Liang Chiou /// Fast - This calling convention attempts to make calls as fast as 382853367fd0f8ce1655a1f5fd2b44d8190fba1adeDan Gohman /// possible (e.g. by passing things in registers). 39a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner Fast = 8, 40a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 41a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // Cold - This calling convention attempts to make code in the caller as 42a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // efficient as possible under the assumption that the call is not commonly 43a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // executed. As such, these calls often preserve all registers so that the 44a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // call does not break any live ranges in the caller side. 45a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner Cold = 9, 46a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 4729689434635364346cbef6f4e309f1d9fcdd5d80Chris Lattner // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC). 4829689434635364346cbef6f4e309f1d9fcdd5d80Chris Lattner GHC = 10, 4929689434635364346cbef6f4e309f1d9fcdd5d80Chris Lattner 50a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // Target - This is the start of the target-specific calling conventions, 51a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner // e.g. fastcall and thiscall on X86. 52bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov FirstTargetCC = 64, 53bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov 54bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// X86_StdCall - stdcall is the calling conventions mostly used by the 55bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// Win32 API. It is basically the same as the C convention with the 56bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// difference in that the callee is responsible for popping the arguments 57bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// from the stack. 58bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov X86_StdCall = 64, 59bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov 60bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments 61bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// in ECX:EDX registers, others - via stack. Callee is responsible for 62bcb9770efe409f3291ce21269904744e7bf3397bAnton Korobeynikov /// stack cleaning. 63385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov X86_FastCall = 65, 64385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov 65385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, 66385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov /// but still used on some targets). 67385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov ARM_APCS = 66, 68385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov 69385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling 70385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov /// convention (aka EABI). Soft float variant. 71385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov ARM_AAPCS = 67, 72385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov 73385f5a99ecc7fee48a7539bc63d3e1d3b5089c0dAnton Korobeynikov /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI. 74211a14e476abc9b864ab6a5d5e0bbb86d288b650Anton Korobeynikov ARM_AAPCS_VFP = 68, 75211a14e476abc9b864ab6a5d5e0bbb86d288b650Anton Korobeynikov 76211a14e476abc9b864ab6a5d5e0bbb86d288b650Anton Korobeynikov /// MSP430_INTR - Calling convention used for MSP430 interrupt routines. 77ded05e34b65dc42998e9db6ca1abd513e7a9d120Anton Korobeynikov MSP430_INTR = 69, 78ded05e34b65dc42998e9db6ca1abd513e7a9d120Anton Korobeynikov 79ded05e34b65dc42998e9db6ca1abd513e7a9d120Anton Korobeynikov /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX, 80ded05e34b65dc42998e9db6ca1abd513e7a9d120Anton Korobeynikov /// others via stack. Callee is responsible for stack cleaning. MSVC uses 81ded05e34b65dc42998e9db6ca1abd513e7a9d120Anton Korobeynikov /// this by default for methods in its ABI. 82f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou X86_ThisCall = 70, 83f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou 84f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou /// PTX_Kernel - Call to a PTX kernel. 85f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou /// Passes all arguments in parameter space. 86f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou PTX_Kernel = 71, 87f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou 88f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou /// PTX_Device - Call to a PTX device function. 89f9930da2ef72350c6c805af09e754e4e6e13d47bChe-Liang Chiou /// Passes all arguments in register or parameter space. 90d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck PTX_Device = 72, 91d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck 92d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck /// MBLAZE_INTR - Calling convention used for MBlaze interrupt routines. 93d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck MBLAZE_INTR = 73, 94d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck 95d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck /// MBLAZE_INTR - Calling convention used for MBlaze interrupt support 96d364acd3d7b0dd78bc92e168af268a56ff7141d4Wesley Peck /// routines (i.e. GCC's save_volatiles attribute). 9749d7999b89759a1b58180fec9c491ba05204c95cTilmann Scheller MBLAZE_SVOL = 74 98a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner }; 99a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner} // End CallingConv namespace 100a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 101a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner} // End llvm namespace 102a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner 103a62e52ab181c10738066e65a6dcc6c3cdfa5d806Chris Lattner#endif 104