[llvm] 5c37b2a - Revert "[flang][openmp] Use common Directive and Clause enum from llvm/Frontend"
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 15:49:32 PDT 2020
Author: clementval
Date: 2020-07-01T18:49:07-04:00
New Revision: 5c37b2a5eee49df2545a6455eec64fb4b105df40
URL: https://github.com/llvm/llvm-project/commit/5c37b2a5eee49df2545a6455eec64fb4b105df40
DIFF: https://github.com/llvm/llvm-project/commit/5c37b2a5eee49df2545a6455eec64fb4b105df40.diff
LOG: Revert "[flang][openmp] Use common Directive and Clause enum from llvm/Frontend"
This reverts commit 7f1e7767952233d1b6af1feef1371d127de5fa50.
Added:
Modified:
flang/include/flang/Common/enum-set.h
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Evaluate/CMakeLists.txt
flang/lib/Parser/CMakeLists.txt
flang/lib/Parser/openmp-parsers.cpp
flang/lib/Parser/unparse.cpp
flang/lib/Semantics/CMakeLists.txt
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/check-omp-structure.h
flang/lib/Semantics/resolve-names.cpp
flang/tools/f18-parse-demo/CMakeLists.txt
llvm/include/llvm/Frontend/OpenMP/OMP.td
Removed:
################################################################################
diff --git a/flang/include/flang/Common/enum-set.h b/flang/include/flang/Common/enum-set.h
index 4d2bc1e7433c..5346cceaadfa 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/flang/include/flang/Common/enum-set.h
@@ -190,7 +190,7 @@ template <typename ENUM, std::size_t BITS> class EnumSet {
// std::bitset: just iterate
for (std::size_t j{0}; j < BITS; ++j) {
auto enumerator{static_cast<enumerationType>(j)};
- if (bitset_.test(j)) {
+ if (bitset_.test(enumerator)) {
return {enumerator};
}
}
diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index 80a1411db5dd..ad93fcd25795 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -409,11 +409,7 @@ class ParseTreeDumper {
NODE(parser, OmpBeginLoopDirective)
NODE(parser, OmpBeginSectionsDirective)
NODE(parser, OmpBlockDirective)
- static std::string GetNodeName(const llvm::omp::Directive &x) {
- return llvm::Twine(
- "llvm::omp::Directive = ", llvm::omp::getOpenMPDirectiveName(x))
- .str();
- }
+ NODE_ENUM(OmpBlockDirective, Directive)
NODE(parser, OmpCancelType)
NODE_ENUM(OmpCancelType, Type)
NODE(parser, OmpClause)
@@ -481,6 +477,7 @@ class ParseTreeDumper {
NODE(parser, OmpLinearModifier)
NODE_ENUM(OmpLinearModifier, Type)
NODE(parser, OmpLoopDirective)
+ NODE_ENUM(OmpLoopDirective, Directive)
NODE(parser, OmpMapClause)
NODE(parser, OmpMapType)
NODE(OmpMapType, Always)
@@ -508,7 +505,9 @@ class ParseTreeDumper {
NODE_ENUM(OmpScheduleModifierType, ModType)
NODE(parser, OmpSectionBlocks)
NODE(parser, OmpSectionsDirective)
+ NODE_ENUM(OmpSectionsDirective, Directive)
NODE(parser, OmpSimpleStandaloneDirective)
+ NODE_ENUM(OmpSimpleStandaloneDirective, Directive)
NODE(parser, Only)
NODE(parser, OpenMPAtomicConstruct)
NODE(parser, OpenMPBlockConstruct)
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 1ca3b4967240..933638d039d3 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -25,7 +25,6 @@
#include "flang/Common/Fortran.h"
#include "flang/Common/idioms.h"
#include "flang/Common/indirection.h"
-#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include <cinttypes>
#include <list>
#include <memory>
@@ -3496,7 +3495,8 @@ struct OmpClauseList {
// 2.7.2 SECTIONS
// 2.11.2 PARALLEL SECTIONS
struct OmpSectionsDirective {
- WRAPPER_CLASS_BOILERPLATE(OmpSectionsDirective, llvm::omp::Directive);
+ ENUM_CLASS(Directive, Sections, ParallelSections);
+ WRAPPER_CLASS_BOILERPLATE(OmpSectionsDirective, Directive);
CharBlock source;
};
@@ -3527,7 +3527,10 @@ struct OpenMPSectionsConstruct {
// OpenMP directive beginning or ending a block
struct OmpBlockDirective {
- WRAPPER_CLASS_BOILERPLATE(OmpBlockDirective, llvm::omp::Directive);
+ ENUM_CLASS(Directive, Master, Ordered, Parallel, ParallelWorkshare, Single,
+ Target, TargetData, TargetParallel, TargetTeams, Task, Taskgroup, Teams,
+ Workshare);
+ WRAPPER_CLASS_BOILERPLATE(OmpBlockDirective, Directive);
CharBlock source;
};
@@ -3681,7 +3684,15 @@ struct OpenMPAtomicConstruct {
// OpenMP directives that associate with loop(s)
struct OmpLoopDirective {
- WRAPPER_CLASS_BOILERPLATE(OmpLoopDirective, llvm::omp::Directive);
+ ENUM_CLASS(Directive, Distribute, DistributeParallelDo,
+ DistributeParallelDoSimd, DistributeSimd, ParallelDo, ParallelDoSimd, Do,
+ DoSimd, Simd, TargetParallelDo, TargetParallelDoSimd,
+ TargetTeamsDistribute, TargetTeamsDistributeParallelDo,
+ TargetTeamsDistributeParallelDoSimd, TargetTeamsDistributeSimd,
+ TargetSimd, Taskloop, TaskloopSimd, TeamsDistribute,
+ TeamsDistributeParallelDo, TeamsDistributeParallelDoSimd,
+ TeamsDistributeSimd)
+ WRAPPER_CLASS_BOILERPLATE(OmpLoopDirective, Directive);
CharBlock source;
};
@@ -3715,7 +3726,9 @@ struct OpenMPFlushConstruct {
};
struct OmpSimpleStandaloneDirective {
- WRAPPER_CLASS_BOILERPLATE(OmpSimpleStandaloneDirective, llvm::omp::Directive);
+ ENUM_CLASS(Directive, Barrier, Taskwait, Taskyield, TargetEnterData,
+ TargetExitData, TargetUpdate, Ordered)
+ WRAPPER_CLASS_BOILERPLATE(OmpSimpleStandaloneDirective, Directive);
CharBlock source;
};
diff --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt
index e94f07adf814..ddcdc8018658 100644
--- a/flang/lib/Evaluate/CMakeLists.txt
+++ b/flang/lib/Evaluate/CMakeLists.txt
@@ -33,9 +33,6 @@ add_flang_library(FortranEvaluate
FortranDecimal
FortranSemantics
FortranParser
-
- DEPENDS
- omp_gen
)
if (LIBPGMATH_DIR)
diff --git a/flang/lib/Parser/CMakeLists.txt b/flang/lib/Parser/CMakeLists.txt
index eb5126e1b937..cc691de35b48 100644
--- a/flang/lib/Parser/CMakeLists.txt
+++ b/flang/lib/Parser/CMakeLists.txt
@@ -29,7 +29,4 @@ add_flang_library(FortranParser
LINK_COMPONENTS
Support
-
- DEPENDS
- omp_gen
)
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index b845d6573c65..2d81f5a8197b 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -240,38 +240,45 @@ TYPE_PARSER(construct<OmpObjectList>(nonemptyList(Parser<OmpObject>{})))
// Omp directives enclosing do loop
TYPE_PARSER(sourced(construct<OmpLoopDirective>(first(
"DISTRIBUTE PARALLEL DO SIMD" >>
- pure(llvm::omp::Directive::OMPD_distribute_parallel_do_simd),
+ pure(OmpLoopDirective::Directive::DistributeParallelDoSimd),
"DISTRIBUTE PARALLEL DO" >>
- pure(llvm::omp::Directive::OMPD_distribute_parallel_do),
- "DISTRIBUTE SIMD" >> pure(llvm::omp::Directive::OMPD_distribute_simd),
- "DISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_distribute),
- "DO SIMD" >> pure(llvm::omp::Directive::OMPD_do_simd),
- "DO" >> pure(llvm::omp::Directive::OMPD_do),
- "PARALLEL DO SIMD" >> pure(llvm::omp::Directive::OMPD_parallel_do_simd),
- "PARALLEL DO" >> pure(llvm::omp::Directive::OMPD_parallel_do),
- "SIMD" >> pure(llvm::omp::Directive::OMPD_simd),
+ pure(OmpLoopDirective::Directive::DistributeParallelDo),
+
+ "DISTRIBUTE SIMD" >> pure(OmpLoopDirective::Directive::DistributeSimd),
+
+ "DISTRIBUTE" >> pure(OmpLoopDirective::Directive::Distribute),
+
+ "DO SIMD" >> pure(OmpLoopDirective::Directive::DoSimd),
+ "DO" >> pure(OmpLoopDirective::Directive::Do),
+ "PARALLEL DO SIMD" >> pure(OmpLoopDirective::Directive::ParallelDoSimd),
+
+ "PARALLEL DO" >> pure(OmpLoopDirective::Directive::ParallelDo),
+
+ "SIMD" >> pure(OmpLoopDirective::Directive::Simd),
"TARGET PARALLEL DO SIMD" >>
- pure(llvm::omp::Directive::OMPD_target_parallel_do_simd),
- "TARGET PARALLEL DO" >> pure(llvm::omp::Directive::OMPD_target_parallel_do),
- "TARGET SIMD" >> pure(llvm::omp::Directive::OMPD_target_simd),
+ pure(OmpLoopDirective::Directive::TargetParallelDoSimd),
+ "TARGET PARALLEL DO" >> pure(OmpLoopDirective::Directive::TargetParallelDo),
+
+ "TARGET SIMD" >> pure(OmpLoopDirective::Directive::TargetSimd),
"TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
- pure(llvm::omp::Directive::
- OMPD_target_teams_distribute_parallel_do_simd),
+ pure(OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd),
"TARGET TEAMS DISTRIBUTE PARALLEL DO" >>
- pure(llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do),
+ pure(OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo),
"TARGET TEAMS DISTRIBUTE SIMD" >>
- pure(llvm::omp::Directive::OMPD_target_teams_distribute_simd),
+ pure(OmpLoopDirective::Directive::TargetTeamsDistributeSimd),
"TARGET TEAMS DISTRIBUTE" >>
- pure(llvm::omp::Directive::OMPD_target_teams_distribute),
- "TASKLOOP SIMD" >> pure(llvm::omp::Directive::OMPD_taskloop_simd),
- "TASKLOOP" >> pure(llvm::omp::Directive::OMPD_taskloop),
+ pure(OmpLoopDirective::Directive::TargetTeamsDistribute),
+
+ "TASKLOOP SIMD" >> pure(OmpLoopDirective::Directive::TaskloopSimd),
+
+ "TASKLOOP" >> pure(OmpLoopDirective::Directive::Taskloop),
"TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
- pure(llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd),
+ pure(OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd),
"TEAMS DISTRIBUTE PARALLEL DO" >>
- pure(llvm::omp::Directive::OMPD_teams_distribute_parallel_do),
+ pure(OmpLoopDirective::Directive::TeamsDistributeParallelDo),
"TEAMS DISTRIBUTE SIMD" >>
- pure(llvm::omp::Directive::OMPD_teams_distribute_simd),
- "TEAMS DISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_teams_distribute)))))
+ pure(OmpLoopDirective::Directive::TeamsDistributeSimd),
+ "TEAMS DISTRIBUTE" >> pure(OmpLoopDirective::Directive::TeamsDistribute)))))
TYPE_PARSER(sourced(construct<OmpBeginLoopDirective>(
sourced(Parser<OmpLoopDirective>{}), Parser<OmpClauseList>{})))
@@ -297,13 +304,16 @@ TYPE_PARSER(sourced(construct<OpenMPFlushConstruct>(
// Simple Standalone Directives
TYPE_PARSER(sourced(construct<OmpSimpleStandaloneDirective>(first(
- "BARRIER" >> pure(llvm::omp::Directive::OMPD_barrier),
- "ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
- "TARGET ENTER DATA" >> pure(llvm::omp::Directive::OMPD_target_enter_data),
- "TARGET EXIT DATA" >> pure(llvm::omp::Directive::OMPD_target_exit_data),
- "TARGET UPDATE" >> pure(llvm::omp::Directive::OMPD_target_update),
- "TASKWAIT" >> pure(llvm::omp::Directive::OMPD_taskwait),
- "TASKYIELD" >> pure(llvm::omp::Directive::OMPD_taskyield)))))
+ "BARRIER" >> pure(OmpSimpleStandaloneDirective::Directive::Barrier),
+ "ORDERED" >> pure(OmpSimpleStandaloneDirective::Directive::Ordered),
+ "TARGET ENTER DATA" >>
+ pure(OmpSimpleStandaloneDirective::Directive::TargetEnterData),
+ "TARGET EXIT DATA" >>
+ pure(OmpSimpleStandaloneDirective::Directive::TargetExitData),
+ "TARGET UPDATE" >>
+ pure(OmpSimpleStandaloneDirective::Directive::TargetUpdate),
+ "TASKWAIT" >> pure(OmpSimpleStandaloneDirective::Directive::Taskwait),
+ "TASKYIELD" >> pure(OmpSimpleStandaloneDirective::Directive::Taskyield)))))
TYPE_PARSER(sourced(construct<OpenMPSimpleStandaloneConstruct>(
Parser<OmpSimpleStandaloneDirective>{}, Parser<OmpClauseList>{})))
@@ -319,20 +329,21 @@ TYPE_PARSER(
endOfLine)
// Directives enclosing structured-block
-TYPE_PARSER(construct<OmpBlockDirective>(first(
- "MASTER" >> pure(llvm::omp::Directive::OMPD_master),
- "ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
- "PARALLEL WORKSHARE" >> pure(llvm::omp::Directive::OMPD_parallel_workshare),
- "PARALLEL" >> pure(llvm::omp::Directive::OMPD_parallel),
- "SINGLE" >> pure(llvm::omp::Directive::OMPD_single),
- "TARGET DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
- "TARGET PARALLEL" >> pure(llvm::omp::Directive::OMPD_target_parallel),
- "TARGET TEAMS" >> pure(llvm::omp::Directive::OMPD_target_teams),
- "TARGET" >> pure(llvm::omp::Directive::OMPD_target),
- "TASK"_id >> pure(llvm::omp::Directive::OMPD_task),
- "TASKGROUP" >> pure(llvm::omp::Directive::OMPD_taskgroup),
- "TEAMS" >> pure(llvm::omp::Directive::OMPD_teams),
- "WORKSHARE" >> pure(llvm::omp::Directive::OMPD_workshare))))
+TYPE_PARSER(construct<OmpBlockDirective>(
+ first("MASTER" >> pure(OmpBlockDirective::Directive::Master),
+ "ORDERED" >> pure(OmpBlockDirective::Directive::Ordered),
+ "PARALLEL WORKSHARE" >>
+ pure(OmpBlockDirective::Directive::ParallelWorkshare),
+ "PARALLEL" >> pure(OmpBlockDirective::Directive::Parallel),
+ "SINGLE" >> pure(OmpBlockDirective::Directive::Single),
+ "TARGET DATA" >> pure(OmpBlockDirective::Directive::TargetData),
+ "TARGET PARALLEL" >> pure(OmpBlockDirective::Directive::TargetParallel),
+ "TARGET TEAMS" >> pure(OmpBlockDirective::Directive::TargetTeams),
+ "TARGET" >> pure(OmpBlockDirective::Directive::Target),
+ "TASK"_id >> pure(OmpBlockDirective::Directive::Task),
+ "TASKGROUP" >> pure(OmpBlockDirective::Directive::Taskgroup),
+ "TEAMS" >> pure(OmpBlockDirective::Directive::Teams),
+ "WORKSHARE" >> pure(OmpBlockDirective::Directive::Workshare))))
TYPE_PARSER(sourced(construct<OmpBeginBlockDirective>(
sourced(Parser<OmpBlockDirective>{}), Parser<OmpClauseList>{})))
@@ -465,9 +476,10 @@ TYPE_PARSER(construct<OpenMPBlockConstruct>(
Parser<OmpEndBlockDirective>{} / endOmpLine))
// OMP SECTIONS Directive
-TYPE_PARSER(construct<OmpSectionsDirective>(first(
- "SECTIONS" >> pure(llvm::omp::Directive::OMPD_sections),
- "PARALLEL SECTIONS" >> pure(llvm::omp::Directive::OMPD_parallel_sections))))
+TYPE_PARSER(construct<OmpSectionsDirective>(
+ first("SECTIONS" >> pure(OmpSectionsDirective::Directive::Sections),
+ "PARALLEL SECTIONS" >>
+ pure(OmpSectionsDirective::Directive::ParallelSections))))
// OMP BEGIN and END SECTIONS Directive
TYPE_PARSER(sourced(construct<OmpBeginSectionsDirective>(
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 19c5ba6d589a..c2b5c28767da 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -2017,149 +2017,141 @@ class UnparseVisitor {
}
void Unparse(const OmpLoopDirective &x) {
switch (x.v) {
- case llvm::omp::Directive::OMPD_distribute:
+ case OmpLoopDirective::Directive::Distribute:
Word("DISTRIBUTE ");
break;
- case llvm::omp::Directive::OMPD_distribute_parallel_do:
+ case OmpLoopDirective::Directive::DistributeParallelDo:
Word("DISTRIBUTE PARALLEL DO ");
break;
- case llvm::omp::Directive::OMPD_distribute_parallel_do_simd:
+ case OmpLoopDirective::Directive::DistributeParallelDoSimd:
Word("DISTRIBUTE PARALLEL DO SIMD ");
break;
- case llvm::omp::Directive::OMPD_distribute_simd:
+ case OmpLoopDirective::Directive::DistributeSimd:
Word("DISTRIBUTE SIMD ");
break;
- case llvm::omp::Directive::OMPD_do:
+ case OmpLoopDirective::Directive::Do:
Word("DO ");
break;
- case llvm::omp::Directive::OMPD_do_simd:
- Word("DO SIMD ");
+ case OmpLoopDirective::Directive::DoSimd:
+ Word("Do SIMD ");
break;
- case llvm::omp::Directive::OMPD_parallel_do:
+ case OmpLoopDirective::Directive::ParallelDo:
Word("PARALLEL DO ");
break;
- case llvm::omp::Directive::OMPD_parallel_do_simd:
+ case OmpLoopDirective::Directive::ParallelDoSimd:
Word("PARALLEL DO SIMD ");
break;
- case llvm::omp::Directive::OMPD_simd:
+ case OmpLoopDirective::Directive::Simd:
Word("SIMD ");
break;
- case llvm::omp::Directive::OMPD_target_parallel_do:
+ case OmpLoopDirective::Directive::TargetParallelDo:
Word("TARGET PARALLEL DO ");
break;
- case llvm::omp::Directive::OMPD_target_parallel_do_simd:
+ case OmpLoopDirective::Directive::TargetParallelDoSimd:
Word("TARGET PARALLEL DO SIMD ");
break;
- case llvm::omp::Directive::OMPD_target_teams_distribute:
+ case OmpLoopDirective::Directive::TargetTeamsDistribute:
Word("TARGET TEAMS DISTRIBUTE ");
break;
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
+ case OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo:
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO ");
break;
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd:
+ case OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd:
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD ");
break;
- case llvm::omp::Directive::OMPD_target_teams_distribute_simd:
+ case OmpLoopDirective::Directive::TargetTeamsDistributeSimd:
Word("TARGET TEAMS DISTRIBUTE SIMD ");
break;
- case llvm::omp::Directive::OMPD_target_simd:
+ case OmpLoopDirective::Directive::TargetSimd:
Word("TARGET SIMD ");
break;
- case llvm::omp::Directive::OMPD_taskloop:
+ case OmpLoopDirective::Directive::Taskloop:
Word("TASKLOOP ");
break;
- case llvm::omp::Directive::OMPD_taskloop_simd:
+ case OmpLoopDirective::Directive::TaskloopSimd:
Word("TASKLOOP SIMD ");
break;
- case llvm::omp::Directive::OMPD_teams_distribute:
+ case OmpLoopDirective::Directive::TeamsDistribute:
Word("TEAMS DISTRIBUTE ");
break;
- case llvm::omp::Directive::OMPD_teams_distribute_parallel_do:
+ case OmpLoopDirective::Directive::TeamsDistributeParallelDo:
Word("TEAMS DISTRIBUTE PARALLEL DO ");
break;
- case llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd:
+ case OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd:
Word("TEAMS DISTRIBUTE PARALLEL DO SIMD ");
break;
- case llvm::omp::Directive::OMPD_teams_distribute_simd:
+ case OmpLoopDirective::Directive::TeamsDistributeSimd:
Word("TEAMS DISTRIBUTE SIMD ");
break;
- default:
- break;
}
}
void Unparse(const OmpObjectList &x) { Walk(x.v, ","); }
void Unparse(const OmpSimpleStandaloneDirective &x) {
switch (x.v) {
- case llvm::omp::Directive::OMPD_barrier:
+ case OmpSimpleStandaloneDirective::Directive::Barrier:
Word("BARRIER ");
break;
- case llvm::omp::Directive::OMPD_taskwait:
+ case OmpSimpleStandaloneDirective::Directive::Taskwait:
Word("TASKWAIT ");
break;
- case llvm::omp::Directive::OMPD_taskyield:
+ case OmpSimpleStandaloneDirective::Directive::Taskyield:
Word("TASKYIELD ");
break;
- case llvm::omp::Directive::OMPD_target_enter_data:
+ case OmpSimpleStandaloneDirective::Directive::TargetEnterData:
Word("TARGET ENTER DATA ");
break;
- case llvm::omp::Directive::OMPD_target_exit_data:
+ case OmpSimpleStandaloneDirective::Directive::TargetExitData:
Word("TARGET EXIT DATA ");
break;
- case llvm::omp::Directive::OMPD_target_update:
+ case OmpSimpleStandaloneDirective::Directive::TargetUpdate:
Word("TARGET UPDATE ");
break;
- case llvm::omp::Directive::OMPD_ordered:
+ case OmpSimpleStandaloneDirective::Directive::Ordered:
Word("ORDERED ");
break;
- default:
- // Nothing to be done
- break;
}
}
void Unparse(const OmpBlockDirective &x) {
switch (x.v) {
- case llvm::omp::Directive::OMPD_master:
+ case OmpBlockDirective::Directive::Master:
Word("MASTER");
break;
- case llvm::omp::Directive::OMPD_ordered:
+ case OmpBlockDirective::Directive::Ordered:
Word("ORDERED ");
break;
- case llvm::omp::Directive::OMPD_parallel_workshare:
+ case OmpBlockDirective::Directive::ParallelWorkshare:
Word("PARALLEL WORKSHARE ");
break;
- case llvm::omp::Directive::OMPD_parallel:
+ case OmpBlockDirective::Directive::Parallel:
Word("PARALLEL ");
break;
- case llvm::omp::Directive::OMPD_single:
+ case OmpBlockDirective::Directive::Single:
Word("SINGLE ");
break;
- case llvm::omp::Directive::OMPD_target_data:
+ case OmpBlockDirective::Directive::TargetData:
Word("TARGET DATA ");
break;
- case llvm::omp::Directive::OMPD_target_parallel:
+ case OmpBlockDirective::Directive::TargetParallel:
Word("TARGET PARALLEL ");
break;
- case llvm::omp::Directive::OMPD_target_teams:
+ case OmpBlockDirective::Directive::TargetTeams:
Word("TARGET TEAMS ");
break;
- case llvm::omp::Directive::OMPD_target:
+ case OmpBlockDirective::Directive::Target:
Word("TARGET ");
break;
- case llvm::omp::Directive::OMPD_taskgroup:
+ case OmpBlockDirective::Directive::Taskgroup:
Word("TASKGROUP ");
break;
- case llvm::omp::Directive::OMPD_task:
+ case OmpBlockDirective::Directive::Task:
Word("TASK ");
break;
- case llvm::omp::Directive::OMPD_teams:
+ case OmpBlockDirective::Directive::Teams:
Word("TEAMS ");
break;
- case llvm::omp::Directive::OMPD_workshare:
+ case OmpBlockDirective::Directive::Workshare:
Word("WORKSHARE ");
break;
- default:
- // Nothing to be done
- break;
}
}
void Unparse(const OmpMemoryClause &x) {
@@ -2322,14 +2314,12 @@ class UnparseVisitor {
}
void Unparse(const OmpSectionsDirective &x) {
switch (x.v) {
- case llvm::omp::Directive::OMPD_sections:
+ case OmpSectionsDirective::Directive::Sections:
Word("SECTIONS ");
break;
- case llvm::omp::Directive::OMPD_parallel_sections:
+ case OmpSectionsDirective::Directive::ParallelSections:
Word("PARALLEL SECTIONS ");
break;
- default:
- break;
}
}
void Unparse(const OmpSectionBlocks &x) {
diff --git a/flang/lib/Semantics/CMakeLists.txt b/flang/lib/Semantics/CMakeLists.txt
index b0e40bd3251d..4fd75bc60f00 100644
--- a/flang/lib/Semantics/CMakeLists.txt
+++ b/flang/lib/Semantics/CMakeLists.txt
@@ -39,14 +39,10 @@ add_flang_library(FortranSemantics
type.cpp
unparse-with-symbols.cpp
- DEPENDS
- omp_gen
-
LINK_LIBS
FortranCommon
FortranEvaluate
LINK_COMPONENTS
Support
- FrontendOpenMP
)
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index b4e86faffe19..77312733cd2e 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -13,62 +13,55 @@
namespace Fortran::semantics {
-static OmpClauseSet doAllowedClauses{llvm::omp::Clause::OMPC_private,
- llvm::omp::Clause::OMPC_firstprivate, llvm::omp::Clause::OMPC_lastprivate,
- llvm::omp::Clause::OMPC_linear, llvm::omp::Clause::OMPC_reduction};
-static OmpClauseSet doAllowedOnceClauses{llvm::omp::Clause::OMPC_schedule,
- llvm::omp::Clause::OMPC_collapse, llvm::omp::Clause::OMPC_ordered};
-
-static OmpClauseSet simdAllowedClauses{llvm::omp::Clause::OMPC_linear,
- llvm::omp::Clause::OMPC_aligned, llvm::omp::Clause::OMPC_private,
- llvm::omp::Clause::OMPC_lastprivate, llvm::omp::Clause::OMPC_reduction};
-static OmpClauseSet simdAllowedOnceClauses{llvm::omp::Clause::OMPC_collapse,
- llvm::omp::Clause::OMPC_safelen, llvm::omp::Clause::OMPC_simdlen};
-
-static OmpClauseSet parallelAllowedClauses{llvm::omp::Clause::OMPC_default,
- llvm::omp::Clause::OMPC_private, llvm::omp::Clause::OMPC_firstprivate,
- llvm::omp::Clause::OMPC_shared, llvm::omp::Clause::OMPC_copyin,
- llvm::omp::Clause::OMPC_reduction};
-static OmpClauseSet parallelAllowedOnceClauses{llvm::omp::Clause::OMPC_if,
- llvm::omp::Clause::OMPC_num_threads, llvm::omp::Clause::OMPC_proc_bind};
-
-static OmpClauseSet taskloopAllowedClauses{llvm::omp::Clause::OMPC_shared,
- llvm::omp::Clause::OMPC_private, llvm::omp::Clause::OMPC_firstprivate,
- llvm::omp::Clause::OMPC_lastprivate, llvm::omp::Clause::OMPC_default,
- llvm::omp::Clause::OMPC_untied, llvm::omp::Clause::OMPC_mergeable,
- llvm::omp::Clause::OMPC_nogroup};
-static OmpClauseSet taskloopAllowedOnceClauses{llvm::omp::Clause::OMPC_collapse,
- llvm::omp::Clause::OMPC_if, llvm::omp::Clause::OMPC_final,
- llvm::omp::Clause::OMPC_priority};
-static OmpClauseSet taskloopAllowedExclusiveClauses{
- llvm::omp::Clause::OMPC_grainsize, llvm::omp::Clause::OMPC_num_tasks};
-
-static OmpClauseSet distributeAllowedClauses{llvm::omp::Clause::OMPC_private,
- llvm::omp::Clause::OMPC_firstprivate, llvm::omp::Clause::OMPC_lastprivate};
-static OmpClauseSet distributeAllowedOnceClauses{
- llvm::omp::Clause::OMPC_collapse, llvm::omp::Clause::OMPC_dist_schedule};
-
-static OmpClauseSet targetAllowedClauses{llvm::omp::Clause::OMPC_if,
- llvm::omp::Clause::OMPC_private, llvm::omp::Clause::OMPC_firstprivate,
- llvm::omp::Clause::OMPC_map, llvm::omp::Clause::OMPC_is_device_ptr,
- llvm::omp::Clause::OMPC_depend};
-static OmpClauseSet targetAllowedOnceClauses{llvm::omp::Clause::OMPC_device,
- llvm::omp::Clause::OMPC_defaultmap, llvm::omp::Clause::OMPC_nowait};
-
-static OmpClauseSet teamsAllowedClauses{llvm::omp::Clause::OMPC_private,
- llvm::omp::Clause::OMPC_firstprivate, llvm::omp::Clause::OMPC_shared,
- llvm::omp::Clause::OMPC_reduction};
-static OmpClauseSet teamsAllowedOnceClauses{llvm::omp::Clause::OMPC_num_teams,
- llvm::omp::Clause::OMPC_thread_limit, llvm::omp::Clause::OMPC_default};
-
-static OmpClauseSet sectionsAllowedClauses{llvm::omp::Clause::OMPC_private,
- llvm::omp::Clause::OMPC_firstprivate, llvm::omp::Clause::OMPC_lastprivate,
- llvm::omp::Clause::OMPC_reduction};
+static constexpr inline OmpClauseSet doAllowedClauses{OmpClause::PRIVATE,
+ OmpClause::FIRSTPRIVATE, OmpClause::LASTPRIVATE, OmpClause::LINEAR,
+ OmpClause::REDUCTION};
+static constexpr inline OmpClauseSet doAllowedOnceClauses{
+ OmpClause::SCHEDULE, OmpClause::COLLAPSE, OmpClause::ORDERED};
+
+static constexpr inline OmpClauseSet simdAllowedClauses{OmpClause::LINEAR,
+ OmpClause::ALIGNED, OmpClause::PRIVATE, OmpClause::LASTPRIVATE,
+ OmpClause::REDUCTION};
+static constexpr inline OmpClauseSet simdAllowedOnceClauses{
+ OmpClause::COLLAPSE, OmpClause::SAFELEN, OmpClause::SIMDLEN};
+
+static constexpr inline OmpClauseSet parallelAllowedClauses{OmpClause::DEFAULT,
+ OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE, OmpClause::SHARED,
+ OmpClause::COPYIN, OmpClause::REDUCTION};
+static constexpr inline OmpClauseSet parallelAllowedOnceClauses{
+ OmpClause::IF, OmpClause::NUM_THREADS, OmpClause::PROC_BIND};
+
+static constexpr inline OmpClauseSet taskloopAllowedClauses{OmpClause::SHARED,
+ OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE, OmpClause::LASTPRIVATE,
+ OmpClause::DEFAULT, OmpClause::UNTIED, OmpClause::MERGEABLE,
+ OmpClause::NOGROUP};
+static constexpr inline OmpClauseSet taskloopAllowedOnceClauses{
+ OmpClause::COLLAPSE, OmpClause::IF, OmpClause::FINAL, OmpClause::PRIORITY};
+static constexpr inline OmpClauseSet taskloopAllowedExclusiveClauses{
+ OmpClause::GRAINSIZE, OmpClause::NUM_TASKS};
+
+static constexpr inline OmpClauseSet distributeAllowedClauses{
+ OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE, OmpClause::LASTPRIVATE};
+static constexpr inline OmpClauseSet distributeAllowedOnceClauses{
+ OmpClause::COLLAPSE, OmpClause::DIST_SCHEDULE};
+
+static constexpr inline OmpClauseSet targetAllowedClauses{OmpClause::IF,
+ OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE, OmpClause::MAP,
+ OmpClause::IS_DEVICE_PTR, OmpClause::DEPEND};
+static constexpr inline OmpClauseSet targetAllowedOnceClauses{
+ OmpClause::DEVICE, OmpClause::DEFAULTMAP, OmpClause::NOWAIT};
+
+static constexpr inline OmpClauseSet teamsAllowedClauses{OmpClause::PRIVATE,
+ OmpClause::FIRSTPRIVATE, OmpClause::SHARED, OmpClause::REDUCTION};
+static constexpr inline OmpClauseSet teamsAllowedOnceClauses{
+ OmpClause::NUM_TEAMS, OmpClause::THREAD_LIMIT, OmpClause::DEFAULT};
+
+static constexpr inline OmpClauseSet sectionsAllowedClauses{OmpClause::PRIVATE,
+ OmpClause::FIRSTPRIVATE, OmpClause::LASTPRIVATE, OmpClause::REDUCTION};
std::string OmpStructureChecker::ContextDirectiveAsFortran() {
- auto dir = llvm::omp::getOpenMPDirectiveName(GetContext().directive).str();
- std::transform(dir.begin(), dir.end(), dir.begin(),
- [](unsigned char c) { return std::toupper(c); });
+ auto dir{EnumToString(GetContext().directive)};
+ std::replace(dir.begin(), dir.end(), '_', ' ');
return dir;
}
@@ -94,13 +87,13 @@ bool OmpStructureChecker::HasInvalidWorksharingNesting(
return false;
}
-void OmpStructureChecker::CheckAllowed(llvm::omp::Clause type) {
+void OmpStructureChecker::CheckAllowed(OmpClause type) {
if (!GetContext().allowedClauses.test(type) &&
!GetContext().allowedOnceClauses.test(type) &&
!GetContext().allowedExclusiveClauses.test(type)) {
context_.Say(GetContext().clauseSource,
"%s clause is not allowed on the %s directive"_err_en_US,
- parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(type).str()),
+ EnumToString(type),
parser::ToUpperCaseLetters(GetContext().directiveSource.ToString()));
return;
}
@@ -109,25 +102,22 @@ void OmpStructureChecker::CheckAllowed(llvm::omp::Clause type) {
FindClause(type)) {
context_.Say(GetContext().clauseSource,
"At most one %s clause can appear on the %s directive"_err_en_US,
- parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(type).str()),
+ EnumToString(type),
parser::ToUpperCaseLetters(GetContext().directiveSource.ToString()));
return;
}
if (GetContext().allowedExclusiveClauses.test(type)) {
- std::vector<llvm::omp::Clause> others;
- GetContext().allowedExclusiveClauses.IterateOverMembers(
- [&](llvm::omp::Clause o) {
- if (FindClause(o)) {
- others.emplace_back(o);
- }
- });
+ std::vector<OmpClause> others;
+ GetContext().allowedExclusiveClauses.IterateOverMembers([&](OmpClause o) {
+ if (FindClause(o)) {
+ others.emplace_back(o);
+ }
+ });
for (const auto &e : others) {
context_.Say(GetContext().clauseSource,
"%s and %s are mutually exclusive and may not appear on the "
"same %s directive"_err_en_US,
- parser::ToUpperCaseLetters(
- llvm::omp::getOpenMPClauseName(type).str()),
- parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(e).str()),
+ EnumToString(type), EnumToString(e),
parser::ToUpperCaseLetters(GetContext().directiveSource.ToString()));
}
if (!others.empty()) {
@@ -137,37 +127,34 @@ void OmpStructureChecker::CheckAllowed(llvm::omp::Clause type) {
SetContextClauseInfo(type);
}
-void OmpStructureChecker::CheckRequired(llvm::omp::Clause c) {
+void OmpStructureChecker::CheckRequired(OmpClause c) {
if (!FindClause(c)) {
context_.Say(GetContext().directiveSource,
"At least one %s clause must appear on the %s directive"_err_en_US,
- parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(c).str()),
- ContextDirectiveAsFortran());
+ EnumToString(c), ContextDirectiveAsFortran());
}
}
void OmpStructureChecker::RequiresConstantPositiveParameter(
- const llvm::omp::Clause &clause, const parser::ScalarIntConstantExpr &i) {
+ const OmpClause &clause, const parser::ScalarIntConstantExpr &i) {
if (const auto v{GetIntValue(i)}) {
if (*v <= 0) {
context_.Say(GetContext().clauseSource,
"The parameter of the %s clause must be "
"a constant positive integer expression"_err_en_US,
- parser::ToUpperCaseLetters(
- llvm::omp::getOpenMPClauseName(clause).str()));
+ EnumToString(clause));
}
}
}
void OmpStructureChecker::RequiresPositiveParameter(
- const llvm::omp::Clause &clause, const parser::ScalarIntExpr &i) {
+ const OmpClause &clause, const parser::ScalarIntExpr &i) {
if (const auto v{GetIntValue(i)}) {
if (*v <= 0) {
context_.Say(GetContext().clauseSource,
"The parameter of the %s clause must be "
"a positive integer expression"_err_en_US,
- parser::ToUpperCaseLetters(
- llvm::omp::getOpenMPClauseName(clause).str()));
+ EnumToString(clause));
}
}
}
@@ -186,9 +173,6 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
CheckMatching<parser::OmpLoopDirective>(beginLoopDir, *endLoopDir);
}
- if (beginDir.v != llvm::omp::Directive::OMPD_do)
- PushContext(beginDir.source, beginDir.v);
-
switch (beginDir.v) {
// 2.7.1 do-clause -> private-clause |
// firstprivate-clause |
@@ -198,26 +182,23 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
// schedule-clause |
// collapse-clause |
// ordered-clause
- case llvm::omp::Directive::OMPD_do: {
+ case parser::OmpLoopDirective::Directive::Do: {
// nesting check
HasInvalidWorksharingNesting(beginDir.source,
- {llvm::omp::Directive::OMPD_do, llvm::omp::Directive::OMPD_sections,
- llvm::omp::Directive::OMPD_single,
- llvm::omp::Directive::OMPD_workshare,
- llvm::omp::Directive::OMPD_task,
- llvm::omp::Directive::OMPD_taskloop,
- llvm::omp::Directive::OMPD_critical,
- llvm::omp::Directive::OMPD_ordered,
- llvm::omp::Directive::OMPD_atomic,
- llvm::omp::Directive::OMPD_master});
- PushContext(beginDir.source, llvm::omp::Directive::OMPD_do);
+ {OmpDirective::DO, OmpDirective::SECTIONS, OmpDirective::SINGLE,
+ OmpDirective::WORKSHARE, OmpDirective::TASK, OmpDirective::TASKLOOP,
+ OmpDirective::CRITICAL, OmpDirective::ORDERED, OmpDirective::ATOMIC,
+ OmpDirective::MASTER});
+
+ PushContext(beginDir.source, OmpDirective::DO);
SetContextAllowed(doAllowedClauses);
SetContextAllowedOnce(doAllowedOnceClauses);
} break;
// 2.11.1 parallel-do-clause -> parallel-clause |
// do-clause
- case llvm::omp::Directive::OMPD_parallel_do: {
+ case parser::OmpLoopDirective::Directive::ParallelDo: {
+ PushContext(beginDir.source, OmpDirective::PARALLEL_DO);
SetContextAllowed(parallelAllowedClauses | doAllowedClauses);
SetContextAllowedOnce(parallelAllowedOnceClauses | doAllowedOnceClauses);
} break;
@@ -230,21 +211,24 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
// lastprivate-clause |
// reduction-clause |
// collapse-clause
- case llvm::omp::Directive::OMPD_simd: {
+ case parser::OmpLoopDirective::Directive::Simd: {
+ PushContext(beginDir.source, OmpDirective::SIMD);
SetContextAllowed(simdAllowedClauses);
SetContextAllowedOnce(simdAllowedOnceClauses);
} break;
// 2.8.3 do-simd-clause -> do-clause |
// simd-clause
- case llvm::omp::Directive::OMPD_do_simd: {
+ case parser::OmpLoopDirective::Directive::DoSimd: {
+ PushContext(beginDir.source, OmpDirective::DO_SIMD);
SetContextAllowed(doAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(doAllowedOnceClauses | simdAllowedOnceClauses);
} break;
// 2.11.4 parallel-do-simd-clause -> parallel-clause |
// do-simd-clause
- case llvm::omp::Directive::OMPD_parallel_do_simd: {
+ case parser::OmpLoopDirective::Directive::ParallelDoSimd: {
+ PushContext(beginDir.source, OmpDirective::PARALLEL_DO_SIMD);
SetContextAllowed(
parallelAllowedClauses | doAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(parallelAllowedOnceClauses | doAllowedOnceClauses |
@@ -265,7 +249,8 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
// untied-clause |
// mergeable-clause |
// nogroup-clause
- case llvm::omp::Directive::OMPD_taskloop: {
+ case parser::OmpLoopDirective::Directive::Taskloop: {
+ PushContext(beginDir.source, OmpDirective::TASKLOOP);
SetContextAllowed(taskloopAllowedClauses);
SetContextAllowedOnce(taskloopAllowedOnceClauses);
SetContextAllowedExclusive(taskloopAllowedExclusiveClauses);
@@ -273,9 +258,10 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
// 2.9.3 taskloop-simd-clause -> taskloop-clause |
// simd-clause
- case llvm::omp::Directive::OMPD_taskloop_simd: {
- SetContextAllowed((taskloopAllowedClauses | simdAllowedClauses) -
- llvm::omp::Clause::OMPC_reduction);
+ case parser::OmpLoopDirective::Directive::TaskloopSimd: {
+ PushContext(beginDir.source, OmpDirective::TASKLOOP_SIMD);
+ SetContextAllowed(
+ (taskloopAllowedClauses | simdAllowedClauses) - OmpClause::REDUCTION);
SetContextAllowedOnce(taskloopAllowedOnceClauses | simdAllowedOnceClauses);
SetContextAllowedExclusive(taskloopAllowedExclusiveClauses);
} break;
@@ -285,104 +271,116 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
// lastprivate-clause |
// collapse-clause |
// dist-schedule-clause
- case llvm::omp::Directive::OMPD_distribute: {
+ case parser::OmpLoopDirective::Directive::Distribute: {
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE);
SetContextAllowed(distributeAllowedClauses);
SetContextAllowedOnce(distributeAllowedOnceClauses);
} break;
- // 2.10.9 distribute-simd-clause -> distribute-clause |
- // simd-clause
- case llvm::omp::Directive::OMPD_distribute_simd: {
+ // 2.10.9 distribute-simd-clause -> distribute-clause |
+ // simd-clause
+ case parser::OmpLoopDirective::Directive::DistributeSimd: {
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE_SIMD);
SetContextAllowed(distributeAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(
distributeAllowedOnceClauses | simdAllowedOnceClauses);
} break;
- // 2.10.10 distribute-parallel-do-clause -> distribute-clause |
- // parallel-do-clause
- case llvm::omp::Directive::OMPD_distribute_parallel_do: {
+ // 2.10.10 distribute-parallel-do-clause -> distribute-clause |
+ // parallel-do-clause
+ case parser::OmpLoopDirective::Directive::DistributeParallelDo: {
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE_PARALLEL_DO);
SetContextAllowed(
distributeAllowedClauses | parallelAllowedClauses | doAllowedClauses);
SetContextAllowedOnce(distributeAllowedOnceClauses |
parallelAllowedOnceClauses | doAllowedOnceClauses);
} break;
- // 2.10.11 distribute-parallel-do-simd-clause -> distribute-clause |
- // parallel-do-simd-clause
- case llvm::omp::Directive::OMPD_distribute_parallel_do_simd: {
+ // 2.10.11 distribute-parallel-do-simd-clause -> distribute-clause |
+ // parallel-do-simd-clause
+ case parser::OmpLoopDirective::Directive::DistributeParallelDoSimd: {
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD);
SetContextAllowed(distributeAllowedClauses | parallelAllowedClauses |
doAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(distributeAllowedOnceClauses |
parallelAllowedOnceClauses | doAllowedOnceClauses | simdAllowedClauses);
} break;
- // 2.11.6 target-parallel-do-clause -> target-clause |
- // parallel-do-clause
- case llvm::omp::Directive::OMPD_target_parallel_do: {
+ // 2.11.6 target-parallel-do-clause -> target-clause |
+ // parallel-do-clause
+ case parser::OmpLoopDirective::Directive::TargetParallelDo: {
+ PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL_DO);
SetContextAllowed(
targetAllowedClauses | parallelAllowedClauses | doAllowedClauses);
SetContextAllowedOnce(
(targetAllowedOnceClauses | parallelAllowedOnceClauses |
doAllowedOnceClauses) -
- llvm::omp::Clause::OMPC_nowait);
+ OmpClause::NOWAIT);
} break;
- // 2.11.7 target-parallel-do-simd-clause -> target-clause |
- // parallel-do-simd-clause
- case llvm::omp::Directive::OMPD_target_parallel_do_simd: {
+ // 2.11.7 target-parallel-do-simd-clause -> target-clause |
+ // parallel-do-simd-clause
+ case parser::OmpLoopDirective::Directive::TargetParallelDoSimd: {
+ PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL_DO_SIMD);
SetContextAllowed(targetAllowedClauses | parallelAllowedClauses |
doAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(
(targetAllowedOnceClauses | parallelAllowedOnceClauses |
doAllowedOnceClauses | simdAllowedOnceClauses) -
- llvm::omp::Clause::OMPC_nowait);
+ OmpClause::NOWAIT);
} break;
- // 2.11.8 target-simd-clause -> target-clause |
- // simd-clause
- case llvm::omp::Directive::OMPD_target_simd: {
+ // 2.11.8 target-simd-clause -> target-clause |
+ // simd-clause
+ case parser::OmpLoopDirective::Directive::TargetSimd: {
+ PushContext(beginDir.source, OmpDirective::TARGET_SIMD);
SetContextAllowed(targetAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(targetAllowedOnceClauses | simdAllowedOnceClauses);
} break;
- // 2.11.10 teams-distribute-clause -> teams-clause |
- // distribute-clause
- case llvm::omp::Directive::OMPD_teams_distribute: {
+ // 2.11.10 teams-distribute-clause -> teams-clause |
+ // distribute-clause
+ case parser::OmpLoopDirective::Directive::TeamsDistribute: {
+ PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE);
SetContextAllowed(teamsAllowedClauses | distributeAllowedClauses);
SetContextAllowedOnce(
teamsAllowedOnceClauses | distributeAllowedOnceClauses);
} break;
- // 2.11.11 teams-distribute-simd-clause -> teams-clause |
- // distribute-simd-clause
- case llvm::omp::Directive::OMPD_teams_distribute_simd: {
+ // 2.11.11 teams-distribute-simd-clause -> teams-clause |
+ // distribute-simd-clause
+ case parser::OmpLoopDirective::Directive::TeamsDistributeSimd: {
+ PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_SIMD);
SetContextAllowed(
teamsAllowedClauses | distributeAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(teamsAllowedOnceClauses |
distributeAllowedOnceClauses | simdAllowedOnceClauses);
} break;
- // 2.11.12 target-teams-distribute-clause -> target-clause |
- // teams-distribute-clause
- case llvm::omp::Directive::OMPD_target_teams_distribute: {
+ // 2.11.12 target-teams-distribute-clause -> target-clause |
+ // teams-distribute-clause
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistribute: {
+ PushContext(beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE);
SetContextAllowed(
targetAllowedClauses | teamsAllowedClauses | distributeAllowedClauses);
SetContextAllowedOnce(targetAllowedOnceClauses | teamsAllowedOnceClauses |
distributeAllowedOnceClauses);
} break;
- // 2.11.13 target-teams-distribute-simd-clause -> target-clause |
- // teams-distribute-simd-clause
- case llvm::omp::Directive::OMPD_target_teams_distribute_simd: {
+ // 2.11.13 target-teams-distribute-simd-clause -> target-clause |
+ // teams-distribute-simd-clause
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistributeSimd: {
+ PushContext(beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD);
SetContextAllowed(targetAllowedClauses | teamsAllowedClauses |
distributeAllowedClauses | simdAllowedClauses);
SetContextAllowed(targetAllowedOnceClauses | teamsAllowedOnceClauses |
distributeAllowedOnceClauses | simdAllowedOnceClauses);
} break;
- // 2.11.14 teams-distribute-parallel-do-clause -> teams-clause |
- // distribute-parallel-do-clause
- case llvm::omp::Directive::OMPD_teams_distribute_parallel_do: {
+ // 2.11.14 teams-distribute-parallel-do-clause -> teams-clause |
+ // distribute-parallel-do-clause
+ case parser::OmpLoopDirective::Directive::TeamsDistributeParallelDo: {
+ PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO);
SetContextAllowed(teamsAllowedClauses | distributeAllowedClauses |
parallelAllowedClauses | doAllowedClauses);
SetContextAllowedOnce(teamsAllowedOnceClauses |
@@ -390,9 +388,11 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
doAllowedOnceClauses);
} break;
- // 2.11.15 target-teams-distribute-parallel-do-clause -> target-clause |
- // teams-distribute-parallel-do-clause
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do: {
+ // 2.11.15 target-teams-distribute-parallel-do-clause -> target-clause |
+ // teams-distribute-parallel-do-clause
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo: {
+ PushContext(
+ beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO);
SetContextAllowed(targetAllowedClauses | teamsAllowedClauses |
distributeAllowedClauses | parallelAllowedClauses | doAllowedClauses);
SetContextAllowedOnce(targetAllowedOnceClauses | teamsAllowedOnceClauses |
@@ -400,9 +400,11 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
doAllowedOnceClauses);
} break;
- // 2.11.16 teams-distribute-parallel-do-clause -> teams-clause |
- // distribute-parallel-do-simd-clause
- case llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd: {
+ // 2.11.16 teams-distribute-parallel-do-clause -> teams-clause |
+ // distribute-parallel-do-simd-clause
+ case parser::OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd: {
+ PushContext(
+ beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
SetContextAllowed(teamsAllowedClauses | distributeAllowedClauses |
parallelAllowedClauses | doAllowedClauses | simdAllowedClauses);
SetContextAllowedOnce(teamsAllowedOnceClauses |
@@ -410,18 +412,20 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
doAllowedOnceClauses | simdAllowedOnceClauses);
} break;
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd: {
+ case parser::OmpLoopDirective::Directive::
+ TargetTeamsDistributeParallelDoSimd: {
+ PushContext(beginDir.source,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
SetContextAllowed(targetAllowedClauses | teamsAllowedClauses |
distributeAllowedClauses | parallelAllowedClauses | doAllowedClauses |
simdAllowedClauses);
SetContextAllowedOnce(targetAllowedOnceClauses | teamsAllowedOnceClauses |
distributeAllowedOnceClauses | parallelAllowedOnceClauses |
doAllowedOnceClauses | simdAllowedOnceClauses);
- } break;
+ }
- default:
- // TODO others
- break;
+ // TODO others
+ break;
}
}
@@ -435,13 +439,13 @@ void OmpStructureChecker::Enter(const parser::OmpEndLoopDirective &x) {
switch (dir.v) {
// 2.7.1 end-do -> END DO [nowait-clause]
// 2.8.3 end-do-simd -> END DO SIMD [nowait-clause]
- case llvm::omp::Directive::OMPD_do:
- SetContextDirectiveEnum(llvm::omp::Directive::OMPD_end_do);
- SetContextAllowed(OmpClauseSet{llvm::omp::Clause::OMPC_nowait});
+ case parser::OmpLoopDirective::Directive::Do:
+ SetContextDirectiveEnum(OmpDirective::END_DO);
+ SetContextAllowed(OmpClauseSet{OmpClause::NOWAIT});
break;
- case llvm::omp::Directive::OMPD_do_simd:
- SetContextDirectiveEnum(llvm::omp::Directive::OMPD_end_do_simd);
- SetContextAllowed(OmpClauseSet{llvm::omp::Clause::OMPC_nowait});
+ case parser::OmpLoopDirective::Directive::DoSimd:
+ SetContextDirectiveEnum(OmpDirective::END_DO_SIMD);
+ SetContextAllowed(OmpClauseSet{OmpClause::NOWAIT});
break;
default:
// no clauses are allowed
@@ -455,7 +459,6 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
const auto &beginDir{
CheckMatching<parser::OmpBlockDirective>(beginBlockDir, endBlockDir)};
- PushContext(beginDir.source, beginDir.v);
switch (beginDir.v) {
// 2.5 parallel-clause -> if-clause |
// num-threads-clause |
@@ -466,22 +469,25 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
// copyin-clause |
// reduction-clause |
// proc-bind-clause
- case llvm::omp::Directive::OMPD_parallel: {
+ case parser::OmpBlockDirective::Directive::Parallel: {
// reserve for nesting check
+ PushContext(beginDir.source, OmpDirective::PARALLEL);
SetContextAllowed(parallelAllowedClauses);
SetContextAllowedOnce(parallelAllowedOnceClauses);
} break;
// 2.7.3 single-clause -> private-clause |
// firstprivate-clause
- case llvm::omp::Directive::OMPD_single:
- SetContextAllowed({llvm::omp::Clause::OMPC_private,
- llvm::omp::Clause::OMPC_firstprivate});
+ case parser::OmpBlockDirective::Directive::Single:
+ PushContext(beginDir.source, OmpDirective::SINGLE);
+ SetContextAllowed({OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE});
break;
// 2.7.4 workshare (no clauses are allowed)
- case llvm::omp::Directive::OMPD_workshare:
+ case parser::OmpBlockDirective::Directive::Workshare:
+ PushContext(beginDir.source, OmpDirective::WORKSHARE);
break;
// 2.11.3 parallel-workshare-clause -> parallel-clause
- case llvm::omp::Directive::OMPD_parallel_workshare: {
+ case parser::OmpBlockDirective::Directive::ParallelWorkshare: {
+ PushContext(beginDir.source, OmpDirective::PARALLEL_WORKSHARE);
SetContextAllowed(parallelAllowedClauses);
SetContextAllowedOnce(parallelAllowedOnceClauses);
} break;
@@ -495,14 +501,14 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
// shared-clause |
// depend-clause |
// priority-clause
- case llvm::omp::Directive::OMPD_task: {
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_untied,
- llvm::omp::Clause::OMPC_default, llvm::omp::Clause::OMPC_mergeable,
- llvm::omp::Clause::OMPC_private, llvm::omp::Clause::OMPC_firstprivate,
- llvm::omp::Clause::OMPC_shared, llvm::omp::Clause::OMPC_depend};
+ case parser::OmpBlockDirective::Directive::Task: {
+ PushContext(beginDir.source, OmpDirective::TASK);
+ OmpClauseSet allowed{OmpClause::UNTIED, OmpClause::DEFAULT,
+ OmpClause::MERGEABLE, OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE,
+ OmpClause::SHARED, OmpClause::DEPEND};
SetContextAllowed(allowed);
- OmpClauseSet allowedOnce{llvm::omp::Clause::OMPC_if,
- llvm::omp::Clause::OMPC_final, llvm::omp::Clause::OMPC_priority};
+ OmpClauseSet allowedOnce{
+ OmpClause::IF, OmpClause::FINAL, OmpClause::PRIORITY};
SetContextAllowedOnce(allowedOnce);
} break;
// 2.10.4 target-clause -> if-clause |
@@ -514,7 +520,8 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
// defaultmap-clause |
// nowait-clause |
// depend-clause
- case llvm::omp::Directive::OMPD_target: {
+ case parser::OmpBlockDirective::Directive::Target: {
+ PushContext(beginDir.source, OmpDirective::TARGET);
SetContextAllowed(targetAllowedClauses);
SetContextAllowedOnce(targetAllowedOnceClauses);
} break;
@@ -525,35 +532,40 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
// firstprivate-clause |
// shared-clause |
// reduction-clause
- case llvm::omp::Directive::OMPD_teams: {
+ case parser::OmpBlockDirective::Directive::Teams: {
+ PushContext(beginDir.source, OmpDirective::TEAMS);
SetContextAllowed(teamsAllowedClauses);
SetContextAllowedOnce(teamsAllowedOnceClauses);
} break;
- // 2.11.9 target-teams -> target-clause |
- // teams-clause
- case llvm::omp::Directive::OMPD_target_teams: {
+ // 2.11.9 target-teams -> target-clause |
+ // teams-clause
+ case parser::OmpBlockDirective::Directive::TargetTeams: {
+ PushContext(beginDir.source, OmpDirective::TARGET_TEAMS);
SetContextAllowed(targetAllowedClauses | teamsAllowedClauses);
SetContextAllowedOnce(targetAllowedOnceClauses | teamsAllowedOnceClauses);
} break;
- // 2.10.1 target-data-clause -> if-clause |
- // device-clause |
- // map-clause |
- // use-device-ptr-clause
- case llvm::omp::Directive::OMPD_target_data: {
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_if,
- llvm::omp::Clause::OMPC_map, llvm::omp::Clause::OMPC_use_device_ptr};
+ // 2.10.1 target-data-clause -> if-clause |
+ // device-clause |
+ // map-clause |
+ // use-device-ptr-clause
+ case parser::OmpBlockDirective::Directive::TargetData: {
+ PushContext(beginDir.source, OmpDirective::TARGET_DATA);
+ OmpClauseSet allowed{
+ OmpClause::IF, OmpClause::MAP, OmpClause::USE_DEVICE_PTR};
SetContextAllowed(allowed);
- SetContextAllowedOnce({llvm::omp::Clause::OMPC_device});
- SetContextRequired({llvm::omp::Clause::OMPC_map});
+ SetContextAllowedOnce({OmpClause::DEVICE});
+ SetContextRequired({OmpClause::MAP});
} break;
- // 2.13.1 master (no clauses are allowed)
- case llvm::omp::Directive::OMPD_master:
+ // 2.13.1 master (no clauses are allowed)
+ case parser::OmpBlockDirective::Directive::Master:
+ PushContext(beginDir.source, OmpDirective::MASTER);
break;
- // 2.11.5 target-parallel-clause -> target-clause |
- // parallel-clause
- case llvm::omp::Directive::OMPD_target_parallel: {
- SetContextAllowed((targetAllowedClauses | parallelAllowedClauses) -
- llvm::omp::Clause::OMPC_copyin);
+ // 2.11.5 target-parallel-clause -> target-clause |
+ // parallel-clause
+ case parser::OmpBlockDirective::Directive::TargetParallel: {
+ PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL);
+ SetContextAllowed(
+ (targetAllowedClauses | parallelAllowedClauses) - OmpClause::COPYIN);
SetContextAllowedOnce(
targetAllowedOnceClauses | parallelAllowedOnceClauses);
} break;
@@ -574,24 +586,22 @@ void OmpStructureChecker::Enter(const parser::OpenMPSectionsConstruct &x) {
const auto &beginDir{CheckMatching<parser::OmpSectionsDirective>(
beginSectionsDir, endSectionsDir)};
- PushContext(beginDir.source, beginDir.v);
switch (beginDir.v) {
// 2.7.2 sections-clause -> private-clause |
// firstprivate-clause |
// lastprivate-clause |
// reduction-clause
- case llvm::omp::Directive::OMPD_sections: {
+ case parser::OmpSectionsDirective::Directive::Sections: {
+ PushContext(beginDir.source, OmpDirective::SECTIONS);
SetContextAllowed(sectionsAllowedClauses);
} break;
// 2.11.2 -> parallel-sections-clause -> parallel-clause |
// sections-clause
- case llvm::omp::Directive::OMPD_parallel_sections: {
+ case parser::OmpSectionsDirective::Directive::ParallelSections: {
+ PushContext(beginDir.source, OmpDirective::PARALLEL_SECTIONS);
SetContextAllowed(parallelAllowedClauses | sectionsAllowedClauses);
SetContextAllowedOnce(parallelAllowedOnceClauses);
} break;
- default:
- // TODO others
- break;
}
}
@@ -604,9 +614,9 @@ void OmpStructureChecker::Enter(const parser::OmpEndSectionsDirective &x) {
ResetPartialContext(dir.source);
switch (dir.v) {
// 2.7.2 end-sections -> END SECTIONS [nowait-clause]
- case llvm::omp::Directive::OMPD_sections:
- SetContextDirectiveEnum(llvm::omp::Directive::OMPD_end_sections);
- SetContextAllowed(OmpClauseSet{llvm::omp::Clause::OMPC_nowait});
+ case parser::OmpSectionsDirective::Directive::Sections:
+ SetContextDirectiveEnum(OmpDirective::END_SECTIONS);
+ SetContextAllowed(OmpClauseSet{OmpClause::NOWAIT});
break;
default:
// no clauses are allowed
@@ -616,19 +626,18 @@ void OmpStructureChecker::Enter(const parser::OmpEndSectionsDirective &x) {
void OmpStructureChecker::Enter(const parser::OpenMPDeclareSimdConstruct &x) {
const auto &dir{std::get<parser::Verbatim>(x.t)};
- PushContext(dir.source, llvm::omp::Directive::OMPD_declare_simd);
+ PushContext(dir.source, OmpDirective::DECLARE_SIMD);
// 2.8.2 declare-simd-clause -> simdlen-clause |
// linear-clause |
// aligned-clause |
// uniform-clause |
// inbranch-clause |
// notinbranch-clause
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_linear,
- llvm::omp::Clause::OMPC_aligned, llvm::omp::Clause::OMPC_uniform};
+ OmpClauseSet allowed{
+ OmpClause::LINEAR, OmpClause::ALIGNED, OmpClause::UNIFORM};
SetContextAllowed(allowed);
- SetContextAllowedOnce({llvm::omp::Clause::OMPC_simdlen});
- SetContextAllowedExclusive(
- {llvm::omp::Clause::OMPC_inbranch, llvm::omp::Clause::OMPC_notinbranch});
+ SetContextAllowedOnce({OmpClause::SIMDLEN});
+ SetContextAllowedExclusive({OmpClause::INBRANCH, OmpClause::NOTINBRANCH});
}
void OmpStructureChecker::Leave(const parser::OpenMPDeclareSimdConstruct &) {
@@ -637,11 +646,10 @@ void OmpStructureChecker::Leave(const parser::OpenMPDeclareSimdConstruct &) {
void OmpStructureChecker::Enter(const parser::OpenMPDeclareTargetConstruct &x) {
const auto &dir{std::get<parser::Verbatim>(x.t)};
- PushContext(dir.source, llvm::omp::Directive::OMPD_declare_target);
+ PushContext(dir.source, OmpDirective::DECLARE_TARGET);
const auto &spec{std::get<parser::OmpDeclareTargetSpecifier>(x.t)};
if (std::holds_alternative<parser::OmpDeclareTargetWithClause>(spec.u)) {
- SetContextAllowed(
- OmpClauseSet{llvm::omp::Clause::OMPC_to, llvm::omp::Clause::OMPC_link});
+ SetContextAllowed(OmpClauseSet{OmpClause::TO, OmpClause::LINK});
}
}
@@ -652,56 +660,55 @@ void OmpStructureChecker::Leave(const parser::OpenMPDeclareTargetConstruct &) {
void OmpStructureChecker::Enter(
const parser::OpenMPSimpleStandaloneConstruct &x) {
const auto &dir{std::get<parser::OmpSimpleStandaloneDirective>(x.t)};
- PushContext(dir.source, dir.v);
switch (dir.v) {
- case llvm::omp::Directive::OMPD_barrier: {
+ case parser::OmpSimpleStandaloneDirective::Directive::Barrier: {
// 2.13.3 barrier
+ PushContext(dir.source, OmpDirective::BARRIER);
} break;
- case llvm::omp::Directive::OMPD_taskwait: {
+ case parser::OmpSimpleStandaloneDirective::Directive::Taskwait: {
// 2.13.4 taskwait
+ PushContext(dir.source, OmpDirective::TASKWAIT);
} break;
- case llvm::omp::Directive::OMPD_taskyield: {
+ case parser::OmpSimpleStandaloneDirective::Directive::Taskyield: {
// 2.9.4 taskyield
+ PushContext(dir.source, OmpDirective::TASKYIELD);
} break;
- case llvm::omp::Directive::OMPD_target_enter_data: {
+ case parser::OmpSimpleStandaloneDirective::Directive::TargetEnterData: {
// 2.10.2 target-enter-data-clause -> if-clause |
// device-clause |
// map-clause |
// depend-clause |
// nowait-clause
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_map,
- llvm::omp::Clause::OMPC_depend, llvm::omp::Clause::OMPC_nowait};
+ PushContext(dir.source, OmpDirective::TARGET_ENTER_DATA);
+ OmpClauseSet allowed{OmpClause::MAP, OmpClause::DEPEND, OmpClause::NOWAIT};
SetContextAllowed(allowed);
- OmpClauseSet allowedOnce{
- llvm::omp::Clause::OMPC_device, llvm::omp::Clause::OMPC_if};
+ OmpClauseSet allowedOnce{OmpClause::DEVICE, OmpClause::IF};
SetContextAllowedOnce(allowedOnce);
- SetContextRequired({llvm::omp::Clause::OMPC_map});
+ SetContextRequired({OmpClause::MAP});
} break;
- case llvm::omp::Directive::OMPD_target_exit_data: {
+ case parser::OmpSimpleStandaloneDirective::Directive::TargetExitData: {
// 2.10.3 target-enter-data-clause -> if-clause |
// device-clause |
// map-clause |
// depend-clause |
// nowait-clause
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_map,
- llvm::omp::Clause::OMPC_depend, llvm::omp::Clause::OMPC_nowait};
+ PushContext(dir.source, OmpDirective::TARGET_EXIT_DATA);
+ OmpClauseSet allowed{OmpClause::MAP, OmpClause::DEPEND, OmpClause::NOWAIT};
SetContextAllowed(allowed);
- OmpClauseSet allowedOnce{
- llvm::omp::Clause::OMPC_device, llvm::omp::Clause::OMPC_if};
+ OmpClauseSet allowedOnce{OmpClause::DEVICE, OmpClause::IF};
SetContextAllowedOnce(allowedOnce);
- SetContextRequired({llvm::omp::Clause::OMPC_map});
+ SetContextRequired({OmpClause::MAP});
} break;
- case llvm::omp::Directive::OMPD_target_update: {
+ case parser::OmpSimpleStandaloneDirective::Directive::TargetUpdate: {
// 2.10.5 target-update
+ PushContext(dir.source, OmpDirective::TARGET_UPDATE);
} break;
- case llvm::omp::Directive::OMPD_ordered: {
+ case parser::OmpSimpleStandaloneDirective::Directive::Ordered: {
// 2.13.8 ordered-construct-clause -> depend-clause
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_depend};
+ PushContext(dir.source, OmpDirective::ORDERED);
+ OmpClauseSet allowed{OmpClause::DEPEND};
SetContextAllowed(allowed);
} break;
- default:
- // TODO others
- break;
}
}
@@ -712,7 +719,7 @@ void OmpStructureChecker::Leave(
void OmpStructureChecker::Enter(const parser::OpenMPFlushConstruct &x) {
const auto &dir{std::get<parser::Verbatim>(x.t)};
- PushContext(dir.source, llvm::omp::Directive::OMPD_flush);
+ PushContext(dir.source, OmpDirective::FLUSH);
}
void OmpStructureChecker::Leave(const parser::OpenMPFlushConstruct &) {
@@ -721,7 +728,7 @@ void OmpStructureChecker::Leave(const parser::OpenMPFlushConstruct &) {
void OmpStructureChecker::Enter(const parser::OpenMPCancelConstruct &x) {
const auto &dir{std::get<parser::Verbatim>(x.t)};
- PushContext(dir.source, llvm::omp::Directive::OMPD_cancel);
+ PushContext(dir.source, OmpDirective::CANCEL);
}
void OmpStructureChecker::Leave(const parser::OpenMPCancelConstruct &) {
@@ -731,7 +738,7 @@ void OmpStructureChecker::Leave(const parser::OpenMPCancelConstruct &) {
void OmpStructureChecker::Enter(
const parser::OpenMPCancellationPointConstruct &x) {
const auto &dir{std::get<parser::Verbatim>(x.t)};
- PushContext(dir.source, llvm::omp::Directive::OMPD_cancellation_point);
+ PushContext(dir.source, OmpDirective::CANCELLATION_POINT);
}
void OmpStructureChecker::Leave(
@@ -745,17 +752,17 @@ void OmpStructureChecker::Enter(const parser::OmpEndBlockDirective &x) {
switch (dir.v) {
// 2.7.3 end-single-clause -> copyprivate-clause |
// nowait-clause
- case llvm::omp::Directive::OMPD_single: {
- SetContextDirectiveEnum(llvm::omp::Directive::OMPD_end_single);
- OmpClauseSet allowed{llvm::omp::Clause::OMPC_copyprivate};
+ case parser::OmpBlockDirective::Directive::Single: {
+ SetContextDirectiveEnum(OmpDirective::END_SINGLE);
+ OmpClauseSet allowed{OmpClause::COPYPRIVATE};
SetContextAllowed(allowed);
- OmpClauseSet allowedOnce{llvm::omp::Clause::OMPC_nowait};
+ OmpClauseSet allowedOnce{OmpClause::NOWAIT};
SetContextAllowedOnce(allowedOnce);
} break;
// 2.7.4 end-workshare -> END WORKSHARE [nowait-clause]
- case llvm::omp::Directive::OMPD_workshare:
- SetContextDirectiveEnum(llvm::omp::Directive::OMPD_end_workshare);
- SetContextAllowed(OmpClauseSet{llvm::omp::Clause::OMPC_nowait});
+ case parser::OmpBlockDirective::Directive::Workshare:
+ SetContextDirectiveEnum(OmpDirective::END_WORKSHARE);
+ SetContextAllowed(OmpClauseSet{OmpClause::NOWAIT});
break;
default:
// no clauses are allowed
@@ -765,13 +772,13 @@ void OmpStructureChecker::Enter(const parser::OmpEndBlockDirective &x) {
void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
// 2.7 Loop Construct Restriction
- if (llvm::omp::doSet.test(GetContext().directive)) {
- if (auto *clause{FindClause(llvm::omp::Clause::OMPC_schedule)}) {
+ if (doSet.test(GetContext().directive)) {
+ if (auto *clause{FindClause(OmpClause::SCHEDULE)}) {
// only one schedule clause is allowed
const auto &schedClause{std::get<parser::OmpScheduleClause>(clause->u)};
if (ScheduleModifierHasType(schedClause,
parser::OmpScheduleModifierType::ModType::Nonmonotonic)) {
- if (FindClause(llvm::omp::Clause::OMPC_ordered)) {
+ if (FindClause(OmpClause::ORDERED)) {
context_.Say(clause->source,
"The NONMONOTONIC modifier cannot be specified "
"if an ORDERED clause is specified"_err_en_US);
@@ -785,19 +792,19 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
}
}
- if (auto *clause{FindClause(llvm::omp::Clause::OMPC_ordered)}) {
+ if (auto *clause{FindClause(OmpClause::ORDERED)}) {
// only one ordered clause is allowed
const auto &orderedClause{
std::get<parser::OmpClause::Ordered>(clause->u)};
if (orderedClause.v) {
- if (FindClause(llvm::omp::Clause::OMPC_linear)) {
+ if (FindClause(OmpClause::LINEAR)) {
context_.Say(clause->source,
"A loop directive may not have both a LINEAR clause and "
"an ORDERED clause with a parameter"_err_en_US);
}
- if (auto *clause2{FindClause(llvm::omp::Clause::OMPC_collapse)}) {
+ if (auto *clause2{FindClause(OmpClause::COLLAPSE)}) {
const auto &collapseClause{
std::get<parser::OmpClause::Collapse>(clause2->u)};
// ordered and collapse both have parameters
@@ -819,9 +826,9 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
} // doSet
// 2.8.1 Simd Construct Restriction
- if (llvm::omp::simdSet.test(GetContext().directive)) {
- if (auto *clause{FindClause(llvm::omp::Clause::OMPC_simdlen)}) {
- if (auto *clause2{FindClause(llvm::omp::Clause::OMPC_safelen)}) {
+ if (simdSet.test(GetContext().directive)) {
+ if (auto *clause{FindClause(OmpClause::SIMDLEN)}) {
+ if (auto *clause2{FindClause(OmpClause::SAFELEN)}) {
const auto &simdlenClause{
std::get<parser::OmpClause::Simdlen>(clause->u)};
const auto &safelenClause{
@@ -843,9 +850,9 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
} // SIMD
// 2.7.3 Single Construct Restriction
- if (GetContext().directive == llvm::omp::Directive::OMPD_end_single) {
- if (auto *clause{FindClause(llvm::omp::Clause::OMPC_copyprivate)}) {
- if (FindClause(llvm::omp::Clause::OMPC_nowait)) {
+ if (GetContext().directive == OmpDirective::END_SINGLE) {
+ if (auto *clause{FindClause(OmpClause::COPYPRIVATE)}) {
+ if (FindClause(OmpClause::NOWAIT)) {
context_.Say(clause->source,
"The COPYPRIVATE clause must not be used with "
"the NOWAIT clause"_err_en_US);
@@ -854,7 +861,7 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
}
GetContext().requiredClauses.IterateOverMembers(
- [this](llvm::omp::Clause c) { CheckRequired(c); });
+ [this](OmpClause c) { CheckRequired(c); });
}
void OmpStructureChecker::Enter(const parser::OmpClause &x) {
@@ -862,80 +869,80 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
}
void OmpStructureChecker::Enter(const parser::OmpNowait &) {
- CheckAllowed(llvm::omp::Clause::OMPC_nowait);
+ CheckAllowed(OmpClause::NOWAIT);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Inbranch &) {
- CheckAllowed(llvm::omp::Clause::OMPC_inbranch);
+ CheckAllowed(OmpClause::INBRANCH);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Mergeable &) {
- CheckAllowed(llvm::omp::Clause::OMPC_mergeable);
+ CheckAllowed(OmpClause::MERGEABLE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Nogroup &) {
- CheckAllowed(llvm::omp::Clause::OMPC_nogroup);
+ CheckAllowed(OmpClause::NOGROUP);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Notinbranch &) {
- CheckAllowed(llvm::omp::Clause::OMPC_notinbranch);
+ CheckAllowed(OmpClause::NOTINBRANCH);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Untied &) {
- CheckAllowed(llvm::omp::Clause::OMPC_untied);
+ CheckAllowed(OmpClause::UNTIED);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Collapse &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_collapse);
+ CheckAllowed(OmpClause::COLLAPSE);
// collapse clause must have a parameter
- RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_collapse, x.v);
+ RequiresConstantPositiveParameter(OmpClause::COLLAPSE, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Copyin &) {
- CheckAllowed(llvm::omp::Clause::OMPC_copyin);
+ CheckAllowed(OmpClause::COPYIN);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Copyprivate &) {
- CheckAllowed(llvm::omp::Clause::OMPC_copyprivate);
+ CheckAllowed(OmpClause::COPYPRIVATE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Device &) {
- CheckAllowed(llvm::omp::Clause::OMPC_device);
+ CheckAllowed(OmpClause::DEVICE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::DistSchedule &) {
- CheckAllowed(llvm::omp::Clause::OMPC_dist_schedule);
+ CheckAllowed(OmpClause::DIST_SCHEDULE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Final &) {
- CheckAllowed(llvm::omp::Clause::OMPC_final);
+ CheckAllowed(OmpClause::FINAL);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Firstprivate &) {
- CheckAllowed(llvm::omp::Clause::OMPC_firstprivate);
+ CheckAllowed(OmpClause::FIRSTPRIVATE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::From &) {
- CheckAllowed(llvm::omp::Clause::OMPC_from);
+ CheckAllowed(OmpClause::FROM);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Grainsize &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_grainsize);
- RequiresPositiveParameter(llvm::omp::Clause::OMPC_grainsize, x.v);
+ CheckAllowed(OmpClause::GRAINSIZE);
+ RequiresPositiveParameter(OmpClause::GRAINSIZE, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Lastprivate &) {
- CheckAllowed(llvm::omp::Clause::OMPC_lastprivate);
+ CheckAllowed(OmpClause::LASTPRIVATE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::NumTasks &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_num_tasks);
- RequiresPositiveParameter(llvm::omp::Clause::OMPC_num_tasks, x.v);
+ CheckAllowed(OmpClause::NUM_TASKS);
+ RequiresPositiveParameter(OmpClause::NUM_TASKS, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::NumTeams &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_num_teams);
- RequiresPositiveParameter(llvm::omp::Clause::OMPC_num_teams, x.v);
+ CheckAllowed(OmpClause::NUM_TEAMS);
+ RequiresPositiveParameter(OmpClause::NUM_TEAMS, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::NumThreads &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_num_threads);
- RequiresPositiveParameter(llvm::omp::Clause::OMPC_num_threads, x.v);
+ CheckAllowed(OmpClause::NUM_THREADS);
+ RequiresPositiveParameter(OmpClause::NUM_THREADS, x.v);
// if parameter is variable, defer to Expression Analysis
}
void OmpStructureChecker::Enter(const parser::OmpClause::Ordered &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_ordered);
+ CheckAllowed(OmpClause::ORDERED);
// the parameter of ordered clause is optional
if (const auto &expr{x.v}) {
- RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_ordered, *expr);
+ RequiresConstantPositiveParameter(OmpClause::ORDERED, *expr);
// 2.8.3 Loop SIMD Construct Restriction
- if (llvm::omp::doSimdSet.test(GetContext().directive)) {
+ if (doSimdSet.test(GetContext().directive)) {
context_.Say(GetContext().clauseSource,
"No ORDERED clause with a parameter can be specified "
"on the %s directive"_err_en_US,
@@ -944,45 +951,45 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Ordered &x) {
}
}
void OmpStructureChecker::Enter(const parser::OmpClause::Priority &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_priority);
- RequiresPositiveParameter(llvm::omp::Clause::OMPC_priority, x.v);
+ CheckAllowed(OmpClause::PRIORITY);
+ RequiresPositiveParameter(OmpClause::PRIORITY, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Private &) {
- CheckAllowed(llvm::omp::Clause::OMPC_private);
+ CheckAllowed(OmpClause::PRIVATE);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Safelen &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_safelen);
- RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_safelen, x.v);
+ CheckAllowed(OmpClause::SAFELEN);
+ RequiresConstantPositiveParameter(OmpClause::SAFELEN, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Shared &) {
- CheckAllowed(llvm::omp::Clause::OMPC_shared);
+ CheckAllowed(OmpClause::SHARED);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Simdlen &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_simdlen);
- RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_simdlen, x.v);
+ CheckAllowed(OmpClause::SIMDLEN);
+ RequiresConstantPositiveParameter(OmpClause::SIMDLEN, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::ThreadLimit &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_thread_limit);
- RequiresPositiveParameter(llvm::omp::Clause::OMPC_thread_limit, x.v);
+ CheckAllowed(OmpClause::THREAD_LIMIT);
+ RequiresPositiveParameter(OmpClause::THREAD_LIMIT, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::To &) {
- CheckAllowed(llvm::omp::Clause::OMPC_to);
+ CheckAllowed(OmpClause::TO);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Link &) {
- CheckAllowed(llvm::omp::Clause::OMPC_link);
+ CheckAllowed(OmpClause::LINK);
}
void OmpStructureChecker::Enter(const parser::OmpClause::Uniform &) {
- CheckAllowed(llvm::omp::Clause::OMPC_uniform);
+ CheckAllowed(OmpClause::UNIFORM);
}
void OmpStructureChecker::Enter(const parser::OmpClause::UseDevicePtr &) {
- CheckAllowed(llvm::omp::Clause::OMPC_use_device_ptr);
+ CheckAllowed(OmpClause::USE_DEVICE_PTR);
}
void OmpStructureChecker::Enter(const parser::OmpClause::IsDevicePtr &) {
- CheckAllowed(llvm::omp::Clause::OMPC_is_device_ptr);
+ CheckAllowed(OmpClause::IS_DEVICE_PTR);
}
void OmpStructureChecker::Enter(const parser::OmpAlignedClause &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_aligned);
+ CheckAllowed(OmpClause::ALIGNED);
if (const auto &expr{
std::get<std::optional<parser::ScalarIntConstantExpr>>(x.t)}) {
@@ -997,10 +1004,10 @@ void OmpStructureChecker::Enter(const parser::OmpAlignedClause &x) {
// 2.8.1 TODO: list-item attribute check
}
void OmpStructureChecker::Enter(const parser::OmpDefaultClause &) {
- CheckAllowed(llvm::omp::Clause::OMPC_default);
+ CheckAllowed(OmpClause::DEFAULT);
}
void OmpStructureChecker::Enter(const parser::OmpDefaultmapClause &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_defaultmap);
+ CheckAllowed(OmpClause::DEFAULTMAP);
using VariableCategory = parser::OmpDefaultmapClause::VariableCategory;
if (!std::get<std::optional<VariableCategory>>(x.t)) {
context_.Say(GetContext().clauseSource,
@@ -1009,26 +1016,22 @@ void OmpStructureChecker::Enter(const parser::OmpDefaultmapClause &x) {
}
}
void OmpStructureChecker::Enter(const parser::OmpDependClause &) {
- CheckAllowed(llvm::omp::Clause::OMPC_depend);
+ CheckAllowed(OmpClause::DEPEND);
}
void OmpStructureChecker::Enter(const parser::OmpIfClause &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_if);
+ CheckAllowed(OmpClause::IF);
using dirNameModifier = parser::OmpIfClause::DirectiveNameModifier;
static std::unordered_map<dirNameModifier, OmpDirectiveSet>
- dirNameModifierMap{{dirNameModifier::Parallel, llvm::omp::parallelSet},
- {dirNameModifier::Target, llvm::omp::targetSet},
- {dirNameModifier::TargetEnterData,
- {llvm::omp::Directive::OMPD_target_enter_data}},
- {dirNameModifier::TargetExitData,
- {llvm::omp::Directive::OMPD_target_exit_data}},
- {dirNameModifier::TargetData,
- {llvm::omp::Directive::OMPD_target_data}},
- {dirNameModifier::TargetUpdate,
- {llvm::omp::Directive::OMPD_target_update}},
- {dirNameModifier::Task, {llvm::omp::Directive::OMPD_task}},
- {dirNameModifier::Taskloop, llvm::omp::taskloopSet}};
+ dirNameModifierMap{{dirNameModifier::Parallel, parallelSet},
+ {dirNameModifier::Target, targetSet},
+ {dirNameModifier::TargetEnterData, {OmpDirective::TARGET_ENTER_DATA}},
+ {dirNameModifier::TargetExitData, {OmpDirective::TARGET_EXIT_DATA}},
+ {dirNameModifier::TargetData, {OmpDirective::TARGET_DATA}},
+ {dirNameModifier::TargetUpdate, {OmpDirective::TARGET_UPDATE}},
+ {dirNameModifier::Task, {OmpDirective::TASK}},
+ {dirNameModifier::Taskloop, taskloopSet}};
if (const auto &directiveName{
std::get<std::optional<dirNameModifier>>(x.t)}) {
auto search{dirNameModifierMap.find(*directiveName)};
@@ -1046,10 +1049,10 @@ void OmpStructureChecker::Enter(const parser::OmpIfClause &x) {
}
void OmpStructureChecker::Enter(const parser::OmpLinearClause &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_linear);
+ CheckAllowed(OmpClause::LINEAR);
// 2.7 Loop Construct Restriction
- if ((llvm::omp::doSet | llvm::omp::simdSet).test(GetContext().directive)) {
+ if ((doSet | simdSet).test(GetContext().directive)) {
if (std::holds_alternative<parser::OmpLinearClause::WithModifier>(x.u)) {
context_.Say(GetContext().clauseSource,
"A modifier may not be specified in a LINEAR clause "
@@ -1059,18 +1062,18 @@ void OmpStructureChecker::Enter(const parser::OmpLinearClause &x) {
}
}
void OmpStructureChecker::Enter(const parser::OmpMapClause &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_map);
+ CheckAllowed(OmpClause::MAP);
if (const auto &maptype{std::get<std::optional<parser::OmpMapType>>(x.t)}) {
using Type = parser::OmpMapType::Type;
const Type &type{std::get<Type>(maptype->t)};
switch (GetContext().directive) {
- case llvm::omp::Directive::OMPD_target:
- case llvm::omp::Directive::OMPD_target_teams:
- case llvm::omp::Directive::OMPD_target_teams_distribute:
- case llvm::omp::Directive::OMPD_target_teams_distribute_simd:
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd:
- case llvm::omp::Directive::OMPD_target_data: {
+ case OmpDirective::TARGET:
+ case OmpDirective::TARGET_TEAMS:
+ case OmpDirective::TARGET_TEAMS_DISTRIBUTE:
+ case OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD:
+ case OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
+ case OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
+ case OmpDirective::TARGET_DATA: {
if (type != Type::To && type != Type::From && type != Type::Tofrom &&
type != Type::Alloc) {
context_.Say(GetContext().clauseSource,
@@ -1079,7 +1082,7 @@ void OmpStructureChecker::Enter(const parser::OmpMapClause &x) {
ContextDirectiveAsFortran());
}
} break;
- case llvm::omp::Directive::OMPD_target_enter_data: {
+ case OmpDirective::TARGET_ENTER_DATA: {
if (type != Type::To && type != Type::Alloc) {
context_.Say(GetContext().clauseSource,
"Only the TO or ALLOC map types are permitted "
@@ -1087,7 +1090,7 @@ void OmpStructureChecker::Enter(const parser::OmpMapClause &x) {
ContextDirectiveAsFortran());
}
} break;
- case llvm::omp::Directive::OMPD_target_exit_data: {
+ case OmpDirective::TARGET_EXIT_DATA: {
if (type != Type::Delete && type != Type::Release && type != Type::From) {
context_.Say(GetContext().clauseSource,
"Only the FROM, RELEASE, or DELETE map types are permitted "
@@ -1101,10 +1104,10 @@ void OmpStructureChecker::Enter(const parser::OmpMapClause &x) {
}
}
void OmpStructureChecker::Enter(const parser::OmpProcBindClause &) {
- CheckAllowed(llvm::omp::Clause::OMPC_proc_bind);
+ CheckAllowed(OmpClause::PROC_BIND);
}
void OmpStructureChecker::Enter(const parser::OmpReductionClause &) {
- CheckAllowed(llvm::omp::Clause::OMPC_reduction);
+ CheckAllowed(OmpClause::REDUCTION);
}
bool OmpStructureChecker::ScheduleModifierHasType(
@@ -1125,10 +1128,10 @@ bool OmpStructureChecker::ScheduleModifierHasType(
return false;
}
void OmpStructureChecker::Enter(const parser::OmpScheduleClause &x) {
- CheckAllowed(llvm::omp::Clause::OMPC_schedule);
+ CheckAllowed(OmpClause::SCHEDULE);
// 2.7 Loop Construct Restriction
- if (llvm::omp::doSet.test(GetContext().directive)) {
+ if (doSet.test(GetContext().directive)) {
const auto &kind{std::get<1>(x.t)};
const auto &chunk{std::get<2>(x.t)};
if (chunk) {
diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h
index 1585b0c861ad..e952b3531f84 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -17,63 +17,80 @@
#include "flang/Common/enum-set.h"
#include "flang/Parser/parse-tree.h"
#include "flang/Semantics/semantics.h"
-#include "llvm/Frontend/OpenMP/OMPConstants.h"
-
-using OmpDirectiveSet = Fortran::common::EnumSet<llvm::omp::Directive,
- llvm::omp::Directive_enumSize>;
-
-using OmpClauseSet =
- Fortran::common::EnumSet<llvm::omp::Clause, llvm::omp::Clause_enumSize>;
-
-namespace llvm {
-namespace omp {
-static OmpDirectiveSet parallelSet{Directive::OMPD_distribute_parallel_do,
- Directive::OMPD_distribute_parallel_do_simd, Directive::OMPD_parallel,
- Directive::OMPD_parallel_do, Directive::OMPD_parallel_do_simd,
- Directive::OMPD_parallel_sections, Directive::OMPD_parallel_workshare,
- Directive::OMPD_target_parallel, Directive::OMPD_target_parallel_do,
- Directive::OMPD_target_parallel_do_simd,
- Directive::OMPD_target_teams_distribute_parallel_do,
- Directive::OMPD_target_teams_distribute_parallel_do_simd,
- Directive::OMPD_teams_distribute_parallel_do,
- Directive::OMPD_teams_distribute_parallel_do_simd};
-static OmpDirectiveSet doSet{Directive::OMPD_distribute_parallel_do,
- Directive::OMPD_distribute_parallel_do_simd, Directive::OMPD_parallel,
- Directive::OMPD_parallel_do, Directive::OMPD_parallel_do_simd,
- Directive::OMPD_do, Directive::OMPD_do_simd,
- Directive::OMPD_target_parallel_do, Directive::OMPD_target_parallel_do_simd,
- Directive::OMPD_target_teams_distribute_parallel_do,
- Directive::OMPD_target_teams_distribute_parallel_do_simd,
- Directive::OMPD_teams_distribute_parallel_do,
- Directive::OMPD_teams_distribute_parallel_do_simd};
-static OmpDirectiveSet doSimdSet{Directive::OMPD_distribute_parallel_do_simd,
- Directive::OMPD_parallel_do_simd, Directive::OMPD_do_simd,
- Directive::OMPD_target_parallel_do_simd,
- Directive::OMPD_target_teams_distribute_parallel_do_simd,
- Directive::OMPD_teams_distribute_parallel_do_simd};
-static OmpDirectiveSet taskloopSet{
- Directive::OMPD_taskloop, Directive::OMPD_taskloop_simd};
-static OmpDirectiveSet targetSet{Directive::OMPD_target,
- Directive::OMPD_target_parallel, Directive::OMPD_target_parallel_do,
- Directive::OMPD_target_parallel_do_simd, Directive::OMPD_target_simd,
- Directive::OMPD_target_teams, Directive::OMPD_target_teams_distribute,
- Directive::OMPD_target_teams_distribute_simd};
-static OmpDirectiveSet simdSet{Directive::OMPD_distribute_parallel_do_simd,
- Directive::OMPD_distribute_simd, Directive::OMPD_parallel_do_simd,
- Directive::OMPD_do_simd, Directive::OMPD_simd,
- Directive::OMPD_target_parallel_do_simd,
- Directive::OMPD_target_teams_distribute_parallel_do_simd,
- Directive::OMPD_target_teams_distribute_simd, Directive::OMPD_target_simd,
- Directive::OMPD_taskloop_simd,
- Directive::OMPD_teams_distribute_parallel_do_simd,
- Directive::OMPD_teams_distribute_simd};
-static OmpDirectiveSet taskGeneratingSet{
- OmpDirectiveSet{Directive::OMPD_task} | taskloopSet};
-} // namespace omp
-} // namespace llvm
namespace Fortran::semantics {
+ENUM_CLASS(OmpDirective, ATOMIC, BARRIER, CANCEL, CANCELLATION_POINT, CRITICAL,
+ DECLARE_REDUCTION, DECLARE_SIMD, DECLARE_TARGET, DISTRIBUTE,
+ DISTRIBUTE_PARALLEL_DO, DISTRIBUTE_PARALLEL_DO_SIMD, DISTRIBUTE_SIMD, DO,
+ DO_SIMD, END_CRITICAL, END_DO, END_DO_SIMD, END_SECTIONS, END_SINGLE,
+ END_WORKSHARE, FLUSH, MASTER, ORDERED, PARALLEL, PARALLEL_DO,
+ PARALLEL_DO_SIMD, PARALLEL_SECTIONS, PARALLEL_WORKSHARE, SECTION, SECTIONS,
+ SIMD, SINGLE, TARGET, TARGET_DATA, TARGET_ENTER_DATA, TARGET_EXIT_DATA,
+ TARGET_PARALLEL, TARGET_PARALLEL_DO, TARGET_PARALLEL_DO_SIMD, TARGET_SIMD,
+ TARGET_TEAMS, TARGET_TEAMS_DISTRIBUTE, TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
+ TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, TARGET_TEAMS_DISTRIBUTE_SIMD,
+ TARGET_UPDATE, TASK, TASKGROUP, TASKLOOP, TASKLOOP_SIMD, TASKWAIT,
+ TASKYIELD, TEAMS, TEAMS_DISTRIBUTE, TEAMS_DISTRIBUTE_PARALLEL_DO,
+ TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, TEAMS_DISTRIBUTE_SIMD, THREADPRIVATE,
+ WORKSHARE)
+
+using OmpDirectiveSet = common::EnumSet<OmpDirective, OmpDirective_enumSize>;
+
+ENUM_CLASS(OmpClause, ALIGNED, COLLAPSE, COPYIN, COPYPRIVATE, DEFAULT,
+ DEFAULTMAP, DEPEND, DEVICE, DIST_SCHEDULE, FINAL, FIRSTPRIVATE, FROM,
+ GRAINSIZE, IF, INBRANCH, IS_DEVICE_PTR, LASTPRIVATE, LINEAR, LINK, MAP,
+ MERGEABLE, NOGROUP, NOTINBRANCH, NOWAIT, NUM_TASKS, NUM_TEAMS, NUM_THREADS,
+ ORDERED, PRIORITY, PRIVATE, PROC_BIND, REDUCTION, SAFELEN, SCHEDULE, SHARED,
+ SIMD, SIMDLEN, THREAD_LIMIT, THREADS, TO, UNIFORM, UNTIED, USE_DEVICE_PTR)
+
+using OmpClauseSet = common::EnumSet<OmpClause, OmpClause_enumSize>;
+
+static constexpr OmpDirectiveSet parallelSet{
+ OmpDirective::DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::PARALLEL,
+ OmpDirective::PARALLEL_DO, OmpDirective::PARALLEL_DO_SIMD,
+ OmpDirective::PARALLEL_SECTIONS, OmpDirective::PARALLEL_WORKSHARE,
+ OmpDirective::TARGET_PARALLEL, OmpDirective::TARGET_PARALLEL_DO,
+ OmpDirective::TARGET_PARALLEL_DO_SIMD,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
+ OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD};
+static constexpr OmpDirectiveSet doSet{OmpDirective::DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::PARALLEL_DO,
+ OmpDirective::PARALLEL_DO_SIMD, OmpDirective::DO, OmpDirective::DO_SIMD,
+ OmpDirective::TARGET_PARALLEL_DO, OmpDirective::TARGET_PARALLEL_DO_SIMD,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
+ OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD};
+static constexpr OmpDirectiveSet doSimdSet{
+ OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::PARALLEL_DO_SIMD,
+ OmpDirective::DO_SIMD, OmpDirective::TARGET_PARALLEL_DO_SIMD,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
+ OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD};
+static constexpr OmpDirectiveSet taskloopSet{
+ OmpDirective::TASKLOOP, OmpDirective::TASKLOOP_SIMD};
+static constexpr OmpDirectiveSet targetSet{OmpDirective::TARGET,
+ OmpDirective::TARGET_PARALLEL, OmpDirective::TARGET_PARALLEL_DO,
+ OmpDirective::TARGET_PARALLEL_DO_SIMD, OmpDirective::TARGET_SIMD,
+ OmpDirective::TARGET_TEAMS, OmpDirective::TARGET_TEAMS_DISTRIBUTE,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD};
+static constexpr OmpDirectiveSet simdSet{
+ OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::DISTRIBUTE_SIMD,
+ OmpDirective::PARALLEL_DO_SIMD, OmpDirective::DO_SIMD, OmpDirective::SIMD,
+ OmpDirective::TARGET_PARALLEL_DO_SIMD,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD, OmpDirective::TARGET_SIMD,
+ OmpDirective::TASKLOOP_SIMD,
+ OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
+ OmpDirective::TEAMS_DISTRIBUTE_SIMD};
+static constexpr OmpDirectiveSet taskGeneratingSet{
+ OmpDirectiveSet{OmpDirective::TASK} | taskloopSet};
+
class OmpStructureChecker : public virtual BaseChecker {
public:
OmpStructureChecker(SemanticsContext &context) : context_{context} {}
@@ -152,18 +169,18 @@ class OmpStructureChecker : public virtual BaseChecker {
private:
struct OmpContext {
- OmpContext(parser::CharBlock source, llvm::omp::Directive d)
+ OmpContext(parser::CharBlock source, OmpDirective d)
: directiveSource{source}, directive{d} {}
parser::CharBlock directiveSource{nullptr};
parser::CharBlock clauseSource{nullptr};
- llvm::omp::Directive directive;
+ OmpDirective directive;
OmpClauseSet allowedClauses{};
OmpClauseSet allowedOnceClauses{};
OmpClauseSet allowedExclusiveClauses{};
OmpClauseSet requiredClauses{};
const parser::OmpClause *clause{nullptr};
- std::multimap<llvm::omp::Clause, const parser::OmpClause *> clauseInfo;
+ std::multimap<OmpClause, const parser::OmpClause *> clauseInfo;
};
// back() is the top of the stack
OmpContext &GetContext() {
@@ -188,7 +205,7 @@ class OmpStructureChecker : public virtual BaseChecker {
GetContext().clauseSource = clause.source;
GetContext().clause = &clause;
}
- void SetContextDirectiveEnum(llvm::omp::Directive dir) {
+ void SetContextDirectiveEnum(OmpDirective dir) {
GetContext().directive = dir;
}
void SetContextAllowed(const OmpClauseSet &allowed) {
@@ -203,30 +220,30 @@ class OmpStructureChecker : public virtual BaseChecker {
void SetContextRequired(const OmpClauseSet &required) {
GetContext().requiredClauses = required;
}
- void SetContextClauseInfo(llvm::omp::Clause type) {
+ void SetContextClauseInfo(OmpClause type) {
GetContext().clauseInfo.emplace(type, GetContext().clause);
}
- const parser::OmpClause *FindClause(llvm::omp::Clause type) {
+ const parser::OmpClause *FindClause(OmpClause type) {
auto it{GetContext().clauseInfo.find(type)};
if (it != GetContext().clauseInfo.end()) {
return it->second;
}
return nullptr;
}
- void PushContext(const parser::CharBlock &source, llvm::omp::Directive dir) {
+ void PushContext(const parser::CharBlock &source, OmpDirective dir) {
ompContext_.emplace_back(source, dir);
}
void RequiresConstantPositiveParameter(
- const llvm::omp::Clause &clause, const parser::ScalarIntConstantExpr &i);
+ const OmpClause &clause, const parser::ScalarIntConstantExpr &i);
void RequiresPositiveParameter(
- const llvm::omp::Clause &clause, const parser::ScalarIntExpr &i);
+ const OmpClause &clause, const parser::ScalarIntExpr &i);
bool CurrentDirectiveIsNested() { return ompContext_.size() > 0; };
bool HasInvalidWorksharingNesting(
const parser::CharBlock &, const OmpDirectiveSet &);
- void CheckAllowed(llvm::omp::Clause);
- void CheckRequired(llvm::omp::Clause);
+ void CheckAllowed(OmpClause);
+ void CheckRequired(OmpClause);
std::string ContextDirectiveAsFortran();
void SayNotMatching(const parser::CharBlock &, const parser::CharBlock &);
template <typename A, typename B, typename C>
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 51abeced62b2..277f5f77d1b3 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1150,9 +1150,9 @@ bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
switch (beginDir.v) {
- case llvm::omp::Directive::OMPD_target_data:
- case llvm::omp::Directive::OMPD_master:
- case llvm::omp::Directive::OMPD_ordered:
+ case parser::OmpBlockDirective::Directive::TargetData:
+ case parser::OmpBlockDirective::Directive::Master:
+ case parser::OmpBlockDirective::Directive::Ordered:
return false;
default:
return true;
@@ -1236,11 +1236,10 @@ class OmpAttributeVisitor {
private:
struct OmpContext {
- OmpContext(
- const parser::CharBlock &source, llvm::omp::Directive d, Scope &s)
+ OmpContext(const parser::CharBlock &source, OmpDirective d, Scope &s)
: directiveSource{source}, directive{d}, scope{s} {}
parser::CharBlock directiveSource;
- llvm::omp::Directive directive;
+ OmpDirective directive;
Scope &scope;
// TODO: default DSA is implicitly determined in
diff erent ways
Symbol::Flag defaultDSA{Symbol::Flag::OmpShared};
@@ -1254,14 +1253,14 @@ class OmpAttributeVisitor {
CHECK(!ompContext_.empty());
return ompContext_.back();
}
- void PushContext(const parser::CharBlock &source, llvm::omp::Directive dir) {
+ void PushContext(const parser::CharBlock &source, OmpDirective dir) {
ompContext_.emplace_back(source, dir, context_.FindScope(source));
}
void PopContext() { ompContext_.pop_back(); }
void SetContextDirectiveSource(parser::CharBlock &dir) {
GetContext().directiveSource = dir;
}
- void SetContextDirectiveEnum(llvm::omp::Directive dir) {
+ void SetContextDirectiveEnum(OmpDirective dir) {
GetContext().directive = dir;
}
Scope &currScope() { return GetContext().scope; }
@@ -6442,19 +6441,41 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
switch (beginDir.v) {
- case llvm::omp::Directive::OMPD_master:
- case llvm::omp::Directive::OMPD_ordered:
- case llvm::omp::Directive::OMPD_parallel:
- case llvm::omp::Directive::OMPD_single:
- case llvm::omp::Directive::OMPD_target:
- case llvm::omp::Directive::OMPD_target_data:
- case llvm::omp::Directive::OMPD_task:
- case llvm::omp::Directive::OMPD_teams:
- case llvm::omp::Directive::OMPD_workshare:
- case llvm::omp::Directive::OMPD_parallel_workshare:
- case llvm::omp::Directive::OMPD_target_teams:
- case llvm::omp::Directive::OMPD_target_parallel:
- PushContext(beginDir.source, beginDir.v);
+ case parser::OmpBlockDirective::Directive::Master:
+ PushContext(beginDir.source, OmpDirective::MASTER);
+ break;
+ case parser::OmpBlockDirective::Directive::Ordered:
+ PushContext(beginDir.source, OmpDirective::ORDERED);
+ break;
+ case parser::OmpBlockDirective::Directive::Parallel:
+ PushContext(beginDir.source, OmpDirective::PARALLEL);
+ break;
+ case parser::OmpBlockDirective::Directive::Single:
+ PushContext(beginDir.source, OmpDirective::SINGLE);
+ break;
+ case parser::OmpBlockDirective::Directive::Target:
+ PushContext(beginDir.source, OmpDirective::TARGET);
+ break;
+ case parser::OmpBlockDirective::Directive::TargetData:
+ PushContext(beginDir.source, OmpDirective::TARGET_DATA);
+ break;
+ case parser::OmpBlockDirective::Directive::Task:
+ PushContext(beginDir.source, OmpDirective::TASK);
+ break;
+ case parser::OmpBlockDirective::Directive::Teams:
+ PushContext(beginDir.source, OmpDirective::TEAMS);
+ break;
+ case parser::OmpBlockDirective::Directive::Workshare:
+ PushContext(beginDir.source, OmpDirective::WORKSHARE);
+ break;
+ case parser::OmpBlockDirective::Directive::ParallelWorkshare:
+ PushContext(beginDir.source, OmpDirective::PARALLEL_WORKSHARE);
+ break;
+ case parser::OmpBlockDirective::Directive::TargetTeams:
+ PushContext(beginDir.source, OmpDirective::TARGET_TEAMS);
+ break;
+ case parser::OmpBlockDirective::Directive::TargetParallel:
+ PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL);
break;
default:
// TODO others
@@ -6469,31 +6490,74 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPLoopConstruct &x) {
const auto &beginDir{std::get<parser::OmpLoopDirective>(beginLoopDir.t)};
const auto &clauseList{std::get<parser::OmpClauseList>(beginLoopDir.t)};
switch (beginDir.v) {
- case llvm::omp::Directive::OMPD_distribute:
- case llvm::omp::Directive::OMPD_distribute_parallel_do:
- case llvm::omp::Directive::OMPD_distribute_parallel_do_simd:
- case llvm::omp::Directive::OMPD_distribute_simd:
- case llvm::omp::Directive::OMPD_do:
- case llvm::omp::Directive::OMPD_do_simd:
- case llvm::omp::Directive::OMPD_parallel_do:
- case llvm::omp::Directive::OMPD_parallel_do_simd:
- case llvm::omp::Directive::OMPD_simd:
- case llvm::omp::Directive::OMPD_target_parallel_do:
- case llvm::omp::Directive::OMPD_target_parallel_do_simd:
- case llvm::omp::Directive::OMPD_target_teams_distribute:
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
- case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd:
- case llvm::omp::Directive::OMPD_target_teams_distribute_simd:
- case llvm::omp::Directive::OMPD_target_simd:
- case llvm::omp::Directive::OMPD_taskloop:
- case llvm::omp::Directive::OMPD_taskloop_simd:
- case llvm::omp::Directive::OMPD_teams_distribute:
- case llvm::omp::Directive::OMPD_teams_distribute_parallel_do:
- case llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd:
- case llvm::omp::Directive::OMPD_teams_distribute_simd:
- PushContext(beginDir.source, beginDir.v);
+ case parser::OmpLoopDirective::Directive::Distribute:
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE);
break;
- default:
+ case parser::OmpLoopDirective::Directive::DistributeParallelDo:
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE_PARALLEL_DO);
+ break;
+ case parser::OmpLoopDirective::Directive::DistributeParallelDoSimd:
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::DistributeSimd:
+ PushContext(beginDir.source, OmpDirective::DISTRIBUTE_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::Do:
+ PushContext(beginDir.source, OmpDirective::DO);
+ break;
+ case parser::OmpLoopDirective::Directive::DoSimd:
+ PushContext(beginDir.source, OmpDirective::DO_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::ParallelDo:
+ PushContext(beginDir.source, OmpDirective::PARALLEL_DO);
+ break;
+ case parser::OmpLoopDirective::Directive::ParallelDoSimd:
+ PushContext(beginDir.source, OmpDirective::PARALLEL_DO_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::Simd:
+ PushContext(beginDir.source, OmpDirective::SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetParallelDo:
+ PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL_DO);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetParallelDoSimd:
+ PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL_DO_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistribute:
+ PushContext(beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo:
+ PushContext(
+ beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd:
+ PushContext(beginDir.source,
+ OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetTeamsDistributeSimd:
+ PushContext(beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::TargetSimd:
+ PushContext(beginDir.source, OmpDirective::TARGET_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::Taskloop:
+ PushContext(beginDir.source, OmpDirective::TASKLOOP);
+ break;
+ case parser::OmpLoopDirective::Directive::TaskloopSimd:
+ PushContext(beginDir.source, OmpDirective::TASKLOOP_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::TeamsDistribute:
+ PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE);
+ break;
+ case parser::OmpLoopDirective::Directive::TeamsDistributeParallelDo:
+ PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO);
+ break;
+ case parser::OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd:
+ PushContext(
+ beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
+ break;
+ case parser::OmpLoopDirective::Directive::TeamsDistributeSimd:
+ PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_SIMD);
break;
}
ClearDataSharingAttributeObjects();
@@ -6517,8 +6581,8 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
if (targetIt == ompContext_.rend()) {
return;
}
- if (llvm::omp::parallelSet.test(targetIt->directive) ||
- llvm::omp::taskGeneratingSet.test(targetIt->directive)) {
+ if (parallelSet.test(targetIt->directive) ||
+ taskGeneratingSet.test(targetIt->directive)) {
break;
}
}
@@ -6605,7 +6669,7 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndex(
if (level <= 0)
return;
Symbol::Flag ivDSA{Symbol::Flag::OmpPrivate};
- if (llvm::omp::simdSet.test(GetContext().directive)) {
+ if (simdSet.test(GetContext().directive)) {
if (level == 1) {
ivDSA = Symbol::Flag::OmpLinear;
} else {
@@ -6636,11 +6700,11 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPSectionsConstruct &x) {
const auto &beginDir{
std::get<parser::OmpSectionsDirective>(beginSectionsDir.t)};
switch (beginDir.v) {
- case llvm::omp::Directive::OMPD_parallel_sections:
- case llvm::omp::Directive::OMPD_sections:
- PushContext(beginDir.source, beginDir.v);
+ case parser::OmpSectionsDirective::Directive::ParallelSections:
+ PushContext(beginDir.source, OmpDirective::PARALLEL_SECTIONS);
break;
- default:
+ case parser::OmpSectionsDirective::Directive::Sections:
+ PushContext(beginDir.source, OmpDirective::SECTIONS);
break;
}
ClearDataSharingAttributeObjects();
@@ -6648,7 +6712,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPSectionsConstruct &x) {
}
bool OmpAttributeVisitor::Pre(const parser::OpenMPThreadprivate &x) {
- PushContext(x.source, llvm::omp::Directive::OMPD_threadprivate);
+ PushContext(x.source, OmpDirective::THREADPRIVATE);
const auto &list{std::get<parser::OmpObjectList>(x.t)};
ResolveOmpObjectList(list, Symbol::Flag::OmpThreadprivate);
return false;
diff --git a/flang/tools/f18-parse-demo/CMakeLists.txt b/flang/tools/f18-parse-demo/CMakeLists.txt
index 465873ca00ff..d60d7d6d5cbd 100644
--- a/flang/tools/f18-parse-demo/CMakeLists.txt
+++ b/flang/tools/f18-parse-demo/CMakeLists.txt
@@ -1,7 +1,3 @@
-set(LLVM_LINK_COMPONENTS
- FrontendOpenMP
- )
-
add_flang_tool(f18-parse-demo
f18-parse-demo.cpp
stub-evaluate.cpp
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index ed44676d2fa1..8813b2d434ef 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -189,9 +189,6 @@ def OMPC_Unknown : Clause<"unknown"> {
let isImplicit = 1;
let isDefault = 1;
}
-def OMPC_Link : Clause<"link"> {}
-def OMPC_Inbranch : Clause<"inbranch"> {}
-def OMPC_Notinbranch : Clause<"notinbranch"> {}
//===----------------------------------------------------------------------===//
// Definition of OpenMP directives
@@ -219,11 +216,6 @@ def OMP_For : Directive<"for"> {
OMPC_Reduction, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered, OMPC_NoWait,
OMPC_Linear, OMPC_Allocate, OMPC_Order];
}
-def OMP_Do : Directive<"do"> {
- let allowedClauses = [OMPC_Private, OMPC_FirstPrivate, OMPC_LastPrivate,
- OMPC_Linear, OMPC_Reduction];
- let allowedOnceClauses = [OMPC_Schedule, OMPC_Collapse, OMPC_Ordered];
-}
def OMP_Sections : Directive<"sections"> {
let allowedClauses = [OMPC_Private, OMPC_LastPrivate, OMPC_FirstPrivate,
OMPC_Reduction, OMPC_NoWait, OMPC_Allocate];
@@ -297,14 +289,6 @@ def OMP_TargetParallelFor : Directive<"target parallel for"> {
OMPC_Linear, OMPC_IsDevicePtr, OMPC_Allocator, OMPC_Order,
OMPC_UsesAllocators];
}
-def OMP_TargetParallelDo : Directive<"target parallel do"> {
- let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
- OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_NoWait, OMPC_Depend,
- OMPC_DefaultMap, OMPC_NumThreads, OMPC_DefaultMap, OMPC_ProcBind,
- OMPC_Shared, OMPC_Reduction, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered,
- OMPC_Linear, OMPC_IsDevicePtr, OMPC_Allocator, OMPC_Order,
- OMPC_UsesAllocators];
-}
def OMP_TargetUpdate : Directive<"target update"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_To, OMPC_From, OMPC_NoWait,
OMPC_Depend];
@@ -315,12 +299,6 @@ def OMP_ParallelFor : Directive<"parallel for"> {
OMPC_LastPrivate, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered, OMPC_Linear,
OMPC_Allocate, OMPC_Order];
}
-def OMP_ParallelDo : Directive<"parallel do"> {
- let allowedClauses = [ OMPC_Default, OMPC_Private, OMPC_FirstPrivate,
- OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_LastPrivate, OMPC_Linear];
- let allowedOnceClauses = [OMPC_If, OMPC_NumThreads, OMPC_ProcBind,
- OMPC_Schedule, OMPC_Ordered, OMPC_Collapse];
-}
def OMP_ParallelForSimd : Directive<"parallel for simd"> {
let allowedClauses = [OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_FirstPrivate, OMPC_Shared, OMPC_Reduction, OMPC_Copyin,
@@ -328,13 +306,6 @@ def OMP_ParallelForSimd : Directive<"parallel for simd"> {
OMPC_SimdLen, OMPC_Linear, OMPC_Aligned, OMPC_Ordered, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order];
}
-def OMP_ParallelDoSimd : Directive<"parallel do simd"> {
- let allowedClauses = [OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
- OMPC_Private, OMPC_FirstPrivate, OMPC_Shared, OMPC_Reduction, OMPC_Copyin,
- OMPC_LastPrivate, OMPC_Collapse, OMPC_Schedule, OMPC_SafeLen,
- OMPC_SimdLen, OMPC_Linear, OMPC_Aligned, OMPC_Ordered, OMPC_Allocate,
- OMPC_NonTemporal, OMPC_Order];
-}
def OMP_ParallelMaster : Directive<"parallel master"> {
let allowedClauses = [OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_Private,
OMPC_FirstPrivate, OMPC_Shared, OMPC_Copyin, OMPC_Reduction,
@@ -351,12 +322,6 @@ def OMP_ForSimd : Directive<"for simd"> {
OMPC_SimdLen, OMPC_Linear, OMPC_Aligned, OMPC_Ordered, OMPC_Allocate,
OMPC_If, OMPC_NonTemporal, OMPC_Order];
}
-def OMP_DoSimd : Directive<"do simd"> {
- let allowedClauses = [OMPC_Aligned, OMPC_Private, OMPC_FirstPrivate,
- OMPC_LastPrivate, OMPC_Linear, OMPC_Reduction];
- let allowedOnceClauses = [OMPC_Schedule, OMPC_Collapse, OMPC_Ordered,
- OMPC_SafeLen, OMPC_SimdLen];
-}
def OMP_CancellationPoint : Directive<"cancellation point"> {}
def OMP_DeclareReduction : Directive<"declare reduction"> {}
def OMP_DeclareMapper : Directive<"declare mapper"> {
@@ -388,12 +353,6 @@ def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_Schedule,
OMPC_Allocate, OMPC_Order];
}
-def OMP_DistributeParallelDo : Directive<"distribute parallel do"> {
- let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
- OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
- OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_Schedule,
- OMPC_Allocate, OMPC_Order];
-}
def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
@@ -401,13 +360,6 @@ def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order];
}
-def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
- let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
- OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
- OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_Schedule,
- OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
- OMPC_NonTemporal, OMPC_Order];
-}
def OMP_DistributeSimd : Directive<"distribute simd"> {
let allowedClauses = [OMPC_Private, OMPC_FirstPrivate, OMPC_LastPrivate,
OMPC_Collapse, OMPC_DistSchedule, OMPC_Linear, OMPC_Aligned, OMPC_SafeLen,
@@ -422,14 +374,6 @@ def OMP_TargetParallelForSimd : Directive<"target parallel for simd"> {
OMPC_Linear, OMPC_SafeLen, OMPC_SimdLen, OMPC_Aligned, OMPC_IsDevicePtr,
OMPC_Allocate, OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
}
-def OMP_TargetParallelDoSimd : Directive<"target parallel do simd"> {
- let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
- OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_NoWait, OMPC_Depend,
- OMPC_DefaultMap, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
- OMPC_Shared, OMPC_Reduction, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered,
- OMPC_Linear, OMPC_SafeLen, OMPC_SimdLen, OMPC_Aligned, OMPC_IsDevicePtr,
- OMPC_Allocate, OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
-}
def OMP_TargetSimd : Directive<"target simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
@@ -457,14 +401,6 @@ def OMP_TeamsDistributeParallelForSimd :
OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_NumTeams, OMPC_ThreadLimit,
OMPC_Allocate, OMPC_NonTemporal, OMPC_Order];
}
-def OMP_TeamsDistributeParallelDoSimd :
- Directive<"teams distribute parallel do simd"> {
- let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
- OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
- OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Schedule, OMPC_Linear,
- OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_NumTeams, OMPC_ThreadLimit,
- OMPC_Allocate, OMPC_NonTemporal, OMPC_Order];
-}
def OMP_TeamsDistributeParallelFor :
Directive<"teams distribute parallel for"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
@@ -472,13 +408,6 @@ def OMP_TeamsDistributeParallelFor :
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Schedule, OMPC_NumTeams,
OMPC_ThreadLimit, OMPC_Copyin, OMPC_Allocate, OMPC_Order];
}
-def OMP_TeamsDistributeParallelDo :
- Directive<"teams distribute parallel do"> {
- let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
- OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
- OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Schedule, OMPC_NumTeams,
- OMPC_ThreadLimit, OMPC_Copyin, OMPC_Allocate, OMPC_Order];
-}
def OMP_TargetTeams : Directive<"target teams"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
@@ -501,15 +430,6 @@ def OMP_TargetTeamsDistributeParallelFor :
OMPC_DistSchedule, OMPC_NumThreads, OMPC_ProcBind, OMPC_Schedule,
OMPC_Allocate, OMPC_Order, OMPC_UsesAllocators];
}
-def OMP_TargetTeamsDistributeParallelDo :
- Directive<"target teams distribute parallel do"> {
- let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
- OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
- OMPC_IsDevicePtr, OMPC_Default, OMPC_Shared, OMPC_Reduction,
- OMPC_NumTeams, OMPC_ThreadLimit, OMPC_LastPrivate, OMPC_Collapse,
- OMPC_DistSchedule, OMPC_NumThreads, OMPC_ProcBind, OMPC_Schedule,
- OMPC_Allocate, OMPC_Order, OMPC_UsesAllocators];
-}
def OMP_TargetTeamsDistributeParallelForSimd :
Directive<"target teams distribute parallel for simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
@@ -520,16 +440,6 @@ def OMP_TargetTeamsDistributeParallelForSimd :
OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
}
-def OMP_TargetTeamsDistributeParallelDoSimd :
- Directive<"target teams distribute parallel do simd"> {
- let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
- OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
- OMPC_IsDevicePtr, OMPC_Default, OMPC_Shared, OMPC_Reduction,
- OMPC_NumTeams, OMPC_ThreadLimit, OMPC_LastPrivate, OMPC_Collapse,
- OMPC_DistSchedule, OMPC_NumThreads, OMPC_ProcBind, OMPC_Schedule,
- OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
- OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
-}
def OMP_TargetTeamsDistributeSimd :
Directive<"target teams distribute simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
@@ -584,13 +494,6 @@ def OMP_Scan : Directive<"scan"> {
}
def OMP_BeginDeclareVariant : Directive<"begin declare variant"> {}
def OMP_EndDeclareVariant : Directive<"end declare variant"> {}
-def OMP_ParallelWorkshare : Directive<"parallel workshare"> {}
-def OMP_Workshare : Directive<"workshare"> {}
-def OMP_EndDo : Directive<"end do"> {}
-def OMP_EndDoSimd : Directive<"end do simd"> {}
-def OMP_EndSections : Directive<"end sections"> {}
-def OMP_EndSingle : Directive<"end single"> {}
-def OMP_EndWorkshare : Directive<"end workshare"> {}
def OMP_Unknown : Directive<"unknown"> {
let isDefault = 1;
}
More information about the llvm-commits
mailing list