[Mlir-commits] [mlir] [MLIR][LLVM] Make DISubprogramAttr cyclic (PR #106571)
Tobias Gysi
llvmlistbot at llvm.org
Thu Aug 29 11:21:50 PDT 2024
================
@@ -577,13 +579,28 @@ def LLVM_DISubprogramAttr : LLVM_Attr<"DISubprogram", "di_subprogram",
"ArrayRef<DINodeAttr>":$retainedNodes
), [{
MLIRContext *ctx = file.getContext();
- return $_get(ctx, id, compileUnit, scope, StringAttr::get(ctx, name),
+ return $_get(ctx, id, /*recId=*/nullptr, compileUnit, scope,
+ StringAttr::get(ctx, name),
StringAttr::get(ctx, linkageName), file, line,
scopeLine, subprogramFlags, type, retainedNodes);
}]>
];
-
let assemblyFormat = "`<` struct(params) `>`";
+ let extraClassDeclaration = [{
+ /// Requirements of DIRecursiveTypeAttrInterface.
+ /// @{
+
+ /// Get whether this attr describes a recursive self reference.
+ bool isRecSelf() { return !getScope(); }
----------------
gysit wrote:
Alternatively we could maybe add a tag parameter to the enum similar to the one we have on DICompositeType? It is a bit redundant though since a subprogram is a subprogram. So maybe a separate boolean makes sense.
It is indeed true that using the scope feels a bit hacky.
https://github.com/llvm/llvm-project/pull/106571
More information about the Mlir-commits
mailing list