[llvm] c67808c - [OpenMP] Change association of some directives from "none" to "explicit" (#222703)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 07:15:54 PDT 2026
Author: Krzysztof Parzyszek
Date: 2026-09-13T09:15:50-05:00
New Revision: c67808cf4426290e259f2cd4bd1a48516f9b8d7b
URL: https://github.com/llvm/llvm-project/commit/c67808cf4426290e259f2cd4bd1a48516f9b8d7b
DIFF: https://github.com/llvm/llvm-project/commit/c67808cf4426290e259f2cd4bd1a48516f9b8d7b.diff
LOG: [OpenMP] Change association of some directives from "none" to "explicit" (#222703)
Certain declarative directives are associated with base language
declarations by having the declared entities explicitly listed as
arguments.
Previously these had "none" in OMP.td. Change them to "explicit" to be
consistent with the spec. The existing code does not require any
changes, since the only potentially affected code would be that which
checked the assocation for "none", and the only such cases were applied
to executable directives.
Added:
Modified:
llvm/include/llvm/Frontend/Directive/DirectiveBase.td
llvm/include/llvm/Frontend/OpenMP/OMP.td
llvm/test/TableGen/directive1.td
llvm/test/TableGen/directive2.td
llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index c7653dd228f7c..fb3e9c7367cd7 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -169,6 +169,7 @@ def AS_Block : Association<"Block"> {} // Block (incl. single
def AS_Declaration : Association<"Declaration"> {} // Declaration
def AS_Delimited : Association<"Delimited"> {} // Region delimited with
// begin/end
+def AS_Explicit : Association<"Explicit"> {} // Explicit association
def AS_LoopNest : Association<"LoopNest"> {} // Loop nest
def AS_LoopSeq : Association<"LoopSeq"> {} // Loop sequence
def AS_Separating : Association<"Separating"> {} // Separates parts of a
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index 9faf3589fb8c0..8f18a26754bbc 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -664,7 +664,7 @@ def OMP_Allocate : Directive<[Spelling<"allocate">]> {
VersionedClause<OMPC_Align, 51>,
VersionedClause<OMPC_Allocator>,
];
- let association = AS_None;
+ let association = AS_Explicit;
let category = CA_Declarative;
let pureSince = 50;
}
@@ -864,7 +864,7 @@ def OMP_DeclareTarget : Directive<[Spelling<"declare target", 1, 52>,
VersionedClause<OMPC_DeviceType, 50>,
VersionedClause<OMPC_Indirect, 51>,
];
- let association = AS_None;
+ let association = AS_Explicit;
let category = CA_Declarative;
let pureSince = 45;
}
@@ -1007,7 +1007,7 @@ def OMP_Groupprivate : Directive<[Spelling<"groupprivate">]> {
let allowedOnceClauses = [
VersionedClause<OMPC_DeviceType>,
];
- let association = AS_None;
+ let association = AS_Explicit;
let category = CA_Declarative;
let languages = [L_C, L_Fortran];
let pureSince = 50;
@@ -1448,7 +1448,7 @@ def OMP_Teams : Directive<[Spelling<"teams">]> {
}
def OMP_ThreadPrivate : Directive<[Spelling<"threadprivate">]> {
let pureSince = 50;
- let association = AS_None;
+ let association = AS_Explicit;
let category = CA_Declarative;
}
def OMP_Tile : Directive<[Spelling<"tile">]> {
diff --git a/llvm/test/TableGen/directive1.td b/llvm/test/TableGen/directive1.td
index 8c0fbeecaa946..fa97bde9a8acc 100644
--- a/llvm/test/TableGen/directive1.td
+++ b/llvm/test/TableGen/directive1.td
@@ -72,6 +72,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
// CHECK-NEXT: First_ = Block,
// CHECK-NEXT: Declaration,
// CHECK-NEXT: Delimited,
+// CHECK-NEXT: Explicit,
// CHECK-NEXT: LoopNest,
// CHECK-NEXT: LoopSeq,
// CHECK-NEXT: None,
@@ -79,7 +80,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
// CHECK-NEXT: Last_ = Separating,
// CHECK-NEXT: };
// CHECK-EMPTY:
-// CHECK-NEXT: static constexpr std::size_t Association_enumSize = 7;
+// CHECK-NEXT: static constexpr std::size_t Association_enumSize = 8;
// CHECK-EMPTY:
// CHECK-NEXT: enum class Category {
// CHECK-NEXT: Declarative,
diff --git a/llvm/test/TableGen/directive2.td b/llvm/test/TableGen/directive2.td
index 412862b6ebfa5..8962c2126b06c 100644
--- a/llvm/test/TableGen/directive2.td
+++ b/llvm/test/TableGen/directive2.td
@@ -64,6 +64,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
// CHECK-NEXT: First_ = Block,
// CHECK-NEXT: Declaration,
// CHECK-NEXT: Delimited,
+// CHECK-NEXT: Explicit,
// CHECK-NEXT: LoopNest,
// CHECK-NEXT: LoopSeq,
// CHECK-NEXT: None,
@@ -71,7 +72,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
// CHECK-NEXT: Last_ = Separating,
// CHECK-NEXT: };
// CHECK-EMPTY:
-// CHECK-NEXT: static constexpr std::size_t Association_enumSize = 7;
+// CHECK-NEXT: static constexpr std::size_t Association_enumSize = 8;
// CHECK-EMPTY:
// CHECK-NEXT: enum class Category {
// CHECK-NEXT: Declarative,
diff --git a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
index eba05154dc61f..51cdd9d033e67 100644
--- a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
@@ -768,6 +768,7 @@ static void generateGetDirectiveAssociation(const DirectiveLanguage &DirLang,
Block, // If the order of the rest of these changes, update the
Declaration, // 'Reduce' function below.
Delimited,
+ Explicit,
LoopNest,
LoopSeq,
Separating,
@@ -782,6 +783,7 @@ static void generateGetDirectiveAssociation(const DirectiveLanguage &DirLang,
.Case("AS_Block", Association::Block)
.Case("AS_Declaration", Association::Declaration)
.Case("AS_Delimited", Association::Delimited)
+ .Case("AS_Explicit", Association::Explicit)
.Case("AS_LoopNest", Association::LoopNest)
.Case("AS_LoopSeq", Association::LoopSeq)
.Case("AS_None", Association::None)
More information about the llvm-commits
mailing list