Skip to content

[OpenMP] Add directive spellings introduced in spec v6.0 #141772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

kparzysz
Copy link
Contributor

@kparzysz kparzysz requested review from tblah and mjklemm May 28, 2025 14:28
@llvmbot llvmbot added flang:openmp clang:openmp OpenMP related changes to Clang labels May 28, 2025
@llvmbot
Copy link
Member

llvmbot commented May 28, 2025

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-openacc
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-core
@llvm/pr-subscribers-tablegen

@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)

Changes

For background information see
https://discourse.llvm.org/t/rfc-alternative-spellings-of-openmp-directives/85507


Full diff: https://github.com/llvm/llvm-project/pull/141772.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+20-10)
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index 027692275b63b..04433ffd72b7b 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -677,7 +677,8 @@ def OMP_Cancel : Directive<[Spelling<"cancel">]> {
   let association = AS_None;
   let category = CA_Executable;
 }
-def OMP_CancellationPoint : Directive<[Spelling<"cancellation point">]> {
+def OMP_CancellationPoint : Directive<[Spelling<"cancellation point", 1, 52>,
+                                       Spelling<"cancellation_point", 60>]> {
   let allowedOnceClauses = [
     VersionedClause<OMPC_CancellationConstructType>,
   ];
@@ -691,21 +692,24 @@ def OMP_Critical : Directive<[Spelling<"critical">]> {
   let association = AS_Block;
   let category = CA_Executable;
 }
-def OMP_DeclareMapper : Directive<[Spelling<"declare mapper">]> {
+def OMP_DeclareMapper : Directive<[Spelling<"declare mapper", 1, 52>,
+                                   Spelling<"declare_mapper", 60>]> {
   let requiredClauses = [
     VersionedClause<OMPC_Map, 45>,
   ];
   let association = AS_None;
   let category = CA_Declarative;
 }
-def OMP_DeclareReduction : Directive<[Spelling<"declare reduction">]> {
+def OMP_DeclareReduction : Directive<[Spelling<"declare reduction", 1, 52>,
+                                      Spelling<"declare_reduction", 60>]> {
   let allowedOnceClauses = [
     VersionedClause<OMPC_Initializer>,
   ];
   let association = AS_None;
   let category = CA_Declarative;
 }
-def OMP_DeclareSimd : Directive<[Spelling<"declare simd">]> {
+def OMP_DeclareSimd : Directive<[Spelling<"declare simd", 1, 52>,
+                                 Spelling<"declare_simd", 60>]> {
   let allowedClauses = [
     VersionedClause<OMPC_Aligned>,
     VersionedClause<OMPC_Linear>,
@@ -721,7 +725,8 @@ def OMP_DeclareSimd : Directive<[Spelling<"declare simd">]> {
   let association = AS_Declaration;
   let category = CA_Declarative;
 }
-def OMP_DeclareTarget : Directive<[Spelling<"declare target">]> {
+def OMP_DeclareTarget : Directive<[Spelling<"declare target", 1, 52>,
+                                   Spelling<"declare_target", 60>]> {
   let allowedClauses = [
     VersionedClause<OMPC_Enter, 52>,
     VersionedClause<OMPC_Indirect>,
@@ -734,7 +739,8 @@ def OMP_DeclareTarget : Directive<[Spelling<"declare target">]> {
   let association = AS_None;
   let category = CA_Declarative;
 }
-def OMP_DeclareVariant : Directive<[Spelling<"declare variant">]> {
+def OMP_DeclareVariant : Directive<[Spelling<"declare variant", 1, 52>,
+                                    Spelling<"declare_variant", 60>]> {
   let allowedClauses = [
     VersionedClause<OMPC_AdjustArgs, 51>,
   ];
@@ -1093,7 +1099,8 @@ def OMP_Target : Directive<[Spelling<"target">]> {
   let association = AS_Block;
   let category = CA_Executable;
 }
-def OMP_TargetData : Directive<[Spelling<"target data">]> {
+def OMP_TargetData : Directive<[Spelling<"target data", 1, 52>,
+                                Spelling<"target_data", 60>]> {
   let allowedOnceClauses = [
     VersionedClause<OMPC_Device>,
     VersionedClause<OMPC_If>,
@@ -1106,7 +1113,8 @@ def OMP_TargetData : Directive<[Spelling<"target data">]> {
   let association = AS_Block;
   let category = CA_Executable;
 }
-def OMP_TargetEnterData : Directive<[Spelling<"target enter data">]> {
+def OMP_TargetEnterData : Directive<[Spelling<"target enter data", 1, 52>,
+                                     Spelling<"target_enter_data", 60>]> {
   let allowedClauses = [
     VersionedClause<OMPC_Depend>,
   ];
@@ -1121,7 +1129,8 @@ def OMP_TargetEnterData : Directive<[Spelling<"target enter data">]> {
   let association = AS_None;
   let category = CA_Executable;
 }
-def OMP_TargetExitData : Directive<[Spelling<"target exit data">]> {
+def OMP_TargetExitData : Directive<[Spelling<"target exit data", 1, 52>,
+                                    Spelling<"target_exit_data", 60>]> {
   let allowedClauses = [
     VersionedClause<OMPC_Depend>,
   ];
@@ -1136,7 +1145,8 @@ def OMP_TargetExitData : Directive<[Spelling<"target exit data">]> {
   let association = AS_None;
   let category = CA_Executable;
 }
-def OMP_TargetUpdate : Directive<[Spelling<"target update">]> {
+def OMP_TargetUpdate : Directive<[Spelling<"target update", 1, 52>,
+                                  Spelling<"target_update", 60>]> {
   let allowedClauses = [
     VersionedClause<OMPC_Depend>,
     VersionedClause<OMPC_From>,

Copy link
Contributor

@mjklemm mjklemm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kparzysz kparzysz force-pushed the users/kparzysz/spr/t08-versioned-spellings branch from b081ce6 to 4dcc159 Compare June 5, 2025 18:05
@kparzysz kparzysz deleted the branch main June 5, 2025 18:09
@kparzysz kparzysz closed this Jun 5, 2025
@kparzysz kparzysz reopened this Jun 5, 2025
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure tablegen mlir openacc labels Jun 5, 2025
Base automatically changed from users/kparzysz/spr/t08-versioned-spellings to main June 6, 2025 22:07
@kparzysz kparzysz force-pushed the users/kparzysz/spr/t09-openmp60 branch from 8385ab9 to 9099611 Compare June 10, 2025 12:26
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 10, 2025
@kparzysz
Copy link
Contributor Author

Hi @alexey-bataev, could you check if you're ok with this? I had to modify a few clang tests to accommodate this change.

@alexey-bataev
Copy link
Member

Can you add the tests for the new spellings?

@kparzysz
Copy link
Contributor Author

The modified tests do contain new spellings when the version is 60. Do you want me to extract these RUN lines into separate files?

Right now we don't yet parse the new names, this is just checking the names in the diagnostics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category flang:openmp mlir:core MLIR Core Infrastructure mlir openacc tablegen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants