1#ifndef LLVM_OpenMP_INC
2#define LLVM_OpenMP_INC
3
4#include "llvm/ADT/ArrayRef.h"
5#include "llvm/ADT/BitmaskEnum.h"
6#include "llvm/ADT/Sequence.h"
7#include "llvm/ADT/STLExtras.h"
8#include "llvm/ADT/StringRef.h"
9#include "llvm/Frontend/Directive/Spelling.h"
10#include "llvm/Frontend/OpenMP/OMPVersion.h"
11#include "llvm/Support/Compiler.h"
12#include <cstddef>
13#include <utility>
14
15namespace llvm {
16
17namespace omp {
18
19LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
20
21enum class Association {
22 Block,
23 First_ = Block,
24 Declaration,
25 Delimited,
26 Explicit,
27 LoopNest,
28 LoopSequence,
29 None,
30 Separating,
31 Last_ = Separating,
32};
33
34static constexpr std::size_t Association_enumSize = 8;
35
36enum class Category {
37 Declarative,
38 First_ = Declarative,
39 Executable,
40 Informational,
41 Meta,
42 Subsidiary,
43 Utility,
44 Last_ = Utility,
45};
46
47static constexpr std::size_t Category_enumSize = 6;
48
49enum class SourceLanguage : uint32_t {
50 C = 1U,
51 Fortran = 2U,
52 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Fortran)
53};
54
55static constexpr std::size_t SourceLanguage_enumSize = 2;
56
57enum class Directive {
58 OMPD_allocate,
59 First_ = OMPD_allocate,
60 OMPD_allocators,
61 OMPD_assume,
62 OMPD_assumes,
63 OMPD_atomic,
64 OMPD_barrier,
65 OMPD_begin_assumes,
66 OMPD_begin_declare_target,
67 OMPD_begin_declare_variant,
68 OMPD_cancel,
69 OMPD_cancellation_point,
70 OMPD_critical,
71 OMPD_declare_induction,
72 OMPD_declare_mapper,
73 OMPD_declare_reduction,
74 OMPD_declare_simd,
75 OMPD_declare_target,
76 OMPD_declare_variant,
77 OMPD_depobj,
78 OMPD_distribute,
79 OMPD_distribute_parallel_do,
80 OMPD_distribute_parallel_do_simd,
81 OMPD_distribute_parallel_for,
82 OMPD_distribute_parallel_for_simd,
83 OMPD_distribute_simd,
84 OMPD_do,
85 OMPD_do_simd,
86 OMPD_end_assumes,
87 OMPD_end_declare_target,
88 OMPD_end_declare_variant,
89 OMPD_error,
90 OMPD_flatten,
91 OMPD_flush,
92 OMPD_for,
93 OMPD_for_simd,
94 OMPD_fuse,
95 OMPD_groupprivate,
96 OMPD_interchange,
97 OMPD_masked_taskloop,
98 OMPD_masked_taskloop_simd,
99 OMPD_master,
100 OMPD_master_taskloop,
101 OMPD_master_taskloop_simd,
102 OMPD_metadirective,
103 OMPD_nothing,
104 OMPD_ordered_blockassoc,
105 OMPD_ordered_standalone,
106 OMPD_parallel,
107 OMPD_parallel_do,
108 OMPD_parallel_do_simd,
109 OMPD_parallel_for,
110 OMPD_parallel_for_simd,
111 OMPD_parallel_masked,
112 OMPD_parallel_masked_taskloop,
113 OMPD_parallel_masked_taskloop_simd,
114 OMPD_parallel_master,
115 OMPD_parallel_master_taskloop,
116 OMPD_parallel_master_taskloop_simd,
117 OMPD_parallel_sections,
118 OMPD_parallel_workshare,
119 OMPD_requires,
120 OMPD_reverse,
121 OMPD_scan,
122 OMPD_scope,
123 OMPD_section,
124 OMPD_sections,
125 OMPD_simd,
126 OMPD_single,
127 OMPD_split,
128 OMPD_stripe,
129 OMPD_target,
130 OMPD_target_data,
131 OMPD_target_enter_data,
132 OMPD_target_exit_data,
133 OMPD_target_parallel,
134 OMPD_target_parallel_do,
135 OMPD_target_parallel_do_simd,
136 OMPD_target_parallel_for,
137 OMPD_target_parallel_for_simd,
138 OMPD_target_simd,
139 OMPD_target_teams,
140 OMPD_target_teams_distribute,
141 OMPD_target_teams_distribute_parallel_do,
142 OMPD_target_teams_distribute_parallel_do_simd,
143 OMPD_target_teams_distribute_parallel_for,
144 OMPD_target_teams_distribute_parallel_for_simd,
145 OMPD_target_teams_distribute_simd,
146 OMPD_target_teams_workdistribute,
147 OMPD_target_update,
148 OMPD_task,
149 OMPD_taskgroup,
150 OMPD_taskloop,
151 OMPD_taskloop_simd,
152 OMPD_taskwait,
153 OMPD_taskyield,
154 OMPD_taskgraph,
155 OMPD_teams,
156 OMPD_teams_distribute,
157 OMPD_teams_distribute_parallel_do,
158 OMPD_teams_distribute_parallel_do_simd,
159 OMPD_teams_distribute_parallel_for,
160 OMPD_teams_distribute_parallel_for_simd,
161 OMPD_teams_distribute_simd,
162 OMPD_teams_workdistribute,
163 OMPD_threadprivate,
164 OMPD_tile,
165 OMPD_unknown,
166 OMPD_unroll,
167 OMPD_workdistribute,
168 OMPD_workshare,
169 OMPD_dispatch,
170 OMPD_interop,
171 OMPD_loop,
172 OMPD_masked,
173 OMPD_parallel_loop,
174 OMPD_target_loop,
175 OMPD_target_parallel_loop,
176 OMPD_target_teams_loop,
177 OMPD_teams_loop,
178 Last_ = OMPD_teams_loop,
179};
180
181static constexpr std::size_t Directive_enumSize = 119;
182
183constexpr auto OMPD_allocate = Directive::OMPD_allocate;
184constexpr auto OMPD_allocators = Directive::OMPD_allocators;
185constexpr auto OMPD_assume = Directive::OMPD_assume;
186constexpr auto OMPD_assumes = Directive::OMPD_assumes;
187constexpr auto OMPD_atomic = Directive::OMPD_atomic;
188constexpr auto OMPD_barrier = Directive::OMPD_barrier;
189constexpr auto OMPD_begin_assumes = Directive::OMPD_begin_assumes;
190constexpr auto OMPD_begin_declare_target = Directive::OMPD_begin_declare_target;
191constexpr auto OMPD_begin_declare_variant = Directive::OMPD_begin_declare_variant;
192constexpr auto OMPD_cancel = Directive::OMPD_cancel;
193constexpr auto OMPD_cancellation_point = Directive::OMPD_cancellation_point;
194constexpr auto OMPD_critical = Directive::OMPD_critical;
195constexpr auto OMPD_declare_induction = Directive::OMPD_declare_induction;
196constexpr auto OMPD_declare_mapper = Directive::OMPD_declare_mapper;
197constexpr auto OMPD_declare_reduction = Directive::OMPD_declare_reduction;
198constexpr auto OMPD_declare_simd = Directive::OMPD_declare_simd;
199constexpr auto OMPD_declare_target = Directive::OMPD_declare_target;
200constexpr auto OMPD_declare_variant = Directive::OMPD_declare_variant;
201constexpr auto OMPD_depobj = Directive::OMPD_depobj;
202constexpr auto OMPD_distribute = Directive::OMPD_distribute;
203constexpr auto OMPD_distribute_parallel_do = Directive::OMPD_distribute_parallel_do;
204constexpr auto OMPD_distribute_parallel_do_simd = Directive::OMPD_distribute_parallel_do_simd;
205constexpr auto OMPD_distribute_parallel_for = Directive::OMPD_distribute_parallel_for;
206constexpr auto OMPD_distribute_parallel_for_simd = Directive::OMPD_distribute_parallel_for_simd;
207constexpr auto OMPD_distribute_simd = Directive::OMPD_distribute_simd;
208constexpr auto OMPD_do = Directive::OMPD_do;
209constexpr auto OMPD_do_simd = Directive::OMPD_do_simd;
210constexpr auto OMPD_end_assumes = Directive::OMPD_end_assumes;
211constexpr auto OMPD_end_declare_target = Directive::OMPD_end_declare_target;
212constexpr auto OMPD_end_declare_variant = Directive::OMPD_end_declare_variant;
213constexpr auto OMPD_error = Directive::OMPD_error;
214constexpr auto OMPD_flatten = Directive::OMPD_flatten;
215constexpr auto OMPD_flush = Directive::OMPD_flush;
216constexpr auto OMPD_for = Directive::OMPD_for;
217constexpr auto OMPD_for_simd = Directive::OMPD_for_simd;
218constexpr auto OMPD_fuse = Directive::OMPD_fuse;
219constexpr auto OMPD_groupprivate = Directive::OMPD_groupprivate;
220constexpr auto OMPD_interchange = Directive::OMPD_interchange;
221constexpr auto OMPD_masked_taskloop = Directive::OMPD_masked_taskloop;
222constexpr auto OMPD_masked_taskloop_simd = Directive::OMPD_masked_taskloop_simd;
223constexpr auto OMPD_master = Directive::OMPD_master;
224constexpr auto OMPD_master_taskloop = Directive::OMPD_master_taskloop;
225constexpr auto OMPD_master_taskloop_simd = Directive::OMPD_master_taskloop_simd;
226constexpr auto OMPD_metadirective = Directive::OMPD_metadirective;
227constexpr auto OMPD_nothing = Directive::OMPD_nothing;
228constexpr auto OMPD_ordered_blockassoc = Directive::OMPD_ordered_blockassoc;
229constexpr auto OMPD_ordered_standalone = Directive::OMPD_ordered_standalone;
230constexpr auto OMPD_parallel = Directive::OMPD_parallel;
231constexpr auto OMPD_parallel_do = Directive::OMPD_parallel_do;
232constexpr auto OMPD_parallel_do_simd = Directive::OMPD_parallel_do_simd;
233constexpr auto OMPD_parallel_for = Directive::OMPD_parallel_for;
234constexpr auto OMPD_parallel_for_simd = Directive::OMPD_parallel_for_simd;
235constexpr auto OMPD_parallel_masked = Directive::OMPD_parallel_masked;
236constexpr auto OMPD_parallel_masked_taskloop = Directive::OMPD_parallel_masked_taskloop;
237constexpr auto OMPD_parallel_masked_taskloop_simd = Directive::OMPD_parallel_masked_taskloop_simd;
238constexpr auto OMPD_parallel_master = Directive::OMPD_parallel_master;
239constexpr auto OMPD_parallel_master_taskloop = Directive::OMPD_parallel_master_taskloop;
240constexpr auto OMPD_parallel_master_taskloop_simd = Directive::OMPD_parallel_master_taskloop_simd;
241constexpr auto OMPD_parallel_sections = Directive::OMPD_parallel_sections;
242constexpr auto OMPD_parallel_workshare = Directive::OMPD_parallel_workshare;
243constexpr auto OMPD_requires = Directive::OMPD_requires;
244constexpr auto OMPD_reverse = Directive::OMPD_reverse;
245constexpr auto OMPD_scan = Directive::OMPD_scan;
246constexpr auto OMPD_scope = Directive::OMPD_scope;
247constexpr auto OMPD_section = Directive::OMPD_section;
248constexpr auto OMPD_sections = Directive::OMPD_sections;
249constexpr auto OMPD_simd = Directive::OMPD_simd;
250constexpr auto OMPD_single = Directive::OMPD_single;
251constexpr auto OMPD_split = Directive::OMPD_split;
252constexpr auto OMPD_stripe = Directive::OMPD_stripe;
253constexpr auto OMPD_target = Directive::OMPD_target;
254constexpr auto OMPD_target_data = Directive::OMPD_target_data;
255constexpr auto OMPD_target_enter_data = Directive::OMPD_target_enter_data;
256constexpr auto OMPD_target_exit_data = Directive::OMPD_target_exit_data;
257constexpr auto OMPD_target_parallel = Directive::OMPD_target_parallel;
258constexpr auto OMPD_target_parallel_do = Directive::OMPD_target_parallel_do;
259constexpr auto OMPD_target_parallel_do_simd = Directive::OMPD_target_parallel_do_simd;
260constexpr auto OMPD_target_parallel_for = Directive::OMPD_target_parallel_for;
261constexpr auto OMPD_target_parallel_for_simd = Directive::OMPD_target_parallel_for_simd;
262constexpr auto OMPD_target_simd = Directive::OMPD_target_simd;
263constexpr auto OMPD_target_teams = Directive::OMPD_target_teams;
264constexpr auto OMPD_target_teams_distribute = Directive::OMPD_target_teams_distribute;
265constexpr auto OMPD_target_teams_distribute_parallel_do = Directive::OMPD_target_teams_distribute_parallel_do;
266constexpr auto OMPD_target_teams_distribute_parallel_do_simd = Directive::OMPD_target_teams_distribute_parallel_do_simd;
267constexpr auto OMPD_target_teams_distribute_parallel_for = Directive::OMPD_target_teams_distribute_parallel_for;
268constexpr auto OMPD_target_teams_distribute_parallel_for_simd = Directive::OMPD_target_teams_distribute_parallel_for_simd;
269constexpr auto OMPD_target_teams_distribute_simd = Directive::OMPD_target_teams_distribute_simd;
270constexpr auto OMPD_target_teams_workdistribute = Directive::OMPD_target_teams_workdistribute;
271constexpr auto OMPD_target_update = Directive::OMPD_target_update;
272constexpr auto OMPD_task = Directive::OMPD_task;
273constexpr auto OMPD_taskgroup = Directive::OMPD_taskgroup;
274constexpr auto OMPD_taskloop = Directive::OMPD_taskloop;
275constexpr auto OMPD_taskloop_simd = Directive::OMPD_taskloop_simd;
276constexpr auto OMPD_taskwait = Directive::OMPD_taskwait;
277constexpr auto OMPD_taskyield = Directive::OMPD_taskyield;
278constexpr auto OMPD_taskgraph = Directive::OMPD_taskgraph;
279constexpr auto OMPD_teams = Directive::OMPD_teams;
280constexpr auto OMPD_teams_distribute = Directive::OMPD_teams_distribute;
281constexpr auto OMPD_teams_distribute_parallel_do = Directive::OMPD_teams_distribute_parallel_do;
282constexpr auto OMPD_teams_distribute_parallel_do_simd = Directive::OMPD_teams_distribute_parallel_do_simd;
283constexpr auto OMPD_teams_distribute_parallel_for = Directive::OMPD_teams_distribute_parallel_for;
284constexpr auto OMPD_teams_distribute_parallel_for_simd = Directive::OMPD_teams_distribute_parallel_for_simd;
285constexpr auto OMPD_teams_distribute_simd = Directive::OMPD_teams_distribute_simd;
286constexpr auto OMPD_teams_workdistribute = Directive::OMPD_teams_workdistribute;
287constexpr auto OMPD_threadprivate = Directive::OMPD_threadprivate;
288constexpr auto OMPD_tile = Directive::OMPD_tile;
289constexpr auto OMPD_unknown = Directive::OMPD_unknown;
290constexpr auto OMPD_unroll = Directive::OMPD_unroll;
291constexpr auto OMPD_workdistribute = Directive::OMPD_workdistribute;
292constexpr auto OMPD_workshare = Directive::OMPD_workshare;
293constexpr auto OMPD_dispatch = Directive::OMPD_dispatch;
294constexpr auto OMPD_interop = Directive::OMPD_interop;
295constexpr auto OMPD_loop = Directive::OMPD_loop;
296constexpr auto OMPD_masked = Directive::OMPD_masked;
297constexpr auto OMPD_parallel_loop = Directive::OMPD_parallel_loop;
298constexpr auto OMPD_target_loop = Directive::OMPD_target_loop;
299constexpr auto OMPD_target_parallel_loop = Directive::OMPD_target_parallel_loop;
300constexpr auto OMPD_target_teams_loop = Directive::OMPD_target_teams_loop;
301constexpr auto OMPD_teams_loop = Directive::OMPD_teams_loop;
302
303enum class Clause {
304 OMPC_absent,
305 First_ = OMPC_absent,
306 OMPC_acq_rel,
307 OMPC_acquire,
308 OMPC_adjust_args,
309 OMPC_affinity,
310 OMPC_align,
311 OMPC_aligned,
312 OMPC_allocate,
313 OMPC_allocator,
314 OMPC_append_args,
315 OMPC_apply,
316 OMPC_at,
317 OMPC_atomic_default_mem_order,
318 OMPC_bind,
319 OMPC_cancellation_construct_type,
320 OMPC_capture,
321 OMPC_collapse,
322 OMPC_collector,
323 OMPC_combiner,
324 OMPC_compare,
325 OMPC_contains,
326 OMPC_copyprivate,
327 OMPC_copyin,
328 OMPC_counts,
329 OMPC_default,
330 OMPC_defaultmap,
331 OMPC_default_variant,
332 OMPC_depend,
333 OMPC_depobj,
334 OMPC_depth,
335 OMPC_destroy,
336 OMPC_detach,
337 OMPC_device,
338 OMPC_device_safesync,
339 OMPC_device_type,
340 OMPC_dist_schedule,
341 OMPC_doacross,
342 OMPC_dyn_groupprivate,
343 OMPC_dynamic_allocators,
344 OMPC_enter,
345 OMPC_exclusive,
346 OMPC_fail,
347 OMPC_filter,
348 OMPC_final,
349 OMPC_firstprivate,
350 OMPC_flush,
351 OMPC_from,
352 OMPC_full,
353 OMPC_grainsize,
354 OMPC_graph_id,
355 OMPC_graph_reset,
356 OMPC_groupprivate,
357 OMPC_has_device_addr,
358 OMPC_hint,
359 OMPC_holds,
360 OMPC_if,
361 OMPC_in_reduction,
362 OMPC_inbranch,
363 OMPC_inclusive,
364 OMPC_indirect,
365 OMPC_induction,
366 OMPC_inductor,
367 OMPC_init,
368 OMPC_init_complete,
369 OMPC_initializer,
370 OMPC_interop,
371 OMPC_is_device_ptr,
372 OMPC_lastprivate,
373 OMPC_linear,
374 OMPC_link,
375 OMPC_local,
376 OMPC_looprange,
377 OMPC_map,
378 OMPC_match,
379 OMPC_memory_order,
380 OMPC_memscope,
381 OMPC_mergeable,
382 OMPC_message,
383 OMPC_nogroup,
384 OMPC_no_openmp,
385 OMPC_no_openmp_constructs,
386 OMPC_no_openmp_routines,
387 OMPC_no_parallelism,
388 OMPC_nowait,
389 OMPC_nocontext,
390 OMPC_nontemporal,
391 OMPC_notinbranch,
392 OMPC_novariants,
393 OMPC_num_tasks,
394 OMPC_num_teams,
395 OMPC_num_threads,
396 OMPC_ompx_attribute,
397 OMPC_ompx_bare,
398 OMPC_ompx_dyn_cgroup_mem,
399 OMPC_order,
400 OMPC_ordered,
401 OMPC_otherwise,
402 OMPC_partial,
403 OMPC_permutation,
404 OMPC_priority,
405 OMPC_private,
406 OMPC_proc_bind,
407 OMPC_read,
408 OMPC_reduction,
409 OMPC_reduction_kind,
410 OMPC_relaxed,
411 OMPC_release,
412 OMPC_replayable,
413 OMPC_reverse_offload,
414 OMPC_safelen,
415 OMPC_safesync,
416 OMPC_schedule,
417 OMPC_self_maps,
418 OMPC_seq_cst,
419 OMPC_severity,
420 OMPC_shared,
421 OMPC_shift,
422 OMPC_simd,
423 OMPC_simdlen,
424 OMPC_sizes,
425 OMPC_task_reduction,
426 OMPC_thread_limit,
427 OMPC_threadprivate,
428 OMPC_threads,
429 OMPC_threadset,
430 OMPC_to,
431 OMPC_transparent,
432 OMPC_unified_address,
433 OMPC_unified_shared_memory,
434 OMPC_uniform,
435 OMPC_unknown,
436 OMPC_untied,
437 OMPC_update,
438 OMPC_update_depend_objects,
439 OMPC_use,
440 OMPC_use_device_addr,
441 OMPC_use_device_ptr,
442 OMPC_uses_allocators,
443 OMPC_weak,
444 OMPC_when,
445 OMPC_write,
446 Last_ = OMPC_write,
447};
448
449static constexpr std::size_t Clause_enumSize = 141;
450
451constexpr auto OMPC_absent = Clause::OMPC_absent;
452constexpr auto OMPC_acq_rel = Clause::OMPC_acq_rel;
453constexpr auto OMPC_acquire = Clause::OMPC_acquire;
454constexpr auto OMPC_adjust_args = Clause::OMPC_adjust_args;
455constexpr auto OMPC_affinity = Clause::OMPC_affinity;
456constexpr auto OMPC_align = Clause::OMPC_align;
457constexpr auto OMPC_aligned = Clause::OMPC_aligned;
458constexpr auto OMPC_allocate = Clause::OMPC_allocate;
459constexpr auto OMPC_allocator = Clause::OMPC_allocator;
460constexpr auto OMPC_append_args = Clause::OMPC_append_args;
461constexpr auto OMPC_apply = Clause::OMPC_apply;
462constexpr auto OMPC_at = Clause::OMPC_at;
463constexpr auto OMPC_atomic_default_mem_order = Clause::OMPC_atomic_default_mem_order;
464constexpr auto OMPC_bind = Clause::OMPC_bind;
465constexpr auto OMPC_cancellation_construct_type = Clause::OMPC_cancellation_construct_type;
466constexpr auto OMPC_capture = Clause::OMPC_capture;
467constexpr auto OMPC_collapse = Clause::OMPC_collapse;
468constexpr auto OMPC_collector = Clause::OMPC_collector;
469constexpr auto OMPC_combiner = Clause::OMPC_combiner;
470constexpr auto OMPC_compare = Clause::OMPC_compare;
471constexpr auto OMPC_contains = Clause::OMPC_contains;
472constexpr auto OMPC_copyprivate = Clause::OMPC_copyprivate;
473constexpr auto OMPC_copyin = Clause::OMPC_copyin;
474constexpr auto OMPC_counts = Clause::OMPC_counts;
475constexpr auto OMPC_default = Clause::OMPC_default;
476constexpr auto OMPC_defaultmap = Clause::OMPC_defaultmap;
477constexpr auto OMPC_default_variant = Clause::OMPC_default_variant;
478constexpr auto OMPC_depend = Clause::OMPC_depend;
479constexpr auto OMPC_depobj = Clause::OMPC_depobj;
480constexpr auto OMPC_depth = Clause::OMPC_depth;
481constexpr auto OMPC_destroy = Clause::OMPC_destroy;
482constexpr auto OMPC_detach = Clause::OMPC_detach;
483constexpr auto OMPC_device = Clause::OMPC_device;
484constexpr auto OMPC_device_safesync = Clause::OMPC_device_safesync;
485constexpr auto OMPC_device_type = Clause::OMPC_device_type;
486constexpr auto OMPC_dist_schedule = Clause::OMPC_dist_schedule;
487constexpr auto OMPC_doacross = Clause::OMPC_doacross;
488constexpr auto OMPC_dyn_groupprivate = Clause::OMPC_dyn_groupprivate;
489constexpr auto OMPC_dynamic_allocators = Clause::OMPC_dynamic_allocators;
490constexpr auto OMPC_enter = Clause::OMPC_enter;
491constexpr auto OMPC_exclusive = Clause::OMPC_exclusive;
492constexpr auto OMPC_fail = Clause::OMPC_fail;
493constexpr auto OMPC_filter = Clause::OMPC_filter;
494constexpr auto OMPC_final = Clause::OMPC_final;
495constexpr auto OMPC_firstprivate = Clause::OMPC_firstprivate;
496constexpr auto OMPC_flush = Clause::OMPC_flush;
497constexpr auto OMPC_from = Clause::OMPC_from;
498constexpr auto OMPC_full = Clause::OMPC_full;
499constexpr auto OMPC_grainsize = Clause::OMPC_grainsize;
500constexpr auto OMPC_graph_id = Clause::OMPC_graph_id;
501constexpr auto OMPC_graph_reset = Clause::OMPC_graph_reset;
502constexpr auto OMPC_groupprivate = Clause::OMPC_groupprivate;
503constexpr auto OMPC_has_device_addr = Clause::OMPC_has_device_addr;
504constexpr auto OMPC_hint = Clause::OMPC_hint;
505constexpr auto OMPC_holds = Clause::OMPC_holds;
506constexpr auto OMPC_if = Clause::OMPC_if;
507constexpr auto OMPC_in_reduction = Clause::OMPC_in_reduction;
508constexpr auto OMPC_inbranch = Clause::OMPC_inbranch;
509constexpr auto OMPC_inclusive = Clause::OMPC_inclusive;
510constexpr auto OMPC_indirect = Clause::OMPC_indirect;
511constexpr auto OMPC_induction = Clause::OMPC_induction;
512constexpr auto OMPC_inductor = Clause::OMPC_inductor;
513constexpr auto OMPC_init = Clause::OMPC_init;
514constexpr auto OMPC_init_complete = Clause::OMPC_init_complete;
515constexpr auto OMPC_initializer = Clause::OMPC_initializer;
516constexpr auto OMPC_interop = Clause::OMPC_interop;
517constexpr auto OMPC_is_device_ptr = Clause::OMPC_is_device_ptr;
518constexpr auto OMPC_lastprivate = Clause::OMPC_lastprivate;
519constexpr auto OMPC_linear = Clause::OMPC_linear;
520constexpr auto OMPC_link = Clause::OMPC_link;
521constexpr auto OMPC_local = Clause::OMPC_local;
522constexpr auto OMPC_looprange = Clause::OMPC_looprange;
523constexpr auto OMPC_map = Clause::OMPC_map;
524constexpr auto OMPC_match = Clause::OMPC_match;
525constexpr auto OMPC_memory_order = Clause::OMPC_memory_order;
526constexpr auto OMPC_memscope = Clause::OMPC_memscope;
527constexpr auto OMPC_mergeable = Clause::OMPC_mergeable;
528constexpr auto OMPC_message = Clause::OMPC_message;
529constexpr auto OMPC_nogroup = Clause::OMPC_nogroup;
530constexpr auto OMPC_no_openmp = Clause::OMPC_no_openmp;
531constexpr auto OMPC_no_openmp_constructs = Clause::OMPC_no_openmp_constructs;
532constexpr auto OMPC_no_openmp_routines = Clause::OMPC_no_openmp_routines;
533constexpr auto OMPC_no_parallelism = Clause::OMPC_no_parallelism;
534constexpr auto OMPC_nowait = Clause::OMPC_nowait;
535constexpr auto OMPC_nocontext = Clause::OMPC_nocontext;
536constexpr auto OMPC_nontemporal = Clause::OMPC_nontemporal;
537constexpr auto OMPC_notinbranch = Clause::OMPC_notinbranch;
538constexpr auto OMPC_novariants = Clause::OMPC_novariants;
539constexpr auto OMPC_num_tasks = Clause::OMPC_num_tasks;
540constexpr auto OMPC_num_teams = Clause::OMPC_num_teams;
541constexpr auto OMPC_num_threads = Clause::OMPC_num_threads;
542constexpr auto OMPC_ompx_attribute = Clause::OMPC_ompx_attribute;
543constexpr auto OMPC_ompx_bare = Clause::OMPC_ompx_bare;
544constexpr auto OMPC_ompx_dyn_cgroup_mem = Clause::OMPC_ompx_dyn_cgroup_mem;
545constexpr auto OMPC_order = Clause::OMPC_order;
546constexpr auto OMPC_ordered = Clause::OMPC_ordered;
547constexpr auto OMPC_otherwise = Clause::OMPC_otherwise;
548constexpr auto OMPC_partial = Clause::OMPC_partial;
549constexpr auto OMPC_permutation = Clause::OMPC_permutation;
550constexpr auto OMPC_priority = Clause::OMPC_priority;
551constexpr auto OMPC_private = Clause::OMPC_private;
552constexpr auto OMPC_proc_bind = Clause::OMPC_proc_bind;
553constexpr auto OMPC_read = Clause::OMPC_read;
554constexpr auto OMPC_reduction = Clause::OMPC_reduction;
555constexpr auto OMPC_reduction_kind = Clause::OMPC_reduction_kind;
556constexpr auto OMPC_relaxed = Clause::OMPC_relaxed;
557constexpr auto OMPC_release = Clause::OMPC_release;
558constexpr auto OMPC_replayable = Clause::OMPC_replayable;
559constexpr auto OMPC_reverse_offload = Clause::OMPC_reverse_offload;
560constexpr auto OMPC_safelen = Clause::OMPC_safelen;
561constexpr auto OMPC_safesync = Clause::OMPC_safesync;
562constexpr auto OMPC_schedule = Clause::OMPC_schedule;
563constexpr auto OMPC_self_maps = Clause::OMPC_self_maps;
564constexpr auto OMPC_seq_cst = Clause::OMPC_seq_cst;
565constexpr auto OMPC_severity = Clause::OMPC_severity;
566constexpr auto OMPC_shared = Clause::OMPC_shared;
567constexpr auto OMPC_shift = Clause::OMPC_shift;
568constexpr auto OMPC_simd = Clause::OMPC_simd;
569constexpr auto OMPC_simdlen = Clause::OMPC_simdlen;
570constexpr auto OMPC_sizes = Clause::OMPC_sizes;
571constexpr auto OMPC_task_reduction = Clause::OMPC_task_reduction;
572constexpr auto OMPC_thread_limit = Clause::OMPC_thread_limit;
573constexpr auto OMPC_threadprivate = Clause::OMPC_threadprivate;
574constexpr auto OMPC_threads = Clause::OMPC_threads;
575constexpr auto OMPC_threadset = Clause::OMPC_threadset;
576constexpr auto OMPC_to = Clause::OMPC_to;
577constexpr auto OMPC_transparent = Clause::OMPC_transparent;
578constexpr auto OMPC_unified_address = Clause::OMPC_unified_address;
579constexpr auto OMPC_unified_shared_memory = Clause::OMPC_unified_shared_memory;
580constexpr auto OMPC_uniform = Clause::OMPC_uniform;
581constexpr auto OMPC_unknown = Clause::OMPC_unknown;
582constexpr auto OMPC_untied = Clause::OMPC_untied;
583constexpr auto OMPC_update = Clause::OMPC_update;
584constexpr auto OMPC_update_depend_objects = Clause::OMPC_update_depend_objects;
585constexpr auto OMPC_use = Clause::OMPC_use;
586constexpr auto OMPC_use_device_addr = Clause::OMPC_use_device_addr;
587constexpr auto OMPC_use_device_ptr = Clause::OMPC_use_device_ptr;
588constexpr auto OMPC_uses_allocators = Clause::OMPC_uses_allocators;
589constexpr auto OMPC_weak = Clause::OMPC_weak;
590constexpr auto OMPC_when = Clause::OMPC_when;
591constexpr auto OMPC_write = Clause::OMPC_write;
592
593enum class LoopModifier {
594 OMPLM_flattened,
595 First_ = OMPLM_flattened,
596 OMPLM_fused,
597 OMPLM_grid,
598 OMPLM_identity,
599 OMPLM_interchanged,
600 OMPLM_intratile,
601 OMPLM_offsets,
602 OMPLM_reversed,
603 OMPLM_split,
604 OMPLM_unrolled,
605 Last_ = OMPLM_unrolled,
606};
607
608static constexpr std::size_t LoopModifier_enumSize = 10;
609
610constexpr auto OMPLM_flattened = LoopModifier::OMPLM_flattened;
611constexpr auto OMPLM_fused = LoopModifier::OMPLM_fused;
612constexpr auto OMPLM_grid = LoopModifier::OMPLM_grid;
613constexpr auto OMPLM_identity = LoopModifier::OMPLM_identity;
614constexpr auto OMPLM_interchanged = LoopModifier::OMPLM_interchanged;
615constexpr auto OMPLM_intratile = LoopModifier::OMPLM_intratile;
616constexpr auto OMPLM_offsets = LoopModifier::OMPLM_offsets;
617constexpr auto OMPLM_reversed = LoopModifier::OMPLM_reversed;
618constexpr auto OMPLM_split = LoopModifier::OMPLM_split;
619constexpr auto OMPLM_unrolled = LoopModifier::OMPLM_unrolled;
620
621enum class BindKind {
622 OMP_BIND_parallel=1,
623 OMP_BIND_teams=2,
624 OMP_BIND_thread=3,
625};
626
627constexpr auto OMP_BIND_parallel = BindKind::OMP_BIND_parallel;
628constexpr auto OMP_BIND_teams = BindKind::OMP_BIND_teams;
629constexpr auto OMP_BIND_thread = BindKind::OMP_BIND_thread;
630
631enum class CancellationConstructType {
632 OMP_CANCELLATION_CONSTRUCT_Parallel=1,
633 OMP_CANCELLATION_CONSTRUCT_Loop=2,
634 OMP_CANCELLATION_CONSTRUCT_Sections=3,
635 OMP_CANCELLATION_CONSTRUCT_Taskgroup=4,
636 OMP_CANCELLATION_CONSTRUCT_None=5,
637};
638
639constexpr auto OMP_CANCELLATION_CONSTRUCT_Parallel = CancellationConstructType::OMP_CANCELLATION_CONSTRUCT_Parallel;
640constexpr auto OMP_CANCELLATION_CONSTRUCT_Loop = CancellationConstructType::OMP_CANCELLATION_CONSTRUCT_Loop;
641constexpr auto OMP_CANCELLATION_CONSTRUCT_Sections = CancellationConstructType::OMP_CANCELLATION_CONSTRUCT_Sections;
642constexpr auto OMP_CANCELLATION_CONSTRUCT_Taskgroup = CancellationConstructType::OMP_CANCELLATION_CONSTRUCT_Taskgroup;
643constexpr auto OMP_CANCELLATION_CONSTRUCT_None = CancellationConstructType::OMP_CANCELLATION_CONSTRUCT_None;
644
645enum class GrainsizeType {
646 OMP_GRAINSIZE_Strict=1,
647 OMP_GRAINSIZE_Unknown=2,
648};
649
650constexpr auto OMP_GRAINSIZE_Strict = GrainsizeType::OMP_GRAINSIZE_Strict;
651constexpr auto OMP_GRAINSIZE_Unknown = GrainsizeType::OMP_GRAINSIZE_Unknown;
652
653enum class MemoryOrderKind {
654 OMP_MEMORY_ORDER_SeqCst=1,
655 OMP_MEMORY_ORDER_AcqRel=2,
656 OMP_MEMORY_ORDER_Acquire=3,
657 OMP_MEMORY_ORDER_Release=4,
658 OMP_MEMORY_ORDER_Relaxed=5,
659 OMP_MEMORY_ORDER_Default=6,
660};
661
662constexpr auto OMP_MEMORY_ORDER_SeqCst = MemoryOrderKind::OMP_MEMORY_ORDER_SeqCst;
663constexpr auto OMP_MEMORY_ORDER_AcqRel = MemoryOrderKind::OMP_MEMORY_ORDER_AcqRel;
664constexpr auto OMP_MEMORY_ORDER_Acquire = MemoryOrderKind::OMP_MEMORY_ORDER_Acquire;
665constexpr auto OMP_MEMORY_ORDER_Release = MemoryOrderKind::OMP_MEMORY_ORDER_Release;
666constexpr auto OMP_MEMORY_ORDER_Relaxed = MemoryOrderKind::OMP_MEMORY_ORDER_Relaxed;
667constexpr auto OMP_MEMORY_ORDER_Default = MemoryOrderKind::OMP_MEMORY_ORDER_Default;
668
669enum class NumTasksType {
670 OMP_NUMTASKS_Strict=1,
671 OMP_NUMTASKS_Unknown=2,
672};
673
674constexpr auto OMP_NUMTASKS_Strict = NumTasksType::OMP_NUMTASKS_Strict;
675constexpr auto OMP_NUMTASKS_Unknown = NumTasksType::OMP_NUMTASKS_Unknown;
676
677enum class NumThreadsType {
678 OMP_NUMTHREADS_Strict=1,
679 OMP_NUMTHREADS_Unknown=2,
680};
681
682constexpr auto OMP_NUMTHREADS_Strict = NumThreadsType::OMP_NUMTHREADS_Strict;
683constexpr auto OMP_NUMTHREADS_Unknown = NumThreadsType::OMP_NUMTHREADS_Unknown;
684
685enum class OrderKind {
686 OMP_ORDER_unknown=2,
687 OMP_ORDER_concurrent=1,
688};
689
690constexpr auto OMP_ORDER_unknown = OrderKind::OMP_ORDER_unknown;
691constexpr auto OMP_ORDER_concurrent = OrderKind::OMP_ORDER_concurrent;
692
693enum class ProcBindKind {
694 OMP_PROC_BIND_primary=5,
695 OMP_PROC_BIND_master=2,
696 OMP_PROC_BIND_close=3,
697 OMP_PROC_BIND_spread=4,
698 OMP_PROC_BIND_default=6,
699 OMP_PROC_BIND_unknown=7,
700};
701
702constexpr auto OMP_PROC_BIND_primary = ProcBindKind::OMP_PROC_BIND_primary;
703constexpr auto OMP_PROC_BIND_master = ProcBindKind::OMP_PROC_BIND_master;
704constexpr auto OMP_PROC_BIND_close = ProcBindKind::OMP_PROC_BIND_close;
705constexpr auto OMP_PROC_BIND_spread = ProcBindKind::OMP_PROC_BIND_spread;
706constexpr auto OMP_PROC_BIND_default = ProcBindKind::OMP_PROC_BIND_default;
707constexpr auto OMP_PROC_BIND_unknown = ProcBindKind::OMP_PROC_BIND_unknown;
708
709enum class ScheduleKind {
710 OMP_SCHEDULE_Static=2,
711 OMP_SCHEDULE_Dynamic=3,
712 OMP_SCHEDULE_Guided=4,
713 OMP_SCHEDULE_Auto=5,
714 OMP_SCHEDULE_Runtime=6,
715 OMP_SCHEDULE_Distribute=7,
716 OMP_SCHEDULE_Default=8,
717};
718
719constexpr auto OMP_SCHEDULE_Static = ScheduleKind::OMP_SCHEDULE_Static;
720constexpr auto OMP_SCHEDULE_Dynamic = ScheduleKind::OMP_SCHEDULE_Dynamic;
721constexpr auto OMP_SCHEDULE_Guided = ScheduleKind::OMP_SCHEDULE_Guided;
722constexpr auto OMP_SCHEDULE_Auto = ScheduleKind::OMP_SCHEDULE_Auto;
723constexpr auto OMP_SCHEDULE_Runtime = ScheduleKind::OMP_SCHEDULE_Runtime;
724constexpr auto OMP_SCHEDULE_Distribute = ScheduleKind::OMP_SCHEDULE_Distribute;
725constexpr auto OMP_SCHEDULE_Default = ScheduleKind::OMP_SCHEDULE_Default;
726
727// Constexpr functions.
728
729constexpr Association getDirectiveAssociation(Directive Dir) {
730 switch (Dir) {
731 case OMPD_allocate:
732 return Association::Explicit;
733 case OMPD_allocators:
734 return Association::Block;
735 case OMPD_assume:
736 return Association::Block;
737 case OMPD_assumes:
738 return Association::None;
739 case OMPD_atomic:
740 return Association::Block;
741 case OMPD_barrier:
742 return Association::None;
743 case OMPD_begin_assumes:
744 return Association::Delimited;
745 case OMPD_begin_declare_target:
746 return Association::Delimited;
747 case OMPD_begin_declare_variant:
748 return Association::Delimited;
749 case OMPD_cancel:
750 return Association::None;
751 case OMPD_cancellation_point:
752 return Association::None;
753 case OMPD_critical:
754 return Association::Block;
755 case OMPD_declare_induction:
756 return Association::None;
757 case OMPD_declare_mapper:
758 return Association::None;
759 case OMPD_declare_reduction:
760 return Association::None;
761 case OMPD_declare_simd:
762 return Association::Declaration;
763 case OMPD_declare_target:
764 return Association::Explicit;
765 case OMPD_declare_variant:
766 return Association::Declaration;
767 case OMPD_depobj:
768 return Association::None;
769 case OMPD_distribute:
770 return Association::LoopNest;
771 case OMPD_distribute_parallel_do:
772 return Association::LoopNest;
773 case OMPD_distribute_parallel_do_simd:
774 return Association::LoopNest;
775 case OMPD_distribute_parallel_for:
776 return Association::LoopNest;
777 case OMPD_distribute_parallel_for_simd:
778 return Association::LoopNest;
779 case OMPD_distribute_simd:
780 return Association::LoopNest;
781 case OMPD_do:
782 return Association::LoopNest;
783 case OMPD_do_simd:
784 return Association::LoopNest;
785 case OMPD_end_assumes:
786 return Association::Delimited;
787 case OMPD_end_declare_target:
788 return Association::Delimited;
789 case OMPD_end_declare_variant:
790 return Association::Delimited;
791 case OMPD_error:
792 return Association::None;
793 case OMPD_flatten:
794 return Association::LoopNest;
795 case OMPD_flush:
796 return Association::None;
797 case OMPD_for:
798 return Association::LoopNest;
799 case OMPD_for_simd:
800 return Association::LoopNest;
801 case OMPD_fuse:
802 return Association::LoopSequence;
803 case OMPD_groupprivate:
804 return Association::Explicit;
805 case OMPD_interchange:
806 return Association::LoopNest;
807 case OMPD_masked_taskloop:
808 return Association::LoopNest;
809 case OMPD_masked_taskloop_simd:
810 return Association::LoopNest;
811 case OMPD_master:
812 return Association::Block;
813 case OMPD_master_taskloop:
814 return Association::LoopNest;
815 case OMPD_master_taskloop_simd:
816 return Association::LoopNest;
817 case OMPD_metadirective:
818 return Association::None;
819 case OMPD_nothing:
820 return Association::None;
821 case OMPD_ordered_blockassoc:
822 return Association::Block;
823 case OMPD_ordered_standalone:
824 return Association::None;
825 case OMPD_parallel:
826 return Association::Block;
827 case OMPD_parallel_do:
828 return Association::LoopNest;
829 case OMPD_parallel_do_simd:
830 return Association::LoopNest;
831 case OMPD_parallel_for:
832 return Association::LoopNest;
833 case OMPD_parallel_for_simd:
834 return Association::LoopNest;
835 case OMPD_parallel_masked:
836 return Association::Block;
837 case OMPD_parallel_masked_taskloop:
838 return Association::LoopNest;
839 case OMPD_parallel_masked_taskloop_simd:
840 return Association::LoopNest;
841 case OMPD_parallel_master:
842 return Association::Block;
843 case OMPD_parallel_master_taskloop:
844 return Association::LoopNest;
845 case OMPD_parallel_master_taskloop_simd:
846 return Association::LoopNest;
847 case OMPD_parallel_sections:
848 return Association::Block;
849 case OMPD_parallel_workshare:
850 return Association::Block;
851 case OMPD_requires:
852 return Association::None;
853 case OMPD_reverse:
854 return Association::LoopNest;
855 case OMPD_scan:
856 return Association::Separating;
857 case OMPD_scope:
858 return Association::Block;
859 case OMPD_section:
860 return Association::Separating;
861 case OMPD_sections:
862 return Association::Block;
863 case OMPD_simd:
864 return Association::LoopNest;
865 case OMPD_single:
866 return Association::Block;
867 case OMPD_split:
868 return Association::LoopNest;
869 case OMPD_stripe:
870 return Association::LoopNest;
871 case OMPD_target:
872 return Association::Block;
873 case OMPD_target_data:
874 return Association::Block;
875 case OMPD_target_enter_data:
876 return Association::None;
877 case OMPD_target_exit_data:
878 return Association::None;
879 case OMPD_target_parallel:
880 return Association::Block;
881 case OMPD_target_parallel_do:
882 return Association::LoopNest;
883 case OMPD_target_parallel_do_simd:
884 return Association::LoopNest;
885 case OMPD_target_parallel_for:
886 return Association::LoopNest;
887 case OMPD_target_parallel_for_simd:
888 return Association::LoopNest;
889 case OMPD_target_simd:
890 return Association::LoopNest;
891 case OMPD_target_teams:
892 return Association::Block;
893 case OMPD_target_teams_distribute:
894 return Association::LoopNest;
895 case OMPD_target_teams_distribute_parallel_do:
896 return Association::LoopNest;
897 case OMPD_target_teams_distribute_parallel_do_simd:
898 return Association::LoopNest;
899 case OMPD_target_teams_distribute_parallel_for:
900 return Association::LoopNest;
901 case OMPD_target_teams_distribute_parallel_for_simd:
902 return Association::LoopNest;
903 case OMPD_target_teams_distribute_simd:
904 return Association::LoopNest;
905 case OMPD_target_teams_workdistribute:
906 return Association::Block;
907 case OMPD_target_update:
908 return Association::None;
909 case OMPD_task:
910 return Association::Block;
911 case OMPD_taskgroup:
912 return Association::Block;
913 case OMPD_taskloop:
914 return Association::LoopNest;
915 case OMPD_taskloop_simd:
916 return Association::LoopNest;
917 case OMPD_taskwait:
918 return Association::None;
919 case OMPD_taskyield:
920 return Association::None;
921 case OMPD_taskgraph:
922 return Association::Block;
923 case OMPD_teams:
924 return Association::Block;
925 case OMPD_teams_distribute:
926 return Association::LoopNest;
927 case OMPD_teams_distribute_parallel_do:
928 return Association::LoopNest;
929 case OMPD_teams_distribute_parallel_do_simd:
930 return Association::LoopNest;
931 case OMPD_teams_distribute_parallel_for:
932 return Association::LoopNest;
933 case OMPD_teams_distribute_parallel_for_simd:
934 return Association::LoopNest;
935 case OMPD_teams_distribute_simd:
936 return Association::LoopNest;
937 case OMPD_teams_workdistribute:
938 return Association::Block;
939 case OMPD_threadprivate:
940 return Association::Explicit;
941 case OMPD_tile:
942 return Association::LoopNest;
943 case OMPD_unknown:
944 return Association::None;
945 case OMPD_unroll:
946 return Association::LoopNest;
947 case OMPD_workdistribute:
948 return Association::Block;
949 case OMPD_workshare:
950 return Association::Block;
951 case OMPD_dispatch:
952 return Association::Block;
953 case OMPD_interop:
954 return Association::None;
955 case OMPD_loop:
956 return Association::LoopNest;
957 case OMPD_masked:
958 return Association::Block;
959 case OMPD_parallel_loop:
960 return Association::LoopNest;
961 case OMPD_target_loop:
962 return Association::LoopNest;
963 case OMPD_target_parallel_loop:
964 return Association::LoopNest;
965 case OMPD_target_teams_loop:
966 return Association::LoopNest;
967 case OMPD_teams_loop:
968 return Association::LoopNest;
969 } // switch (Dir)
970#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 9
971 abort();
972#else
973 llvm_unreachable("Unexpected directive");
974#endif
975}
976
977constexpr Category getDirectiveCategory(Directive Dir) {
978 switch (Dir) {
979 case OMPD_allocate:
980 return Category::Declarative;
981 case OMPD_allocators:
982 return Category::Executable;
983 case OMPD_assume:
984 return Category::Informational;
985 case OMPD_assumes:
986 return Category::Informational;
987 case OMPD_atomic:
988 return Category::Executable;
989 case OMPD_barrier:
990 return Category::Executable;
991 case OMPD_begin_assumes:
992 return Category::Informational;
993 case OMPD_begin_declare_target:
994 return Category::Declarative;
995 case OMPD_begin_declare_variant:
996 return Category::Declarative;
997 case OMPD_cancel:
998 return Category::Executable;
999 case OMPD_cancellation_point:
1000 return Category::Executable;
1001 case OMPD_critical:
1002 return Category::Executable;
1003 case OMPD_declare_induction:
1004 return Category::Declarative;
1005 case OMPD_declare_mapper:
1006 return Category::Declarative;
1007 case OMPD_declare_reduction:
1008 return Category::Declarative;
1009 case OMPD_declare_simd:
1010 return Category::Declarative;
1011 case OMPD_declare_target:
1012 return Category::Declarative;
1013 case OMPD_declare_variant:
1014 return Category::Declarative;
1015 case OMPD_depobj:
1016 return Category::Executable;
1017 case OMPD_distribute:
1018 return Category::Executable;
1019 case OMPD_distribute_parallel_do:
1020 return Category::Executable;
1021 case OMPD_distribute_parallel_do_simd:
1022 return Category::Executable;
1023 case OMPD_distribute_parallel_for:
1024 return Category::Executable;
1025 case OMPD_distribute_parallel_for_simd:
1026 return Category::Executable;
1027 case OMPD_distribute_simd:
1028 return Category::Executable;
1029 case OMPD_do:
1030 return Category::Executable;
1031 case OMPD_do_simd:
1032 return Category::Executable;
1033 case OMPD_end_assumes:
1034 return Category::Informational;
1035 case OMPD_end_declare_target:
1036 return Category::Declarative;
1037 case OMPD_end_declare_variant:
1038 return Category::Declarative;
1039 case OMPD_error:
1040 return Category::Utility;
1041 case OMPD_flatten:
1042 return Category::Executable;
1043 case OMPD_flush:
1044 return Category::Executable;
1045 case OMPD_for:
1046 return Category::Executable;
1047 case OMPD_for_simd:
1048 return Category::Executable;
1049 case OMPD_fuse:
1050 return Category::Executable;
1051 case OMPD_groupprivate:
1052 return Category::Declarative;
1053 case OMPD_interchange:
1054 return Category::Executable;
1055 case OMPD_masked_taskloop:
1056 return Category::Executable;
1057 case OMPD_masked_taskloop_simd:
1058 return Category::Executable;
1059 case OMPD_master:
1060 return Category::Executable;
1061 case OMPD_master_taskloop:
1062 return Category::Executable;
1063 case OMPD_master_taskloop_simd:
1064 return Category::Executable;
1065 case OMPD_metadirective:
1066 return Category::Meta;
1067 case OMPD_nothing:
1068 return Category::Utility;
1069 case OMPD_ordered_blockassoc:
1070 return Category::Executable;
1071 case OMPD_ordered_standalone:
1072 return Category::Executable;
1073 case OMPD_parallel:
1074 return Category::Executable;
1075 case OMPD_parallel_do:
1076 return Category::Executable;
1077 case OMPD_parallel_do_simd:
1078 return Category::Executable;
1079 case OMPD_parallel_for:
1080 return Category::Executable;
1081 case OMPD_parallel_for_simd:
1082 return Category::Executable;
1083 case OMPD_parallel_masked:
1084 return Category::Executable;
1085 case OMPD_parallel_masked_taskloop:
1086 return Category::Executable;
1087 case OMPD_parallel_masked_taskloop_simd:
1088 return Category::Executable;
1089 case OMPD_parallel_master:
1090 return Category::Executable;
1091 case OMPD_parallel_master_taskloop:
1092 return Category::Executable;
1093 case OMPD_parallel_master_taskloop_simd:
1094 return Category::Executable;
1095 case OMPD_parallel_sections:
1096 return Category::Executable;
1097 case OMPD_parallel_workshare:
1098 return Category::Executable;
1099 case OMPD_requires:
1100 return Category::Informational;
1101 case OMPD_reverse:
1102 return Category::Executable;
1103 case OMPD_scan:
1104 return Category::Subsidiary;
1105 case OMPD_scope:
1106 return Category::Executable;
1107 case OMPD_section:
1108 return Category::Subsidiary;
1109 case OMPD_sections:
1110 return Category::Executable;
1111 case OMPD_simd:
1112 return Category::Executable;
1113 case OMPD_single:
1114 return Category::Executable;
1115 case OMPD_split:
1116 return Category::Executable;
1117 case OMPD_stripe:
1118 return Category::Executable;
1119 case OMPD_target:
1120 return Category::Executable;
1121 case OMPD_target_data:
1122 return Category::Executable;
1123 case OMPD_target_enter_data:
1124 return Category::Executable;
1125 case OMPD_target_exit_data:
1126 return Category::Executable;
1127 case OMPD_target_parallel:
1128 return Category::Executable;
1129 case OMPD_target_parallel_do:
1130 return Category::Executable;
1131 case OMPD_target_parallel_do_simd:
1132 return Category::Executable;
1133 case OMPD_target_parallel_for:
1134 return Category::Executable;
1135 case OMPD_target_parallel_for_simd:
1136 return Category::Executable;
1137 case OMPD_target_simd:
1138 return Category::Executable;
1139 case OMPD_target_teams:
1140 return Category::Executable;
1141 case OMPD_target_teams_distribute:
1142 return Category::Executable;
1143 case OMPD_target_teams_distribute_parallel_do:
1144 return Category::Executable;
1145 case OMPD_target_teams_distribute_parallel_do_simd:
1146 return Category::Executable;
1147 case OMPD_target_teams_distribute_parallel_for:
1148 return Category::Executable;
1149 case OMPD_target_teams_distribute_parallel_for_simd:
1150 return Category::Executable;
1151 case OMPD_target_teams_distribute_simd:
1152 return Category::Executable;
1153 case OMPD_target_teams_workdistribute:
1154 return Category::Executable;
1155 case OMPD_target_update:
1156 return Category::Executable;
1157 case OMPD_task:
1158 return Category::Executable;
1159 case OMPD_taskgroup:
1160 return Category::Executable;
1161 case OMPD_taskloop:
1162 return Category::Executable;
1163 case OMPD_taskloop_simd:
1164 return Category::Executable;
1165 case OMPD_taskwait:
1166 return Category::Executable;
1167 case OMPD_taskyield:
1168 return Category::Executable;
1169 case OMPD_taskgraph:
1170 return Category::Executable;
1171 case OMPD_teams:
1172 return Category::Executable;
1173 case OMPD_teams_distribute:
1174 return Category::Executable;
1175 case OMPD_teams_distribute_parallel_do:
1176 return Category::Executable;
1177 case OMPD_teams_distribute_parallel_do_simd:
1178 return Category::Executable;
1179 case OMPD_teams_distribute_parallel_for:
1180 return Category::Executable;
1181 case OMPD_teams_distribute_parallel_for_simd:
1182 return Category::Executable;
1183 case OMPD_teams_distribute_simd:
1184 return Category::Executable;
1185 case OMPD_teams_workdistribute:
1186 return Category::Executable;
1187 case OMPD_threadprivate:
1188 return Category::Declarative;
1189 case OMPD_tile:
1190 return Category::Executable;
1191 case OMPD_unknown:
1192 return Category::Utility;
1193 case OMPD_unroll:
1194 return Category::Executable;
1195 case OMPD_workdistribute:
1196 return Category::Executable;
1197 case OMPD_workshare:
1198 return Category::Executable;
1199 case OMPD_dispatch:
1200 return Category::Executable;
1201 case OMPD_interop:
1202 return Category::Executable;
1203 case OMPD_loop:
1204 return Category::Executable;
1205 case OMPD_masked:
1206 return Category::Executable;
1207 case OMPD_parallel_loop:
1208 return Category::Executable;
1209 case OMPD_target_loop:
1210 return Category::Executable;
1211 case OMPD_target_parallel_loop:
1212 return Category::Executable;
1213 case OMPD_target_teams_loop:
1214 return Category::Executable;
1215 case OMPD_teams_loop:
1216 return Category::Executable;
1217 } // switch (Dir)
1218#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 9
1219 abort();
1220#else
1221 llvm_unreachable("Unexpected directive");
1222#endif
1223}
1224
1225constexpr Version getDirectivePureSince(Directive Dir) {
1226 switch (Dir) {
1227 case OMPD_allocate:
1228 return Version(50);
1229 case OMPD_assume:
1230 return Version(52);
1231 case OMPD_assumes:
1232 return Version(52);
1233 case OMPD_begin_declare_target:
1234 return Version(45);
1235 case OMPD_begin_declare_variant:
1236 return Version(50);
1237 case OMPD_declare_induction:
1238 return Version(50);
1239 case OMPD_declare_mapper:
1240 return Version(50);
1241 case OMPD_declare_reduction:
1242 return Version(50);
1243 case OMPD_declare_simd:
1244 return Version(50);
1245 case OMPD_declare_target:
1246 return Version(45);
1247 case OMPD_declare_variant:
1248 return Version(50);
1249 case OMPD_end_declare_target:
1250 return Version(45);
1251 case OMPD_end_declare_variant:
1252 return Version(50);
1253 case OMPD_error:
1254 return Version(52);
1255 case OMPD_fuse:
1256 return Version(60);
1257 case OMPD_groupprivate:
1258 return Version(50);
1259 case OMPD_interchange:
1260 return Version(60);
1261 case OMPD_metadirective:
1262 return Version(52);
1263 case OMPD_nothing:
1264 return Version(52);
1265 case OMPD_requires:
1266 return Version(50);
1267 case OMPD_reverse:
1268 return Version(60);
1269 case OMPD_scan:
1270 return Version(60);
1271 case OMPD_simd:
1272 return Version(45);
1273 case OMPD_split:
1274 return Version(60);
1275 case OMPD_stripe:
1276 return Version(60);
1277 case OMPD_threadprivate:
1278 return Version(50);
1279 case OMPD_tile:
1280 return Version(52);
1281 case OMPD_unroll:
1282 return Version(52);
1283 default:
1284 return Version(2147483647);
1285 } // switch (Dir)
1286}
1287
1288constexpr SourceLanguage getDirectiveLanguages(Directive D) {
1289 switch (D) {
1290 case OMPD_allocate:
1291 return SourceLanguage::C | SourceLanguage::Fortran;
1292 case OMPD_allocators:
1293 return SourceLanguage::Fortran;
1294 case OMPD_assume:
1295 return SourceLanguage::C | SourceLanguage::Fortran;
1296 case OMPD_assumes:
1297 return SourceLanguage::C | SourceLanguage::Fortran;
1298 case OMPD_atomic:
1299 return SourceLanguage::C | SourceLanguage::Fortran;
1300 case OMPD_barrier:
1301 return SourceLanguage::C | SourceLanguage::Fortran;
1302 case OMPD_begin_assumes:
1303 return SourceLanguage::C;
1304 case OMPD_begin_declare_target:
1305 return SourceLanguage::C;
1306 case OMPD_begin_declare_variant:
1307 return SourceLanguage::C;
1308 case OMPD_cancel:
1309 return SourceLanguage::C | SourceLanguage::Fortran;
1310 case OMPD_cancellation_point:
1311 return SourceLanguage::C | SourceLanguage::Fortran;
1312 case OMPD_critical:
1313 return SourceLanguage::C | SourceLanguage::Fortran;
1314 case OMPD_declare_induction:
1315 return SourceLanguage::C | SourceLanguage::Fortran;
1316 case OMPD_declare_mapper:
1317 return SourceLanguage::C | SourceLanguage::Fortran;
1318 case OMPD_declare_reduction:
1319 return SourceLanguage::C | SourceLanguage::Fortran;
1320 case OMPD_declare_simd:
1321 return SourceLanguage::C | SourceLanguage::Fortran;
1322 case OMPD_declare_target:
1323 return SourceLanguage::C | SourceLanguage::Fortran;
1324 case OMPD_declare_variant:
1325 return SourceLanguage::C;
1326 case OMPD_depobj:
1327 return SourceLanguage::C | SourceLanguage::Fortran;
1328 case OMPD_distribute:
1329 return SourceLanguage::C | SourceLanguage::Fortran;
1330 case OMPD_distribute_parallel_do:
1331 return SourceLanguage::Fortran;
1332 case OMPD_distribute_parallel_do_simd:
1333 return SourceLanguage::Fortran;
1334 case OMPD_distribute_parallel_for:
1335 return SourceLanguage::C;
1336 case OMPD_distribute_parallel_for_simd:
1337 return SourceLanguage::C;
1338 case OMPD_distribute_simd:
1339 return SourceLanguage::C | SourceLanguage::Fortran;
1340 case OMPD_do:
1341 return SourceLanguage::Fortran;
1342 case OMPD_do_simd:
1343 return SourceLanguage::Fortran;
1344 case OMPD_end_assumes:
1345 return SourceLanguage::C;
1346 case OMPD_end_declare_target:
1347 return SourceLanguage::C;
1348 case OMPD_end_declare_variant:
1349 return SourceLanguage::C;
1350 case OMPD_error:
1351 return SourceLanguage::C | SourceLanguage::Fortran;
1352 case OMPD_flatten:
1353 return SourceLanguage::C | SourceLanguage::Fortran;
1354 case OMPD_flush:
1355 return SourceLanguage::C | SourceLanguage::Fortran;
1356 case OMPD_for:
1357 return SourceLanguage::C;
1358 case OMPD_for_simd:
1359 return SourceLanguage::C | SourceLanguage::Fortran;
1360 case OMPD_fuse:
1361 return SourceLanguage::C | SourceLanguage::Fortran;
1362 case OMPD_groupprivate:
1363 return SourceLanguage::C | SourceLanguage::Fortran;
1364 case OMPD_interchange:
1365 return SourceLanguage::C | SourceLanguage::Fortran;
1366 case OMPD_masked_taskloop:
1367 return SourceLanguage::C | SourceLanguage::Fortran;
1368 case OMPD_masked_taskloop_simd:
1369 return SourceLanguage::C | SourceLanguage::Fortran;
1370 case OMPD_master:
1371 return SourceLanguage::C | SourceLanguage::Fortran;
1372 case OMPD_master_taskloop:
1373 return SourceLanguage::C | SourceLanguage::Fortran;
1374 case OMPD_master_taskloop_simd:
1375 return SourceLanguage::C | SourceLanguage::Fortran;
1376 case OMPD_metadirective:
1377 return SourceLanguage::C | SourceLanguage::Fortran;
1378 case OMPD_nothing:
1379 return SourceLanguage::C | SourceLanguage::Fortran;
1380 case OMPD_ordered_blockassoc:
1381 return SourceLanguage::C | SourceLanguage::Fortran;
1382 case OMPD_ordered_standalone:
1383 return SourceLanguage::C | SourceLanguage::Fortran;
1384 case OMPD_parallel:
1385 return SourceLanguage::C | SourceLanguage::Fortran;
1386 case OMPD_parallel_do:
1387 return SourceLanguage::Fortran;
1388 case OMPD_parallel_do_simd:
1389 return SourceLanguage::Fortran;
1390 case OMPD_parallel_for:
1391 return SourceLanguage::C;
1392 case OMPD_parallel_for_simd:
1393 return SourceLanguage::C;
1394 case OMPD_parallel_masked:
1395 return SourceLanguage::C | SourceLanguage::Fortran;
1396 case OMPD_parallel_masked_taskloop:
1397 return SourceLanguage::C | SourceLanguage::Fortran;
1398 case OMPD_parallel_masked_taskloop_simd:
1399 return SourceLanguage::C | SourceLanguage::Fortran;
1400 case OMPD_parallel_master:
1401 return SourceLanguage::C | SourceLanguage::Fortran;
1402 case OMPD_parallel_master_taskloop:
1403 return SourceLanguage::C | SourceLanguage::Fortran;
1404 case OMPD_parallel_master_taskloop_simd:
1405 return SourceLanguage::C | SourceLanguage::Fortran;
1406 case OMPD_parallel_sections:
1407 return SourceLanguage::C | SourceLanguage::Fortran;
1408 case OMPD_parallel_workshare:
1409 return SourceLanguage::Fortran;
1410 case OMPD_requires:
1411 return SourceLanguage::C | SourceLanguage::Fortran;
1412 case OMPD_reverse:
1413 return SourceLanguage::C | SourceLanguage::Fortran;
1414 case OMPD_scan:
1415 return SourceLanguage::C | SourceLanguage::Fortran;
1416 case OMPD_scope:
1417 return SourceLanguage::C | SourceLanguage::Fortran;
1418 case OMPD_section:
1419 return SourceLanguage::C | SourceLanguage::Fortran;
1420 case OMPD_sections:
1421 return SourceLanguage::C | SourceLanguage::Fortran;
1422 case OMPD_simd:
1423 return SourceLanguage::C | SourceLanguage::Fortran;
1424 case OMPD_single:
1425 return SourceLanguage::C | SourceLanguage::Fortran;
1426 case OMPD_split:
1427 return SourceLanguage::C | SourceLanguage::Fortran;
1428 case OMPD_stripe:
1429 return SourceLanguage::C | SourceLanguage::Fortran;
1430 case OMPD_target:
1431 return SourceLanguage::C | SourceLanguage::Fortran;
1432 case OMPD_target_data:
1433 return SourceLanguage::C | SourceLanguage::Fortran;
1434 case OMPD_target_enter_data:
1435 return SourceLanguage::C | SourceLanguage::Fortran;
1436 case OMPD_target_exit_data:
1437 return SourceLanguage::C | SourceLanguage::Fortran;
1438 case OMPD_target_parallel:
1439 return SourceLanguage::C | SourceLanguage::Fortran;
1440 case OMPD_target_parallel_do:
1441 return SourceLanguage::Fortran;
1442 case OMPD_target_parallel_do_simd:
1443 return SourceLanguage::Fortran;
1444 case OMPD_target_parallel_for:
1445 return SourceLanguage::C;
1446 case OMPD_target_parallel_for_simd:
1447 return SourceLanguage::C;
1448 case OMPD_target_simd:
1449 return SourceLanguage::C | SourceLanguage::Fortran;
1450 case OMPD_target_teams:
1451 return SourceLanguage::C | SourceLanguage::Fortran;
1452 case OMPD_target_teams_distribute:
1453 return SourceLanguage::C | SourceLanguage::Fortran;
1454 case OMPD_target_teams_distribute_parallel_do:
1455 return SourceLanguage::Fortran;
1456 case OMPD_target_teams_distribute_parallel_do_simd:
1457 return SourceLanguage::Fortran;
1458 case OMPD_target_teams_distribute_parallel_for:
1459 return SourceLanguage::C;
1460 case OMPD_target_teams_distribute_parallel_for_simd:
1461 return SourceLanguage::C;
1462 case OMPD_target_teams_distribute_simd:
1463 return SourceLanguage::C | SourceLanguage::Fortran;
1464 case OMPD_target_teams_workdistribute:
1465 return SourceLanguage::Fortran;
1466 case OMPD_target_update:
1467 return SourceLanguage::C | SourceLanguage::Fortran;
1468 case OMPD_task:
1469 return SourceLanguage::C | SourceLanguage::Fortran;
1470 case OMPD_taskgroup:
1471 return SourceLanguage::C | SourceLanguage::Fortran;
1472 case OMPD_taskloop:
1473 return SourceLanguage::C | SourceLanguage::Fortran;
1474 case OMPD_taskloop_simd:
1475 return SourceLanguage::C | SourceLanguage::Fortran;
1476 case OMPD_taskwait:
1477 return SourceLanguage::C | SourceLanguage::Fortran;
1478 case OMPD_taskyield:
1479 return SourceLanguage::C | SourceLanguage::Fortran;
1480 case OMPD_taskgraph:
1481 return SourceLanguage::C | SourceLanguage::Fortran;
1482 case OMPD_teams:
1483 return SourceLanguage::C | SourceLanguage::Fortran;
1484 case OMPD_teams_distribute:
1485 return SourceLanguage::C | SourceLanguage::Fortran;
1486 case OMPD_teams_distribute_parallel_do:
1487 return SourceLanguage::Fortran;
1488 case OMPD_teams_distribute_parallel_do_simd:
1489 return SourceLanguage::Fortran;
1490 case OMPD_teams_distribute_parallel_for:
1491 return SourceLanguage::C;
1492 case OMPD_teams_distribute_parallel_for_simd:
1493 return SourceLanguage::C;
1494 case OMPD_teams_distribute_simd:
1495 return SourceLanguage::C | SourceLanguage::Fortran;
1496 case OMPD_teams_workdistribute:
1497 return SourceLanguage::Fortran;
1498 case OMPD_threadprivate:
1499 return SourceLanguage::C | SourceLanguage::Fortran;
1500 case OMPD_tile:
1501 return SourceLanguage::C | SourceLanguage::Fortran;
1502 case OMPD_unknown:
1503 return SourceLanguage::C | SourceLanguage::Fortran;
1504 case OMPD_unroll:
1505 return SourceLanguage::C | SourceLanguage::Fortran;
1506 case OMPD_workdistribute:
1507 return SourceLanguage::Fortran;
1508 case OMPD_workshare:
1509 return SourceLanguage::Fortran;
1510 case OMPD_dispatch:
1511 return SourceLanguage::C | SourceLanguage::Fortran;
1512 case OMPD_interop:
1513 return SourceLanguage::C | SourceLanguage::Fortran;
1514 case OMPD_loop:
1515 return SourceLanguage::C | SourceLanguage::Fortran;
1516 case OMPD_masked:
1517 return SourceLanguage::C | SourceLanguage::Fortran;
1518 case OMPD_parallel_loop:
1519 return SourceLanguage::C | SourceLanguage::Fortran;
1520 case OMPD_target_loop:
1521 return SourceLanguage::C | SourceLanguage::Fortran;
1522 case OMPD_target_parallel_loop:
1523 return SourceLanguage::C | SourceLanguage::Fortran;
1524 case OMPD_target_teams_loop:
1525 return SourceLanguage::C | SourceLanguage::Fortran;
1526 case OMPD_teams_loop:
1527 return SourceLanguage::C | SourceLanguage::Fortran;
1528 } // switch(D)
1529#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 9
1530 abort();
1531#else
1532 llvm_unreachable("Unexpected directive");
1533#endif
1534}
1535
1536// Enumeration helper functions
1537LLVM_ABI std::pair<Directive, directive::VersionRange> getOpenMPDirectiveKindAndVersions(StringRef Str);
1538inline Directive getOpenMPDirectiveKind(StringRef Str) {
1539 return getOpenMPDirectiveKindAndVersions(Str).first;
1540}
1541
1542LLVM_ABI StringRef getOpenMPDirectiveName(Directive D, Version V = Version(0));
1543
1544LLVM_ABI std::pair<Clause, directive::VersionRange> getOpenMPClauseKindAndVersions(StringRef Str);
1545
1546inline Clause getOpenMPClauseKind(StringRef Str) {
1547 return getOpenMPClauseKindAndVersions(Str).first;
1548}
1549
1550LLVM_ABI StringRef getOpenMPClauseName(Clause C, Version V = Version(0));
1551
1552/// Return true if \p C is a valid clause for \p D in version \p V.
1553LLVM_ABI bool isAllowedClauseForDirective(Directive D, Clause C, Version V);
1554
1555constexpr std::size_t getMaxLeafCount() { return 6; }
1556LLVM_ABI bool isAllowedLoopModifier(Directive D, LoopModifier LM);
1557LLVM_ABI StringRef getLoopModifierName(LoopModifier LM, Version V = Version(0));
1558LLVM_ABI BindKind getBindKind(StringRef Str);
1559LLVM_ABI StringRef getOpenMPBindKindName(BindKind x);
1560LLVM_ABI CancellationConstructType getCancellationConstructType(StringRef Str);
1561LLVM_ABI StringRef getOpenMPCancellationConstructTypeName(CancellationConstructType x);
1562LLVM_ABI GrainsizeType getGrainsizeType(StringRef Str);
1563LLVM_ABI StringRef getOpenMPGrainsizeTypeName(GrainsizeType x);
1564LLVM_ABI MemoryOrderKind getMemoryOrderKind(StringRef Str);
1565LLVM_ABI StringRef getOpenMPMemoryOrderKindName(MemoryOrderKind x);
1566LLVM_ABI NumTasksType getNumTasksType(StringRef Str);
1567LLVM_ABI StringRef getOpenMPNumTasksTypeName(NumTasksType x);
1568LLVM_ABI NumThreadsType getNumThreadsType(StringRef Str);
1569LLVM_ABI StringRef getOpenMPNumThreadsTypeName(NumThreadsType x);
1570LLVM_ABI OrderKind getOrderKind(StringRef Str);
1571LLVM_ABI StringRef getOpenMPOrderKindName(OrderKind x);
1572LLVM_ABI ProcBindKind getProcBindKind(StringRef Str);
1573LLVM_ABI StringRef getOpenMPProcBindKindName(ProcBindKind x);
1574LLVM_ABI ScheduleKind getScheduleKind(StringRef Str);
1575LLVM_ABI StringRef getOpenMPScheduleKindName(ScheduleKind x);
1576
1577} // namespace omp
1578
1579template <> struct enum_iteration_traits<omp::Association> {
1580 static constexpr bool is_iterable = true;
1581};
1582
1583template <> struct enum_iteration_traits<omp::Category> {
1584 static constexpr bool is_iterable = true;
1585};
1586
1587template <> struct enum_iteration_traits<omp::Directive> {
1588 static constexpr bool is_iterable = true;
1589};
1590
1591template <> struct enum_iteration_traits<omp::Clause> {
1592 static constexpr bool is_iterable = true;
1593};
1594
1595template <> struct enum_iteration_traits<omp::LoopModifier> {
1596 static constexpr bool is_iterable = true;
1597};
1598
1599} // namespace llvm
1600
1601#endif // LLVM_OpenMP_INC
1602
1603