16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/ADT/StringSwitch.h"
18 #include "llvm/Support/ErrorHandling.h"
21 using namespace clang;
24 return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
26 #define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
27 #include "clang/Basic/OpenMPKinds.def"
36 #define OPENMP_DIRECTIVE(Name) \
39 #define OPENMP_DIRECTIVE_EXT(Name, Str) \
42 #include "clang/Basic/OpenMPKinds.def"
45 llvm_unreachable(
"Invalid OpenMP directive kind");
55 return llvm::StringSwitch<OpenMPClauseKind>(Str)
57 #include "clang/Basic/OpenMPKinds.def"
67 #define OPENMP_CLAUSE(Name, Class) \
70 #include "clang/Basic/OpenMPKinds.def"
74 return "threadprivate or thread local";
76 llvm_unreachable(
"Invalid OpenMP clause kind");
83 return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
85 #include "clang/Basic/OpenMPKinds.def"
88 return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
90 #include "clang/Basic/OpenMPKinds.def"
93 return llvm::StringSwitch<unsigned>(Str)
95 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
96 #define OPENMP_SCHEDULE_MODIFIER(Name) \
97 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
98 #include "clang/Basic/OpenMPKinds.def"
101 return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
103 #include "clang/Basic/OpenMPKinds.def"
106 return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
108 #include "clang/Basic/OpenMPKinds.def"
111 return llvm::StringSwitch<OpenMPMapClauseKind>(Str)
113 #include "clang/Basic/OpenMPKinds.def"
115 case OMPC_dist_schedule:
116 return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
118 #include "clang/Basic/OpenMPKinds.def"
120 case OMPC_defaultmap:
121 return llvm::StringSwitch<unsigned>(Str)
123 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
124 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
125 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
126 #include "clang/Basic/OpenMPKinds.def"
132 case OMPC_num_threads:
137 case OMPC_firstprivate:
138 case OMPC_lastprivate:
143 case OMPC_copyprivate:
158 case OMPC_thread_limit:
167 case OMPC_use_device_ptr:
168 case OMPC_is_device_ptr:
171 llvm_unreachable(
"Invalid OpenMP simple clause kind");
181 #define OPENMP_DEFAULT_KIND(Name) \
182 case OMPC_DEFAULT_##Name: \
184 #include "clang/Basic/OpenMPKinds.def"
186 llvm_unreachable(
"Invalid OpenMP 'default' clause type");
191 #define OPENMP_PROC_BIND_KIND(Name) \
192 case OMPC_PROC_BIND_##Name: \
194 #include "clang/Basic/OpenMPKinds.def"
196 llvm_unreachable(
"Invalid OpenMP 'proc_bind' clause type");
202 #define OPENMP_SCHEDULE_KIND(Name) \
203 case OMPC_SCHEDULE_##Name: \
205 #define OPENMP_SCHEDULE_MODIFIER(Name) \
206 case OMPC_SCHEDULE_MODIFIER_##Name: \
208 #include "clang/Basic/OpenMPKinds.def"
210 llvm_unreachable(
"Invalid OpenMP 'schedule' clause type");
215 #define OPENMP_DEPEND_KIND(Name) \
216 case OMPC_DEPEND_##Name: \
218 #include "clang/Basic/OpenMPKinds.def"
220 llvm_unreachable(
"Invalid OpenMP 'depend' clause type");
225 #define OPENMP_LINEAR_KIND(Name) \
226 case OMPC_LINEAR_##Name: \
228 #include "clang/Basic/OpenMPKinds.def"
230 llvm_unreachable(
"Invalid OpenMP 'linear' clause type");
235 #define OPENMP_MAP_KIND(Name) \
236 case OMPC_MAP_##Name: \
238 #include "clang/Basic/OpenMPKinds.def"
242 llvm_unreachable(
"Invalid OpenMP 'map' clause type");
243 case OMPC_dist_schedule:
247 #define OPENMP_DIST_SCHEDULE_KIND(Name) \
248 case OMPC_DIST_SCHEDULE_##Name: \
250 #include "clang/Basic/OpenMPKinds.def"
252 llvm_unreachable(
"Invalid OpenMP 'dist_schedule' clause type");
253 case OMPC_defaultmap:
258 #define OPENMP_DEFAULTMAP_KIND(Name) \
259 case OMPC_DEFAULTMAP_##Name: \
261 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
262 case OMPC_DEFAULTMAP_MODIFIER_##Name: \
264 #include "clang/Basic/OpenMPKinds.def"
266 llvm_unreachable(
"Invalid OpenMP 'schedule' clause type");
271 case OMPC_num_threads:
276 case OMPC_firstprivate:
277 case OMPC_lastprivate:
282 case OMPC_copyprivate:
297 case OMPC_thread_limit:
306 case OMPC_use_device_ptr:
307 case OMPC_is_device_ptr:
310 llvm_unreachable(
"Invalid OpenMP simple clause kind");
320 #define OPENMP_PARALLEL_CLAUSE(Name) \
323 #include "clang/Basic/OpenMPKinds.def"
330 #define OPENMP_SIMD_CLAUSE(Name) \
333 #include "clang/Basic/OpenMPKinds.def"
340 #define OPENMP_FOR_CLAUSE(Name) \
343 #include "clang/Basic/OpenMPKinds.def"
350 #define OPENMP_FOR_SIMD_CLAUSE(Name) \
353 #include "clang/Basic/OpenMPKinds.def"
360 #define OPENMP_SECTIONS_CLAUSE(Name) \
363 #include "clang/Basic/OpenMPKinds.def"
370 #define OPENMP_SINGLE_CLAUSE(Name) \
373 #include "clang/Basic/OpenMPKinds.def"
378 case OMPD_parallel_for:
380 #define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
383 #include "clang/Basic/OpenMPKinds.def"
388 case OMPD_parallel_for_simd:
390 #define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
393 #include "clang/Basic/OpenMPKinds.def"
398 case OMPD_parallel_sections:
400 #define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
403 #include "clang/Basic/OpenMPKinds.def"
410 #define OPENMP_TASK_CLAUSE(Name) \
413 #include "clang/Basic/OpenMPKinds.def"
419 return CKind == OMPC_flush;
423 #define OPENMP_ATOMIC_CLAUSE(Name) \
426 #include "clang/Basic/OpenMPKinds.def"
433 #define OPENMP_TARGET_CLAUSE(Name) \
436 #include "clang/Basic/OpenMPKinds.def"
441 case OMPD_target_data:
443 #define OPENMP_TARGET_DATA_CLAUSE(Name) \
446 #include "clang/Basic/OpenMPKinds.def"
451 case OMPD_target_enter_data:
453 #define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name) \
456 #include "clang/Basic/OpenMPKinds.def"
461 case OMPD_target_exit_data:
463 #define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name) \
466 #include "clang/Basic/OpenMPKinds.def"
471 case OMPD_target_parallel:
473 #define OPENMP_TARGET_PARALLEL_CLAUSE(Name) \
476 #include "clang/Basic/OpenMPKinds.def"
481 case OMPD_target_parallel_for:
483 #define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name) \
486 #include "clang/Basic/OpenMPKinds.def"
491 case OMPD_target_update:
493 #define OPENMP_TARGET_UPDATE_CLAUSE(Name) \
496 #include "clang/Basic/OpenMPKinds.def"
503 #define OPENMP_TEAMS_CLAUSE(Name) \
506 #include "clang/Basic/OpenMPKinds.def"
511 case OMPD_declare_simd:
515 #define OPENMP_CANCEL_CLAUSE(Name) \
518 #include "clang/Basic/OpenMPKinds.def"
525 #define OPENMP_ORDERED_CLAUSE(Name) \
528 #include "clang/Basic/OpenMPKinds.def"
535 #define OPENMP_TASKLOOP_CLAUSE(Name) \
538 #include "clang/Basic/OpenMPKinds.def"
543 case OMPD_taskloop_simd:
545 #define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \
548 #include "clang/Basic/OpenMPKinds.def"
555 #define OPENMP_CRITICAL_CLAUSE(Name) \
558 #include "clang/Basic/OpenMPKinds.def"
563 case OMPD_distribute:
565 #define OPENMP_DISTRIBUTE_CLAUSE(Name) \
568 #include "clang/Basic/OpenMPKinds.def"
573 case OMPD_distribute_parallel_for:
575 #define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
578 #include "clang/Basic/OpenMPKinds.def"
583 case OMPD_distribute_parallel_for_simd:
585 #define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
588 #include "clang/Basic/OpenMPKinds.def"
593 case OMPD_distribute_simd:
595 #define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name) \
598 #include "clang/Basic/OpenMPKinds.def"
603 case OMPD_target_parallel_for_simd:
605 #define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name) \
608 #include "clang/Basic/OpenMPKinds.def"
613 case OMPD_declare_target:
614 case OMPD_end_declare_target:
616 case OMPD_threadprivate:
623 case OMPD_cancellation_point:
624 case OMPD_declare_reduction:
631 return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
632 DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
633 DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
634 DKind == OMPD_distribute || DKind == OMPD_target_parallel_for ||
635 DKind == OMPD_distribute_parallel_for ||
636 DKind == OMPD_distribute_parallel_for_simd ||
637 DKind == OMPD_distribute_simd ||
638 DKind == OMPD_target_parallel_for_simd;
643 return DKind == OMPD_for || DKind == OMPD_for_simd ||
644 DKind == OMPD_sections || DKind == OMPD_section ||
645 DKind == OMPD_single || DKind == OMPD_parallel_for ||
646 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
647 DKind == OMPD_target_parallel_for ||
648 DKind == OMPD_distribute_parallel_for ||
649 DKind == OMPD_distribute_parallel_for_simd ||
650 DKind == OMPD_target_parallel_for_simd;
655 return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd;
659 return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
660 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
661 DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
662 DKind == OMPD_distribute_parallel_for ||
663 DKind == OMPD_distribute_parallel_for_simd ||
664 DKind == OMPD_target_parallel_for_simd;
670 return DKind == OMPD_target || DKind == OMPD_target_parallel ||
671 DKind == OMPD_target_parallel_for ||
672 DKind == OMPD_target_parallel_for_simd;
676 return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
677 DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
681 return DKind == OMPD_teams;
685 return DKind == OMPD_simd || DKind == OMPD_for_simd ||
686 DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
687 DKind == OMPD_distribute_parallel_for_simd ||
688 DKind == OMPD_distribute_simd;
693 return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
694 Kind == OMPD_distribute_parallel_for_simd ||
695 Kind == OMPD_distribute_simd;
700 return Kind == OMPC_private || Kind == OMPC_firstprivate ||
701 Kind == OMPC_lastprivate || Kind == OMPC_linear ||
702 Kind == OMPC_reduction;
714 return Kind == OMPD_distribute_parallel_for ||
715 Kind == OMPD_distribute_parallel_for_simd ||
716 Kind == OMPD_distribute_simd;
#define OPENMP_MAP_KIND(Name)
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target data offload directive.
The base class of the type hierarchy.
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind)
#define OPENMP_LINEAR_KIND(Name)
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of tasking directives - task, taskloop or taksloop simd...
Defines some OpenMP-specific enums and functions.
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a teams-kind directive.
OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str)
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target code offload directive.
#define OPENMP_DEFAULTMAP_KIND(Name)
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
#define OPENMP_CLAUSE(Name, Class)
#define OPENMP_PROC_BIND_KIND(Name)
bool isOpenMPPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of private clauses like 'private', 'firstprivate', 'reduction' etc.
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a parallel-kind directive.
#define OPENMP_DEPEND_KIND(Name)
OpenMPClauseKind
OpenMP clauses.
#define OPENMP_DIRECTIVE(Name)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
OpenMPDirectiveKind
OpenMP directives.
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a simd directive.
#define OPENMP_DEFAULT_KIND(Name)
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of threadprivate clauses like 'threadprivate', 'copyin' or 'copyprivate'.
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str)
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str)
const char * getOpenMPDirectiveName(OpenMPDirectiveKind Kind)
#define OPENMP_SCHEDULE_KIND(Name)
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
#define OPENMP_DIST_SCHEDULE_KIND(Name)