summaryrefslogtreecommitdiff
path: root/flang/lib/Parser/openmp-parsers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Parser/openmp-parsers.cpp')
-rw-r--r--flang/lib/Parser/openmp-parsers.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index cec08e18e44c..13ebb7f7efdc 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -140,9 +140,35 @@ TYPE_PARSER(construct<OmpReductionClause>(
TYPE_PARSER(construct<OmpInReductionClause>(
Parser<OmpReductionOperator>{} / ":", Parser<OmpObjectList>{}))
-// OMP 5.0 2.11.4 ALLOCATE ([allocator:] variable-name-list)
+// OMP 5.0 2.11.4 allocate-clause -> ALLOCATE ([allocator:] variable-name-list)
+// OMP 5.2 2.13.4 allocate-clause -> ALLOCATE ([allocate-modifier
+// [, allocate-modifier] :]
+// variable-name-list)
+// allocate-modifier -> allocator | align
TYPE_PARSER(construct<OmpAllocateClause>(
- maybe(construct<OmpAllocateClause::Allocator>(scalarIntExpr) / ":"),
+ maybe(
+ first(
+ construct<OmpAllocateClause::AllocateModifier>("ALLOCATOR" >>
+ construct<OmpAllocateClause::AllocateModifier::ComplexModifier>(
+ parenthesized(construct<
+ OmpAllocateClause::AllocateModifier::Allocator>(
+ scalarIntExpr)) /
+ ",",
+ "ALIGN" >> parenthesized(construct<
+ OmpAllocateClause::AllocateModifier::Align>(
+ scalarIntExpr)))),
+ construct<OmpAllocateClause::AllocateModifier>("ALLOCATOR" >>
+ parenthesized(
+ construct<OmpAllocateClause::AllocateModifier::Allocator>(
+ scalarIntExpr))),
+ construct<OmpAllocateClause::AllocateModifier>("ALIGN" >>
+ parenthesized(
+ construct<OmpAllocateClause::AllocateModifier::Align>(
+ scalarIntExpr))),
+ construct<OmpAllocateClause::AllocateModifier>(
+ construct<OmpAllocateClause::AllocateModifier::Allocator>(
+ scalarIntExpr))) /
+ ":"),
Parser<OmpObjectList>{}))
// 2.13.9 DEPEND (SOURCE | SINK : vec | (IN | OUT | INOUT) : list
@@ -562,6 +588,16 @@ TYPE_PARSER(
maybe(nonemptyList(Parser<OpenMPDeclarativeAllocate>{})) / endOmpLine,
statement(allocateStmt))))
+// 6.7 Allocators construct [OpenMP 5.2]
+// allocators-construct -> ALLOCATORS [allocate-clause [,]]
+// allocate-stmt
+// [omp-end-allocators-construct]
+TYPE_PARSER(sourced(construct<OpenMPAllocatorsConstruct>(
+ verbatim("ALLOCATORS"_tok), Parser<OmpClauseList>{} / endOmpLine,
+ statement(allocateStmt), maybe(Parser<OmpEndAllocators>{} / endOmpLine))))
+
+TYPE_PARSER(construct<OmpEndAllocators>(startOmpLine >> "END ALLOCATORS"_tok))
+
// 2.8.2 Declare Simd construct
TYPE_PARSER(
sourced(construct<OpenMPDeclareSimdConstruct>(verbatim("DECLARE SIMD"_tok),
@@ -638,6 +674,7 @@ TYPE_CONTEXT_PARSER("OpenMP construct"_en_US,
construct<OpenMPConstruct>(Parser<OpenMPStandaloneConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPAtomicConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPExecutableAllocate>{}),
+ construct<OpenMPConstruct>(Parser<OpenMPAllocatorsConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPDeclarativeAllocate>{}),
construct<OpenMPConstruct>(Parser<OpenMPCriticalConstruct>{})))