aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Basic/OpenMPKinds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Basic/OpenMPKinds.cpp')
-rw-r--r--lib/Basic/OpenMPKinds.cpp82
1 files changed, 78 insertions, 4 deletions
diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp
index 06f010f7ceb4..6e98d48c27d3 100644
--- a/lib/Basic/OpenMPKinds.cpp
+++ b/lib/Basic/OpenMPKinds.cpp
@@ -46,6 +46,10 @@ const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
}
OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
+ // 'flush' clause cannot be specified explicitly, because this is an implicit
+ // clause for 'flush' directive. If the 'flush' clause is explicitly specified
+ // the Parser should generate a warning about extra tokens at the end of the
+ // directive.
if (Str == "flush")
return OMPC_unknown;
return llvm::StringSwitch<OpenMPClauseKind>(Str)
@@ -108,6 +112,11 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
case OMPC_untied:
case OMPC_mergeable:
case OMPC_flush:
+ case OMPC_read:
+ case OMPC_write:
+ case OMPC_update:
+ case OMPC_capture:
+ case OMPC_seq_cst:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
@@ -167,6 +176,11 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
case OMPC_untied:
case OMPC_mergeable:
case OMPC_flush:
+ case OMPC_read:
+ case OMPC_write:
+ case OMPC_update:
+ case OMPC_capture:
+ case OMPC_seq_cst:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
@@ -207,6 +221,16 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
break;
}
break;
+ case OMPD_for_simd:
+ switch (CKind) {
+#define OPENMP_FOR_SIMD_CLAUSE(Name) \
+ case OMPC_##Name: \
+ return true;
+#include "clang/Basic/OpenMPKinds.def"
+ default:
+ break;
+ }
+ break;
case OMPD_sections:
switch (CKind) {
#define OPENMP_SECTIONS_CLAUSE(Name) \
@@ -237,6 +261,16 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
break;
}
break;
+ case OMPD_parallel_for_simd:
+ switch (CKind) {
+#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
+ case OMPC_##Name: \
+ return true;
+#include "clang/Basic/OpenMPKinds.def"
+ default:
+ break;
+ }
+ break;
case OMPD_parallel_sections:
switch (CKind) {
#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
@@ -260,6 +294,36 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
case OMPD_flush:
return CKind == OMPC_flush;
break;
+ case OMPD_atomic:
+ switch (CKind) {
+#define OPENMP_ATOMIC_CLAUSE(Name) \
+ case OMPC_##Name: \
+ return true;
+#include "clang/Basic/OpenMPKinds.def"
+ default:
+ break;
+ }
+ break;
+ case OMPD_target:
+ switch (CKind) {
+#define OPENMP_TARGET_CLAUSE(Name) \
+ case OMPC_##Name: \
+ return true;
+#include "clang/Basic/OpenMPKinds.def"
+ default:
+ break;
+ }
+ break;
+ case OMPD_teams:
+ switch (CKind) {
+#define OPENMP_TEAMS_CLAUSE(Name) \
+ case OMPC_##Name: \
+ return true;
+#include "clang/Basic/OpenMPKinds.def"
+ default:
+ break;
+ }
+ break;
case OMPD_unknown:
case OMPD_threadprivate:
case OMPD_section:
@@ -268,29 +332,39 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
case OMPD_taskyield:
case OMPD_barrier:
case OMPD_taskwait:
+ case OMPD_ordered:
break;
}
return false;
}
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
- return DKind == OMPD_simd || DKind == OMPD_for ||
- DKind == OMPD_parallel_for; // TODO add next directives.
+ return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
+ DKind == OMPD_parallel_for ||
+ DKind == OMPD_parallel_for_simd; // TODO add next directives.
}
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
- return DKind == OMPD_for || DKind == OMPD_sections || DKind == OMPD_section ||
+ return DKind == OMPD_for || DKind == OMPD_for_simd ||
+ DKind == OMPD_sections || DKind == OMPD_section ||
DKind == OMPD_single || DKind == OMPD_parallel_for ||
+ DKind == OMPD_parallel_for_simd ||
DKind == OMPD_parallel_sections; // TODO add next directives.
}
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
+ DKind == OMPD_parallel_for_simd ||
DKind == OMPD_parallel_sections; // TODO add next directives.
}
+bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
+ return DKind == OMPD_teams; // TODO add next directives.
+}
+
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
- return DKind == OMPD_simd; // TODO || DKind == OMPD_for_simd || ...
+ return DKind == OMPD_simd || DKind == OMPD_for_simd ||
+ DKind == OMPD_parallel_for_simd; // TODO add next directives.
}
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {