clang 19.0.0git
OpenACCKinds.h
Go to the documentation of this file.
1//===--- OpenACCKinds.h - OpenACC Enums -------------------------*- 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/// Defines some OpenACC-specific enums and functions.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_BASIC_OPENACCKINDS_H
15#define LLVM_CLANG_BASIC_OPENACCKINDS_H
16
18#include "llvm/Support/ErrorHandling.h"
19#include "llvm/Support/raw_ostream.h"
20
21namespace clang {
22// Represents the Construct/Directive kind of a pragma directive. Note the
23// OpenACC standard is inconsistent between calling these Construct vs
24// Directive, but we're calling it a Directive to be consistent with OpenMP.
26 // Compute Constructs.
28 Serial,
29 Kernels,
30
31 // Data Environment. "enter data" and "exit data" are also referred to in the
32 // Executable Directives section, but just as a back reference to the Data
33 // Environment.
34 Data,
38
39 // Misc.
40 Loop,
41 Cache,
42
43 // Combined Constructs.
47
48 // Atomic Construct.
49 Atomic,
50
51 // Declare Directive.
52 Declare,
53
54 // Executable Directives. "wait" is first referred to here, but ends up being
55 // in its own section after "routine".
56 Init,
58 Set,
59 Update,
60 Wait,
61
62 // Procedure Calls in Compute Regions.
63 Routine,
64
65 // Invalid.
66 Invalid,
67};
68
69template <typename StreamTy>
70inline StreamTy &printOpenACCDirectiveKind(StreamTy &Out,
72 switch (K) {
74 return Out << "parallel";
75
77 return Out << "serial";
78
80 return Out << "kernels";
81
83 return Out << "data";
84
86 return Out << "enter data";
87
89 return Out << "exit data";
90
92 return Out << "host_data";
93
95 return Out << "loop";
96
98 return Out << "cache";
99
101 return Out << "parallel loop";
102
104 return Out << "serial loop";
105
107 return Out << "kernels loop";
108
110 return Out << "atomic";
111
113 return Out << "declare";
114
116 return Out << "init";
117
119 return Out << "shutdown";
120
122 return Out << "set";
123
125 return Out << "update";
126
128 return Out << "wait";
129
131 return Out << "routine";
132
134 return Out << "<invalid>";
135 }
136 llvm_unreachable("Uncovered directive kind");
137}
138
141 return printOpenACCDirectiveKind(Out, K);
142}
143
144inline llvm::raw_ostream &operator<<(llvm::raw_ostream &Out,
146 return printOpenACCDirectiveKind(Out, K);
147}
148
150 return K == OpenACCDirectiveKind::Parallel ||
153}
154
156 Read,
157 Write,
158 Update,
159 Capture,
160 Invalid,
161};
162
163/// Represents the kind of an OpenACC clause.
165 /// 'finalize' clause, allowed on 'exit data' directive.
166 Finalize,
167 /// 'if_present' clause, allowed on 'host_data' and 'update' directives.
168 IfPresent,
169 /// 'seq' clause, allowed on 'loop' and 'routine' directives.
170 Seq,
171 /// 'independent' clause, allowed on 'loop' directives.
173 /// 'auto' clause, allowed on 'loop' directives.
174 Auto,
175 /// 'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
176 Worker,
177 /// 'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
178 Vector,
179 /// 'nohost' clause, allowed on 'routine' directives.
180 NoHost,
181 /// 'default' clause, allowed on parallel, serial, kernel (and compound)
182 /// constructs.
183 Default,
184 /// 'if' clause, allowed on all the Compute Constructs, Data Constructs,
185 /// Executable Constructs, and Combined Constructs.
186 If,
187 /// 'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
188 Self,
189 /// 'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and
190 /// 'declare'.
191 Copy,
192 /// 'use_device' clause, allowed on 'host_data' construct.
193 UseDevice,
194 /// 'attach' clause, allowed on Compute and Combined constructs, plus 'data'
195 /// and 'enter data'.
196 Attach,
197 /// 'delete' clause, allowed on the 'exit data' construct.
198 Delete,
199 /// 'detach' clause, allowed on the 'exit data' construct.
200 Detach,
201 /// 'device' clause, allowed on the 'update' construct.
202 Device,
203 /// 'deviceptr' clause, allowed on Compute and Combined Constructs, plus
204 /// 'data' and 'declare'.
205 DevicePtr,
206 /// 'device_resident' clause, allowed on the 'declare' construct.
208 /// 'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop',
209 /// and 'serial loop' constructs.
211 /// 'host' clause, allowed on 'update' construct.
212 Host,
213 /// 'link' clause, allowed on 'declare' construct.
214 Link,
215 /// 'no_create' clause, allowed on allowed on Compute and Combined constructs,
216 /// plus 'data'.
217 NoCreate,
218 /// 'present' clause, allowed on Compute and Combined constructs, plus 'data'
219 /// and 'declare'.
220 Present,
221 /// 'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel
222 /// loop', and 'serial loop' constructs.
223 Private,
224 /// 'copyout' clause, allowed on Compute and Combined constructs, plus 'data',
225 /// 'exit data', and 'declare'.
226 CopyOut,
227 /// 'copyin' clause, allowed on Compute and Combined constructs, plus 'data',
228 /// 'enter data', and 'declare'.
229 CopyIn,
230 /// 'copyin' clause, allowed on Compute and Combined constructs, plus 'data',
231 /// 'enter data', and 'declare'.
232 Create,
233 /// 'reduction' clause, allowed on Parallel, Serial, Loop, and the combined
234 /// constructs.
235 Reduction,
236 /// 'collapse' clause, allowed on 'loop' and Combined constructs.
237 Collapse,
238 /// 'bind' clause, allowed on routine constructs.
239 Bind,
240 /// 'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop',
241 /// and 'kernels loop' constructs.
243 /// 'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and
244 /// 'kernels loop' constructs.
245 NumGangs,
246 /// 'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop',
247 /// and 'kernels loop' constructs.
249 /// 'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
250 DeviceNum,
251 /// 'default_async' clause, allowed on 'set' construct.
253 /// 'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown',
254 /// 'set', update', 'loop', 'routine', and Combined constructs.
256 /// 'dtype' clause, an alias for 'device_type', stored separately for
257 /// diagnostic purposes.
258 DType,
259 /// 'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined
260 /// constructs.
261 Async,
262 /// 'tile' clause, allowed on 'loop' and Combined constructs.
263 Tile,
264 /// 'gang' clause, allowed on 'loop' and Combined constructs.
265 Gang,
266 /// 'wait' clause, allowed on Compute, Data, 'update', and Combined
267 /// constructs.
268 Wait,
269
270 /// Represents an invalid clause, for the purposes of parsing.
271 Invalid,
272};
273
274template <typename StreamTy>
275inline StreamTy &printOpenACCClauseKind(StreamTy &Out, OpenACCClauseKind K) {
276 switch (K) {
278 return Out << "finalize";
279
281 return Out << "if_present";
282
284 return Out << "seq";
285
287 return Out << "independent";
288
290 return Out << "auto";
291
293 return Out << "worker";
294
296 return Out << "vector";
297
299 return Out << "nohost";
300
302 return Out << "default";
303
305 return Out << "if";
306
308 return Out << "self";
309
311 return Out << "copy";
312
314 return Out << "use_device";
315
317 return Out << "attach";
318
320 return Out << "delete";
321
323 return Out << "detach";
324
326 return Out << "device";
327
329 return Out << "deviceptr";
330
332 return Out << "device_resident";
333
335 return Out << "firstprivate";
336
338 return Out << "host";
339
341 return Out << "link";
342
344 return Out << "no_create";
345
347 return Out << "present";
348
350 return Out << "private";
351
353 return Out << "copyout";
354
356 return Out << "copyin";
357
359 return Out << "create";
360
362 return Out << "reduction";
363
365 return Out << "collapse";
366
368 return Out << "bind";
369
371 return Out << "vector_length";
372
374 return Out << "num_gangs";
375
377 return Out << "num_workers";
378
380 return Out << "device_num";
381
383 return Out << "default_async";
384
386 return Out << "device_type";
387
389 return Out << "dtype";
390
392 return Out << "async";
393
395 return Out << "tile";
396
398 return Out << "gang";
399
401 return Out << "wait";
402
404 return Out << "<invalid>";
405 }
406 llvm_unreachable("Uncovered clause kind");
407}
408
411 return printOpenACCClauseKind(Out, K);
412}
413
414inline llvm::raw_ostream &operator<<(llvm::raw_ostream &Out,
416 return printOpenACCClauseKind(Out, K);
417}
418
420 /// 'none' option.
421 None,
422 /// 'present' option.
423 Present,
424 /// Not a valid option.
425 Invalid,
426};
427
428template <typename StreamTy>
429inline StreamTy &printOpenACCDefaultClauseKind(StreamTy &Out,
431 switch (K) {
433 return Out << "none";
435 return Out << "present";
437 return Out << "<invalid>";
438 }
439 llvm_unreachable("Unknown OpenACCDefaultClauseKind enum");
440}
441
444 return printOpenACCDefaultClauseKind(Out, K);
445}
446
447inline llvm::raw_ostream &operator<<(llvm::raw_ostream &Out,
449 return printOpenACCDefaultClauseKind(Out, K);
450}
451
453 /// '+'.
454 Addition,
455 /// '*'.
457 /// 'max'.
458 Max,
459 /// 'min'.
460 Min,
461 /// '&'.
463 /// '|'.
464 BitwiseOr,
465 /// '^'.
467 /// '&&'.
468 And,
469 /// '||'.
470 Or,
471 /// Invalid Reduction Clause Kind.
472 Invalid,
473};
474} // namespace clang
475
476#endif // LLVM_CLANG_BASIC_OPENACCKINDS_H
Defines the Diagnostic-related interfaces.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Definition: Diagnostic.h:1115
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
Definition: OpenACCKinds.h:164
@ Auto
'auto' clause, allowed on 'loop' directives.
@ Bind
'bind' clause, allowed on routine constructs.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ Wait
'wait' clause, allowed on Compute, Data, 'update', and Combined constructs.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ NoHost
'nohost' clause, allowed on 'routine' directives.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Create
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ Link
'link' clause, allowed on 'declare' construct.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Host
'host' clause, allowed on 'update' construct.
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ DeviceResident
'device_resident' clause, allowed on the 'declare' construct.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ DType
'dtype' clause, an alias for 'device_type', stored separately for diagnostic purposes.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Device
'device' clause, allowed on the 'update' construct.
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ IfPresent
'if_present' clause, allowed on 'host_data' and 'update' directives.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ Finalize
'finalize' clause, allowed on 'exit data' directive.
bool isOpenACCComputeDirectiveKind(OpenACCDirectiveKind K)
Definition: OpenACCKinds.h:149
StreamTy & printOpenACCDefaultClauseKind(StreamTy &Out, OpenACCDefaultClauseKind K)
Definition: OpenACCKinds.h:429
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
OpenACCAtomicKind
Definition: OpenACCKinds.h:155
OpenACCDefaultClauseKind
Definition: OpenACCKinds.h:419
@ Invalid
Not a valid option.
StreamTy & printOpenACCClauseKind(StreamTy &Out, OpenACCClauseKind K)
Definition: OpenACCKinds.h:275
OpenACCDirectiveKind
Definition: OpenACCKinds.h:25
StreamTy & printOpenACCDirectiveKind(StreamTy &Out, OpenACCDirectiveKind K)
Definition: OpenACCKinds.h:70
OpenACCReductionOperator
Definition: OpenACCKinds.h:452
@ None
The alignment was not explicit in code.