mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
a2029fa58e
In order to set breakpoints on labels and list source code around labels, we need collect debug information for labels, i.e., label name, the function label belong, line number in the file, and the address label located. In order to keep these information in LLVM IR and to allow backend to generate debug information correctly. We create a new kind of metadata for labels, DILabel. The format of DILabel is !DILabel(scope: !1, name: "foo", file: !2, line: 3) We hope to keep debug information as much as possible even the code is optimized. So, we create a new kind of intrinsic for label metadata to avoid the metadata is eliminated with basic block. The intrinsic will keep existing if we keep it from optimized out. The format of the intrinsic is llvm.dbg.label(metadata !1) It has only one argument, that is the DILabel metadata. The intrinsic will follow the label immediately. Backend could get the label metadata through the intrinsic's parameter. We also create DIBuilder API for labels to be used by Frontend. Frontend could use createLabel() to allocate DILabel objects, and use insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR. Differential Revision: https://reviews.llvm.org/D45024 Patch by Hsiangkai Wang. llvm-svn: 331841
62 lines
3.2 KiB
LLVM
62 lines
3.2 KiB
LLVM
; RUN: sed -e 's/gnuPubnames: false/gnuPubnames: true/' %s | llc -mtriple=x86_64-pc-linux-gnu -filetype=obj | llvm-dwarfdump -v - | FileCheck --check-prefix=GPUB %s
|
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck --check-prefix=NONE %s
|
|
|
|
; Generated from:
|
|
; void f1();
|
|
; inline __attribute__((always_inline)) void f2() {
|
|
; f1();
|
|
; }
|
|
; void f3() {
|
|
; f2();
|
|
; }
|
|
; $ clang++ -gmlt %s -emit-llvm -S
|
|
|
|
; GPUB: Compile Unit
|
|
; GPUB: DW_AT_GNU_pubnames
|
|
|
|
; GPUB: .debug_gnu_pubnames contents:
|
|
; GPUB-NEXT: unit_offset = 0x00000000
|
|
; GPUB-NEXT: Name
|
|
; GPUB-NEXT: "f2"
|
|
; GPUB-NEXT: "f3"
|
|
|
|
; GPUB: .debug_gnu_pubtypes contents:
|
|
; GPUB-NEXT: length = 0x0000000e version = 0x0002 unit_offset = 0x00000000
|
|
; GPUB-NEXT: Name
|
|
|
|
; NONE-NOT: .debug_pubnames contents:
|
|
; NONE-NOT: .debug_pubtypes contents:
|
|
; NONE-NOT: .debug_gnu_pubnames contents:
|
|
; NONE-NOT: .debug_gnu_pubtypes contents:
|
|
|
|
|
|
; Function Attrs: noinline uwtable
|
|
define void @_Z2f3v() #0 !dbg !7 {
|
|
entry:
|
|
call void @_Z2f1v(), !dbg !9
|
|
ret void, !dbg !12
|
|
}
|
|
|
|
declare void @_Z2f1v() #1
|
|
|
|
attributes #0 = { noinline uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4, !5}
|
|
!llvm.ident = !{!6}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 303768) (llvm/trunk 303774)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, gnuPubnames: false)
|
|
!1 = !DIFile(filename: "gnu-public-names-gmlt.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
|
|
!2 = !{}
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{i32 1, !"wchar_size", i32 4}
|
|
!6 = !{!"clang version 5.0.0 (trunk 303768) (llvm/trunk 303774)"}
|
|
!7 = distinct !DISubprogram(name: "f3", scope: !1, file: !1, line: 5, type: !8, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!8 = !DISubroutineType(types: !2)
|
|
!9 = !DILocation(line: 3, column: 3, scope: !10, inlinedAt: !11)
|
|
!10 = distinct !DISubprogram(name: "f2", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!11 = distinct !DILocation(line: 6, column: 3, scope: !7)
|
|
!12 = !DILocation(line: 7, column: 1, scope: !7)
|