Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty-printing of dicuEmissionKind #32

Open
langston-barrett opened this issue Nov 26, 2018 · 0 comments
Open

Pretty-printing of dicuEmissionKind #32

langston-barrett opened this issue Nov 26, 2018 · 0 comments

Comments

@langston-barrett
Copy link
Collaborator

langston-barrett commented Nov 26, 2018

The LLVM disassembler will print the numeric field EmissionKind as a string:

(See also the functions just above those). This prevents the output of llvm-disasm from matching that of llvm-dis, at least on LLVM 6.0.

C++ source

int main()
{
  return 0;
}

llvm-dis output (LLVM 6)

source_filename = "cpp-examples/test.cpp"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i32 @main() #0 !dbg !8 {
  %1 = alloca i32, align 4
  store i32 0, i32* %1, align 4
  ret i32 0, !dbg !12
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
!llvm.ident = !{!7}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.1 (tags/RELEASE_601/final)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "cpp-examples/test.cpp", directory: "/home/siddharthist/code/llvm-pretty-bc-parser")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{i32 7, !"PIC Level", i32 2}
!7 = !{!"clang version 6.0.1 (tags/RELEASE_601/final)"}
!8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!9 = !DISubroutineType(types: !10)
!10 = !{!11}
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!12 = !DILocation(line: 3, column: 3, scope: !8)

llvm-disasm output

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define i32 @main() !dbg !8 {
; <label>: 0
  %1 = alloca i32, align 4
  store i32 0, i32* %1, align 4
  ret i32 0, !dbg !DILocation(line: 3, column: 3, scope: !8)
}
!llvm.dbg.cu = !{!0}
!llvm.ident = !{!7}
!llvm.module.flags = !{!3, !4, !5, !6}

!0 = distinct !DICompileUnit(language: 4, file: !1, producer: "clang version 6.0.1 (tags/RELEASE_601/final)", isOptimized: false, flags: "", runtimeVersion: 0, emissionKind: 1, enums: !2, dwoId: 0)
!1 = !DIFile(filename: "cpp-examples/test.cpp", directory: "/home/siddharthist/code/llvm-pretty-bc-parser")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{i32 7, !"PIC Level", i32 2}
!7 = !{!"clang version 6.0.1 (tags/RELEASE_601/final)"}
!8 = distinct !DISubprogram(scope: !DIFile(filename: "cpp-examples/test.cpp", directory: "/home/siddharthist/code/llvm-pretty-bc-parser"), name: "main", file: !DIFile(filename: "cpp-examples/test.cpp", directory: "/home/siddharthist/code/llvm-pretty-bc-parser"), line: 1, type: !11, isLocal: false, isDefinition: true, scopeLine: 2, virtuality: 0, virtualIndex: 0, flags: 256, isOptimized: false, templateParams: !DICompileUnit(language: 4, file: !1, producer: "clang version 6.0.1 (tags/RELEASE_601/final)", isOptimized: false, flags: "", runtimeVersion: 0, emissionKind: 1, enums: !2, dwoId: 0))
!9 = !DIBasicType(tag: 36, name: "int", size: 32, align: 0, encoding: 5)
!10 = !{!9}
!11 = distinct !DISubroutineType(flags: 0, types: !10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant