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