clang 10.0.0git

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 {
26 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
27 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
28 #include "clang/Basic/BuiltinsNEON.def"
29 FirstTSBuiltin
30 };
31 }
32
33 /// ARM builtins
34 namespace ARM {
35 enum {
36 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
37 LastNEONBuiltin = NEON::FirstTSBuiltin - 1,
38 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
39 #include "clang/Basic/BuiltinsARM.def"
40 LastTSBuiltin
41 };
42 }
43
44 /// AArch64 builtins
45 namespace AArch64 {
46 enum {
47 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
48 LastNEONBuiltin = NEON::FirstTSBuiltin - 1,
49 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
50 #include "clang/Basic/BuiltinsAArch64.def"
51 LastTSBuiltin
52 };
53 }
54
55 /// BPF builtins
56 namespace BPF {
57 enum {
58 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
59 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
60 #include "clang/Basic/BuiltinsBPF.def"
61 LastTSBuiltin
62 };
63 }
64
65 /// PPC builtins
66 namespace PPC {
67 enum {
68 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
69 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
70 #include "clang/Basic/BuiltinsPPC.def"
71 LastTSBuiltin
72 };
73 }
74
75 /// NVPTX builtins
76 namespace NVPTX {
77 enum {
78 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
79 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
80 #include "clang/Basic/BuiltinsNVPTX.def"
81 LastTSBuiltin
82 };
83 }
84
85 /// AMDGPU builtins
86 namespace AMDGPU {
87 enum {
88 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
89 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
90 #include "clang/Basic/BuiltinsAMDGPU.def"
91 LastTSBuiltin
92 };
93 }
94
95 /// X86 builtins
96 namespace X86 {
97 enum {
98 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
99 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
100 #include "clang/Basic/BuiltinsX86.def"
101 FirstX86_64Builtin,
102 LastX86CommonBuiltin = FirstX86_64Builtin - 1,
103 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
104 #include "clang/Basic/BuiltinsX86_64.def"
105 LastTSBuiltin
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.
112 class NeonTypeFlags {
113 enum {
114 EltTypeMask = 0xf,
115 UnsignedFlag = 0x10,
116 QuadFlag = 0x20
117 };
118 uint32_t Flags;
119
120 public:
121 enum EltType {
122 Int8,
123 Int16,
124 Int32,
125 Int64,
126 Poly8,
127 Poly16,
128 Poly64,
129 Poly128,
130 Float16,
131 Float32,
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 {
155 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
156 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
157 #include "clang/Basic/BuiltinsHexagon.def"
158 LastTSBuiltin
159 };
160 }
161
162 /// MIPS builtins
163 namespace Mips {
164 enum {
165 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
166 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
167 #include "clang/Basic/BuiltinsMips.def"
168 LastTSBuiltin
169 };
170 }
171
172 /// XCore builtins
173 namespace XCore {
174 enum {
175 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
176 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
177 #include "clang/Basic/BuiltinsXCore.def"
178 LastTSBuiltin
179 };
180 }
181
182 /// Le64 builtins
183 namespace Le64 {
184 enum {
185 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
186 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
187 #include "clang/Basic/BuiltinsLe64.def"
188 LastTSBuiltin
189 };
190 }
191
192 /// SystemZ builtins
193 namespace SystemZ {
194 enum {
195 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
196 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
197 #include "clang/Basic/BuiltinsSystemZ.def"
198 LastTSBuiltin
199 };
200 }
201
202 /// WebAssembly builtins
203 namespace WebAssembly {
204 enum {
205 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
206 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
207 #include "clang/Basic/BuiltinsWebAssembly.def"
208 LastTSBuiltin
209 };
210 }
211
212 } // end namespace clang.
213
214 #endif
clang::NeonTypeFlags::Poly128
Definition: TargetBuiltins.h:129
clang::WebAssembly::LastTSBuiltin
Definition: TargetBuiltins.h:208
clang::NEON::FirstTSBuiltin
Definition: TargetBuiltins.h:29
clang::NeonTypeFlags::Int64
Definition: TargetBuiltins.h:125
clang::X86::FirstX86_64Builtin
Definition: TargetBuiltins.h:101
clang::NeonTypeFlags::EltType
EltType
Definition: TargetBuiltins.h:121
clang::AArch64::LastNEONBuiltin
Definition: TargetBuiltins.h:48
clang::NeonTypeFlags::Poly8
Definition: TargetBuiltins.h:126
clang::NeonTypeFlags::isUnsigned
bool isUnsigned() const
Definition: TargetBuiltins.h:148
clang::NeonTypeFlags::Int16
Definition: TargetBuiltins.h:123
clang::X86::LastX86CommonBuiltin
Definition: TargetBuiltins.h:102
clang::NeonTypeFlags::Poly64
Definition: TargetBuiltins.h:128
clang::NeonTypeFlags::Float16
Definition: TargetBuiltins.h:130
clang::NeonTypeFlags::getEltType
EltType getEltType() const
Definition: TargetBuiltins.h:143
clang::NeonTypeFlags::isPoly
bool isPoly() const
Definition: TargetBuiltins.h:144
clang::NeonTypeFlags::Poly16
Definition: TargetBuiltins.h:127
clang::NEON::LastTIBuiltin
Definition: TargetBuiltins.h:26
stdint.h
clang::NeonTypeFlags::NeonTypeFlags
NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad)
Definition: TargetBuiltins.h:136
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::NeonTypeFlags::NeonTypeFlags
NeonTypeFlags(unsigned F)
Definition: TargetBuiltins.h:135
clang::NeonTypeFlags
Flags to identify the types for overloaded Neon builtins.
Definition: TargetBuiltins.h:112
clang::NeonTypeFlags::Int8
Definition: TargetBuiltins.h:122
clang::NeonTypeFlags::Float32
Definition: TargetBuiltins.h:131
clang::Builtin::FirstTSBuiltin
Definition: Builtins.h:50
clang::NeonTypeFlags::isQuad
bool isQuad() const
Definition: TargetBuiltins.h:149
clang::NeonTypeFlags::Int32
Definition: TargetBuiltins.h:124
Builtins.h
Defines enum values for all the target-independent builtin functions.