clang  9.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  /// PPC builtins
56  namespace PPC {
57  enum {
59 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
60 #include "clang/Basic/BuiltinsPPC.def"
62  };
63  }
64 
65  /// NVPTX builtins
66  namespace NVPTX {
67  enum {
69 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
70 #include "clang/Basic/BuiltinsNVPTX.def"
72  };
73  }
74 
75  /// AMDGPU builtins
76  namespace AMDGPU {
77  enum {
79  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
80  #include "clang/Basic/BuiltinsAMDGPU.def"
82  };
83  }
84 
85  /// X86 builtins
86  namespace X86 {
87  enum {
89 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
90 #include "clang/Basic/BuiltinsX86.def"
93 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
94 #include "clang/Basic/BuiltinsX86_64.def"
96  };
97  }
98 
99  /// Flags to identify the types for overloaded Neon builtins.
100  ///
101  /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h.
103  enum {
104  EltTypeMask = 0xf,
105  UnsignedFlag = 0x10,
106  QuadFlag = 0x20
107  };
108  uint32_t Flags;
109 
110  public:
111  enum EltType {
122  Float64
123  };
124 
125  NeonTypeFlags(unsigned F) : Flags(F) {}
126  NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
127  if (IsUnsigned)
128  Flags |= UnsignedFlag;
129  if (IsQuad)
130  Flags |= QuadFlag;
131  }
132 
133  EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
134  bool isPoly() const {
135  EltType ET = getEltType();
136  return ET == Poly8 || ET == Poly16;
137  }
138  bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
139  bool isQuad() const { return (Flags & QuadFlag) != 0; }
140  };
141 
142  /// Hexagon builtins
143  namespace Hexagon {
144  enum {
146 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
147 #include "clang/Basic/BuiltinsHexagon.def"
149  };
150  }
151 
152  /// MIPS builtins
153  namespace Mips {
154  enum {
156 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
157 #include "clang/Basic/BuiltinsMips.def"
159  };
160  }
161 
162  /// XCore builtins
163  namespace XCore {
164  enum {
166 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
167 #include "clang/Basic/BuiltinsXCore.def"
169  };
170  }
171 
172  /// Le64 builtins
173  namespace Le64 {
174  enum {
176  #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
177  #include "clang/Basic/BuiltinsLe64.def"
179  };
180  }
181 
182  /// SystemZ builtins
183  namespace SystemZ {
184  enum {
186 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
187 #include "clang/Basic/BuiltinsSystemZ.def"
189  };
190  }
191 
192  /// WebAssembly builtins
193  namespace WebAssembly {
194  enum {
196 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
197 #include "clang/Basic/BuiltinsWebAssembly.def"
199  };
200  }
201 
202 } // end namespace clang.
203 
204 #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.