15#include "llvm/ADT/StringRef.h"
16#include "llvm/ADT/StringSwitch.h"
17#include "llvm/Support/ErrorHandling.h"
21using namespace llvm::omp;
26 return llvm::StringSwitch<OpenMPDefaultClauseVariableCategory>(Str)
27#define OPENMP_DEFAULT_VARIABLE_CATEGORY(Name) \
28 .Case(#Name, OMPC_DEFAULT_VC_##Name)
29#include "clang/Basic/OpenMPKinds.def"
35#define OPENMP_DEFAULT_VARIABLE_CATEGORY(Name) \
36 case OMPC_DEFAULT_VC_##Name: \
38#include "clang/Basic/OpenMPKinds.def"
40 llvm_unreachable(
"Invalid Variable Category in the default clause");
47 return llvm::StringSwitch<unsigned>(Str)
48#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
49#include "llvm/Frontend/OpenMP/OMPKinds.def"
50 .Default(
unsigned(llvm::omp::OMP_DEFAULT_unknown));
52 return llvm::StringSwitch<unsigned>(Str)
53#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
54#include "llvm/Frontend/OpenMP/OMPKinds.def"
55 .Default(
unsigned(llvm::omp::OMP_PROC_BIND_unknown));
57 return llvm::StringSwitch<unsigned>(Str)
58#define OPENMP_SCHEDULE_KIND(Name) \
59 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
60#define OPENMP_SCHEDULE_MODIFIER(Name) \
61 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
62#include "clang/Basic/OpenMPKinds.def"
65 unsigned Type = llvm::StringSwitch<unsigned>(Str)
66#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
67#include "clang/Basic/OpenMPKinds.def"
69 if (LangOpts.OpenMP < 51 &&
Type == OMPC_DEPEND_inoutset)
74 return llvm::StringSwitch<OpenMPDoacrossClauseModifier>(Str)
75#define OPENMP_DOACROSS_MODIFIER(Name) .Case(#Name, OMPC_DOACROSS_##Name)
76#include "clang/Basic/OpenMPKinds.def"
79 return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
80#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
81#include "clang/Basic/OpenMPKinds.def"
84 unsigned Type = llvm::StringSwitch<unsigned>(Str)
85#define OPENMP_MAP_KIND(Name) \
86 .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
87#define OPENMP_MAP_MODIFIER_KIND(Name) \
88 .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
89#include "clang/Basic/OpenMPKinds.def"
91 if (LangOpts.OpenMP < 51 &&
Type == OMPC_MAP_MODIFIER_present)
93 if (!LangOpts.OpenMPExtensions &&
Type == OMPC_MAP_MODIFIER_ompx_hold)
99 unsigned Type = llvm::StringSwitch<unsigned>(Str)
100#define OPENMP_MOTION_MODIFIER_KIND(Name) \
101 .Case(#Name, static_cast<unsigned>(OMPC_MOTION_MODIFIER_##Name))
102#include "clang/Basic/OpenMPKinds.def"
104 if (LangOpts.OpenMP < 51 &&
Type == OMPC_MOTION_MODIFIER_present)
108 case OMPC_dist_schedule:
109 return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
110#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
111#include "clang/Basic/OpenMPKinds.def"
113 case OMPC_defaultmap: {
114 unsigned Type = llvm::StringSwitch<unsigned>(Str)
115#define OPENMP_DEFAULTMAP_KIND(Name) \
116 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
117#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
118 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
119#include "clang/Basic/OpenMPKinds.def"
121 if (LangOpts.OpenMP < 60 && (
Type == OMPC_DEFAULTMAP_MODIFIER_storage ||
122 Type == OMPC_DEFAULTMAP_MODIFIER_private))
126 case OMPC_atomic_default_mem_order:
127 return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
128#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
129 .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
130#include "clang/Basic/OpenMPKinds.def"
133 return static_cast<unsigned int>(llvm::StringSwitch<llvm::omp::Clause>(Str)
134#define OPENMP_ATOMIC_FAIL_MODIFIER(Name) .Case(#Name, OMPC_##Name)
135#include "clang/Basic/OpenMPKinds.def"
136 .Default(OMPC_unknown));
137 case OMPC_device_type:
138 return llvm::StringSwitch<OpenMPDeviceType>(Str)
139#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
140#include "clang/Basic/OpenMPKinds.def"
143 return llvm::StringSwitch<OpenMPAtClauseKind>(Str)
144#define OPENMP_AT_KIND(Name) .Case(#Name, OMPC_AT_##Name)
145#include "clang/Basic/OpenMPKinds.def"
148 return llvm::StringSwitch<OpenMPSeverityClauseKind>(Str)
149#define OPENMP_SEVERITY_KIND(Name) .Case(#Name, OMPC_SEVERITY_##Name)
150#include "clang/Basic/OpenMPKinds.def"
152 case OMPC_lastprivate:
153 return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
154#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
155#include "clang/Basic/OpenMPKinds.def"
158 return llvm::StringSwitch<unsigned>(Str)
159#define OPENMP_ORDER_KIND(Name) \
160 .Case(#Name, static_cast<unsigned>(OMPC_ORDER_##Name))
161#define OPENMP_ORDER_MODIFIER(Name) \
162 .Case(#Name, static_cast<unsigned>(OMPC_ORDER_MODIFIER_##Name))
163#include "clang/Basic/OpenMPKinds.def"
166 return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
167#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
168#include "clang/Basic/OpenMPKinds.def"
171 return llvm::StringSwitch<OpenMPDeviceClauseModifier>(Str)
172#define OPENMP_DEVICE_MODIFIER(Name) .Case(#Name, OMPC_DEVICE_##Name)
173#include "clang/Basic/OpenMPKinds.def"
176 return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
177#define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
178#include "clang/Basic/OpenMPKinds.def"
180 case OMPC_adjust_args:
181 return llvm::StringSwitch<OpenMPAdjustArgsOpKind>(Str)
182#define OPENMP_ADJUST_ARGS_KIND(Name) .Case(#Name, OMPC_ADJUST_ARGS_##Name)
183#include "clang/Basic/OpenMPKinds.def"
186 return llvm::StringSwitch<unsigned>(Str)
187#define OPENMP_BIND_KIND(Name) .Case(#Name, OMPC_BIND_##Name)
188#include "clang/Basic/OpenMPKinds.def"
190 case OMPC_grainsize: {
191 unsigned Type = llvm::StringSwitch<unsigned>(Str)
192#define OPENMP_GRAINSIZE_MODIFIER(Name) .Case(#Name, OMPC_GRAINSIZE_##Name)
193#include "clang/Basic/OpenMPKinds.def"
195 if (LangOpts.OpenMP < 51)
199 case OMPC_dyn_groupprivate: {
200 return llvm::StringSwitch<unsigned>(Str)
201#define OPENMP_DYN_GROUPPRIVATE_MODIFIER(Name) \
202 .Case(#Name, OMPC_DYN_GROUPPRIVATE_##Name)
203#define OPENMP_DYN_GROUPPRIVATE_FALLBACK_MODIFIER(Name) \
204 .Case(#Name, OMPC_DYN_GROUPPRIVATE_FALLBACK_##Name) \
205 .Case("fallback(" #Name ")", OMPC_DYN_GROUPPRIVATE_FALLBACK_##Name)
206#include "clang/Basic/OpenMPKinds.def"
209 case OMPC_num_tasks: {
210 unsigned Type = llvm::StringSwitch<unsigned>(Str)
211#define OPENMP_NUMTASKS_MODIFIER(Name) .Case(#Name, OMPC_NUMTASKS_##Name)
212#include "clang/Basic/OpenMPKinds.def"
214 if (LangOpts.OpenMP < 51)
218 case OMPC_num_teams: {
219 unsigned Type = llvm::StringSwitch<unsigned>(Str)
220#define OPENMP_NUMTEAMS_MODIFIER(Name) .Case(#Name, OMPC_NUMTEAMS_##Name)
221#include "clang/Basic/OpenMPKinds.def"
223 if (LangOpts.OpenMP < 51)
228 return llvm::StringSwitch<OpenMPAllocateClauseModifier>(Str)
229#define OPENMP_ALLOCATE_MODIFIER(Name) .Case(#Name, OMPC_ALLOCATE_##Name)
230#include "clang/Basic/OpenMPKinds.def"
232 case OMPC_threadset: {
233 unsigned Type = llvm::StringSwitch<unsigned>(Str)
234#define OPENMP_THREADSET_KIND(Name) .Case(#Name, OMPC_THREADSET_##Name)
235#include "clang/Basic/OpenMPKinds.def"
237 if (LangOpts.OpenMP < 60)
241 case OMPC_num_threads: {
242 unsigned Type = llvm::StringSwitch<unsigned>(Str)
243#define OPENMP_NUMTHREADS_MODIFIER(Name) .Case(#Name, OMPC_NUMTHREADS_##Name)
244#include "clang/Basic/OpenMPKinds.def"
246 if (LangOpts.OpenMP < 60)
250 case OMPC_use_device_ptr: {
251 unsigned Type = llvm::StringSwitch<unsigned>(Str)
252#define OPENMP_USE_DEVICE_PTR_FALLBACK_MODIFIER(Name) \
253 .Case(#Name, OMPC_USE_DEVICE_PTR_FALLBACK_##Name)
254#include "clang/Basic/OpenMPKinds.def"
256 if (LangOpts.OpenMP < 61)
261 case OMPC_threadprivate:
262 case OMPC_groupprivate:
269 case OMPC_permutation:
273 case OMPC_firstprivate:
275 case OMPC_task_reduction:
276 case OMPC_in_reduction:
279 case OMPC_copyprivate:
297 case OMPC_thread_limit:
302 case OMPC_use_device_addr:
303 case OMPC_is_device_ptr:
304 case OMPC_has_device_addr:
305 case OMPC_unified_address:
306 case OMPC_unified_shared_memory:
307 case OMPC_reverse_offload:
308 case OMPC_dynamic_allocators:
311 case OMPC_nontemporal:
313 case OMPC_novariants:
318 case OMPC_uses_allocators:
321 case OMPC_append_args:
327 llvm_unreachable(
"Invalid OpenMP simple clause kind");
334 switch (llvm::omp::DefaultKind(
Type)) {
335#define OMP_DEFAULT_KIND(Enum, Name) \
338#include "llvm/Frontend/OpenMP/OMPKinds.def"
340 llvm_unreachable(
"Invalid OpenMP 'default' clause type");
343#define OMP_PROC_BIND_KIND(Enum, Name, Value) \
346#include "llvm/Frontend/OpenMP/OMPKinds.def"
348 llvm_unreachable(
"Invalid OpenMP 'proc_bind' clause type");
354#define OPENMP_SCHEDULE_KIND(Name) \
355 case OMPC_SCHEDULE_##Name: \
357#define OPENMP_SCHEDULE_MODIFIER(Name) \
358 case OMPC_SCHEDULE_MODIFIER_##Name: \
360#include "clang/Basic/OpenMPKinds.def"
362 llvm_unreachable(
"Invalid OpenMP 'schedule' clause type");
367#define OPENMP_DEPEND_KIND(Name) \
368 case OMPC_DEPEND_##Name: \
370#include "clang/Basic/OpenMPKinds.def"
372 llvm_unreachable(
"Invalid OpenMP 'depend' clause type");
377#define OPENMP_DOACROSS_MODIFIER(Name) \
378 case OMPC_DOACROSS_##Name: \
380#include "clang/Basic/OpenMPKinds.def"
382 llvm_unreachable(
"Invalid OpenMP 'doacross' clause type");
387#define OPENMP_LINEAR_KIND(Name) \
388 case OMPC_LINEAR_##Name: \
390#include "clang/Basic/OpenMPKinds.def"
392 llvm_unreachable(
"Invalid OpenMP 'linear' clause type");
398#define OPENMP_MAP_KIND(Name) \
399 case OMPC_MAP_##Name: \
401#define OPENMP_MAP_MODIFIER_KIND(Name) \
402 case OMPC_MAP_MODIFIER_##Name: \
404#include "clang/Basic/OpenMPKinds.def"
408 llvm_unreachable(
"Invalid OpenMP 'map' clause type");
414#define OPENMP_MOTION_MODIFIER_KIND(Name) \
415 case OMPC_MOTION_MODIFIER_##Name: \
417#include "clang/Basic/OpenMPKinds.def"
421 llvm_unreachable(
"Invalid OpenMP 'to' or 'from' clause type");
422 case OMPC_dist_schedule:
426#define OPENMP_DIST_SCHEDULE_KIND(Name) \
427 case OMPC_DIST_SCHEDULE_##Name: \
429#include "clang/Basic/OpenMPKinds.def"
431 llvm_unreachable(
"Invalid OpenMP 'dist_schedule' clause type");
432 case OMPC_defaultmap:
437#define OPENMP_DEFAULTMAP_KIND(Name) \
438 case OMPC_DEFAULTMAP_##Name: \
440#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
441 case OMPC_DEFAULTMAP_MODIFIER_##Name: \
443#include "clang/Basic/OpenMPKinds.def"
445 llvm_unreachable(
"Invalid OpenMP 'defaultmap' clause type");
446 case OMPC_atomic_default_mem_order:
450#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
451 case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name: \
453#include "clang/Basic/OpenMPKinds.def"
455 llvm_unreachable(
"Invalid OpenMP 'atomic_default_mem_order' clause type");
456 case OMPC_device_type:
460#define OPENMP_DEVICE_TYPE_KIND(Name) \
461 case OMPC_DEVICE_TYPE_##Name: \
463#include "clang/Basic/OpenMPKinds.def"
465 llvm_unreachable(
"Invalid OpenMP 'device_type' clause type");
470#define OPENMP_AT_KIND(Name) \
471 case OMPC_AT_##Name: \
473#include "clang/Basic/OpenMPKinds.def"
475 llvm_unreachable(
"Invalid OpenMP 'at' clause type");
480#define OPENMP_SEVERITY_KIND(Name) \
481 case OMPC_SEVERITY_##Name: \
483#include "clang/Basic/OpenMPKinds.def"
485 llvm_unreachable(
"Invalid OpenMP 'severity' clause type");
486 case OMPC_lastprivate:
490#define OPENMP_LASTPRIVATE_KIND(Name) \
491 case OMPC_LASTPRIVATE_##Name: \
493#include "clang/Basic/OpenMPKinds.def"
495 llvm_unreachable(
"Invalid OpenMP 'lastprivate' clause type");
501#define OPENMP_ORDER_KIND(Name) \
502 case OMPC_ORDER_##Name: \
504#define OPENMP_ORDER_MODIFIER(Name) \
505 case OMPC_ORDER_MODIFIER_##Name: \
507#include "clang/Basic/OpenMPKinds.def"
509 llvm_unreachable(
"Invalid OpenMP 'order' clause type");
514#define OPENMP_DEPEND_KIND(Name) \
515 case OMPC_DEPEND_##Name: \
517#include "clang/Basic/OpenMPKinds.def"
519 llvm_unreachable(
"Invalid OpenMP 'depend' clause type");
522 return getOpenMPClauseName(CK).data();
523 llvm_unreachable(
"Invalid OpenMP 'fail' clause modifier");
529#define OPENMP_DEVICE_MODIFIER(Name) \
530 case OMPC_DEVICE_##Name: \
532#include "clang/Basic/OpenMPKinds.def"
534 llvm_unreachable(
"Invalid OpenMP 'device' clause modifier");
539#define OPENMP_REDUCTION_MODIFIER(Name) \
540 case OMPC_REDUCTION_##Name: \
542#include "clang/Basic/OpenMPKinds.def"
544 llvm_unreachable(
"Invalid OpenMP 'reduction' clause modifier");
545 case OMPC_adjust_args:
549#define OPENMP_ADJUST_ARGS_KIND(Name) \
550 case OMPC_ADJUST_ARGS_##Name: \
552#include "clang/Basic/OpenMPKinds.def"
554 llvm_unreachable(
"Invalid OpenMP 'adjust_args' clause kind");
559#define OPENMP_BIND_KIND(Name) \
560 case OMPC_BIND_##Name: \
562#include "clang/Basic/OpenMPKinds.def"
564 llvm_unreachable(
"Invalid OpenMP 'bind' clause type");
569#define OPENMP_GRAINSIZE_MODIFIER(Name) \
570 case OMPC_GRAINSIZE_##Name: \
572#include "clang/Basic/OpenMPKinds.def"
574 llvm_unreachable(
"Invalid OpenMP 'grainsize' clause modifier");
575 case OMPC_dyn_groupprivate:
580#define OPENMP_DYN_GROUPPRIVATE_MODIFIER(Name) \
581 case OMPC_DYN_GROUPPRIVATE_##Name: \
583#define OPENMP_DYN_GROUPPRIVATE_FALLBACK_MODIFIER(Name) \
584 case OMPC_DYN_GROUPPRIVATE_FALLBACK_##Name: \
585 return "fallback(" #Name ")";
586#include "clang/Basic/OpenMPKinds.def"
588 llvm_unreachable(
"Invalid OpenMP 'dyn_groupprivate' clause modifier");
593#define OPENMP_NUMTASKS_MODIFIER(Name) \
594 case OMPC_NUMTASKS_##Name: \
596#include "clang/Basic/OpenMPKinds.def"
598 llvm_unreachable(
"Invalid OpenMP 'num_tasks' clause modifier");
603#define OPENMP_NUMTEAMS_MODIFIER(Name) \
604 case OMPC_NUMTEAMS_##Name: \
606#include "clang/Basic/OpenMPKinds.def"
608 llvm_unreachable(
"Invalid OpenMP 'num_teams' clause modifier");
613#define OPENMP_ALLOCATE_MODIFIER(Name) \
614 case OMPC_ALLOCATE_##Name: \
616#include "clang/Basic/OpenMPKinds.def"
618 llvm_unreachable(
"Invalid OpenMP 'allocate' clause modifier");
619 case OMPC_num_threads:
623#define OPENMP_NUMTHREADS_MODIFIER(Name) \
624 case OMPC_NUMTHREADS_##Name: \
626#include "clang/Basic/OpenMPKinds.def"
628 llvm_unreachable(
"Invalid OpenMP 'num_threads' clause modifier");
633#define OPENMP_THREADSET_KIND(Name) \
634 case OMPC_THREADSET_##Name: \
636#include "clang/Basic/OpenMPKinds.def"
638 llvm_unreachable(
"Invalid OpenMP 'threadset' clause modifier");
639 case OMPC_use_device_ptr:
643#define OPENMP_USE_DEVICE_PTR_FALLBACK_MODIFIER(Name) \
644 case OMPC_USE_DEVICE_PTR_FALLBACK_##Name: \
646#include "clang/Basic/OpenMPKinds.def"
648 llvm_unreachable(
"Invalid OpenMP 'use_device_ptr' clause modifier");
650 case OMPC_threadprivate:
651 case OMPC_groupprivate:
658 case OMPC_permutation:
662 case OMPC_firstprivate:
664 case OMPC_task_reduction:
665 case OMPC_in_reduction:
668 case OMPC_copyprivate:
686 case OMPC_thread_limit:
691 case OMPC_use_device_addr:
692 case OMPC_is_device_ptr:
693 case OMPC_has_device_addr:
694 case OMPC_unified_address:
695 case OMPC_unified_shared_memory:
696 case OMPC_reverse_offload:
697 case OMPC_dynamic_allocators:
700 case OMPC_nontemporal:
703 case OMPC_novariants:
707 case OMPC_uses_allocators:
710 case OMPC_append_args:
716 llvm_unreachable(
"Invalid OpenMP simple clause kind");
720 return getDirectiveAssociation(DKind) == Association::LoopNest;
724 return DKind == OMPD_for || DKind == OMPD_for_simd ||
725 DKind == OMPD_sections || DKind == OMPD_section ||
726 DKind == OMPD_single || DKind == OMPD_parallel_for ||
727 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
728 DKind == OMPD_target_parallel_for ||
729 DKind == OMPD_distribute_parallel_for ||
730 DKind == OMPD_distribute_parallel_for_simd ||
731 DKind == OMPD_target_parallel_for_simd ||
732 DKind == OMPD_teams_distribute_parallel_for_simd ||
733 DKind == OMPD_teams_distribute_parallel_for ||
734 DKind == OMPD_target_teams_distribute_parallel_for ||
735 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
736 DKind == OMPD_parallel_loop || DKind == OMPD_teams_loop ||
737 DKind == OMPD_target_parallel_loop || DKind == OMPD_target_teams_loop;
741 return DKind == OMPD_taskloop ||
742 llvm::is_contained(getLeafConstructs(DKind), OMPD_taskloop);
746 if (DKind == OMPD_teams_loop)
748 return DKind == OMPD_parallel ||
749 llvm::is_contained(getLeafConstructs(DKind), OMPD_parallel);
753 return DKind == OMPD_target ||
754 llvm::is_contained(getLeafConstructs(DKind), OMPD_target);
758 return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
759 DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
763 return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
768 if (DKind == OMPD_teams)
771 return !Leaves.empty() && Leaves.front() == OMPD_teams;
775 return DKind == OMPD_teams ||
776 llvm::is_contained(getLeafConstructs(DKind), OMPD_teams);
781 if (getDirectiveAssociation(DKind) != Association::LoopNest)
786 return DKind == OMPD_simd ||
787 llvm::is_contained(getLeafConstructs(DKind), OMPD_simd);
791 if (Kind == OMPD_distribute)
794 return !Leaves.empty() && Leaves.front() == OMPD_distribute;
798 return Kind == OMPD_distribute ||
799 llvm::is_contained(getLeafConstructs(Kind), OMPD_distribute);
803 if (Kind == OMPD_loop)
806 return !Leaves.empty() && Leaves.back() == OMPD_loop;
810 return Kind == OMPC_private || Kind == OMPC_firstprivate ||
811 Kind == OMPC_lastprivate || Kind == OMPC_linear ||
812 Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
813 Kind == OMPC_in_reduction;
817 return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
825 return Kind == OMPD_distribute_parallel_for ||
826 Kind == OMPD_distribute_parallel_for_simd ||
827 Kind == OMPD_teams_distribute_parallel_for_simd ||
828 Kind == OMPD_teams_distribute_parallel_for ||
829 Kind == OMPD_target_teams_distribute_parallel_for ||
830 Kind == OMPD_target_teams_distribute_parallel_for_simd ||
831 Kind == OMPD_teams_loop || Kind == OMPD_target_teams_loop;
836 return DKind == OMPD_tile || DKind == OMPD_unroll || DKind == OMPD_reverse ||
837 DKind == OMPD_split || DKind == OMPD_interchange ||
838 DKind == OMPD_stripe;
843 return DKind == OMPD_fuse;
852 return DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
853 DKind == OMPD_parallel_master ||
854 DKind == OMPD_parallel_master_taskloop ||
855 DKind == OMPD_parallel_master_taskloop_simd ||
856 DKind == OMPD_parallel_sections;
860 return DKind == OMPD_target || DKind == OMPD_target_parallel ||
861 DKind == OMPD_target_parallel_for ||
862 DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
863 DKind == OMPD_target_parallel_loop;
867 if (DKind == OMPD_error)
869 Category Cat = getDirectiveCategory(DKind);
870 return Cat == Category::Executable || Cat == Category::Subsidiary;
874 if (DKind == OMPD_error)
876 Category Cat = getDirectiveCategory(DKind);
877 return Cat == Category::Informational;
886 case OMPD_cancellation_point:
904 case OMPD_metadirective:
919 if (DKind == OMPD_loop || DKind == OMPD_parallel || DKind == OMPD_simd ||
923 if (LangOpts.OpenMP >= 60)
924 return DKind == OMPD_atomic ||
933 assert(
unsigned(DKind) < llvm::omp::Directive_enumSize);
937 assert(isLeafConstruct(LKind) &&
"Epecting leaf directive");
940 case OMPD_metadirective:
941 CaptureRegions.push_back(OMPD_metadirective);
944 CaptureRegions.push_back(OMPD_nothing);
947 CaptureRegions.push_back(OMPD_parallel);
950 CaptureRegions.push_back(OMPD_task);
951 CaptureRegions.push_back(OMPD_target);
954 case OMPD_target_enter_data:
955 case OMPD_target_exit_data:
956 case OMPD_target_update:
957 CaptureRegions.push_back(OMPD_task);
960 CaptureRegions.push_back(OMPD_teams);
963 CaptureRegions.push_back(OMPD_taskloop);
970 if (!CaptureRegions.empty() &&
971 !llvm::is_contained(CaptureRegions, OMPD_parallel))
972 CaptureRegions.push_back(OMPD_parallel);
977 case OMPD_distribute:
984 case OMPD_target_data:
997 llvm::errs() << getOpenMPDirectiveName(LKind, llvm::omp::FallbackVersion)
999 llvm_unreachable(
"Unexpected directive");
1004 bool MayNeedUnknownRegion =
false;
1006 MayNeedUnknownRegion |= GetRegionsForLeaf(L);
1011 if (CaptureRegions.empty() && MayNeedUnknownRegion)
1012 CaptureRegions.push_back(OMPD_unknown);
1016 assert((CaptureRegions[0] == OMPD_unknown ||
1017 !llvm::is_contained(CaptureRegions, OMPD_unknown)) &&
1018 "Misplaced OMPD_unknown");
1022 return FailClauseParameter == llvm::omp::OMPC_acquire ||
1023 FailClauseParameter == llvm::omp::OMPC_relaxed ||
1024 FailClauseParameter == llvm::omp::OMPC_seq_cst;
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines some OpenMP-specific enums and functions.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
The base class of the type hierarchy.
The JSON file list parser is used to communicate input to InstallAPI.
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind)
Checks if the specified target directive, combined or not, needs task based thread_limit.
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a teams directive in the outermost n...
bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter)
Checks if the parameter to the fail clause in "#pragma atomic compare fail" is restricted only to mem...
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target data offload directive.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
@ OMPC_DEFAULT_VC_unknown
bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a loop transformation directive.
@ OMPC_DEFAULTMAP_MODIFIER_last
@ OMPC_DEFAULTMAP_MODIFIER_unknown
@ OMPC_ORDER_MODIFIER_last
@ OMPC_ADJUST_ARGS_unknown
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
@ OMPC_DEVICE_TYPE_unknown
@ OMPC_SCHEDULE_MODIFIER_last
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a parallel-kind directive.
bool isOpenMPPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of private clauses like 'private', 'firstprivate',...
@ OMPC_DIST_SCHEDULE_unknown
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of tasking directives - task, taskloop,...
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target code offload directive.
@ OMPC_DYN_GROUPPRIVATE_FALLBACK_last
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a teams-kind directive.
bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive constitutes a 'loop' directive in the outermost nest.
@ OMPC_LASTPRIVATE_unknown
bool isOpenMPCanonicalLoopSequenceTransformationDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a loop transformation directive that applies to a canonical loop...
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str, const LangOptions &LangOpts)
bool isOpenMPCanonicalLoopNestTransformationDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a loop transformation directive that applies to a canonical loop...
bool isOpenMPTargetMapEnteringDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a map-entering target directive.
@ OMPC_USE_DEVICE_PTR_FALLBACK_unknown
bool isOpenMPOrderConcurrentNestableDirective(OpenMPDirectiveKind DKind, const LangOptions &LangOpts)
Checks if the specified directive is an order concurrent nestable directive that can be nested within...
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
bool isOpenMPCapturingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive can capture variables.
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
@ OMPC_MOTION_MODIFIER_unknown
@ OMPC_DEFAULTMAP_unknown
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of threadprivate clauses like 'threadprivate',...
bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is considered as "executable".
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
@ OMPC_DYN_GROUPPRIVATE_unknown
bool isOpenMPInformationalDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is considered as "informational".
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a simd directive.
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
@ OMPC_NUMTHREADS_unknown
@ OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
const char * getOpenMPDefaultVariableCategoryName(unsigned VC)
@ OMPC_MAP_MODIFIER_unknown
bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a combined construct for which the first construct is a parallel...
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a distribute directive in the outerm...
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
OpenMPDefaultClauseVariableCategory getOpenMPDefaultVariableCategory(StringRef Str, const LangOptions &LangOpts)