]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/TargetBuiltins.h
There is no Python in the FreeBSD base system
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Basic / TargetBuiltins.h
1 //===--- TargetBuiltins.h - Target specific builtin IDs ---------*- 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 /// \file
11 /// \brief Enumerates target-specific builtins in their own namespaces within
12 /// namespace ::clang.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CLANG_BASIC_TARGET_BUILTINS_H
17 #define LLVM_CLANG_BASIC_TARGET_BUILTINS_H
18
19 #include "clang/Basic/Builtins.h"
20 #undef PPC
21
22 namespace clang {
23
24   namespace NEON {
25   enum {
26     LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
27 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
28 #include "clang/Basic/BuiltinsNEON.def"
29     FirstTSBuiltin
30   };
31   }
32
33   /// \brief ARM builtins
34   namespace ARM {
35     enum {
36       LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
37       LastNEONBuiltin = NEON::FirstTSBuiltin - 1,
38 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
39 #include "clang/Basic/BuiltinsARM.def"
40       LastTSBuiltin
41     };
42   }
43
44   /// \brief AArch64 builtins
45   namespace AArch64 {
46   enum {
47     LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
48     LastNEONBuiltin = NEON::FirstTSBuiltin - 1,
49   #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
50   #include "clang/Basic/BuiltinsAArch64.def"
51     LastTSBuiltin
52   };
53   }
54
55   /// \brief PPC builtins
56   namespace PPC {
57     enum {
58         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
59 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
60 #include "clang/Basic/BuiltinsPPC.def"
61         LastTSBuiltin
62     };
63   }
64
65   /// \brief NVPTX builtins
66   namespace NVPTX {
67     enum {
68         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
69 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
70 #include "clang/Basic/BuiltinsNVPTX.def"
71         LastTSBuiltin
72     };
73   }
74
75   /// \brief R600 builtins
76   namespace R600 {
77   enum {
78     LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
79   #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
80   #include "clang/Basic/BuiltinsR600.def"
81     LastTSBuiltin
82   };
83   }
84
85   /// \brief X86 builtins
86   namespace X86 {
87     enum {
88         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
89 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
90 #include "clang/Basic/BuiltinsX86.def"
91         LastTSBuiltin
92     };
93   }
94
95   /// \brief Flags to identify the types for overloaded Neon builtins.
96   ///
97   /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
98   class NeonTypeFlags {
99     enum {
100       EltTypeMask = 0xf,
101       UnsignedFlag = 0x10,
102       QuadFlag = 0x20
103     };
104     uint32_t Flags;
105
106   public:
107     enum EltType {
108       Int8,
109       Int16,
110       Int32,
111       Int64,
112       Poly8,
113       Poly16,
114       Poly64,
115       Poly128,
116       Float16,
117       Float32,
118       Float64
119     };
120
121     NeonTypeFlags(unsigned F) : Flags(F) {}
122     NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
123       if (IsUnsigned)
124         Flags |= UnsignedFlag;
125       if (IsQuad)
126         Flags |= QuadFlag;
127     }
128
129     EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
130     bool isPoly() const {
131       EltType ET = getEltType();
132       return ET == Poly8 || ET == Poly16;
133     }
134     bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
135     bool isQuad() const { return (Flags & QuadFlag) != 0; }
136   };
137
138   /// \brief Hexagon builtins
139   namespace Hexagon {
140     enum {
141         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
142 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
143 #include "clang/Basic/BuiltinsHexagon.def"
144         LastTSBuiltin
145     };
146   }
147
148   /// \brief MIPS builtins
149   namespace Mips {
150     enum {
151         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
152 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
153 #include "clang/Basic/BuiltinsMips.def"
154         LastTSBuiltin
155     };
156   }
157
158   /// \brief XCore builtins
159   namespace XCore {
160     enum {
161         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
162 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
163 #include "clang/Basic/BuiltinsXCore.def"
164         LastTSBuiltin
165     };
166   }
167 } // end namespace clang.
168
169 #endif