[flang-commits] [flang] 3b3dc1d - Revert "[flang][directives] Use TableGen information for clause classes in parse-tree"

via flang-commits flang-commits at lists.llvm.org
Tue Aug 11 06:54:25 PDT 2020


Author: clementval
Date: 2020-08-11T09:54:04-04:00
New Revision: 3b3dc1dbfffc6a710565bc83a46cee9a1334f32a

URL: https://github.com/llvm/llvm-project/commit/3b3dc1dbfffc6a710565bc83a46cee9a1334f32a
DIFF: https://github.com/llvm/llvm-project/commit/3b3dc1dbfffc6a710565bc83a46cee9a1334f32a.diff

LOG: Revert "[flang][directives] Use TableGen information for clause classes in parse-tree"

This reverts commit bf93edc4758b512e84b70ec6335d15b0cf386a18.

Buildbot failure

Added: 
    

Modified: 
    flang/include/flang/Parser/dump-parse-tree.h
    flang/include/flang/Parser/parse-tree.h
    flang/lib/Evaluate/CMakeLists.txt
    flang/lib/Parser/openacc-parsers.cpp
    flang/lib/Parser/unparse.cpp
    flang/lib/Semantics/CMakeLists.txt
    flang/lib/Semantics/check-acc-structure.cpp
    flang/lib/Semantics/check-acc-structure.h
    flang/lib/Semantics/resolve-directives.cpp
    llvm/include/llvm/Frontend/Directive/DirectiveBase.td
    llvm/include/llvm/Frontend/OpenACC/ACC.td
    llvm/include/llvm/Frontend/OpenMP/OMP.td
    llvm/test/TableGen/directive1.td
    llvm/test/TableGen/directive2.td
    llvm/utils/TableGen/DirectiveEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index 185a514e648f..e3986b754f83 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -64,8 +64,51 @@ class ParseTreeDumper {
   NODE(parser, AccBeginLoopDirective)
   NODE(parser, AccBlockDirective)
   NODE(parser, AccClause)
-#define GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-#include "llvm/Frontend/OpenACC/ACC.cpp.inc"
+  NODE(AccClause, Auto)
+  NODE(AccClause, Async)
+  NODE(AccClause, Attach)
+  NODE(AccClause, Bind)
+  NODE(AccClause, Capture)
+  NODE(AccClause, Collapse)
+  NODE(AccClause, Copy)
+  NODE(AccClause, Copyin)
+  NODE(AccClause, Copyout)
+  NODE(AccClause, Create)
+  NODE(AccClause, Default)
+  NODE(AccClause, DefaultAsync)
+  NODE(AccClause, Delete)
+  NODE(AccClause, Detach)
+  NODE(AccClause, Device)
+  NODE(AccClause, DeviceNum)
+  NODE(AccClause, DevicePtr)
+  NODE(AccClause, DeviceResident)
+  NODE(AccClause, DeviceType)
+  NODE(AccClause, Finalize)
+  NODE(AccClause, FirstPrivate)
+  NODE(AccClause, Gang)
+  NODE(AccClause, Host)
+  NODE(AccClause, If)
+  NODE(AccClause, IfPresent)
+  NODE(AccClause, Independent)
+  NODE(AccClause, Link)
+  NODE(AccClause, NoCreate)
+  NODE(AccClause, NoHost)
+  NODE(AccClause, NumGangs)
+  NODE(AccClause, NumWorkers)
+  NODE(AccClause, Present)
+  NODE(AccClause, Private)
+  NODE(AccClause, Tile)
+  NODE(AccClause, UseDevice)
+  NODE(AccClause, Read)
+  NODE(AccClause, Reduction)
+  NODE(AccClause, Self)
+  NODE(AccClause, Seq)
+  NODE(AccClause, Vector)
+  NODE(AccClause, VectorLength)
+  NODE(AccClause, Wait)
+  NODE(AccClause, Worker)
+  NODE(AccClause, Write)
+  NODE(AccClause, Unknown)
   NODE(parser, AccDefaultClause)
   NODE_ENUM(parser::AccDefaultClause, Arg)
   NODE(parser, AccClauseList)
@@ -458,8 +501,38 @@ class ParseTreeDumper {
   NODE_ENUM(OmpCancelType, Type)
   NODE(parser, OmpClause)
   NODE(parser, OmpClauseList)
-#define GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
+  NODE(OmpClause, Collapse)
+  NODE(OmpClause, Copyin)
+  NODE(OmpClause, Copyprivate)
+  NODE(OmpClause, Device)
+  NODE(OmpClause, DistSchedule)
+  NODE(OmpClause, Final)
+  NODE(OmpClause, Firstprivate)
+  NODE(OmpClause, From)
+  NODE(OmpClause, Grainsize)
+  NODE(OmpClause, Inbranch)
+  NODE(OmpClause, Lastprivate)
+  NODE(OmpClause, Mergeable)
+  NODE(OmpClause, Nogroup)
+  NODE(OmpClause, Notinbranch)
+  NODE(OmpClause, Threads)
+  NODE(OmpClause, Simd)
+  NODE(OmpClause, NumTasks)
+  NODE(OmpClause, NumTeams)
+  NODE(OmpClause, NumThreads)
+  NODE(OmpClause, Ordered)
+  NODE(OmpClause, Priority)
+  NODE(OmpClause, Private)
+  NODE(OmpClause, Safelen)
+  NODE(OmpClause, Shared)
+  NODE(OmpClause, Simdlen)
+  NODE(OmpClause, ThreadLimit)
+  NODE(OmpClause, To)
+  NODE(OmpClause, Link)
+  NODE(OmpClause, Uniform)
+  NODE(OmpClause, Untied)
+  NODE(OmpClause, UseDevicePtr)
+  NODE(OmpClause, IsDevicePtr)
   NODE(parser, OmpCriticalDirective)
   NODE(OmpCriticalDirective, Hint)
   NODE(parser, OmpDeclareTargetSpecifier)

diff  --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index c6d5f68c1376..ebea3331ae5a 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3459,16 +3459,47 @@ EMPTY_CLASS(OmpNowait);
 // OpenMP Clauses
 struct OmpClause {
   UNION_CLASS_BOILERPLATE(OmpClause);
-
-#define GEN_FLANG_CLAUSE_PARSER_CLASSES
-#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
-
+  EMPTY_CLASS(Inbranch);
+  EMPTY_CLASS(Mergeable);
+  EMPTY_CLASS(Nogroup);
+  EMPTY_CLASS(Notinbranch);
+  EMPTY_CLASS(Simd);
+  EMPTY_CLASS(Threads);
+  EMPTY_CLASS(Untied);
+  WRAPPER_CLASS(Collapse, ScalarIntConstantExpr);
+  WRAPPER_CLASS(Copyin, OmpObjectList);
+  WRAPPER_CLASS(Copyprivate, OmpObjectList);
+  WRAPPER_CLASS(Device, ScalarIntExpr);
+  WRAPPER_CLASS(DistSchedule, std::optional<ScalarIntExpr>);
+  WRAPPER_CLASS(Final, ScalarLogicalExpr);
+  WRAPPER_CLASS(Firstprivate, OmpObjectList);
+  WRAPPER_CLASS(From, OmpObjectList);
+  WRAPPER_CLASS(Grainsize, ScalarIntExpr);
+  WRAPPER_CLASS(IsDevicePtr, std::list<Name>);
+  WRAPPER_CLASS(Lastprivate, OmpObjectList);
+  WRAPPER_CLASS(Link, OmpObjectList);
+  WRAPPER_CLASS(NumTasks, ScalarIntExpr);
+  WRAPPER_CLASS(NumTeams, ScalarIntExpr);
+  WRAPPER_CLASS(NumThreads, ScalarIntExpr);
+  WRAPPER_CLASS(Ordered, std::optional<ScalarIntConstantExpr>);
+  WRAPPER_CLASS(Priority, ScalarIntExpr);
+  WRAPPER_CLASS(Private, OmpObjectList);
+  WRAPPER_CLASS(Safelen, ScalarIntConstantExpr);
+  WRAPPER_CLASS(Shared, OmpObjectList);
+  WRAPPER_CLASS(Simdlen, ScalarIntConstantExpr);
+  WRAPPER_CLASS(ThreadLimit, ScalarIntExpr);
+  WRAPPER_CLASS(To, OmpObjectList);
+  WRAPPER_CLASS(Uniform, std::list<Name>);
+  WRAPPER_CLASS(UseDevicePtr, std::list<Name>);
   CharBlock source;
-
-  std::variant<
-#define GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
-      >
+  std::variant<Inbranch, Mergeable, Nogroup, Notinbranch, OmpNowait, Untied,
+      Threads, Simd, Collapse, Copyin, Copyprivate, Device, DistSchedule, Final,
+      Firstprivate, From, Grainsize, Lastprivate, NumTasks, NumTeams,
+      NumThreads, Ordered, Priority, Private, Safelen, Shared, Simdlen,
+      ThreadLimit, To, Link, Uniform, UseDevicePtr, IsDevicePtr,
+      OmpAlignedClause, OmpAllocateClause, OmpDefaultClause,
+      OmpDefaultmapClause, OmpDependClause, OmpIfClause, OmpLinearClause,
+      OmpMapClause, OmpProcBindClause, OmpReductionClause, OmpScheduleClause>
       u;
 };
 
@@ -3864,15 +3895,60 @@ struct AccGangArgument {
 struct AccClause {
   UNION_CLASS_BOILERPLATE(AccClause);
 
-#define GEN_FLANG_CLAUSE_PARSER_CLASSES
-#include "llvm/Frontend/OpenACC/ACC.cpp.inc"
+  EMPTY_CLASS(Auto);
+  WRAPPER_CLASS(Async, std::optional<ScalarIntExpr>);
+  WRAPPER_CLASS(Attach, AccObjectList);
+  WRAPPER_CLASS(Bind, Name);
+  EMPTY_CLASS(Capture);
+  WRAPPER_CLASS(Collapse, ScalarIntConstantExpr);
+  WRAPPER_CLASS(Copy, AccObjectList);
+  WRAPPER_CLASS(Copyin, AccObjectListWithModifier);
+  WRAPPER_CLASS(Copyout, AccObjectListWithModifier);
+  WRAPPER_CLASS(Create, AccObjectListWithModifier);
+  WRAPPER_CLASS(Default, AccDefaultClause);
+  WRAPPER_CLASS(DefaultAsync, ScalarIntExpr);
+  WRAPPER_CLASS(Delete, AccObjectList);
+  WRAPPER_CLASS(Detach, AccObjectList);
+  WRAPPER_CLASS(Device, AccObjectList);
+  WRAPPER_CLASS(DeviceNum, ScalarIntConstantExpr);
+  WRAPPER_CLASS(DevicePtr, AccObjectList);
+  WRAPPER_CLASS(DeviceResident, AccObjectList);
+  WRAPPER_CLASS(DeviceType, std::optional<std::list<Name>>);
+  EMPTY_CLASS(Finalize);
+  WRAPPER_CLASS(FirstPrivate, AccObjectList);
+  WRAPPER_CLASS(Gang, std::optional<AccGangArgument>);
+  WRAPPER_CLASS(Host, AccObjectList);
+  WRAPPER_CLASS(If, ScalarLogicalExpr);
+  EMPTY_CLASS(IfPresent);
+  EMPTY_CLASS(Independent);
+  WRAPPER_CLASS(Link, AccObjectList);
+  WRAPPER_CLASS(NoCreate, AccObjectList);
+  EMPTY_CLASS(NoHost);
+  WRAPPER_CLASS(NumGangs, ScalarIntExpr);
+  WRAPPER_CLASS(NumWorkers, ScalarIntExpr);
+  WRAPPER_CLASS(Present, AccObjectList);
+  WRAPPER_CLASS(Private, AccObjectList);
+  WRAPPER_CLASS(Tile, AccSizeExprList);
+  WRAPPER_CLASS(UseDevice, AccObjectList);
+  EMPTY_CLASS(Read);
+  WRAPPER_CLASS(Reduction, AccObjectListWithReduction);
+  WRAPPER_CLASS(Self, std::optional<ScalarLogicalExpr>);
+  EMPTY_CLASS(Seq);
+  WRAPPER_CLASS(Vector, std::optional<ScalarIntExpr>);
+  WRAPPER_CLASS(VectorLength, ScalarIntExpr);
+  WRAPPER_CLASS(Wait, std::optional<AccWaitArgument>);
+  WRAPPER_CLASS(Worker, std::optional<ScalarIntExpr>);
+  EMPTY_CLASS(Write);
+  EMPTY_CLASS(Unknown);
 
   CharBlock source;
 
-  std::variant<
-#define GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-#include "llvm/Frontend/OpenACC/ACC.cpp.inc"
-      >
+  std::variant<Auto, Async, Attach, Bind, Capture, Collapse, Copy, Copyin,
+      Copyout, Create, Default, DefaultAsync, Delete, Detach, Device, DeviceNum,
+      DevicePtr, DeviceResident, DeviceType, Finalize, FirstPrivate, Gang, Host,
+      If, IfPresent, Independent, Link, NoCreate, NoHost, NumGangs, NumWorkers,
+      Present, Private, Tile, UseDevice, Read, Reduction, Self, Seq, Vector,
+      VectorLength, Wait, Worker, Write, Unknown>
       u;
 };
 

diff  --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt
index 2a60dd7b85b4..9ab83d7c1c25 100644
--- a/flang/lib/Evaluate/CMakeLists.txt
+++ b/flang/lib/Evaluate/CMakeLists.txt
@@ -45,7 +45,6 @@ add_flang_library(FortranEvaluate
   ${LIBPGMATH}
 
   DEPENDS
-  acc_gen
   omp_gen
 )
 

diff  --git a/flang/lib/Parser/openacc-parsers.cpp b/flang/lib/Parser/openacc-parsers.cpp
index 0a61921c9087..a2ab628c0993 100644
--- a/flang/lib/Parser/openacc-parsers.cpp
+++ b/flang/lib/Parser/openacc-parsers.cpp
@@ -55,7 +55,7 @@ TYPE_PARSER("AUTO" >> construct<AccClause>(construct<AccClause::Auto>()) ||
                     parenthesized(Parser<AccObjectList>{}))) ||
     "DEVICE" >> construct<AccClause>(construct<AccClause::Device>(
                     parenthesized(Parser<AccObjectList>{}))) ||
-    "DEVICEPTR" >> construct<AccClause>(construct<AccClause::Deviceptr>(
+    "DEVICEPTR" >> construct<AccClause>(construct<AccClause::DevicePtr>(
                        parenthesized(Parser<AccObjectList>{}))) ||
     "DEVICENUM" >> construct<AccClause>(construct<AccClause::DeviceNum>(
                        parenthesized(scalarIntConstantExpr))) ||
@@ -69,7 +69,7 @@ TYPE_PARSER("AUTO" >> construct<AccClause>(construct<AccClause::Auto>()) ||
         construct<AccClause>(construct<AccClause::DeviceType>(
             parenthesized(maybe(nonemptyList(name))))) ||
     "FINALIZE" >> construct<AccClause>(construct<AccClause::Finalize>()) ||
-    "FIRSTPRIVATE" >> construct<AccClause>(construct<AccClause::Firstprivate>(
+    "FIRSTPRIVATE" >> construct<AccClause>(construct<AccClause::FirstPrivate>(
                           parenthesized(Parser<AccObjectList>{}))) ||
     "GANG" >> construct<AccClause>(construct<AccClause::Gang>(
                   maybe(parenthesized(Parser<AccGangArgument>{})))) ||
@@ -84,7 +84,7 @@ TYPE_PARSER("AUTO" >> construct<AccClause>(construct<AccClause::Auto>()) ||
                   parenthesized(Parser<AccObjectList>{}))) ||
     "NO_CREATE" >> construct<AccClause>(construct<AccClause::NoCreate>(
                        parenthesized(Parser<AccObjectList>{}))) ||
-    "NOHOST" >> construct<AccClause>(construct<AccClause::Nohost>()) ||
+    "NOHOST" >> construct<AccClause>(construct<AccClause::NoHost>()) ||
     "NUM_GANGS" >> construct<AccClause>(construct<AccClause::NumGangs>(
                        parenthesized(scalarIntExpr))) ||
     "NUM_WORKERS" >> construct<AccClause>(construct<AccClause::NumWorkers>(

diff  --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 1093cb21709c..ab18d026e74e 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -1835,7 +1835,7 @@ class UnparseVisitor {
   void Before(const AccClause::Finalize &) { Word("FINALIZE"); }
   void Before(const AccClause::IfPresent &) { Word("IF_PRESENT"); }
   void Before(const AccClause::Independent &) { Word("INDEPENDENT"); }
-  void Before(const AccClause::Nohost &) { Word("NOHOST"); }
+  void Before(const AccClause::NoHost &) { Word("NOHOST"); }
   void Before(const AccClause::Read &) { Word("READ"); }
   void Before(const AccClause::Seq &) { Word("SEQ"); }
   void Before(const AccClause::Write &) { Word("WRITE"); }
@@ -1906,7 +1906,7 @@ class UnparseVisitor {
     Walk(x.v);
     Put(")");
   }
-  void Unparse(const AccClause::Deviceptr &x) {
+  void Unparse(const AccClause::DevicePtr &x) {
     Word("DEVICEPTR");
     Put("(");
     Walk(x.v);
@@ -1918,7 +1918,7 @@ class UnparseVisitor {
     Walk(x.v);
     Put(")");
   }
-  void Unparse(const AccClause::Firstprivate &x) {
+  void Unparse(const AccClause::FirstPrivate &x) {
     Word("FIRSTPRIVATE");
     Put("(");
     Walk(x.v);

diff  --git a/flang/lib/Semantics/CMakeLists.txt b/flang/lib/Semantics/CMakeLists.txt
index 9eb521ecc060..d82926220b3e 100644
--- a/flang/lib/Semantics/CMakeLists.txt
+++ b/flang/lib/Semantics/CMakeLists.txt
@@ -44,7 +44,6 @@ add_flang_library(FortranSemantics
   unparse-with-symbols.cpp
 
   DEPENDS
-  acc_gen
   omp_gen
 
   LINK_LIBS

diff  --git a/flang/lib/Semantics/check-acc-structure.cpp b/flang/lib/Semantics/check-acc-structure.cpp
index 311a7c4d3328..46ccc2b762f5 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -263,11 +263,11 @@ CHECK_SIMPLE_CLAUSE(Delete, ACCC_delete)
 CHECK_SIMPLE_CLAUSE(Detach, ACCC_detach)
 CHECK_SIMPLE_CLAUSE(Device, ACCC_device)
 CHECK_SIMPLE_CLAUSE(DeviceNum, ACCC_device_num)
-CHECK_SIMPLE_CLAUSE(Deviceptr, ACCC_deviceptr)
+CHECK_SIMPLE_CLAUSE(DevicePtr, ACCC_deviceptr)
 CHECK_SIMPLE_CLAUSE(DeviceResident, ACCC_device_resident)
 CHECK_SIMPLE_CLAUSE(DeviceType, ACCC_device_type)
 CHECK_SIMPLE_CLAUSE(Finalize, ACCC_finalize)
-CHECK_SIMPLE_CLAUSE(Firstprivate, ACCC_firstprivate)
+CHECK_SIMPLE_CLAUSE(FirstPrivate, ACCC_firstprivate)
 CHECK_SIMPLE_CLAUSE(Gang, ACCC_gang)
 CHECK_SIMPLE_CLAUSE(Host, ACCC_host)
 CHECK_SIMPLE_CLAUSE(If, ACCC_if)
@@ -275,7 +275,7 @@ CHECK_SIMPLE_CLAUSE(IfPresent, ACCC_if_present)
 CHECK_SIMPLE_CLAUSE(Independent, ACCC_independent)
 CHECK_SIMPLE_CLAUSE(Link, ACCC_link)
 CHECK_SIMPLE_CLAUSE(NoCreate, ACCC_no_create)
-CHECK_SIMPLE_CLAUSE(Nohost, ACCC_nohost)
+CHECK_SIMPLE_CLAUSE(NoHost, ACCC_nohost)
 CHECK_SIMPLE_CLAUSE(NumGangs, ACCC_num_gangs)
 CHECK_SIMPLE_CLAUSE(NumWorkers, ACCC_num_workers)
 CHECK_SIMPLE_CLAUSE(Present, ACCC_present)

diff  --git a/flang/lib/Semantics/check-acc-structure.h b/flang/lib/Semantics/check-acc-structure.h
index efed05d42869..1ce6e9052b03 100644
--- a/flang/lib/Semantics/check-acc-structure.h
+++ b/flang/lib/Semantics/check-acc-structure.h
@@ -76,11 +76,11 @@ class AccStructureChecker
   void Enter(const parser::AccClause::Detach &);
   void Enter(const parser::AccClause::Device &);
   void Enter(const parser::AccClause::DeviceNum &);
-  void Enter(const parser::AccClause::Deviceptr &);
+  void Enter(const parser::AccClause::DevicePtr &);
   void Enter(const parser::AccClause::DeviceResident &);
   void Enter(const parser::AccClause::DeviceType &);
   void Enter(const parser::AccClause::Finalize &);
-  void Enter(const parser::AccClause::Firstprivate &);
+  void Enter(const parser::AccClause::FirstPrivate &);
   void Enter(const parser::AccClause::Gang &);
   void Enter(const parser::AccClause::Host &);
   void Enter(const parser::AccClause::If &);
@@ -88,7 +88,7 @@ class AccStructureChecker
   void Enter(const parser::AccClause::Independent &);
   void Enter(const parser::AccClause::Link &);
   void Enter(const parser::AccClause::NoCreate &);
-  void Enter(const parser::AccClause::Nohost &);
+  void Enter(const parser::AccClause::NoHost &);
   void Enter(const parser::AccClause::NumGangs &);
   void Enter(const parser::AccClause::NumWorkers &);
   void Enter(const parser::AccClause::Present &);

diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index e73bfa7c37cc..d05eb5385ba8 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -173,7 +173,7 @@ class AccAttributeVisitor : DirectiveAttributeVisitor<llvm::acc::Directive> {
     ResolveAccObjectList(x.v, Symbol::Flag::AccPrivate);
     return false;
   }
-  bool Pre(const parser::AccClause::Firstprivate &x) {
+  bool Pre(const parser::AccClause::FirstPrivate &x) {
     ResolveAccObjectList(x.v, Symbol::Flag::AccFirstPrivate);
     return false;
   }

diff  --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index 13b1edef0580..26049ca60db3 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -46,9 +46,6 @@ class DirectiveLanguage {
 
   // EnumSet class name used for clauses to generated the allowed clauses map.
   string clauseEnumSetClass = "";
-
-  // Class holding the clauses in the flang parse-tree.
-  string flangClauseBaseClass = "";
 }
 
 // Information about a specific clause.
@@ -60,20 +57,10 @@ class Clause<string c> {
   string alternativeName = "";
 
   // Optional class holding value of the clause in clang AST.
-  string clangClass = "";
-
-  // Optional class holding the clause in flang AST. If left blank, the class
-  // is assumed to be the name of the clause with capitalized word and
-  // underscores removed.
-  // ex: async -> Async
-  //     num_threads -> NumThreads
-  string flangClass = "";
+  string clangClass = ?;
 
   // Optional class holding value of the clause in flang AST.
-  string flangClassValue = "";
-
-  // If set to 1, value is optional. Not optional by default.
-  bit isValueOptional = 0;
+  string flangClass = ?;
 
   // Is clause implicit? If clause is set as implicit, the default kind will
   // be return in get<LanguageName>ClauseKind instead of their own kind.

diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 4c686aad050b..4dbf4bbc0fb0 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -25,30 +25,28 @@ def OpenACC : DirectiveLanguage {
   let enableBitmaskEnumInNamespace = 1;
   let includeHeader = "llvm/Frontend/OpenACC/ACC.h.inc";
   let clauseEnumSetClass = "AccClauseSet";
-  let flangClauseBaseClass = "AccClause";
 }
 
 //===----------------------------------------------------------------------===//
 // Definition of OpenACC clauses
 //===----------------------------------------------------------------------===//
 
+// 2.9.6
+def ACCC_Auto : Clause<"auto"> {}
+
 // 2.16.1
 def ACCC_Async : Clause<"async"> {
-  let flangClassValue = "ScalarIntExpr";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<ScalarIntExpr>";
 }
 
-// 2.9.6
-def ACCC_Auto : Clause<"auto"> {}
-
 // 2.7.11
 def ACCC_Attach : Clause<"attach"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.15.1
 def ACCC_Bind : Clause<"bind"> {
-  let flangClassValue = "Name";
+  let flangClass = "Name";
 }
 
 // 2.12
@@ -57,73 +55,72 @@ def ACCC_Capture : Clause<"capture"> {
 
 // 2.9.1
 def ACCC_Collapse : Clause<"collapse"> {
-  let flangClassValue = "ScalarIntConstantExpr";
+  let flangClass = "ScalarIntConstantExpr";
 }
 
 // 2.7.5
 def ACCC_Copy : Clause<"copy"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 // 2.7.6
 def ACCC_Copyin : Clause<"copyin"> {
-  let flangClassValue = "AccObjectListWithModifier";
+  let flangClass = "AccObjectListWithModifier";
 }
 
 // 2.7.7
 def ACCC_Copyout : Clause<"copyout"> {
-  let flangClassValue = "AccObjectListWithModifier";
+  let flangClass = "AccObjectListWithModifier";
 }
 
 // 2.7.8
 def ACCC_Create : Clause<"create"> {
-  let flangClassValue = "AccObjectListWithModifier";
+  let flangClass = "AccObjectListWithModifier";
 }
 
 // 2.5.14
 def ACCC_Default : Clause<"default"> {
-  let flangClassValue = "AccDefaultClause";
+  let flangClass = "AccDefaultClause";
 }
 
 // 2.4.12
 def ACCC_DefaultAsync : Clause<"default_async"> {
-  let flangClassValue = "ScalarIntExpr";
+  let flangClass = "ScalarIntExpr";
 }
 
 // 2.7.10
 def ACCC_Delete : Clause<"delete"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.7.12
 def ACCC_Detach : Clause<"detach"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.14.4
 def ACCC_Device : Clause<"device"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.14.1
 def ACCC_DeviceNum : Clause<"device_num">  {
-  let flangClassValue = "ScalarIntConstantExpr";
+  let flangClass = "ScalarIntConstantExpr";
 }
 
 // 2.7.3
 def ACCC_DevicePtr : Clause<"deviceptr"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.13
 def ACCC_DeviceResident : Clause<"device_resident"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.4
 def ACCC_DeviceType : Clause<"device_type"> {
   // (DeviceType, "*"
-  let flangClassValue = "std::list<Name>";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<std::list<Name>>";
 }
 
 // 2.6.6
@@ -131,23 +128,22 @@ def ACCC_Finalize : Clause<"finalize"> {}
 
 // 2.5.12
 def ACCC_FirstPrivate : Clause<"firstprivate"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.9.2
 def ACCC_Gang : Clause<"gang"> {
-  let flangClassValue = "AccGangArgument";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<AccGangArgument>";
 }
 
 // 2.14.4
 def ACCC_Host : Clause<"host"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.5.4
 def ACCC_If : Clause <"if"> {
-  let flangClassValue = "ScalarLogicalExpr";
+  let flangClass = "ScalarLogicalExpr";
 }
 
 // 2.14.4
@@ -158,12 +154,12 @@ def ACCC_Independent : Clause<"independent"> {}
 
 // 2.13
 def ACCC_Link : Clause<"link"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.7.9
 def ACCC_NoCreate : Clause<"no_create"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.15.1
@@ -171,32 +167,32 @@ def ACCC_NoHost : Clause<"nohost"> {}
 
 // 2.5.8
 def ACCC_NumGangs : Clause<"num_gangs"> {
-  let flangClassValue = "ScalarIntExpr";
+  let flangClass = "ScalarIntExpr";
 }
 
 // 2.5.9
 def ACCC_NumWorkers : Clause<"num_workers"> {
-  let flangClassValue = "ScalarIntExpr";
+  let flangClass = "ScalarIntExpr";
 }
 
 // 2.7.4
 def ACCC_Present : Clause<"present"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.5.11
 def ACCC_Private : Clause<"private"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.9.7
 def ACCC_Tile : Clause <"tile"> {
-  let flangClassValue = "AccSizeExprList";
+  let flangClass = "AccSizeExprList";
 }
 
 // 2.8.1
 def ACCC_UseDevice : Clause <"use_device"> {
-  let flangClassValue = "AccObjectList";
+  let flangClass = "AccObjectList";
 }
 
 // 2.12
@@ -204,13 +200,12 @@ def ACCC_Read : Clause<"read"> {}
 
 // 2.5.13
 def ACCC_Reduction : Clause<"reduction"> {
-  let flangClassValue = "AccObjectListWithReduction";
+  let flangClass = "AccObjectListWithReduction";
 }
 
 // 2.5.5
 def ACCC_Self : Clause<"self"> {
-  let flangClassValue = "ScalarLogicalExpr";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<ScalarLogicalExpr>";
 }
 
 // 2.9.5
@@ -218,25 +213,22 @@ def ACCC_Seq : Clause<"seq"> {}
 
 // 2.9.4
 def ACCC_Vector : Clause<"vector"> {
-  let flangClassValue = "ScalarIntExpr";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<ScalarIntExpr>";
 }
 
 // 2.5.10
 def ACCC_VectorLength : Clause<"vector_length"> {
-  let flangClassValue = "ScalarIntExpr";
+  let flangClass = "ScalarIntExpr";
 }
 
 // 2.16.2
 def ACCC_Wait : Clause<"wait"> {
-  let flangClassValue = "AccWaitArgument";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<AccWaitArgument>";
 }
 
 // 2.9.3
 def ACCC_Worker: Clause<"worker"> {
-  let flangClassValue = "ScalarIntExpr";
-  let isValueOptional = 1;
+  let flangClass = "std::optional<ScalarIntExpr>";
 }
 
 // 2.12

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index 24111c9e4701..a0d694533e4d 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -25,7 +25,6 @@ def OpenMP : DirectiveLanguage {
   let enableBitmaskEnumInNamespace = 1;
   let includeHeader = "llvm/Frontend/OpenMP/OMP.h.inc";
   let clauseEnumSetClass = "OmpClauseSet";
-  let flangClauseBaseClass = "OmpClause";
 }
 
 //===----------------------------------------------------------------------===//
@@ -35,87 +34,38 @@ def OpenMP : DirectiveLanguage {
 def OMPC_Allocator : Clause<"allocator"> {
   let clangClass = "OMPAllocatorClause";
 }
-def OMPC_If : Clause<"if"> {
-  let clangClass = "OMPIfClause";
-  let flangClass = "OmpIfClause";
-}
-def OMPC_Final : Clause<"final"> {
-  let clangClass = "OMPFinalClause";
-  let flangClassValue = "ScalarLogicalExpr";
-}
+def OMPC_If : Clause<"if"> { let clangClass = "OMPIfClause"; }
+def OMPC_Final : Clause<"final"> { let clangClass = "OMPFinalClause"; }
 def OMPC_NumThreads : Clause<"num_threads"> {
   let clangClass = "OMPNumThreadsClause";
-  let flangClassValue = "ScalarIntExpr";
-}
-def OMPC_SafeLen : Clause<"safelen"> {
-  let clangClass = "OMPSafelenClause";
-  let flangClassValue = "ScalarIntConstantExpr";
-}
-def OMPC_SimdLen : Clause<"simdlen"> {
-  let clangClass = "OMPSimdlenClause";
-  let flangClassValue = "ScalarIntConstantExpr";
-}
-def OMPC_Collapse : Clause<"collapse"> {
-  let clangClass = "OMPCollapseClause";
-  let flangClassValue = "ScalarIntConstantExpr";
-}
-def OMPC_Default : Clause<"default"> {
-  let clangClass = "OMPDefaultClause";
-  let flangClass = "OmpDefaultClause";
-}
-def OMPC_Private : Clause<"private"> {
-  let clangClass = "OMPPrivateClause";
-  let flangClassValue = "OmpObjectList";
 }
+def OMPC_SafeLen : Clause<"safelen"> { let clangClass = "OMPSafelenClause"; }
+def OMPC_SimdLen : Clause<"simdlen"> { let clangClass = "OMPSimdlenClause"; }
+def OMPC_Collapse : Clause<"collapse"> { let clangClass = "OMPCollapseClause"; }
+def OMPC_Default : Clause<"default"> { let clangClass = "OMPDefaultClause"; }
+def OMPC_Private : Clause<"private"> { let clangClass = "OMPPrivateClause"; }
 def OMPC_FirstPrivate : Clause<"firstprivate"> {
   let clangClass = "OMPFirstprivateClause";
-  let flangClassValue = "OmpObjectList";
 }
 def OMPC_LastPrivate : Clause<"lastprivate"> {
   let clangClass = "OMPLastprivateClause";
-  let flangClassValue = "OmpObjectList";
-}
-def OMPC_Shared : Clause<"shared"> {
-  let clangClass = "OMPSharedClause";
-  let flangClassValue = "OmpObjectList";
 }
+def OMPC_Shared : Clause<"shared"> { let clangClass = "OMPSharedClause"; }
 def OMPC_Reduction : Clause<"reduction"> {
   let clangClass = "OMPReductionClause";
-  let flangClass = "OmpReductionClause";
-}
-def OMPC_Linear : Clause<"linear"> {
-  let clangClass = "OMPLinearClause";
-  let flangClass = "OmpLinearClause";
-}
-def OMPC_Aligned : Clause<"aligned"> {
-  let clangClass = "OMPAlignedClause";
-  let flangClass = "OmpAlignedClause";
-}
-def OMPC_Copyin : Clause<"copyin"> {
-  let clangClass = "OMPCopyinClause";
-  let flangClassValue = "OmpObjectList";
 }
+def OMPC_Linear : Clause<"linear"> { let clangClass = "OMPLinearClause"; }
+def OMPC_Aligned : Clause<"aligned"> { let clangClass = "OMPAlignedClause"; }
+def OMPC_Copyin : Clause<"copyin"> { let clangClass = "OMPCopyinClause"; }
 def OMPC_CopyPrivate : Clause<"copyprivate"> {
   let clangClass = "OMPCopyprivateClause";
-  let flangClassValue = "OmpObjectList";
 }
 def OMPC_ProcBind : Clause<"proc_bind"> {
   let clangClass = "OMPProcBindClause";
-  let flangClass = "OmpProcBindClause";
-}
-def OMPC_Schedule : Clause<"schedule"> {
-  let clangClass = "OMPScheduleClause";
-  let flangClass = "OmpScheduleClause";
-}
-def OMPC_Ordered : Clause<"ordered"> {
-  let clangClass = "OMPOrderedClause";
-  let flangClassValue = "ScalarIntConstantExpr";
-  let isValueOptional = 1;
-}
-def OMPC_NoWait : Clause<"nowait"> {
-  let clangClass = "OMPNowaitClause";
-  let flangClass = "OmpNowait";
 }
+def OMPC_Schedule : Clause<"schedule"> { let clangClass = "OMPScheduleClause"; }
+def OMPC_Ordered : Clause<"ordered"> { let clangClass = "OMPOrderedClause"; }
+def OMPC_NoWait : Clause<"nowait"> { let clangClass = "OMPNowaitClause"; }
 def OMPC_Untied : Clause<"untied"> { let clangClass = "OMPUntiedClause"; }
 def OMPC_Mergeable : Clause<"mergeable"> {
   let clangClass = "OMPMergeableClause";
@@ -129,70 +79,47 @@ def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
 def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
 def OMPC_Release : Clause<"release"> { let clangClass = "OMPReleaseClause"; }
 def OMPC_Relaxed : Clause<"relaxed"> { let clangClass = "OMPRelaxedClause"; }
-def OMPC_Depend : Clause<"depend"> {
-  let clangClass = "OMPDependClause";
-  let flangClass = "OmpDependClause";
-}
-def OMPC_Device : Clause<"device"> {
-  let clangClass = "OMPDeviceClause";
-  let flangClassValue = "ScalarIntExpr";
-}
+def OMPC_Depend : Clause<"depend"> { let clangClass = "OMPDependClause"; }
+def OMPC_Device : Clause<"device"> { let clangClass = "OMPDeviceClause"; }
 def OMPC_Threads : Clause<"threads"> { let clangClass = "OMPThreadsClause"; }
 def OMPC_Simd : Clause<"simd"> { let clangClass = "OMPSIMDClause"; }
-def OMPC_Map : Clause<"map"> {
-  let clangClass = "OMPMapClause";
-  let flangClass = "OmpMapClause";
-}
+def OMPC_Map : Clause<"map"> { let clangClass = "OMPMapClause"; }
 def OMPC_NumTeams : Clause<"num_teams"> {
   let clangClass = "OMPNumTeamsClause";
-  let flangClassValue = "ScalarIntExpr";
 }
 def OMPC_ThreadLimit : Clause<"thread_limit"> {
   let clangClass = "OMPThreadLimitClause";
-  let flangClassValue = "ScalarIntExpr";
 }
 def OMPC_Priority : Clause<"priority"> {
   let clangClass = "OMPPriorityClause";
-  let flangClassValue = "ScalarIntExpr";
 }
 def OMPC_GrainSize : Clause<"grainsize"> {
   let clangClass = "OMPGrainsizeClause";
-  let flangClassValue = "ScalarIntExpr";
 }
 def OMPC_NoGroup : Clause<"nogroup"> {
   let clangClass = "OMPNogroupClause";
 }
 def OMPC_NumTasks : Clause<"num_tasks"> {
   let clangClass = "OMPNumTasksClause";
-  let flangClassValue = "ScalarIntExpr";
 }
 def OMPC_Hint : Clause<"hint"> {
   let clangClass = "OMPHintClause";
 }
 def OMPC_DistSchedule : Clause<"dist_schedule"> {
   let clangClass = "OMPDistScheduleClause";
-  let flangClassValue = "ScalarIntExpr";
-  let isValueOptional = 1;
 }
 def OMPC_DefaultMap : Clause<"defaultmap"> {
   let clangClass = "OMPDefaultmapClause";
-  let flangClass = "OmpDefaultmapClause";
 }
 def OMPC_To : Clause<"to"> {
   let clangClass = "OMPToClause";
-  let flangClassValue = "OmpObjectList";
-}
-def OMPC_From : Clause<"from"> {
-  let clangClass = "OMPFromClause";
-  let flangClassValue = "OmpObjectList";
 }
+def OMPC_From : Clause<"from"> { let clangClass = "OMPFromClause"; }
 def OMPC_UseDevicePtr : Clause<"use_device_ptr"> {
   let clangClass = "OMPUseDevicePtrClause";
-  let flangClassValue = "std::list<Name>";
 }
 def OMPC_IsDevicePtr : Clause<"is_device_ptr"> {
   let clangClass = "OMPIsDevicePtrClause";
-  let flangClassValue = "std::list<Name>";
 }
 def OMPC_TaskReduction : Clause<"task_reduction"> {
   let clangClass = "OMPTaskReductionClause";
@@ -217,7 +144,6 @@ def OMPC_AtomicDefaultMemOrder : Clause<"atomic_default_mem_order"> {
 }
 def OMPC_Allocate : Clause<"allocate"> {
   let clangClass = "OMPAllocateClause";
-  let flangClass = "OmpAllocateClause";
 }
 def OMPC_NonTemporal : Clause<"nontemporal"> {
   let clangClass = "OMPNontemporalClause";
@@ -246,9 +172,7 @@ def OMPC_Affinity : Clause<"affinity"> {
 def OMPC_UseDeviceAddr : Clause<"use_device_addr"> {
   let clangClass = "OMPUseDeviceAddrClause";
 }
-def OMPC_Uniform : Clause<"uniform"> {
-  let flangClassValue = "std::list<Name>";
-}
+def OMPC_Uniform : Clause<"uniform"> {}
 def OMPC_DeviceType : Clause<"device_type"> {}
 def OMPC_Match : Clause<"match"> {}
 def OMPC_Depobj : Clause<"depobj"> {
@@ -267,9 +191,7 @@ def OMPC_Unknown : Clause<"unknown"> {
   let isImplicit = 1;
   let isDefault = 1;
 }
-def OMPC_Link : Clause<"link"> {
-  let flangClassValue = "OmpObjectList";
-}
+def OMPC_Link : Clause<"link"> {}
 def OMPC_Inbranch : Clause<"inbranch"> {}
 def OMPC_Notinbranch : Clause<"notinbranch"> {}
 

diff  --git a/llvm/test/TableGen/directive1.td b/llvm/test/TableGen/directive1.td
index f647a03814ce..905d6e28c4f9 100644
--- a/llvm/test/TableGen/directive1.td
+++ b/llvm/test/TableGen/directive1.td
@@ -12,15 +12,10 @@ def TestDirectiveLanguage : DirectiveLanguage {
   let clausePrefix = "TDLC_";
   let makeEnumAvailableInNamespace = 1;
   let enableBitmaskEnumInNamespace = 1;
-  let flangClauseBaseClass = "TdlClause";
 }
 
-def TDLC_ClauseA : Clause<"clausea"> {
-  let flangClass = "TdlClauseA";
-}
+def TDLC_ClauseA : Clause<"clausea"> {}
 def TDLC_ClauseB : Clause<"clauseb"> {
-  let flangClassValue = "IntExpr";
-  let isValueOptional = 1;
   let isDefault = 1;
 }
 
@@ -178,27 +173,4 @@ def TDL_DirA : Directive<"dira"> {
 // GEN-NEXT:  }
 // GEN-EMPTY:
 // GEN-NEXT:  #endif // GEN_FLANG_DIRECTIVE_CLAUSE_MAP
-// GEN-EMPTY:
-// GEN-NEXT:  #ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES
-// GEN-NEXT:  #undef GEN_FLANG_CLAUSE_PARSER_CLASSES
-// GEN-EMPTY:
-// GEN-NEXT:  WRAPPER_CLASS(Clauseb, std::optional<IntExpr>);
-// GEN-EMPTY:
-// GEN-NEXT:  #endif // GEN_FLANG_CLAUSE_PARSER_CLASSES
-// GEN-EMPTY:
-// GEN-NEXT:  #ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-// GEN-NEXT:  #undef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-// GEN-EMPTY:
-// GEN-NEXT:  TdlClauseA
-// GEN-NEXT:  , Clauseb
-// GEN-EMPTY:
-// GEN-NEXT:  #endif // GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-// GEN-EMPTY:
-// GEN-NEXT:  #ifdef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-// GEN-NEXT:  #undef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-// GEN-EMPTY:
-// GEN-NEXT:  NODE(TdlClause, Clauseb)
-// GEN-EMPTY:
-// GEN-NEXT:  #endif // GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-
 

diff  --git a/llvm/test/TableGen/directive2.td b/llvm/test/TableGen/directive2.td
index ed2ac7690841..02f9d4ec40e9 100644
--- a/llvm/test/TableGen/directive2.td
+++ b/llvm/test/TableGen/directive2.td
@@ -11,7 +11,6 @@ def TestDirectiveLanguage : DirectiveLanguage {
   let directivePrefix = "TDLD_";
   let clausePrefix = "TDLC_";
   let includeHeader = "tdl.h.inc";
-  let flangClauseBaseClass = "TdlClause";
 }
 
 def TDLC_ClauseA : Clause<"clausea"> {
@@ -19,7 +18,6 @@ def TDLC_ClauseA : Clause<"clausea"> {
 }
 def TDLC_ClauseB : Clause<"clauseb"> {
   let isDefault = 1;
-  let flangClassValue = "IntExpr";
 }
 
 def TDL_DirA : Directive<"dira"> {
@@ -166,28 +164,3 @@ def TDL_DirA : Directive<"dira"> {
 // GEN-NEXT: }
 // GEN-EMPTY:
 // GEN-NEXT: #endif // GEN_FLANG_DIRECTIVE_CLAUSE_MAP
-// GEN-EMPTY:
-// GEN-NEXT:  #ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES
-// GEN-NEXT:  #undef GEN_FLANG_CLAUSE_PARSER_CLASSES
-// GEN-EMPTY:
-// GEN-NEXT:  EMPTY_CLASS(Clausea);
-// GEN-NEXT:  WRAPPER_CLASS(Clauseb, IntExpr);
-// GEN-EMPTY:
-// GEN-NEXT:  #endif // GEN_FLANG_CLAUSE_PARSER_CLASSES
-// GEN-EMPTY:
-// GEN-NEXT:  #ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-// GEN-NEXT:  #undef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-// GEN-EMPTY:
-// GEN-NEXT:  Clausea
-// GEN-NEXT:  , Clauseb
-// GEN-EMPTY:
-// GEN-NEXT:  #endif // GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
-// GEN-EMPTY:
-// GEN-NEXT:  #ifdef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-// GEN-NEXT:  #undef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-// GEN-EMPTY:
-// GEN-NEXT:  NODE(TdlClause, Clausea)
-// GEN-NEXT:  NODE(TdlClause, Clauseb)
-// GEN-EMPTY:
-// GEN-NEXT:  #endif // GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
-

diff  --git a/llvm/utils/TableGen/DirectiveEmitter.cpp b/llvm/utils/TableGen/DirectiveEmitter.cpp
index ff35264f7c7b..60c80eb09d73 100644
--- a/llvm/utils/TableGen/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/DirectiveEmitter.cpp
@@ -68,10 +68,6 @@ class DirectiveLanguage {
     return Def->getValueAsString("clauseEnumSetClass");
   }
 
-  StringRef getFlangClauseBaseClass() const {
-    return Def->getValueAsString("flangClauseBaseClass");
-  }
-
   bool hasMakeEnumAvailableInNamespace() const {
     return Def->getValueAsBit("makeEnumAvailableInNamespace");
   }
@@ -150,35 +146,6 @@ class Clause : public BaseRecord {
     return Def->getValueAsString("flangClass");
   }
 
-  // Optional field.
-  StringRef getFlangClassValue() const {
-    return Def->getValueAsString("flangClassValue");
-  }
-
-  // Get the formatted name for Flang parser class. The generic formatted class
-  // name is constructed from the name were the first letter of each word is
-  // captitalized and the underscores are removed.
-  // ex: async -> Async
-  //     num_threads -> NumThreads
-  std::string getFormattedParserClassName() {
-    StringRef Name = Def->getValueAsString("name");
-    std::string N = Name.str();
-    bool Cap = true;
-    std::transform(N.begin(), N.end(), N.begin(), [&Cap](unsigned char C) {
-      if (Cap == true) {
-        C = std::toupper(C);
-        Cap = false;
-      } else if (C == '_') {
-        Cap = true;
-      }
-      return C;
-    });
-    N.erase(std::remove(N.begin(), N.end(), '_'), N.end());
-    return N;
-  }
-
-  bool isValueOptional() const { return Def->getValueAsBit("isValueOptional"); }
-
   bool isImplict() const { return Def->getValueAsBit("isImplicit"); }
 };
 
@@ -522,89 +489,15 @@ void GenerateDirectiveClauseMap(const std::vector<Record *> &Directives,
   OS << "}\n";
 }
 
-// Generate classes entry for Flang clauses in the Flang parse-tree
-// If the clause as a non-generic class, no entry is generated.
-// If the clause does not hold a value, an EMPTY_CLASS is used.
-// If the clause class is generic then a WRAPPER_CLASS is used. When the value
-// is optional, the value class is wrapped into a std::optional.
-void GenerateFlangClauseParserClass(const std::vector<Record *> &Clauses,
-                                    raw_ostream &OS) {
-
-  IfDefScope Scope("GEN_FLANG_CLAUSE_PARSER_CLASSES", OS);
-
-  OS << "\n";
-
-  for (const auto &C : Clauses) {
-    Clause Clause{C};
-    // Clause has a non generic class.
-    if (!Clause.getFlangClass().empty())
-      continue;
-    // G
-    if (!Clause.getFlangClassValue().empty()) {
-      if (Clause.isValueOptional()) {
-        OS << "WRAPPER_CLASS(" << Clause.getFormattedParserClassName()
-           << ", std::optional<" << Clause.getFlangClassValue() << ">);\n";
-      } else {
-        OS << "WRAPPER_CLASS(" << Clause.getFormattedParserClassName() << ", "
-           << Clause.getFlangClassValue() << ");\n";
-      }
-    } else {
-      OS << "EMPTY_CLASS(" << Clause.getFormattedParserClassName() << ");\n";
-    }
-  }
-}
-
-// Generate a list of the 
diff erent clause classes for Flang.
-void GenerateFlangClauseParserClassList(const std::vector<Record *> &Clauses,
-                                        raw_ostream &OS) {
-
-  IfDefScope Scope("GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST", OS);
-
-  OS << "\n";
-  llvm::interleaveComma(Clauses, OS, [&](Record *C) {
-    Clause Clause{C};
-    if (Clause.getFlangClass().empty())
-      OS << Clause.getFormattedParserClassName() << "\n";
-    else
-      OS << Clause.getFlangClass() << "\n";
-  });
-}
-
-// Generate dump node list for the clauses holding a generic class name.
-void GenerateFlangClauseDump(const std::vector<Record *> &Clauses,
-                             const DirectiveLanguage &DirLang,
-                             raw_ostream &OS) {
-
-  IfDefScope Scope("GEN_FLANG_DUMP_PARSE_TREE_CLAUSES", OS);
-
-  OS << "\n";
-  for (const auto &C : Clauses) {
-    Clause Clause{C};
-    // Clause has a non generic class.
-    if (!Clause.getFlangClass().empty())
-      continue;
-
-    OS << "NODE(" << DirLang.getFlangClauseBaseClass() << ", "
-       << Clause.getFormattedParserClassName() << ")\n";
-  }
-}
-
 // Generate the implemenation section for the enumeration in the directive
 // language
 void EmitDirectivesFlangImpl(const std::vector<Record *> &Directives,
-                             const std::vector<Record *> &Clauses,
                              raw_ostream &OS,
                              DirectiveLanguage &DirectiveLanguage) {
 
   GenerateDirectiveClauseSets(Directives, OS, DirectiveLanguage);
 
   GenerateDirectiveClauseMap(Directives, OS, DirectiveLanguage);
-
-  GenerateFlangClauseParserClass(Clauses, OS);
-
-  GenerateFlangClauseParserClassList(Clauses, OS);
-
-  GenerateFlangClauseDump(Clauses, DirectiveLanguage, OS);
 }
 
 // Generate the implemenation section for the enumeration in the directive
@@ -620,9 +513,8 @@ void EmitDirectivesGen(RecordKeeper &Records, raw_ostream &OS) {
   }
 
   const auto &Directives = Records.getAllDerivedDefinitions("Directive");
-  const auto &Clauses = Records.getAllDerivedDefinitions("Clause");
   DirectiveLanguage DirectiveLanguage{DirectiveLanguages[0]};
-  EmitDirectivesFlangImpl(Directives, Clauses, OS, DirectiveLanguage);
+  EmitDirectivesFlangImpl(Directives, OS, DirectiveLanguage);
 }
 
 // Generate the implemenation for the enumeration in the directive


        


More information about the flang-commits mailing list