[Mlir-commits] [mlir] [mlir][debug] Handle DIImportedEntity. (PR #103055)
Tobias Gysi
llvmlistbot at llvm.org
Tue Aug 13 23:19:53 PDT 2024
gysit wrote:
I agree that it would be desired to replicate LLVM's structure and add the new attribute using a retained nodes field in the subprogram.
> Please correct me if I am wrong but I thought Attributes are sort of readonly once created. So adding a field in DISubprogramAttr to hold them would not work as
There is a mechanism to do this in principle but it is only implement for DICompositeType so far. Essentially DISubprogram would have to implement the LLVM_DIRecursiveTypeAttrInterface (https://github.com/llvm/llvm-project/blob/0160d817c2c1bd3f32986d9cf8b938e613ac3d12/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td#L374). When translating you would then start translating the subprogram retained nodes but you remember that the traversal already saw the subprogram once and give it an id. So the DIImportedEntity scope would only contain an id instead of the full subprogram. Once all nested attributes are translated you then create the actual subprogram which has the id attached.
I believe we will need some consulting from @zyx-billy to get this working though (the mechanism is non-trivial). In principle the import of debug info already has the mechanism working but only for DICompositeType.
https://github.com/llvm/llvm-project/pull/103055
More information about the Mlir-commits
mailing list