]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/tools/clang/include/clang/Basic/TargetBuiltins.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 /// \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   /// \brief AArch64 builtins
25   namespace AArch64 {
26     enum {
27       LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
28 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
29 #include "clang/Basic/BuiltinsAArch64.def"
30       LastTSBuiltin
31     };
32   }
33   /// \brief ARM builtins
34   namespace ARM {
35     enum {
36         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
37 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
38 #include "clang/Basic/BuiltinsARM.def"
39         LastTSBuiltin
40     };
41   }
42
43   /// \brief PPC builtins
44   namespace PPC {
45     enum {
46         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
47 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
48 #include "clang/Basic/BuiltinsPPC.def"
49         LastTSBuiltin
50     };
51   }
52
53   /// \brief NVPTX builtins
54   namespace NVPTX {
55     enum {
56         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
57 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
58 #include "clang/Basic/BuiltinsNVPTX.def"
59         LastTSBuiltin
60     };
61   }
62
63
64   /// \brief X86 builtins
65   namespace X86 {
66     enum {
67         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
68 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
69 #include "clang/Basic/BuiltinsX86.def"
70         LastTSBuiltin
71     };
72   }
73
74   /// \brief Flags to identify the types for overloaded Neon builtins.
75   ///
76   /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
77   class NeonTypeFlags {
78     enum {
79       EltTypeMask = 0xf,
80       UnsignedFlag = 0x10,
81       QuadFlag = 0x20
82     };
83     uint32_t Flags;
84
85   public:
86     enum EltType {
87       Int8,
88       Int16,
89       Int32,
90       Int64,
91       Poly8,
92       Poly16,
93       Float16,
94       Float32
95     };
96
97     NeonTypeFlags(unsigned F) : Flags(F) {}
98     NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
99       if (IsUnsigned)
100         Flags |= UnsignedFlag;
101       if (IsQuad)
102         Flags |= QuadFlag;
103     }
104
105     EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
106     bool isPoly() const {
107       EltType ET = getEltType();
108       return ET == Poly8 || ET == Poly16;
109     }
110     bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
111     bool isQuad() const { return (Flags & QuadFlag) != 0; }
112   };
113
114   /// \brief Hexagon builtins
115   namespace Hexagon {
116     enum {
117         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
118 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
119 #include "clang/Basic/BuiltinsHexagon.def"
120         LastTSBuiltin
121     };
122   }
123
124   /// \brief MIPS builtins
125   namespace Mips {
126     enum {
127         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
128 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
129 #include "clang/Basic/BuiltinsMips.def"
130         LastTSBuiltin
131     };
132   }
133 } // end namespace clang.
134
135 #endif