• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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       Float64
96     };
97 
NeonTypeFlags(unsigned F)98     NeonTypeFlags(unsigned F) : Flags(F) {}
NeonTypeFlags(EltType ET,bool IsUnsigned,bool IsQuad)99     NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
100       if (IsUnsigned)
101         Flags |= UnsignedFlag;
102       if (IsQuad)
103         Flags |= QuadFlag;
104     }
105 
getEltType()106     EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
isPoly()107     bool isPoly() const {
108       EltType ET = getEltType();
109       return ET == Poly8 || ET == Poly16;
110     }
isUnsigned()111     bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
isQuad()112     bool isQuad() const { return (Flags & QuadFlag) != 0; }
113   };
114 
115   /// \brief Hexagon builtins
116   namespace Hexagon {
117     enum {
118         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
119 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
120 #include "clang/Basic/BuiltinsHexagon.def"
121         LastTSBuiltin
122     };
123   }
124 
125   /// \brief MIPS builtins
126   namespace Mips {
127     enum {
128         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
129 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
130 #include "clang/Basic/BuiltinsMips.def"
131         LastTSBuiltin
132     };
133   }
134 } // end namespace clang.
135 
136 #endif
137