diff options
author | Valentin Clement <clementval@gmail.com> | 2021-01-04 15:18:46 -0500 |
---|---|---|
committer | clementval <clementval@gmail.com> | 2021-01-04 15:19:00 -0500 |
commit | 4d0aad96e431ba78323dd3c7ee9ecd6f5552375d (patch) | |
tree | cee2f57508c4b69b1fc05d775df7925455ec7a9f /flang | |
parent | 4034f9273edacbb1c37acf19139594a226c8bdac (diff) | |
download | llvm-4d0aad96e431ba78323dd3c7ee9ecd6f5552375d.tar.gz |
[flang][openmp] Make Reduction clause part of OmpClause
After discussion in D93105 we found that the reduction clause was not following
the common OmpClause convention. This patch makes reduction clause part of OmpClause
with a value of OmpReductionClause in a similar way than task_reduction.
The unparse function for OmpReductionClause is adapted since the keyword and parenthesis
are issued by the corresponding unparse function for parser::OmpClause::Reduction.
Reviewed By: sameeranjoshi
Differential Revision: https://reviews.llvm.org/D93482
Diffstat (limited to 'flang')
-rw-r--r-- | flang/lib/Parser/openmp-parsers.cpp | 4 | ||||
-rw-r--r-- | flang/lib/Parser/unparse.cpp | 2 | ||||
-rw-r--r-- | flang/lib/Semantics/check-omp-structure.cpp | 2 | ||||
-rw-r--r-- | flang/lib/Semantics/check-omp-structure.h | 2 |
4 files changed, 4 insertions, 6 deletions
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index 3a0d28cd9c12..4588a95f2938 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -218,8 +218,8 @@ TYPE_PARSER( parenthesized(Parser<OmpObjectList>{}))) || "PROC_BIND" >> construct<OmpClause>(construct<OmpClause::ProcBind>( parenthesized(Parser<OmpProcBindClause>{}))) || - "REDUCTION" >> - construct<OmpClause>(parenthesized(Parser<OmpReductionClause>{})) || + "REDUCTION" >> construct<OmpClause>(construct<OmpClause::Reduction>( + parenthesized(Parser<OmpReductionClause>{}))) || "TASK_REDUCTION" >> construct<OmpClause>(construct<OmpClause::TaskReduction>( parenthesized(Parser<OmpReductionClause>{}))) || diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp index ba54a0a84fa7..2086862551d9 100644 --- a/flang/lib/Parser/unparse.cpp +++ b/flang/lib/Parser/unparse.cpp @@ -2013,11 +2013,9 @@ public: Put(")"); } void Unparse(const OmpReductionClause &x) { - Word("REDUCTION("); Walk(std::get<OmpReductionOperator>(x.t)); Put(":"); Walk(std::get<OmpObjectList>(x.t)); - Put(")"); } void Unparse(const OmpAllocateClause &x) { Walk(std::get<std::optional<OmpAllocateClause::Allocator>>(x.t)); diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index a144c7a2b57b..1a7e1dfdbfd2 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -419,6 +419,7 @@ 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(Reduction, OMPC_reduction) CHECK_SIMPLE_CLAUSE(TaskReduction, OMPC_task_reduction) CHECK_SIMPLE_CLAUSE(To, OMPC_to) CHECK_SIMPLE_CLAUSE(Uniform, OMPC_uniform) @@ -495,7 +496,6 @@ void OmpStructureChecker::CheckIsVarPartOfAnotherVar( } } // Following clauses have a seperate node in parse-tree.h. -CHECK_SIMPLE_PARSER_CLAUSE(OmpReductionClause, OMPC_reduction) // Atomic-clause CHECK_SIMPLE_PARSER_CLAUSE(OmpAtomicRead, OMPC_read) CHECK_SIMPLE_PARSER_CLAUSE(OmpAtomicWrite, OMPC_write) diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h index ccd0e08a8c08..7a96db3ec603 100644 --- a/flang/lib/Semantics/check-omp-structure.h +++ b/flang/lib/Semantics/check-omp-structure.h @@ -152,6 +152,7 @@ public: void Enter(const parser::OmpClause::Priority &); void Enter(const parser::OmpClause::Private &); void Enter(const parser::OmpClause::ProcBind &); + void Enter(const parser::OmpClause::Reduction &); void Enter(const parser::OmpClause::Safelen &); void Enter(const parser::OmpClause::Shared &); void Enter(const parser::OmpClause::Simdlen &); @@ -184,7 +185,6 @@ public: void Enter(const parser::OmpIfClause &); void Enter(const parser::OmpLinearClause &); void Enter(const parser::OmpMapClause &); - void Enter(const parser::OmpReductionClause &); void Enter(const parser::OmpScheduleClause &); private: |