8b6a01a0cf5605d0d0e3c4baea5994d048ae1ed6
[oota-llvm.git] / include / llvm / 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     // Target - This is the start of the target-specific calling conventions,
48     // e.g. fastcall and thiscall on X86.
49     FirstTargetCC = 64,
50
51     /// X86_StdCall - stdcall is the calling conventions mostly used by the
52     /// Win32 API. It is basically the same as the C convention with the
53     /// difference in that the callee is responsible for popping the arguments
54     /// from the stack.
55     X86_StdCall = 64,
56
57     /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
58     /// in ECX:EDX registers, others - via stack. Callee is responsible for
59     /// stack cleaning.
60     X86_FastCall = 65,
61
62     /// X86_Ocaml - This is a weird ABI used by Objective Caml. Formally, it
63     /// supports only one to six integer/address arguments, all in-reg. It also
64     /// supports tail call emission.
65     X86_Ocaml = 66
66   };
67 } // End CallingConv namespace
68
69 } // End llvm namespace
70
71 #endif