clang  8.0.0
TargetBuiltins.h
Go to the documentation of this file.
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 /// Enumerates target-specific builtins in their own namespaces within
12 /// namespace ::clang.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_CLANG_BASIC_TARGETBUILTINS_H
17 #define LLVM_CLANG_BASIC_TARGETBUILTINS_H
18 
19 #include <stdint.h>
20 #include "clang/Basic/Builtins.h"
21 #undef PPC
22 
23 namespace clang {
24 
25  namespace NEON {
26  enum {
28 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
29 #include "clang/Basic/BuiltinsNEON.def"
31  };
32  }
33 
34  /// ARM builtins
35  namespace ARM {
36  enum {
39 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
40 #include "clang/Basic/BuiltinsARM.def"
42  };
43  }
44 
45  /// AArch64 builtins
46  namespace AArch64 {
47  enum {
50  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
51  #include "clang/Basic/BuiltinsAArch64.def"
53  };
54  }
55 
56  /// PPC builtins
57  namespace PPC {
58  enum {
60 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
61 #include "clang/Basic/BuiltinsPPC.def"
63  };
64  }
65 
66  /// NVPTX builtins
67  namespace NVPTX {
68  enum {
70 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
71 #include "clang/Basic/BuiltinsNVPTX.def"
73  };
74  }
75 
76  /// AMDGPU builtins
77  namespace AMDGPU {
78  enum {
80  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
81  #include "clang/Basic/BuiltinsAMDGPU.def"
83  };
84  }
85 
86  /// X86 builtins
87  namespace X86 {
88  enum {
90 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
91 #include "clang/Basic/BuiltinsX86.def"
94 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
95 #include "clang/Basic/BuiltinsX86_64.def"
97  };
98  }
99 
100  /// Flags to identify the types for overloaded Neon builtins.
101  ///
102  /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
104  enum {
105  EltTypeMask = 0xf,
106  UnsignedFlag = 0x10,
107  QuadFlag = 0x20
108  };
109  uint32_t Flags;
110 
111  public:
112  enum EltType {
123  Float64
124  };
125 
126  NeonTypeFlags(unsigned F) : Flags(F) {}
127  NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
128  if (IsUnsigned)
129  Flags |= UnsignedFlag;
130  if (IsQuad)
131  Flags |= QuadFlag;
132  }
133 
134  EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
135  bool isPoly() const {
136  EltType ET = getEltType();
137  return ET == Poly8 || ET == Poly16;
138  }
139  bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
140  bool isQuad() const { return (Flags & QuadFlag) != 0; }
141  };
142 
143  /// Hexagon builtins
144  namespace Hexagon {
145  enum {
147 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
148 #include "clang/Basic/BuiltinsHexagon.def"
150  };
151  }
152 
153  /// MIPS builtins
154  namespace Mips {
155  enum {
157 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
158 #include "clang/Basic/BuiltinsMips.def"
160  };
161  }
162 
163  /// XCore builtins
164  namespace XCore {
165  enum {
167 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
168 #include "clang/Basic/BuiltinsXCore.def"
170  };
171  }
172 
173  /// Le64 builtins
174  namespace Le64 {
175  enum {
177  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
178  #include "clang/Basic/BuiltinsLe64.def"
180  };
181  }
182 
183  /// SystemZ builtins
184  namespace SystemZ {
185  enum {
187 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
188 #include "clang/Basic/BuiltinsSystemZ.def"
190  };
191  }
192 
193  /// WebAssembly builtins
194  namespace WebAssembly {
195  enum {
197 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
198 #include "clang/Basic/BuiltinsWebAssembly.def"
200  };
201  }
202 
203 } // end namespace clang.
204 
205 #endif
bool isUnsigned() const
EltType getEltType() const
NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad)
Dataflow Directional Tag Classes.
NeonTypeFlags(unsigned F)
Flags to identify the types for overloaded Neon builtins.
Defines enum values for all the target-independent builtin functions.