[llvm] [OpenMP] Change association of some directives from "none" to "explicit" (PR #222703)
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 05:28:40 PDT 2026
https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/222703
>From 6e1d29494ddb74b97fc86b606ae492bc8d0c22f0 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Thu, 10 Sep 2026 11:23:16 -0500
Subject: [PATCH] [OpenMP] Change association of some directives from "none" to
"explicit"
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.
---
llvm/include/llvm/Frontend/Directive/DirectiveBase.td | 1 +
llvm/include/llvm/Frontend/OpenMP/OMP.td | 8 ++++----
llvm/test/TableGen/directive1.td | 3 ++-
llvm/test/TableGen/directive2.td | 3 ++-
llvm/utils/TableGen/Basic/DirectiveEmitter.cpp | 2 ++
5 files changed, 11 insertions(+), 6 deletions(-)
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 d907bddcfbe82..99c496862c7ab 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