Author: sameeran joshi Date: 2020-12-22T14:02:19+05:30 New Revision: e282ae57da29a37e143ab6d640f68e794f5cd614
URL: https://github.com/llvm/llvm-project/commit/e282ae57da29a37e143ab6d640f68e794f5cd614 DIFF: https://github.com/llvm/llvm-project/commit/e282ae57da29a37e143ab6d640f68e794f5cd614.diff LOG: [Flang][openmp][4/5] Make nowait clause part of OmpClause After discussion in `D93482` we found that the some of the clauses were not following the common OmpClause convention. The benefits of using OmpClause: - Functionalities from structure checker are mostly aligned to work with `llvm::omp::Clause`. - The unparsing as well can take advantage. - Homogeneity with OpenACC and rest of the clauses in OpenMP. - Could even generate the parser with TableGen, when there is homogeneity. - It becomes confusing when to use `flangClass` and `flangClassValue` inside TableGen, if incase we generate parser using TableGen we could have only a single `let expression`. This patch makes `OmpNoWait` clause part of `OmpClause`. Reviewed By: clementval, kiranktp Differential Revision: https://reviews.llvm.org/D93643 Added: Modified: flang/include/flang/Parser/dump-parse-tree.h flang/include/flang/Parser/parse-tree.h flang/lib/Parser/openmp-parsers.cpp flang/lib/Parser/unparse.cpp flang/lib/Semantics/check-omp-structure.cpp flang/lib/Semantics/check-omp-structure.h llvm/include/llvm/Frontend/OpenMP/OMP.td Removed: ################################################################################ diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h index f69dd149e0a3..05152f8c49c6 100644 --- a/flang/include/flang/Parser/dump-parse-tree.h +++ b/flang/include/flang/Parser/dump-parse-tree.h @@ -508,7 +508,6 @@ class ParseTreeDumper { "llvm::omp::Clause = ", llvm::omp::getOpenMPClauseName(x)) .str(); } - NODE(parser, OmpNowait) NODE(parser, OmpObject) NODE(parser, OmpObjectList) NODE(parser, OmpProcBindClause) diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h index 59fa278e0029..09c61477d2e7 100644 --- a/flang/include/flang/Parser/parse-tree.h +++ b/flang/include/flang/Parser/parse-tree.h @@ -3456,9 +3456,6 @@ struct OmpDependClause { std::variant<Source, Sink, InOut> u; }; -// 2.7.1 nowait-clause -> NOWAIT -EMPTY_CLASS(OmpNowait); - // dist_schedule clause does not fit in generic clause class for tablegen. // Therefore it is declared separatly here. WRAPPER_CLASS(OmpDistScheduleClause, std::optional<ScalarIntExpr>); diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index 50999bef8f52..62dd0d1e7d29 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -203,7 +203,7 @@ TYPE_PARSER( "NOGROUP" >> construct<OmpClause>(construct<OmpClause::Nogroup>()) || "NOTINBRANCH" >> construct<OmpClause>(construct<OmpClause::Notinbranch>()) || - "NOWAIT" >> construct<OmpClause>(construct<OmpNowait>()) || + "NOWAIT" >> construct<OmpClause>(construct<OmpClause::Nowait>()) || "NUM_TASKS" >> construct<OmpClause>(construct<OmpClause::NumTasks>( parenthesized(scalarIntExpr))) || "NUM_TEAMS" >> construct<OmpClause>(construct<OmpClause::NumTeams>( diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp index 6be063c1b1bc..5dbf9940e26e 100644 --- a/flang/lib/Parser/unparse.cpp +++ b/flang/lib/Parser/unparse.cpp @@ -2065,7 +2065,6 @@ class UnparseVisitor { std::get<std::optional<OmpDefaultmapClause::VariableCategory>>(x.t)); Word(")"); } - void Unparse(const OmpNowait &) { Word("NOWAIT"); } void Unparse(const OmpDistScheduleClause &x) { Word("DIST_SCHEDULE(STATIC"); Walk(", ", x.v); diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 481099b34966..c901630c098b 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -418,6 +418,7 @@ CHECK_SIMPLE_CLAUSE(Link, OMPC_link) CHECK_SIMPLE_CLAUSE(Mergeable, OMPC_mergeable) CHECK_SIMPLE_CLAUSE(Nogroup, OMPC_nogroup) CHECK_SIMPLE_CLAUSE(Notinbranch, OMPC_notinbranch) +CHECK_SIMPLE_CLAUSE(Nowait, OMPC_nowait) CHECK_SIMPLE_CLAUSE(To, OMPC_to) CHECK_SIMPLE_CLAUSE(Uniform, OMPC_uniform) CHECK_SIMPLE_CLAUSE(Untied, OMPC_untied) @@ -493,7 +494,6 @@ void OmpStructureChecker::CheckIsVarPartOfAnotherVar( } // Following clauses have a seperate node in parse-tree.h. CHECK_SIMPLE_PARSER_CLAUSE(OmpDistScheduleClause, OMPC_dist_schedule) -CHECK_SIMPLE_PARSER_CLAUSE(OmpNowait, OMPC_nowait) CHECK_SIMPLE_PARSER_CLAUSE(OmpReductionClause, OMPC_reduction) // Atomic-clause CHECK_SIMPLE_PARSER_CLAUSE(OmpAtomicRead, OMPC_read) diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h index 89fc3d9faa21..72bb9a523366 100644 --- a/flang/lib/Semantics/check-omp-structure.h +++ b/flang/lib/Semantics/check-omp-structure.h @@ -126,12 +126,12 @@ class OmpStructureChecker void Leave(const parser::OmpClauseList &); void Enter(const parser::OmpClause &); - void Enter(const parser::OmpNowait &); void Enter(const parser::OmpClause::Allocate &); void Enter(const parser::OmpClause::Allocator &); void Enter(const parser::OmpClause::Inbranch &); void Enter(const parser::OmpClause::Mergeable &); void Enter(const parser::OmpClause::Nogroup &); + void Enter(const parser::OmpClause::Nowait &); void Enter(const parser::OmpClause::Notinbranch &); void Enter(const parser::OmpClause::Untied &); void Enter(const parser::OmpClause::Collapse &); diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td index 28b978975ba0..5c8895b5650e 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMP.td +++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -147,7 +147,6 @@ def OMPC_Ordered : Clause<"ordered"> { } def OMPC_NoWait : Clause<"nowait"> { let clangClass = "OMPNowaitClause"; - let flangClass = "OmpNowait"; } def OMPC_Untied : Clause<"untied"> { let clangClass = "OMPUntiedClause"; } def OMPC_Mergeable : Clause<"mergeable"> { _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits