[Mlir-commits] [mlir] [mlir] Add support for recursive elements in DICompositeTypeAttr. (PR #74948)

Tobias Gysi llvmlistbot at llvm.org
Sat Dec 16 08:07:01 PST 2023


================
@@ -684,6 +663,61 @@ def LLVM_AliasScopeDomainAttr : LLVM_Attr<"AliasScopeDomain",
   let assemblyFormat = "`<` struct(params) `>`";
 }
 
+//===----------------------------------------------------------------------===//
+// DICompositeTypeAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_DICompositeTypeAttr : LLVM_Attr<"DICompositeType", "di_composite_type",
+                                         /*traits=*/[NativeTypeTrait<"IsMutable">], "DITypeAttr"> {
+  let parameters = (ins
+    OptionalParameter<"unsigned">:$tag,
+    OptionalParameter<"StringAttr">:$name,
+    OptionalParameter<"DIFileAttr">:$file,
+    OptionalParameter<"uint32_t">:$line,
+    OptionalParameter<"DIScopeAttr">:$scope,
+    OptionalParameter<"DITypeAttr">:$baseType,
+    OptionalParameter<"DIFlags", "DIFlags::Zero">:$flags,
+    OptionalParameter<"uint64_t">:$sizeInBits,
+    OptionalParameter<"uint64_t">:$alignInBits,
+    OptionalArrayRefParameter<"DINodeAttr">:$elements,
+    OptionalParameter<"DistinctAttr">:$identifier
----------------
gysit wrote:

Adding a DistinctAttr as a field to the DICompositeType makes the entire Attribute distinct. It will never be uniqued with another DICompositeType since the 'íd' is always different. Does that make sense? 

The idea of the comment was that a DICompositeType which has a DistinctAtt should map to a distinct metadata node, while all other DICompositeTypes would be mapped to normal metadata nodes that are uniqued like normal attributes.

https://github.com/llvm/llvm-project/pull/74948


More information about the Mlir-commits mailing list