[Mlir-commits] [flang] [mlir] [mlir][debuginfo] Add support for subprogram annotations (PR #110946)

Walter Erquinigo llvmlistbot at llvm.org
Fri Oct 4 12:28:24 PDT 2024


================
@@ -89,7 +89,8 @@ llvm.func @func_no_debug() {
 #spType1 = #llvm.di_subroutine_type<callingConvention = DW_CC_normal>
 #sp1 = #llvm.di_subprogram<
   compileUnit = #cu, scope = #module, name = "empty_types",
-  file = #file, subprogramFlags = "Definition", type = #spType1
+  file = #file, subprogramFlags = "Definition", type = #spType1,
+  annotations = #llvm.di_annotation<name = "foo", value = "bar">
----------------
walter-erquinigo wrote:

It is, but I haven't found a way to represent it in a `.ll` file. The annotation is stored directly as metadata inside DISubprograms and is not implemented a proper attribute in files like `llvm/include/llvm/IR/Metadata.def`. Because of which, the `.ll` parser doesn't allow me write it in a form like the following, used in `debug-info.ll`

```
!17 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !12, entity: !8, file: !3, line: 1, elements: !15)
```

I would need to create proper support for `DIAnnotation` in LLVM but that seems like a very big task, which seems to additional involve refactoring the existing "wrong" uses of it.

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


More information about the Mlir-commits mailing list