Move all of the header files which are involved in modelling the LLVM IR
[oota-llvm.git] / include / llvm / IR / CallingConv.h
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_CALLINGCONV_H
15 #define LLVM_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   /// A set of enums which specify the assigned numeric values for known llvm
24   /// calling conventions.
25   /// @brief LLVM Calling Convention Representation
26   enum ID {
27     /// C - The default llvm calling convention, compatible with C.  This
28     /// convention is the only calling convention that supports varargs calls.
29     /// As with typical C calling conventions, the callee/caller have to
30     /// tolerate certain amounts of prototype mismatch.
31     C = 0,
32
33     // Generic LLVM calling conventions.  None of these calling conventions
34     // support varargs calls, and all assume that the caller and callee
35     // prototype exactly match.
36
37     /// Fast - This calling convention attempts to make calls as fast as
38     /// possible (e.g. by passing things in registers).
39     Fast = 8,
40
41     // Cold - This calling convention attempts to make code in the caller as
42     // efficient as possible under the assumption that the call is not commonly
43     // executed.  As such, these calls often preserve all registers so that the
44     // call does not break any live ranges in the caller side.
45     Cold = 9,
46
47     // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
48     GHC = 10,
49
50     // HiPE - Calling convention used by the High-Performance Erlang Compiler
51     // (HiPE).
52     HiPE = 11,
53
54     // Target - This is the start of the target-specific calling conventions,
55     // e.g. fastcall and thiscall on X86.
56     FirstTargetCC = 64,
57
58     /// X86_StdCall - stdcall is the calling conventions mostly used by the
59     /// Win32 API. It is basically the same as the C convention with the
60     /// difference in that the callee is responsible for popping the arguments
61     /// from the stack.
62     X86_StdCall = 64,
63
64     /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
65     /// in ECX:EDX registers, others - via stack. Callee is responsible for
66     /// stack cleaning.
67     X86_FastCall = 65,
68
69     /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete,
70     /// but still used on some targets).
71     ARM_APCS = 66,
72
73     /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling
74     /// convention (aka EABI). Soft float variant.
75     ARM_AAPCS = 67,
76
77     /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
78     ARM_AAPCS_VFP = 68,
79
80     /// MSP430_INTR - Calling convention used for MSP430 interrupt routines.
81     MSP430_INTR = 69,
82
83     /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX,
84     /// others via stack. Callee is responsible for stack cleaning. MSVC uses
85     /// this by default for methods in its ABI.
86     X86_ThisCall = 70,
87
88     /// PTX_Kernel - Call to a PTX kernel.
89     /// Passes all arguments in parameter space.
90     PTX_Kernel = 71,
91
92     /// PTX_Device - Call to a PTX device function.
93     /// Passes all arguments in register or parameter space.
94     PTX_Device = 72,
95
96     /// MBLAZE_INTR - Calling convention used for MBlaze interrupt routines.
97     MBLAZE_INTR = 73,
98
99     /// MBLAZE_INTR - Calling convention used for MBlaze interrupt support
100     /// routines (i.e. GCC's save_volatiles attribute).
101     MBLAZE_SVOL = 74,
102
103     /// SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
104     /// No lowering or expansion of arguments.
105     /// Structures are passed as a pointer to a struct with the byval attribute.
106     /// Functions can only call SPIR_FUNC and SPIR_KERNEL functions.
107     /// Functions can only have zero or one return values.
108     /// Variable arguments are not allowed, except for printf.
109     /// How arguments/return values are lowered are not specified.
110     /// Functions are only visible to the devices.
111     SPIR_FUNC = 75,
112
113     /// SPIR_KERNEL - Calling convention for SPIR kernel functions.
114     /// Inherits the restrictions of SPIR_FUNC, except
115     /// Cannot have non-void return values.
116     /// Cannot have variable arguments.
117     /// Can also be called by the host.
118     /// Is externally visible.
119     SPIR_KERNEL = 76,
120
121     /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins
122     Intel_OCL_BI = 77
123
124   };
125 } // End CallingConv namespace
126
127 } // End llvm namespace
128
129 #endif