Eric Christopher | 4150a77 | 2013-12-20 04:34:50 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
Eric Christopher | 3a70d00 | 2014-03-14 20:53:43 +0000 | [diff] [blame] | 2 | ; RUN: %llc_dwarf -O0 -filetype=obj %s -o %t |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 3 | ; RUN: llvm-dwarfdump %t | FileCheck %s |
| 4 | |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 5 | ; Check that we emit ranges for this which has a non-traditional section and a normal section. |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 6 | |
| 7 | ; CHECK: DW_TAG_compile_unit |
| 8 | ; CHECK: DW_AT_ranges |
| 9 | ; CHECK: DW_TAG_subprogram |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 10 | ; CHECK: DW_AT_low_pc |
| 11 | ; CHECK: DW_AT_high_pc |
| 12 | ; CHECK: DW_TAG_subprogram |
| 13 | ; CHECK: DW_AT_low_pc |
| 14 | ; CHECK: DW_AT_high_pc |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 15 | |
| 16 | ; CHECK: .debug_ranges contents: |
| 17 | ; FIXME: When we get better dumping facilities we'll want to elaborate here. |
| 18 | ; CHECK: 00000000 <End of list> |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 19 | |
| 20 | ; Function Attrs: nounwind uwtable |
Eric Christopher | a2a6e92 | 2014-03-14 21:16:54 +0000 | [diff] [blame] | 21 | define i32 @foo(i32 %a) #0 section "__TEXT,__foo" { |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 22 | entry: |
| 23 | %a.addr = alloca i32, align 4 |
| 24 | store i32 %a, i32* %a.addr, align 4 |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 25 | call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !13, metadata !{i32 786690}), !dbg !14 |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 26 | %0 = load i32* %a.addr, align 4, !dbg !15 |
| 27 | %add = add nsw i32 %0, 5, !dbg !15 |
| 28 | ret i32 %add, !dbg !15 |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 32 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 33 | |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 34 | ; Function Attrs: nounwind uwtable |
| 35 | define i32 @bar(i32 %a) #0 { |
| 36 | entry: |
| 37 | %a.addr = alloca i32, align 4 |
| 38 | store i32 %a, i32* %a.addr, align 4 |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 39 | call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !16, metadata !{i32 786690}), !dbg !17 |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 40 | %0 = load i32* %a.addr, align 4, !dbg !18 |
| 41 | %add = add nsw i32 %0, 5, !dbg !18 |
| 42 | ret i32 %add, !dbg !18 |
| 43 | } |
| 44 | |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 45 | attributes #0 = { nounwind uwtable "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" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 46 | attributes #1 = { nounwind readnone } |
| 47 | |
| 48 | !llvm.dbg.cu = !{!0} |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 49 | !llvm.module.flags = !{!10, !11} |
| 50 | !llvm.ident = !{!12} |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 51 | |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 52 | !0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/foo.c] [DW_LANG_C99] |
Eric Christopher | 3a70d00 | 2014-03-14 20:53:43 +0000 | [diff] [blame] | 53 | !1 = metadata !{metadata !"foo.c", metadata !"/usr/local/google/home/echristo"} |
David Blaikie | 5e390e4 | 2014-02-04 01:23:52 +0000 | [diff] [blame] | 54 | !2 = metadata !{} |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 55 | !3 = metadata !{metadata !4, metadata !9} |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 56 | !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", metadata !"foo", metadata !"", i32 1, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @foo, null, null, metadata !2, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [foo] |
| 57 | !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/usr/local/google/home/echristo/foo.c] |
| 58 | !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
Eric Christopher | 46e2343 | 2013-12-20 04:16:18 +0000 | [diff] [blame] | 59 | !7 = metadata !{metadata !8, metadata !8} |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 60 | !8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] |
| 61 | !9 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"bar", metadata !"bar", metadata !"", i32 5, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @bar, null, null, metadata !2, i32 5} ; [ DW_TAG_subprogram ] [line 5] [def] [bar] |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 62 | !10 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 63 | !11 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 64 | !12 = metadata !{metadata !"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"} |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 65 | !13 = metadata !{i32 786689, metadata !4, metadata !"a", metadata !5, i32 16777217, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 1] |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 66 | !14 = metadata !{i32 1, i32 0, metadata !4, null} |
| 67 | !15 = metadata !{i32 2, i32 0, metadata !4, null} |
Duncan P. N. Exon Smith | 786cd04 | 2014-10-02 22:15:31 +0000 | [diff] [blame^] | 68 | !16 = metadata !{i32 786689, metadata !9, metadata !"a", metadata !5, i32 16777221, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 5] |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 69 | !17 = metadata !{i32 5, i32 0, metadata !9, null} |
| 70 | !18 = metadata !{i32 6, i32 0, metadata !9, null} |
| 71 | |