]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/Basic/TargetBuiltins.h
MFC r234353:
[FreeBSD/stable/9.git] / contrib / llvm / tools / clang / include / clang / Basic / TargetBuiltins.h
1 //===--- TargetBuiltins.h - Target specific builtin IDs -------------------===//
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 #ifndef LLVM_CLANG_BASIC_TARGET_BUILTINS_H
11 #define LLVM_CLANG_BASIC_TARGET_BUILTINS_H
12
13 #include "clang/Basic/Builtins.h"
14 #undef PPC
15
16 namespace clang {
17
18   /// ARM builtins
19   namespace ARM {
20     enum {
21         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
22 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
23 #include "clang/Basic/BuiltinsARM.def"
24         LastTSBuiltin
25     };
26   }
27
28   /// PPC builtins
29   namespace PPC {
30     enum {
31         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
32 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
33 #include "clang/Basic/BuiltinsPPC.def"
34         LastTSBuiltin
35     };
36   }
37
38   /// PTX builtins
39   namespace PTX {
40     enum {
41         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
42 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
43 #include "clang/Basic/BuiltinsPTX.def"
44         LastTSBuiltin
45     };
46   }
47
48
49   /// X86 builtins
50   namespace X86 {
51     enum {
52         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
53 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
54 #include "clang/Basic/BuiltinsX86.def"
55         LastTSBuiltin
56     };
57   }
58
59   /// NeonTypeFlags - Flags to identify the types for overloaded Neon
60   /// builtins.  These must be kept in sync with the flags in
61   /// utils/TableGen/NeonEmitter.h.
62   class NeonTypeFlags {
63     enum {
64       EltTypeMask = 0xf,
65       UnsignedFlag = 0x10,
66       QuadFlag = 0x20
67     };
68     uint32_t Flags;
69
70   public:
71     enum EltType {
72       Int8,
73       Int16,
74       Int32,
75       Int64,
76       Poly8,
77       Poly16,
78       Float16,
79       Float32
80     };
81
82     NeonTypeFlags(unsigned F) : Flags(F) {}
83     NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
84       if (IsUnsigned)
85         Flags |= UnsignedFlag;
86       if (IsQuad)
87         Flags |= QuadFlag;
88     }
89
90     EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
91     bool isPoly() const {
92       EltType ET = getEltType();
93       return ET == Poly8 || ET == Poly16;
94     }
95     bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
96     bool isQuad() const { return (Flags & QuadFlag) != 0; }
97   };
98
99   /// Hexagon builtins
100   namespace Hexagon {
101     enum {
102         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
103 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
104 #include "clang/Basic/BuiltinsHexagon.def"
105         LastTSBuiltin
106     };
107   }
108 } // end namespace clang.
109
110 #endif