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