[LLVMdev] First-class debug info IR: MDLocation

Eric Christopher echristo at gmail.com
Wed Nov 5 15:49:15 PST 2014


>
>
> Making debug info assembly readable and writable
> ================================================
>
> Moreover, we're now in a place where it's trivial to express the
> "context" pointer structurally.  Here's the same debug info as above,
> using syntactic sugar to fill the "context" pointers:
>
>     !0 = metadata DIFile(filename: "foo.cpp", directory: "/path/to")
>     !1 = metadata DIFile(filename: "./t.h", directory: "/path/to")
>     !2 = metadata DIFile(filename: "bar.cpp", directory: "/path/to")
>     !3 = metadata DIBaseType(name: "short", size: 16, align: 16)
>     !5 = metadata DIBaseType(name: "int", size: 32, align: 32)
>     !6 = metadata DICompositeType(tag: 0x13, name: "T", uniqued: "_ZTS1T",
>                                   file: !1, line: 1, size: 32, align: 16) {
>       !7 = metadata DIMember(line: 1, file: !1, type: !3,
>                              name: "a", size: 16, align: 16)
>       !8 = metadata DIMember(line: 1, file: !1, type: !3,
>                              name: "b", size: 16, align: 16)
>     } ; !6
>     !9 = metadata DISubroutineType(args: [ !5, !6 ])
>     !10 = metadata DICompileUnit(file: !0, language: 4, kind: FullDebug,
>                                  producer: "clang version 3.6.0 ",
>                                  retainedUniqueTypes: [ !6 ]) {
>       !11 = metadata DISubprogram(name: "foo", linkageName: "_Z3foo1T",
>                                   handle: i32(i32)* @_Z3foo1T, file: !0,
>                                   type: !9) {
>         !12 = metadata DIArgVariable(name: "t", arg: 1, line: 2, type: !6)
>         !13 = metadata DILocation(line: 2, column: 11)
>         !14 = metadata DILocation(line: 2, column: 16)
>       } ; !11
>     } ; !10
>     !15 = metadata DICompileUnit(file: !2, language: 4, kind: FullDebug,
>                                  producer: "clang version 3.6.0 ",
>                                  retainedUniqueTypes: [ !6 ]) {
>       !16 = metadata DISubprogram(name: "bar", linkageName: "_Z3bar1T",
>                                   handle: i32 (i32)* @_Z3bar1T, file: !2,
>                                   type: !9) {
>         !17 = metadata DIArgVariable(name: "t", arg: 2, line: 3, type: !6)
>         !18 = metadata DILocation(line: 3, column: 11)
>         !19 = metadata DILocation(line: 3, column: 23)
>       } ; !16
>     } ; !15
>
> This assembly has the following advantages over the status quo:
>
>   - Fields are named.  Aside from readability, this prevents
>     adding/reordering fields in the schema from requiring testcase
>     updates.
>
>   - Serialization graph becomes a DAG.  Aside from readability, this
>     removes most RAUW from assembly (and all RAUW from bitcode).
>
>   - Structure is clear.
>

One more comment on the thread: I really like this syntax :)

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141105/3952c32f/attachment.html>


More information about the llvm-dev mailing list