[Mlir-commits] [mlir] [MLIR][LLVM] Support Recursive DITypes (PR #80251)
Tobias Gysi
llvmlistbot at llvm.org
Sun Mar 10 08:48:03 PDT 2024
================
@@ -319,4 +319,64 @@ def LLVM_PointerElementTypeInterface
];
}
+//===----------------------------------------------------------------------===//
+// LLVM dialect attr interfaces.
+//===----------------------------------------------------------------------===//
+
+def LLVM_DIRecursiveTypeAttrInterface
+ : AttrInterface<"DIRecursiveTypeAttrInterface"> {
+ let description = [{
+ This attribute represents a DITypeAttr that is recursive. Only DITypeAttrs
+ that translate to LLVM DITypes that support mutation should implement this
+ interface.
+
+ There are two modes for conforming attributes:
+
+ 1. "rec-decl":
+ - This attr is a recursive declaration identified by a recId.
+
+ 2. "rec-self":
+ - This attr is considered a recursive self reference.
+ - This attr itself is a placeholder type that should be conceptually
+ replaced with the closest parent attr of the same type with the same
+ recId.
+
+ e.g. To represent a linked list struct:
+
+ #rec_self = di_composite_type<recId = 0>
+ #ptr = di_derived_type<baseType: #struct_self, ...>
+ #field = di_derived_type<name = "next", baseType: #ptr, ...>
+ #rec = di_composite_type<recId = 0, name = "Node", elements: #field, ...>
+ #var = di_local_variable<type = #rec, ...>
+
+ Note that a rec-self without an outer rec-decl with the same recId is
+ conceptually the same as an "unbound" variable. The context needs to provide
+ meaning to the rec-self.
+
+ This can be avoided by calling the `getUnfoldedBaseType()` method on a
----------------
gysit wrote:
This function does not seem to exist anymore?
https://github.com/llvm/llvm-project/pull/80251
More information about the Mlir-commits
mailing list