clang  10.0.0svn
TargetBuiltins.h
Go to the documentation of this file.
1 //===--- TargetBuiltins.h - Target specific builtin IDs ---------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// Enumerates target-specific builtins in their own namespaces within
11 /// namespace ::clang.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_BASIC_TARGETBUILTINS_H
16 #define LLVM_CLANG_BASIC_TARGETBUILTINS_H
17 
18 #include <stdint.h>
19 #include "clang/Basic/Builtins.h"
20 #undef PPC
21 
22 namespace clang {
23 
24  namespace NEON {
25  enum {
27 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
28 #include "clang/Basic/BuiltinsNEON.def"
30  };
31  }
32 
33  /// ARM builtins
34  namespace ARM {
35  enum {
38 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
39 #include "clang/Basic/BuiltinsARM.def"
41  };
42  }
43 
44  /// AArch64 builtins
45  namespace AArch64 {
46  enum {
49  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
50  #include "clang/Basic/BuiltinsAArch64.def"
52  };
53  }
54 
55  /// BPF builtins
56  namespace BPF {
57  enum {
59  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
60  #include "clang/Basic/BuiltinsBPF.def"
62  };
63  }
64 
65  /// PPC builtins
66  namespace PPC {
67  enum {
69 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
70 #include "clang/Basic/BuiltinsPPC.def"
72  };
73  }
74 
75  /// NVPTX builtins
76  namespace NVPTX {
77  enum {
79 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
80 #include "clang/Basic/BuiltinsNVPTX.def"
82  };
83  }
84 
85  /// AMDGPU builtins
86  namespace AMDGPU {
87  enum {
89  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
90  #include "clang/Basic/BuiltinsAMDGPU.def"
92  };
93  }
94 
95  /// X86 builtins
96  namespace X86 {
97  enum {
99 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
100 #include "clang/Basic/BuiltinsX86.def"
103 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
104 #include "clang/Basic/BuiltinsX86_64.def"
106  };
107  }
108 
109  /// Flags to identify the types for overloaded Neon builtins.
110  ///
111  /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
113  enum {
114  EltTypeMask = 0xf,
115  UnsignedFlag = 0x10,
116  QuadFlag = 0x20
117  };
118  uint32_t Flags;
119 
120  public:
121  enum EltType {
132  Float64
133  };
134 
135  NeonTypeFlags(unsigned F) : Flags(F) {}
136  NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
137  if (IsUnsigned)
138  Flags |= UnsignedFlag;
139  if (IsQuad)
140  Flags |= QuadFlag;
141  }
142 
143  EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
144  bool isPoly() const {
145  EltType ET = getEltType();
146  return ET == Poly8 || ET == Poly16;
147  }
148  bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
149  bool isQuad() const { return (Flags & QuadFlag) != 0; }
150  };
151 
152  /// Hexagon builtins
153  namespace Hexagon {
154  enum {
156 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
157 #include "clang/Basic/BuiltinsHexagon.def"
159  };
160  }
161 
162  /// MIPS builtins
163  namespace Mips {
164  enum {
166 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
167 #include "clang/Basic/BuiltinsMips.def"
169  };
170  }
171 
172  /// XCore builtins
173  namespace XCore {
174  enum {
176 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
177 #include "clang/Basic/BuiltinsXCore.def"
179  };
180  }
181 
182  /// Le64 builtins
183  namespace Le64 {
184  enum {
186  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
187  #include "clang/Basic/BuiltinsLe64.def"
189  };
190  }
191 
192  /// SystemZ builtins
193  namespace SystemZ {
194  enum {
196 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
197 #include "clang/Basic/BuiltinsSystemZ.def"
199  };
200  }
201 
202  /// WebAssembly builtins
203  namespace WebAssembly {
204  enum {
206 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
207 #include "clang/Basic/BuiltinsWebAssembly.def"
209  };
210  }
211 
212 } // end namespace clang.
213 
214 #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.