1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[flang][NFC] Unify OpenMP and OpenACC structure checker

This patch remove duplicated code between the check-omp-structure and the check-acc-structure
and unify it into a check-directive-structure templated class.

Reviewed By: kiranchandramohan, sscalpone, ichoyjx

Differential Revision: https://reviews.llvm.org/D85104
This commit is contained in:
Valentin Clement 2020-08-05 14:20:26 -04:00 committed by clementval
parent acac4007fb
commit 103e9a5021
3 changed files with 6 additions and 33 deletions

View File

@ -161,15 +161,7 @@ def TDL_DirA : Directive<"dira"> {
// GEN-NEXT: #ifdef GEN_FLANG_DIRECTIVE_CLAUSE_MAP
// GEN-NEXT: #undef GEN_FLANG_DIRECTIVE_CLAUSE_MAP
// GEN-EMPTY:
// GEN-NEXT: struct TdlDirectiveClauses {
// GEN-NEXT: const allowed;
// GEN-NEXT: const allowedOnce;
// GEN-NEXT: const allowedExclusive;
// GEN-NEXT: const requiredOneOf;
// GEN-NEXT: };
// GEN-EMPTY:
// GEN-NEXT: std::unordered_map<llvm::tdl::Directive, TdlDirectiveClauses>
// GEN-NEXT: directiveClausesTable = {
// GEN-NEXT: {
// GEN-NEXT: {llvm::tdl::Directive::TDLD_dira,
// GEN-NEXT: {
// GEN-NEXT: llvm::tdl::allowedClauses_TDLD_dira,
@ -178,7 +170,7 @@ def TDL_DirA : Directive<"dira"> {
// GEN-NEXT: llvm::tdl::requiredClauses_TDLD_dira,
// GEN-NEXT: }
// GEN-NEXT: },
// GEN-NEXT: };
// GEN-NEXT: }
// GEN-EMPTY:
// GEN-NEXT: #endif // GEN_FLANG_DIRECTIVE_CLAUSE_MAP

View File

@ -152,15 +152,7 @@ def TDL_DirA : Directive<"dira"> {
// GEN-NEXT: #ifdef GEN_FLANG_DIRECTIVE_CLAUSE_MAP
// GEN-NEXT: #undef GEN_FLANG_DIRECTIVE_CLAUSE_MAP
// GEN-EMPTY:
// GEN-NEXT: struct TdlDirectiveClauses {
// GEN-NEXT: const allowed;
// GEN-NEXT: const allowedOnce;
// GEN-NEXT: const allowedExclusive;
// GEN-NEXT: const requiredOneOf;
// GEN-NEXT: };
// GEN-EMPTY:
// GEN-NEXT: std::unordered_map<llvm::tdl::Directive, TdlDirectiveClauses>
// GEN-NEXT: directiveClausesTable = {
// GEN-NEXT: {
// GEN-NEXT: {llvm::tdl::Directive::TDLD_dira,
// GEN-NEXT: {
// GEN-NEXT: llvm::tdl::allowedClauses_TDLD_dira,
@ -169,6 +161,6 @@ def TDL_DirA : Directive<"dira"> {
// GEN-NEXT: llvm::tdl::requiredClauses_TDLD_dira,
// GEN-NEXT: }
// GEN-NEXT: },
// GEN-NEXT: };
// GEN-NEXT: }
// GEN-EMPTY:
// GEN-NEXT: #endif // GEN_FLANG_DIRECTIVE_CLAUSE_MAP

View File

@ -465,18 +465,7 @@ void GenerateDirectiveClauseMap(const std::vector<Record *> &Directives,
IfDefScope Scope("GEN_FLANG_DIRECTIVE_CLAUSE_MAP", OS);
OS << "\n";
OS << "struct " << DirLang.getName() << "DirectiveClauses {\n";
OS << " const " << DirLang.getClauseEnumSetClass() << " allowed;\n";
OS << " const " << DirLang.getClauseEnumSetClass() << " allowedOnce;\n";
OS << " const " << DirLang.getClauseEnumSetClass() << " allowedExclusive;\n";
OS << " const " << DirLang.getClauseEnumSetClass() << " requiredOneOf;\n";
OS << "};\n";
OS << "\n";
OS << "std::unordered_map<llvm::" << DirLang.getCppNamespace()
<< "::Directive, " << DirLang.getName() << "DirectiveClauses>\n";
OS << " directiveClausesTable = {\n";
OS << "{\n";
for (const auto &D : Directives) {
Directive Dir{D};
@ -497,7 +486,7 @@ void GenerateDirectiveClauseMap(const std::vector<Record *> &Directives,
OS << " },\n";
}
OS << "};\n";
OS << "}\n";
}
// Generate the implemenation section for the enumeration in the directive