[flang] Add missing IS_DEVICE_PTR and LINK clauses for OpenMP parsing
authorJinxin Yang <jinxiny@nvidia.com>
Thu, 13 Jun 2019 22:33:15 +0000 (15:33 -0700)
committerJinxin Yang <jinxiny@nvidia.com>
Thu, 13 Jun 2019 22:33:15 +0000 (15:33 -0700)
Original-commit: flang-compiler/f18@541d4031e0d8b79a2fb7e68797d7f64b54980d78
Reviewed-on: https://github.com/flang-compiler/f18/pull/501

flang/lib/parser/dump-parse-tree.h
flang/lib/parser/openmp-grammar.h
flang/lib/parser/parse-tree.h
flang/lib/parser/unparse.cc

index 10867fd..10fe66b 100644 (file)
@@ -473,9 +473,11 @@ public:
   NODE(parser::OmpClause, Simdlen)
   NODE(parser::OmpClause, ThreadLimit)
   NODE(parser::OmpClause, To)
+  NODE(parser::OmpClause, Link)
   NODE(parser::OmpClause, Uniform)
   NODE(parser::OmpClause, Untied)
   NODE(parser::OmpClause, UseDevicePtr)
+  NODE(parser::OmpClause, IsDevicePtr)
   NODE(parser, OmpDefaultClause)
   NODE_ENUM(parser::OmpDefaultClause, Type)
   NODE(parser, OmpDependClause)
index 4cb7b87..5e45275 100644 (file)
@@ -211,10 +211,14 @@ TYPE_PARSER("DEFAULTMAP" >>
                           parenthesized(scalarIntExpr))) ||
     "TO" >> construct<OmpClause>(construct<OmpClause::To>(
                 parenthesized(nonemptyList(designator)))) ||
+    "LINK" >> construct<OmpClause>(construct<OmpClause::Link>(
+                  parenthesized(nonemptyList(designator)))) ||
     "UNIFORM" >> construct<OmpClause>(construct<OmpClause::Uniform>(
                      parenthesized(nonemptyList(name)))) ||
     "USE_DEVICE_PTR" >> construct<OmpClause>(construct<OmpClause::UseDevicePtr>(
                             parenthesized(nonemptyList(name)))) ||
+    "IS_DEVICE_PTR" >> construct<OmpClause>(construct<OmpClause::IsDevicePtr>(
+                           parenthesized(nonemptyList(name)))) ||
     "ALIGNED" >>
         construct<OmpClause>(parenthesized(Parser<OmpAlignedClause>{})) ||
     "DEFAULT" >>
index ddc20c7..cc414b6 100644 (file)
@@ -3441,15 +3441,18 @@ struct OmpClause {
   WRAPPER_CLASS(Simdlen, ScalarIntConstantExpr);
   WRAPPER_CLASS(ThreadLimit, ScalarIntExpr);
   WRAPPER_CLASS(To, std::list<Designator>);
+  WRAPPER_CLASS(Link, std::list<Designator>);
   WRAPPER_CLASS(Uniform, std::list<Name>);
   WRAPPER_CLASS(UseDevicePtr, std::list<Name>);
+  WRAPPER_CLASS(IsDevicePtr, std::list<Name>);
   std::variant<Defaultmap, Inbranch, Mergeable, Nogroup, Notinbranch, OmpNowait,
       Untied, Collapse, Copyin, Copyprivate, Device, DistSchedule, Final,
       Firstprivate, From, Grainsize, Lastprivate, NumTasks, NumTeams,
       NumThreads, Ordered, Priority, Private, Safelen, Shared, Simdlen,
-      ThreadLimit, To, Uniform, UseDevicePtr, OmpAlignedClause,
-      OmpDefaultClause, OmpDependClause, OmpIfClause, OmpLinearClause,
-      OmpMapClause, OmpProcBindClause, OmpReductionClause, OmpScheduleClause>
+      ThreadLimit, To, Link, Uniform, UseDevicePtr, IsDevicePtr,
+      OmpAlignedClause, OmpDefaultClause, OmpDependClause, OmpIfClause,
+      OmpLinearClause, OmpMapClause, OmpProcBindClause, OmpReductionClause,
+      OmpScheduleClause>
       u;
 };
 
index 2afdbdd..4c03a79 100644 (file)
@@ -1992,6 +1992,11 @@ public:
     Walk(x.v, ",");
     Put(")");
   }
+  void Unparse(const OmpClause::Link &x) {
+    Word("LINK(");
+    Walk(x.v, ",");
+    Put(")");
+  }
   void Unparse(const OmpClause::Uniform &x) {
     Word("UNIFORM(");
     Walk(x.v, ",");
@@ -2002,6 +2007,11 @@ public:
     Walk(x.v, ",");
     Put(")");
   }
+  void Unparse(const OmpClause::IsDevicePtr &x) {
+    Word("IS_DEVICE_PTR(");
+    Walk(x.v, ",");
+    Put(")");
+  }
   void Unparse(const OmpLoopDirective &x) {
     std::visit(
         common::visitors{