• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - -use-dwarf-ranges-base-address-specifier | FileCheck --check-prefix=COMMON --check-prefix=BASE %s
2; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - | FileCheck --check-prefix=COMMON --check-prefix=NOBASE %s
3; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - -dwarf-version 5 | FileCheck --check-prefix=DWARF5 %s
4
5; Group ranges in a range list that apply to the same section and use a base
6; address selection entry to reduce the number of relocations to one reloc per
7; section per range list. DWARF5 debug_rnglist (with *x variants) are more
8; efficient than this in terms of relocations, but it's still better than one
9; reloc per entry in a range list.
10
11; This is an object/executable size tradeoff - shrinking objects, but growing
12; the linked executable. In one large binary tested, total object size (not just
13; debug info) shrank by 16%, entirely relocation entries. Linked executable
14; grew by 4%. This was with compressed debug info in the objects, uncompressed
15; in the linked executable. Without compression in the objects, the win would be
16; smaller (the growth of debug_ranges itself would be more significant).
17
18; COMMON: {{^.Ldebug_ranges0}}
19; COMMON-NEXT:   .quad   .Lfunc_begin0
20; COMMON-NEXT:   .quad   .Lfunc_end0
21; BASE-NEXT:   .quad   -1
22; BASE-NEXT:   .quad   .Lfunc_begin1
23; BASE-NEXT:   .quad   .Lfunc_begin1-.Lfunc_begin1
24; BASE-NEXT:   .quad   .Lfunc_end1-.Lfunc_begin1
25; BASE-NEXT:   .quad   .Lfunc_begin3-.Lfunc_begin1
26; BASE-NEXT:   .quad   .Lfunc_end3-.Lfunc_begin1
27; BASE-NEXT:   .quad   -1
28; BASE-NEXT:   .quad   0
29; NOBASE-NEXT:   .quad   .Lfunc_begin1
30; NOBASE-NEXT:   .quad   .Lfunc_end1
31; NOBASE-NEXT:   .quad   .Lfunc_begin3
32; NOBASE-NEXT:   .quad   .Lfunc_end3
33; COMMON-NEXT:   .quad   .Lfunc_begin4
34; COMMON-NEXT:   .quad   .Lfunc_end4
35; COMMON-NEXT:   .quad   .Lfunc_begin5
36; COMMON-NEXT:   .quad   .Lfunc_end5
37; COMMON-NEXT:   .quad   0
38; COMMON-NEXT:   .quad   0
39
40; DWARF5: {{^.Ldebug_ranges0}}
41; DWARF5-NEXT:                                      # DW_RLE_start_length
42; DWARF5-NEXT: .quad    .Lfunc_begin0               #   start
43; DWARF5-NEXT: .uleb128 .Lfunc_end0-.Lfunc_begin0   #   length
44; DWARF5-NEXT:                                      # DW_RLE_base_address
45; DWARF5-NEXT: .quad    .Lfunc_begin1               #   base address
46; DWARF5-NEXT:                                      # DW_RLE_offset_pair
47; DWARF5-NEXT: .uleb128 .Lfunc_begin1-.Lfunc_begin1 #   starting offset
48; DWARF5-NEXT: .uleb128 .Lfunc_end1-.Lfunc_begin1   #   ending offset
49; DWARF5-NEXT:                                      # DW_RLE_offset_pair
50; DWARF5-NEXT: .uleb128 .Lfunc_begin3-.Lfunc_begin1 #   starting offset
51; DWARF5-NEXT: .uleb128 .Lfunc_end3-.Lfunc_begin1   #   ending offset
52; DWARF5-NEXT:                                      # DW_RLE_start_length
53; DWARF5-NEXT: .quad	   .Lfunc_begin4               #   start
54; DWARF5-NEXT: .uleb128 .Lfunc_end4-.Lfunc_begin4   #   length
55; DWARF5-NEXT:                                      # DW_RLE_start_length
56; DWARF5-NEXT: .quad	   .Lfunc_begin5               #   start
57; DWARF5-NEXT: .uleb128 .Lfunc_end5-.Lfunc_begin5   #   length
58; DWARF5-NEXT:                                      # DW_RLE_end_of_list
59
60; Function Attrs: noinline nounwind optnone uwtable
61define void @_Z2f1v() #0 section "a" !dbg !7 {
62entry:
63  ret void, !dbg !10
64}
65
66; Function Attrs: noinline nounwind optnone uwtable
67define void @_Z2f2v() #0 section "b" !dbg !11 {
68entry:
69  ret void, !dbg !12
70}
71
72; Function Attrs: noinline nounwind optnone uwtable
73define void @_Z2f3v() #0 section "b" {
74entry:
75  ret void
76}
77
78; Function Attrs: noinline nounwind optnone uwtable
79define void @_Z2f4v() #0 section "b" !dbg !13 {
80entry:
81  ret void, !dbg !14
82}
83
84; Function Attrs: noinline nounwind optnone uwtable
85define void @_Z2f5v() #0 section "e" !dbg !15 {
86entry:
87  ret void, !dbg !16
88}
89
90; Function Attrs: noinline nounwind optnone uwtable
91define void @_Z2f6v() #0 section "f" !dbg !17 {
92entry:
93  ret void, !dbg !18
94}
95
96attributes #0 = { noinline nounwind optnone 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" }
97
98!llvm.dbg.cu = !{!0}
99!llvm.module.flags = !{!3, !4, !5}
100!llvm.ident = !{!6}
101
102!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 309523) (llvm/trunk 309526)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
103!1 = !DIFile(filename: "funcs.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
104!2 = !{}
105!3 = !{i32 2, !"Dwarf Version", i32 4}
106!4 = !{i32 2, !"Debug Info Version", i32 3}
107!5 = !{i32 1, !"wchar_size", i32 4}
108!6 = !{!"clang version 6.0.0 (trunk 309523) (llvm/trunk 309526)"}
109!7 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
110!8 = !DISubroutineType(types: !9)
111!9 = !{null}
112!10 = !DILocation(line: 1, column: 42, scope: !7)
113!11 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
114!12 = !DILocation(line: 2, column: 42, scope: !11)
115!13 = distinct !DISubprogram(name: "f4", linkageName: "_Z2f4v", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
116!14 = !DILocation(line: 4, column: 42, scope: !13)
117!15 = distinct !DISubprogram(name: "f5", linkageName: "_Z2f5v", scope: !1, file: !1, line: 5, type: !8, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
118!16 = !DILocation(line: 5, column: 42, scope: !15)
119!17 = distinct !DISubprogram(name: "f6", linkageName: "_Z2f6v", scope: !1, file: !1, line: 6, type: !8, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
120!18 = !DILocation(line: 6, column: 42, scope: !17)
121