-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Frontend] Introduce getDirectiveCategory
for ACC/OMP directives
#94689
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
Conversation
The file OMP.td is becoming tedious to update by hand due to the seemingly random ordering of various items in it. This patch brings order to it by sorting most of the contents. The clause definitions are sorted alphabetically with respect to the spelling of the clause.[1] The directive definitions are split into two leaf directives and compound directives.[2] Within each, definitions are sorted alphabetically with respect to the spelling, with the exception that "end xyz" directives are placed immediately following the definition of "xyz".[3] Within each directive definition, the lists of clauses are also sorted alphabetically. [1] All spellings are made of lowercase letters, _, or space. Ordering between non-letters follow the order assumed by `sort` utility. [2] Compound directives refer to the consituent leaf directives, hence the leaf definitions must come first. [3] Some of the "end xyz" directives have properties derived from the corresponding "xyz" directive. This exception guarantees that "xyz" precedes the "end xyz".
The categories are primarily meant for OpenMP, where the spec assigns a category to each directive. It's one of declarative, executable, informational, meta, subsidiary, and utility. These will be used in clang to avoid listing directives belonging to certain categories by hand.
@llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesThe categories are primarily meant for OpenMP, where the spec assigns a category to each directive. It's one of declarative, executable, informational, meta, subsidiary, and utility. These will be used in clang to avoid listing directives belonging to certain categories by hand. Patch is 39.92 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94689.diff 7 Files Affected:
diff --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index ce532e0cfae29..6889c7e642ec6 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -156,6 +156,18 @@ def AS_FromLeaves : Association<"FromLeaves"> {} // See below
// The name "AS_FromLeaves" is recognized by TableGen, and there is no enum
// generated for it.
+// Kinds of directive categories.
+class Category<string n> {
+ string name = n; // Name of the enum value in enum class Category.
+}
+
+def CA_Declarative: Category<"Declarative"> {}
+def CA_Executable: Category<"Executable"> {}
+def CA_Informational: Category<"Informational"> {}
+def CA_Meta: Category<"Meta"> {}
+def CA_Subsidiary: Category<"Subsidiary"> {}
+def CA_Utility: Category<"Utility"> {}
+
// Information about a specific directive.
class Directive<string d> {
// Name of the directive. Can be composite directive sepearted by whitespace.
@@ -190,4 +202,7 @@ class Directive<string d> {
// What the directive is associated with.
Association association = AS_FromLeaves;
+
+ // The category if the directive.
+ Category category = ?;
}
diff --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index dfa6a222e9f77..30a81efe7f8a6 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -268,6 +268,7 @@ def ACCC_Unknown : Clause<"unknown"> {
// 2.12
def ACC_Atomic : Directive<"atomic"> {
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.6.5
@@ -293,6 +294,7 @@ def ACC_Data : Directive<"data"> {
VersionedClause<ACCC_Present>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.13
@@ -308,6 +310,7 @@ def ACC_Declare : Directive<"declare"> {
VersionedClause<ACCC_Link>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.5.3
@@ -334,6 +337,7 @@ def ACC_Kernels : Directive<"kernels"> {
VersionedClause<ACCC_VectorLength>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.5.1
@@ -363,6 +367,7 @@ def ACC_Parallel : Directive<"parallel"> {
VersionedClause<ACCC_Self>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.5.2
@@ -391,6 +396,7 @@ def ACC_Serial : Directive<"serial"> {
VersionedClause<ACCC_Self>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.9
@@ -411,11 +417,13 @@ def ACC_Loop : Directive<"loop"> {
VersionedClause<ACCC_Seq>
];
let association = AS_Loop;
+ let category = CA_Executable;
}
// 2.10
def ACC_Cache : Directive<"cache"> {
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.1
@@ -426,6 +434,7 @@ def ACC_Init : Directive<"init"> {
VersionedClause<ACCC_If>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.15.1
@@ -442,6 +451,7 @@ def ACC_Routine : Directive<"routine"> {
VersionedClause<ACCC_NoHost>
];
let association = AS_Declaration;
+ let category = CA_Declarative;
}
// 2.14.3
@@ -461,6 +471,7 @@ def ACC_Set : Directive<"set"> {
VersionedClause<ACCC_DeviceType>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.2
@@ -471,6 +482,7 @@ def ACC_Shutdown : Directive<"shutdown"> {
VersionedClause<ACCC_If>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.4
@@ -490,6 +502,7 @@ def ACC_Update : Directive<"update"> {
VersionedClause<ACCC_Self>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.16.3
@@ -499,6 +512,7 @@ def ACC_Wait : Directive<"wait"> {
VersionedClause<ACCC_If>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.6
@@ -516,6 +530,7 @@ def ACC_EnterData : Directive<"enter data"> {
VersionedClause<ACCC_Copyin>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.7
@@ -534,6 +549,7 @@ def ACC_ExitData : Directive<"exit data"> {
VersionedClause<ACCC_Detach>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.8
@@ -546,6 +562,7 @@ def ACC_HostData : Directive<"host_data"> {
VersionedClause<ACCC_UseDevice>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.11
@@ -584,6 +601,7 @@ def ACC_KernelsLoop : Directive<"kernels loop"> {
VersionedClause<ACCC_Seq>
];
let leafConstructs = [ACC_Kernels, ACC_Loop];
+ let category = CA_Executable;
}
// 2.11
@@ -623,6 +641,7 @@ def ACC_ParallelLoop : Directive<"parallel loop"> {
VersionedClause<ACCC_Seq>
];
let leafConstructs = [ACC_Parallel, ACC_Loop];
+ let category = CA_Executable;
}
// 2.11
@@ -659,9 +678,11 @@ def ACC_SerialLoop : Directive<"serial loop"> {
VersionedClause<ACCC_Seq>
];
let leafConstructs = [ACC_Serial, ACC_Loop];
+ let category = CA_Executable;
}
def ACC_Unknown : Directive<"unknown"> {
let isDefault = true;
let association = AS_None;
+ let category = CA_Utility;
}
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index afb8d5f725753..12a944e34c414 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -493,18 +493,22 @@ def OMP_Allocate : Directive<"allocate"> {
VersionedClause<OMPC_Allocator>,
];
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_Allocators : Directive<"allocators"> {
let allowedClauses = [
VersionedClause<OMPC_Allocate>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Assumes : Directive<"assumes"> {
let association = AS_None;
+ let category = CA_Informational;
}
def OMP_EndAssumes : Directive<"end assumes"> {
let association = AS_Delimited;
+ let category = OMP_Assumes.category;
}
def OMP_Atomic : Directive<"atomic"> {
let allowedClauses = [
@@ -525,12 +529,15 @@ def OMP_Atomic : Directive<"atomic"> {
VersionedClause<OMPC_Weak, 51>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Barrier : Directive<"barrier"> {
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_BeginAssumes : Directive<"begin assumes"> {
let association = AS_Delimited;
+ let category = CA_Informational;
}
def OMP_BeginDeclareTarget : Directive<"begin declare target"> {
let allowedClauses = [
@@ -540,33 +547,40 @@ def OMP_BeginDeclareTarget : Directive<"begin declare target"> {
VersionedClause<OMPC_To>,
];
let association = AS_Delimited;
+ let category = CA_Declarative;
}
def OMP_BeginDeclareVariant : Directive<"begin declare variant"> {
let association = AS_Delimited;
+ let category = CA_Declarative;
}
def OMP_Cancel : Directive<"cancel"> {
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_CancellationPoint : Directive<"cancellation point"> {
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_Critical : Directive<"critical"> {
let allowedClauses = [
VersionedClause<OMPC_Hint>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_DeclareMapper : Directive<"declare mapper"> {
let allowedClauses = [
VersionedClause<OMPC_Map>,
];
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_DeclareReduction : Directive<"declare reduction"> {
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_DeclareSimd : Directive<"declare simd"> {
let allowedClauses = [
@@ -582,6 +596,7 @@ def OMP_DeclareSimd : Directive<"declare simd"> {
VersionedClause<OMPC_Notinbranch>,
];
let association = AS_Declaration;
+ let category = CA_Declarative;
}
def OMP_DeclareTarget : Directive<"declare target"> {
let allowedClauses = [
@@ -594,9 +609,11 @@ def OMP_DeclareTarget : Directive<"declare target"> {
VersionedClause<OMPC_DeviceType, 50>,
];
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_EndDeclareTarget : Directive<"end declare target"> {
let association = AS_Delimited;
+ let category = OMP_DeclareTarget.category;
}
def OMP_DeclareVariant : Directive<"declare variant"> {
let allowedClauses = [
@@ -607,9 +624,11 @@ def OMP_DeclareVariant : Directive<"declare variant"> {
VersionedClause<OMPC_AppendArgs, 51>,
];
let association = AS_Declaration;
+ let category = CA_Declarative;
}
def OMP_EndDeclareVariant : Directive<"end declare variant"> {
let association = AS_Delimited;
+ let category = OMP_DeclareVariant.category;
}
def OMP_Depobj : Directive<"depobj"> {
let allowedClauses = [
@@ -621,6 +640,7 @@ def OMP_Depobj : Directive<"depobj"> {
VersionedClause<OMPC_Update, 50>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_dispatch : Directive<"dispatch"> {
let allowedClauses = [
@@ -633,6 +653,7 @@ def OMP_dispatch : Directive<"dispatch"> {
VersionedClause<OMPC_NoWait>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Distribute : Directive<"distribute"> {
let allowedClauses = [
@@ -646,6 +667,7 @@ def OMP_Distribute : Directive<"distribute"> {
VersionedClause<OMPC_DistSchedule>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Do : Directive<"do"> {
let allowedClauses = [
@@ -663,6 +685,7 @@ def OMP_Do : Directive<"do"> {
VersionedClause<OMPC_Schedule>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_EndDo : Directive<"end do"> {
let allowedOnceClauses = [
@@ -671,6 +694,7 @@ def OMP_EndDo : Directive<"end do"> {
// Needed for association computation, since OMP_Do has it "from leafConstructs".
let leafConstructs = OMP_Do.leafConstructs;
let association = OMP_Do.association;
+ let category = OMP_Do.category;
}
def OMP_Error : Directive<"error"> {
let allowedClauses = [
@@ -679,6 +703,7 @@ def OMP_Error : Directive<"error"> {
VersionedClause<OMPC_Severity, 51>,
];
let association = AS_None;
+ let category = CA_Utility;
}
def OMP_Flush : Directive<"flush"> {
let allowedOnceClauses = [
@@ -690,6 +715,7 @@ def OMP_Flush : Directive<"flush"> {
VersionedClause<OMPC_Release, 50>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_For : Directive<"for"> {
let allowedClauses = [
@@ -706,6 +732,7 @@ def OMP_For : Directive<"for"> {
VersionedClause<OMPC_Schedule>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_interop : Directive<"interop"> {
let allowedClauses = [
@@ -717,6 +744,7 @@ def OMP_interop : Directive<"interop"> {
VersionedClause<OMPC_Use>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_loop : Directive<"loop"> {
let allowedClauses = [
@@ -730,15 +758,18 @@ def OMP_loop : Directive<"loop"> {
VersionedClause<OMPC_Order, 50>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_masked : Directive<"masked"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Filter>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Master : Directive<"master"> {
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Metadirective : Directive<"metadirective"> {
let allowedClauses = [
@@ -748,9 +779,11 @@ def OMP_Metadirective : Directive<"metadirective"> {
VersionedClause<OMPC_Default>,
];
let association = AS_None;
+ let category = CA_Meta;
}
def OMP_Nothing : Directive<"nothing"> {
let association = AS_None;
+ let category = CA_Utility;
}
def OMP_Ordered : Directive<"ordered"> {
let allowedClauses = [
@@ -763,6 +796,7 @@ def OMP_Ordered : Directive<"ordered"> {
];
let association = AS_None;
// There is also a block-associated "ordered" directive.
+ let category = CA_Executable;
}
def OMP_Parallel : Directive<"parallel"> {
let allowedClauses = [
@@ -781,6 +815,7 @@ def OMP_Parallel : Directive<"parallel"> {
VersionedClause<OMPC_ProcBind>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Requires : Directive<"requires"> {
let allowedOnceClauses = [
@@ -799,6 +834,7 @@ def OMP_Requires : Directive<"requires"> {
VersionedClause<OMPC_ReverseOffload, 99>,
];
let association = AS_None;
+ let category = CA_Informational;
}
def OMP_Scan : Directive<"scan"> {
let allowedClauses = [
@@ -806,6 +842,7 @@ def OMP_Scan : Directive<"scan"> {
VersionedClause<OMPC_Inclusive, 50>,
];
let association = AS_Separating;
+ let category = CA_Subsidiary;
}
def OMP_scope : Directive<"scope"> {
let allowedClauses = [
@@ -816,9 +853,11 @@ def OMP_scope : Directive<"scope"> {
VersionedClause<OMPC_NoWait, 51>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Section : Directive<"section"> {
let association = AS_Separating;
+ let category = CA_Subsidiary;
}
def OMP_Sections : Directive<"sections"> {
let allowedClauses = [
@@ -830,6 +869,7 @@ def OMP_Sections : Directive<"sections"> {
VersionedClause<OMPC_Reduction>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_EndSections : Directive<"end sections"> {
let allowedOnceClauses = [
@@ -837,6 +877,7 @@ def OMP_EndSections : Directive<"end sections"> {
];
let leafConstructs = OMP_Sections.leafConstructs;
let association = OMP_Sections.association;
+ let category = OMP_Sections.category;
}
def OMP_Simd : Directive<"simd"> {
let allowedClauses = [
@@ -856,6 +897,7 @@ def OMP_Simd : Directive<"simd"> {
VersionedClause<OMPC_SimdLen>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Single : Directive<"single"> {
let allowedClauses = [
@@ -866,6 +908,7 @@ def OMP_Single : Directive<"single"> {
VersionedClause<OMPC_Private>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_EndSingle : Directive<"end single"> {
let allowedClauses = [
@@ -876,6 +919,7 @@ def OMP_EndSingle : Directive<"end single"> {
];
let leafConstructs = OMP_Single.leafConstructs;
let association = OMP_Single.association;
+ let category = OMP_Single.category;
}
def OMP_Target : Directive<"target"> {
let allowedClauses = [
@@ -899,6 +943,7 @@ def OMP_Target : Directive<"target"> {
VersionedClause<OMPC_ThreadLimit, 51>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TargetData : Directive<"target data"> {
let allowedOnceClauses = [
@@ -911,6 +956,7 @@ def OMP_TargetData : Directive<"target data"> {
VersionedClause<OMPC_UseDevicePtr>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TargetEnterData : Directive<"target enter data"> {
let allowedClauses = [
@@ -925,6 +971,7 @@ def OMP_TargetEnterData : Directive<"target enter data"> {
VersionedClause<OMPC_Map>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_TargetExitData : Directive<"target exit data"> {
let allowedClauses = [
@@ -939,6 +986,7 @@ def OMP_TargetExitData : Directive<"target exit data"> {
VersionedClause<OMPC_Map>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_TargetUpdate : Directive<"target update"> {
let allowedClauses = [
@@ -952,6 +1000,7 @@ def OMP_TargetUpdate : Directive<"target update"> {
VersionedClause<OMPC_NoWait>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_Task : Directive<"task"> {
let allowedClauses = [
@@ -973,6 +1022,7 @@ def OMP_Task : Directive<"task"> {
VersionedClause<OMPC_Priority>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TaskGroup : Directive<"taskgroup"> {
let allowedClauses = [
@@ -980,6 +1030,7 @@ def OMP_TaskGroup : Directive<"taskgroup"> {
VersionedClause<OMPC_TaskReduction, 50>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TaskLoop : Directive<"taskloop"> {
let allowedClauses = [
@@ -1006,6 +1057,7 @@ def OMP_TaskLoop : Directive<"taskloop"> {
VersionedClause<OMPC_NumTasks>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_TaskWait : Directive<"taskwait"> {
let allowedClauses = [
@@ -1013,9 +1065,11 @@ def OMP_TaskWait : Directive<"taskwait"> {
VersionedClause<OMPC_NoWait, 51>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_TaskYield : Directive<"taskyield"> {
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_Teams : Directive<"teams"> {
let allowedClauses = [
@@ -1033,19 +1087,23 @@ def OMP_Teams : Directive<"teams"> {
VersionedClause<OMPC_ThreadLimit>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_ThreadPrivate : Directive<"threadprivate"> {
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_Tile : Directive<"tile"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Sizes, 51>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Unknown : Directive<"unknown"> {
let isDefault = true;
let association = AS_None;
+ let category = CA_Utility;
}
def OMP_Unroll : Directive<"unroll"> {
let allowedOnceClauses = [
@@ -1053,12 +1111,14 @@ def OMP_Unroll : Directive<"unroll"> {
VersionedClause<OMPC_Partial, 51>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Workshare : Directive<"workshare"> {
let allowedOnceClauses = [
VersionedClause<OMPC_NoWait>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_EndWorkshare : Directive<"end workshare"> {
let allowedClauses = [
@@ -1066,6 +1126,7 @@ def OMP_EndWorkshare : Directive<"end workshare"> {
];
let leafConstructs = OMP_Workshare.leafConstructs;
let association = OMP_Workshare.association;
+ let category = OMP_Workshare.category;
}
//===----------------------------------------------------------------------===//
@@ -1097,6 +1158,7 @@ def OMP_DistributeParallelDo : Directive<"distribute parallel do"> {
VersionedClause<OMPC_Schedule>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_Do];
+ let category = CA_Executable;
}
def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
let allowedClauses = [
@@ -1122,6 +1184,7 @@ def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_Do, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
let allowedClauses = [
@@ -1143,6 +1206,7 @@ def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
VersionedClause<OMPC_Shared>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_For];
+ let category = CA_Executable;
}
def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
let allowedClauses = [
@@ -1169,6 +1233,7 @@ def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_For, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_DistributeSimd : Directive<"distribute simd"> {
let allowedClauses = [
@@ -1196,6 +1261,7 @@ def OMP_DistributeSimd : Directive<"distribute simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Distribute, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_DoSimd : Directive<"do simd"> {
let allowedClauses = [
@@ -1217,6 +1283,7 @@ def OMP_DoSimd : Directive<"do simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Do, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_EndDoSimd : Directive<"end do simd"> {
let allowedOnceClauses = [
@@ -1224,6 +1291,7 @@ def OMP_EndDoSimd : Directive<"end do simd"> {
];
let leafConstructs = OMP_DoSimd.leafConstructs;
let association = OMP_DoSimd.associ...
[truncated]
|
@llvm/pr-subscribers-openacc Author: Krzysztof Parzyszek (kparzysz) ChangesThe categories are primarily meant for OpenMP, where the spec assigns a category to each directive. It's one of declarative, executable, informational, meta, subsidiary, and utility. These will be used in clang to avoid listing directives belonging to certain categories by hand. Patch is 39.92 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94689.diff 7 Files Affected:
diff --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index ce532e0cfae29..6889c7e642ec6 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -156,6 +156,18 @@ def AS_FromLeaves : Association<"FromLeaves"> {} // See below
// The name "AS_FromLeaves" is recognized by TableGen, and there is no enum
// generated for it.
+// Kinds of directive categories.
+class Category<string n> {
+ string name = n; // Name of the enum value in enum class Category.
+}
+
+def CA_Declarative: Category<"Declarative"> {}
+def CA_Executable: Category<"Executable"> {}
+def CA_Informational: Category<"Informational"> {}
+def CA_Meta: Category<"Meta"> {}
+def CA_Subsidiary: Category<"Subsidiary"> {}
+def CA_Utility: Category<"Utility"> {}
+
// Information about a specific directive.
class Directive<string d> {
// Name of the directive. Can be composite directive sepearted by whitespace.
@@ -190,4 +202,7 @@ class Directive<string d> {
// What the directive is associated with.
Association association = AS_FromLeaves;
+
+ // The category if the directive.
+ Category category = ?;
}
diff --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index dfa6a222e9f77..30a81efe7f8a6 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -268,6 +268,7 @@ def ACCC_Unknown : Clause<"unknown"> {
// 2.12
def ACC_Atomic : Directive<"atomic"> {
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.6.5
@@ -293,6 +294,7 @@ def ACC_Data : Directive<"data"> {
VersionedClause<ACCC_Present>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.13
@@ -308,6 +310,7 @@ def ACC_Declare : Directive<"declare"> {
VersionedClause<ACCC_Link>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.5.3
@@ -334,6 +337,7 @@ def ACC_Kernels : Directive<"kernels"> {
VersionedClause<ACCC_VectorLength>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.5.1
@@ -363,6 +367,7 @@ def ACC_Parallel : Directive<"parallel"> {
VersionedClause<ACCC_Self>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.5.2
@@ -391,6 +396,7 @@ def ACC_Serial : Directive<"serial"> {
VersionedClause<ACCC_Self>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.9
@@ -411,11 +417,13 @@ def ACC_Loop : Directive<"loop"> {
VersionedClause<ACCC_Seq>
];
let association = AS_Loop;
+ let category = CA_Executable;
}
// 2.10
def ACC_Cache : Directive<"cache"> {
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.1
@@ -426,6 +434,7 @@ def ACC_Init : Directive<"init"> {
VersionedClause<ACCC_If>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.15.1
@@ -442,6 +451,7 @@ def ACC_Routine : Directive<"routine"> {
VersionedClause<ACCC_NoHost>
];
let association = AS_Declaration;
+ let category = CA_Declarative;
}
// 2.14.3
@@ -461,6 +471,7 @@ def ACC_Set : Directive<"set"> {
VersionedClause<ACCC_DeviceType>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.2
@@ -471,6 +482,7 @@ def ACC_Shutdown : Directive<"shutdown"> {
VersionedClause<ACCC_If>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.4
@@ -490,6 +502,7 @@ def ACC_Update : Directive<"update"> {
VersionedClause<ACCC_Self>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.16.3
@@ -499,6 +512,7 @@ def ACC_Wait : Directive<"wait"> {
VersionedClause<ACCC_If>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.6
@@ -516,6 +530,7 @@ def ACC_EnterData : Directive<"enter data"> {
VersionedClause<ACCC_Copyin>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.14.7
@@ -534,6 +549,7 @@ def ACC_ExitData : Directive<"exit data"> {
VersionedClause<ACCC_Detach>
];
let association = AS_None;
+ let category = CA_Executable;
}
// 2.8
@@ -546,6 +562,7 @@ def ACC_HostData : Directive<"host_data"> {
VersionedClause<ACCC_UseDevice>
];
let association = AS_Block;
+ let category = CA_Executable;
}
// 2.11
@@ -584,6 +601,7 @@ def ACC_KernelsLoop : Directive<"kernels loop"> {
VersionedClause<ACCC_Seq>
];
let leafConstructs = [ACC_Kernels, ACC_Loop];
+ let category = CA_Executable;
}
// 2.11
@@ -623,6 +641,7 @@ def ACC_ParallelLoop : Directive<"parallel loop"> {
VersionedClause<ACCC_Seq>
];
let leafConstructs = [ACC_Parallel, ACC_Loop];
+ let category = CA_Executable;
}
// 2.11
@@ -659,9 +678,11 @@ def ACC_SerialLoop : Directive<"serial loop"> {
VersionedClause<ACCC_Seq>
];
let leafConstructs = [ACC_Serial, ACC_Loop];
+ let category = CA_Executable;
}
def ACC_Unknown : Directive<"unknown"> {
let isDefault = true;
let association = AS_None;
+ let category = CA_Utility;
}
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index afb8d5f725753..12a944e34c414 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -493,18 +493,22 @@ def OMP_Allocate : Directive<"allocate"> {
VersionedClause<OMPC_Allocator>,
];
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_Allocators : Directive<"allocators"> {
let allowedClauses = [
VersionedClause<OMPC_Allocate>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Assumes : Directive<"assumes"> {
let association = AS_None;
+ let category = CA_Informational;
}
def OMP_EndAssumes : Directive<"end assumes"> {
let association = AS_Delimited;
+ let category = OMP_Assumes.category;
}
def OMP_Atomic : Directive<"atomic"> {
let allowedClauses = [
@@ -525,12 +529,15 @@ def OMP_Atomic : Directive<"atomic"> {
VersionedClause<OMPC_Weak, 51>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Barrier : Directive<"barrier"> {
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_BeginAssumes : Directive<"begin assumes"> {
let association = AS_Delimited;
+ let category = CA_Informational;
}
def OMP_BeginDeclareTarget : Directive<"begin declare target"> {
let allowedClauses = [
@@ -540,33 +547,40 @@ def OMP_BeginDeclareTarget : Directive<"begin declare target"> {
VersionedClause<OMPC_To>,
];
let association = AS_Delimited;
+ let category = CA_Declarative;
}
def OMP_BeginDeclareVariant : Directive<"begin declare variant"> {
let association = AS_Delimited;
+ let category = CA_Declarative;
}
def OMP_Cancel : Directive<"cancel"> {
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_CancellationPoint : Directive<"cancellation point"> {
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_Critical : Directive<"critical"> {
let allowedClauses = [
VersionedClause<OMPC_Hint>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_DeclareMapper : Directive<"declare mapper"> {
let allowedClauses = [
VersionedClause<OMPC_Map>,
];
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_DeclareReduction : Directive<"declare reduction"> {
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_DeclareSimd : Directive<"declare simd"> {
let allowedClauses = [
@@ -582,6 +596,7 @@ def OMP_DeclareSimd : Directive<"declare simd"> {
VersionedClause<OMPC_Notinbranch>,
];
let association = AS_Declaration;
+ let category = CA_Declarative;
}
def OMP_DeclareTarget : Directive<"declare target"> {
let allowedClauses = [
@@ -594,9 +609,11 @@ def OMP_DeclareTarget : Directive<"declare target"> {
VersionedClause<OMPC_DeviceType, 50>,
];
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_EndDeclareTarget : Directive<"end declare target"> {
let association = AS_Delimited;
+ let category = OMP_DeclareTarget.category;
}
def OMP_DeclareVariant : Directive<"declare variant"> {
let allowedClauses = [
@@ -607,9 +624,11 @@ def OMP_DeclareVariant : Directive<"declare variant"> {
VersionedClause<OMPC_AppendArgs, 51>,
];
let association = AS_Declaration;
+ let category = CA_Declarative;
}
def OMP_EndDeclareVariant : Directive<"end declare variant"> {
let association = AS_Delimited;
+ let category = OMP_DeclareVariant.category;
}
def OMP_Depobj : Directive<"depobj"> {
let allowedClauses = [
@@ -621,6 +640,7 @@ def OMP_Depobj : Directive<"depobj"> {
VersionedClause<OMPC_Update, 50>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_dispatch : Directive<"dispatch"> {
let allowedClauses = [
@@ -633,6 +653,7 @@ def OMP_dispatch : Directive<"dispatch"> {
VersionedClause<OMPC_NoWait>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Distribute : Directive<"distribute"> {
let allowedClauses = [
@@ -646,6 +667,7 @@ def OMP_Distribute : Directive<"distribute"> {
VersionedClause<OMPC_DistSchedule>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Do : Directive<"do"> {
let allowedClauses = [
@@ -663,6 +685,7 @@ def OMP_Do : Directive<"do"> {
VersionedClause<OMPC_Schedule>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_EndDo : Directive<"end do"> {
let allowedOnceClauses = [
@@ -671,6 +694,7 @@ def OMP_EndDo : Directive<"end do"> {
// Needed for association computation, since OMP_Do has it "from leafConstructs".
let leafConstructs = OMP_Do.leafConstructs;
let association = OMP_Do.association;
+ let category = OMP_Do.category;
}
def OMP_Error : Directive<"error"> {
let allowedClauses = [
@@ -679,6 +703,7 @@ def OMP_Error : Directive<"error"> {
VersionedClause<OMPC_Severity, 51>,
];
let association = AS_None;
+ let category = CA_Utility;
}
def OMP_Flush : Directive<"flush"> {
let allowedOnceClauses = [
@@ -690,6 +715,7 @@ def OMP_Flush : Directive<"flush"> {
VersionedClause<OMPC_Release, 50>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_For : Directive<"for"> {
let allowedClauses = [
@@ -706,6 +732,7 @@ def OMP_For : Directive<"for"> {
VersionedClause<OMPC_Schedule>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_interop : Directive<"interop"> {
let allowedClauses = [
@@ -717,6 +744,7 @@ def OMP_interop : Directive<"interop"> {
VersionedClause<OMPC_Use>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_loop : Directive<"loop"> {
let allowedClauses = [
@@ -730,15 +758,18 @@ def OMP_loop : Directive<"loop"> {
VersionedClause<OMPC_Order, 50>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_masked : Directive<"masked"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Filter>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Master : Directive<"master"> {
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Metadirective : Directive<"metadirective"> {
let allowedClauses = [
@@ -748,9 +779,11 @@ def OMP_Metadirective : Directive<"metadirective"> {
VersionedClause<OMPC_Default>,
];
let association = AS_None;
+ let category = CA_Meta;
}
def OMP_Nothing : Directive<"nothing"> {
let association = AS_None;
+ let category = CA_Utility;
}
def OMP_Ordered : Directive<"ordered"> {
let allowedClauses = [
@@ -763,6 +796,7 @@ def OMP_Ordered : Directive<"ordered"> {
];
let association = AS_None;
// There is also a block-associated "ordered" directive.
+ let category = CA_Executable;
}
def OMP_Parallel : Directive<"parallel"> {
let allowedClauses = [
@@ -781,6 +815,7 @@ def OMP_Parallel : Directive<"parallel"> {
VersionedClause<OMPC_ProcBind>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Requires : Directive<"requires"> {
let allowedOnceClauses = [
@@ -799,6 +834,7 @@ def OMP_Requires : Directive<"requires"> {
VersionedClause<OMPC_ReverseOffload, 99>,
];
let association = AS_None;
+ let category = CA_Informational;
}
def OMP_Scan : Directive<"scan"> {
let allowedClauses = [
@@ -806,6 +842,7 @@ def OMP_Scan : Directive<"scan"> {
VersionedClause<OMPC_Inclusive, 50>,
];
let association = AS_Separating;
+ let category = CA_Subsidiary;
}
def OMP_scope : Directive<"scope"> {
let allowedClauses = [
@@ -816,9 +853,11 @@ def OMP_scope : Directive<"scope"> {
VersionedClause<OMPC_NoWait, 51>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_Section : Directive<"section"> {
let association = AS_Separating;
+ let category = CA_Subsidiary;
}
def OMP_Sections : Directive<"sections"> {
let allowedClauses = [
@@ -830,6 +869,7 @@ def OMP_Sections : Directive<"sections"> {
VersionedClause<OMPC_Reduction>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_EndSections : Directive<"end sections"> {
let allowedOnceClauses = [
@@ -837,6 +877,7 @@ def OMP_EndSections : Directive<"end sections"> {
];
let leafConstructs = OMP_Sections.leafConstructs;
let association = OMP_Sections.association;
+ let category = OMP_Sections.category;
}
def OMP_Simd : Directive<"simd"> {
let allowedClauses = [
@@ -856,6 +897,7 @@ def OMP_Simd : Directive<"simd"> {
VersionedClause<OMPC_SimdLen>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Single : Directive<"single"> {
let allowedClauses = [
@@ -866,6 +908,7 @@ def OMP_Single : Directive<"single"> {
VersionedClause<OMPC_Private>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_EndSingle : Directive<"end single"> {
let allowedClauses = [
@@ -876,6 +919,7 @@ def OMP_EndSingle : Directive<"end single"> {
];
let leafConstructs = OMP_Single.leafConstructs;
let association = OMP_Single.association;
+ let category = OMP_Single.category;
}
def OMP_Target : Directive<"target"> {
let allowedClauses = [
@@ -899,6 +943,7 @@ def OMP_Target : Directive<"target"> {
VersionedClause<OMPC_ThreadLimit, 51>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TargetData : Directive<"target data"> {
let allowedOnceClauses = [
@@ -911,6 +956,7 @@ def OMP_TargetData : Directive<"target data"> {
VersionedClause<OMPC_UseDevicePtr>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TargetEnterData : Directive<"target enter data"> {
let allowedClauses = [
@@ -925,6 +971,7 @@ def OMP_TargetEnterData : Directive<"target enter data"> {
VersionedClause<OMPC_Map>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_TargetExitData : Directive<"target exit data"> {
let allowedClauses = [
@@ -939,6 +986,7 @@ def OMP_TargetExitData : Directive<"target exit data"> {
VersionedClause<OMPC_Map>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_TargetUpdate : Directive<"target update"> {
let allowedClauses = [
@@ -952,6 +1000,7 @@ def OMP_TargetUpdate : Directive<"target update"> {
VersionedClause<OMPC_NoWait>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_Task : Directive<"task"> {
let allowedClauses = [
@@ -973,6 +1022,7 @@ def OMP_Task : Directive<"task"> {
VersionedClause<OMPC_Priority>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TaskGroup : Directive<"taskgroup"> {
let allowedClauses = [
@@ -980,6 +1030,7 @@ def OMP_TaskGroup : Directive<"taskgroup"> {
VersionedClause<OMPC_TaskReduction, 50>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_TaskLoop : Directive<"taskloop"> {
let allowedClauses = [
@@ -1006,6 +1057,7 @@ def OMP_TaskLoop : Directive<"taskloop"> {
VersionedClause<OMPC_NumTasks>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_TaskWait : Directive<"taskwait"> {
let allowedClauses = [
@@ -1013,9 +1065,11 @@ def OMP_TaskWait : Directive<"taskwait"> {
VersionedClause<OMPC_NoWait, 51>,
];
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_TaskYield : Directive<"taskyield"> {
let association = AS_None;
+ let category = CA_Executable;
}
def OMP_Teams : Directive<"teams"> {
let allowedClauses = [
@@ -1033,19 +1087,23 @@ def OMP_Teams : Directive<"teams"> {
VersionedClause<OMPC_ThreadLimit>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_ThreadPrivate : Directive<"threadprivate"> {
let association = AS_None;
+ let category = CA_Declarative;
}
def OMP_Tile : Directive<"tile"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Sizes, 51>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Unknown : Directive<"unknown"> {
let isDefault = true;
let association = AS_None;
+ let category = CA_Utility;
}
def OMP_Unroll : Directive<"unroll"> {
let allowedOnceClauses = [
@@ -1053,12 +1111,14 @@ def OMP_Unroll : Directive<"unroll"> {
VersionedClause<OMPC_Partial, 51>,
];
let association = AS_Loop;
+ let category = CA_Executable;
}
def OMP_Workshare : Directive<"workshare"> {
let allowedOnceClauses = [
VersionedClause<OMPC_NoWait>,
];
let association = AS_Block;
+ let category = CA_Executable;
}
def OMP_EndWorkshare : Directive<"end workshare"> {
let allowedClauses = [
@@ -1066,6 +1126,7 @@ def OMP_EndWorkshare : Directive<"end workshare"> {
];
let leafConstructs = OMP_Workshare.leafConstructs;
let association = OMP_Workshare.association;
+ let category = OMP_Workshare.category;
}
//===----------------------------------------------------------------------===//
@@ -1097,6 +1158,7 @@ def OMP_DistributeParallelDo : Directive<"distribute parallel do"> {
VersionedClause<OMPC_Schedule>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_Do];
+ let category = CA_Executable;
}
def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
let allowedClauses = [
@@ -1122,6 +1184,7 @@ def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_Do, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
let allowedClauses = [
@@ -1143,6 +1206,7 @@ def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
VersionedClause<OMPC_Shared>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_For];
+ let category = CA_Executable;
}
def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
let allowedClauses = [
@@ -1169,6 +1233,7 @@ def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Distribute, OMP_Parallel, OMP_For, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_DistributeSimd : Directive<"distribute simd"> {
let allowedClauses = [
@@ -1196,6 +1261,7 @@ def OMP_DistributeSimd : Directive<"distribute simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Distribute, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_DoSimd : Directive<"do simd"> {
let allowedClauses = [
@@ -1217,6 +1283,7 @@ def OMP_DoSimd : Directive<"do simd"> {
VersionedClause<OMPC_SimdLen>,
];
let leafConstructs = [OMP_Do, OMP_Simd];
+ let category = CA_Executable;
}
def OMP_EndDoSimd : Directive<"end do simd"> {
let allowedOnceClauses = [
@@ -1224,6 +1291,7 @@ def OMP_EndDoSimd : Directive<"end do simd"> {
];
let leafConstructs = OMP_DoSimd.leafConstructs;
let association = OMP_DoSimd.associ...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I didn't check the OMP.td file update so I'll let someone working on OpenMP approving that point.
Co-authored-by: Valentin Clement (バレンタイン クレメン) <[email protected]>
} | ||
def OMP_Unknown : Directive<"unknown"> { | ||
let isDefault = true; | ||
let association = AS_None; | ||
let category = CA_Utility; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you link me to the source for this? I am having trouble finding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only two directives that are categorized as utility
in the spec: error
and nothing
. unknown
is not in the spec (it's our local invention), but since it serves a somewhat similar utilitarian purpose, I categorized it as utility
as well.
Another category that it could fit under is informational
. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is your local invention I guess you can define it how you like. Is there any documentation upstream I can read about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OMPC_unknown
constant has been present for a while in the LLVM sources. Clang uses it in a few places as a value that means "none". I haven't seen any documentation for it other than actual usage.
The categories are primarily meant for OpenMP, where the spec assigns a category to each directive. It's one of declarative, executable, informational, meta, subsidiary, and utility.
These will be used in clang to avoid listing directives belonging to certain categories by hand.