blob: 0d0e6e86a5c81dc2b638f9b8e0902f52b9886466 [file] [log] [blame]
Manman Ren4e042a62013-02-05 21:52:47 +00001; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
2; RUN: llvm-dwarfdump %t | FileCheck %s
Eric Christopher33ff6972013-11-21 23:46:41 +00003; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -dwarf-version=3
4; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=DWARF3
Manman Ren9d4c7352013-05-21 00:57:22 +00005; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM
Manman Ren4e042a62013-02-05 21:52:47 +00006
7; rdar://13067005
8; CHECK: .debug_info contents:
9; CHECK: DW_TAG_compile_unit
NAKAMURA Takumi17b73102013-12-30 09:26:10 +000010; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
Eric Christopher8873ada2014-01-29 22:22:56 +000011; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
Eric Christopher384f3fe2014-03-20 19:16:16 +000012; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
13; CHECK: DW_TAG_subprogram
14; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
15; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
Manman Ren4e042a62013-02-05 21:52:47 +000016
17; CHECK: DW_TAG_compile_unit
NAKAMURA Takumi17b73102013-12-30 09:26:10 +000018; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000003c)
Eric Christopher384f3fe2014-03-20 19:16:16 +000019; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000010)
20; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000009)
21; CHECK: DW_TAG_subprogram
22; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000010)
23; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000009)
24
Manman Ren4e042a62013-02-05 21:52:47 +000025
26; CHECK: .debug_line contents:
27; CHECK-NEXT: Line table prologue:
Manman Ren1e427202013-03-07 01:42:00 +000028; CHECK-NEXT: total_length: 0x00000038
29; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple.c
Manman Ren4e042a62013-02-05 21:52:47 +000030; CHECK: Line table prologue:
Manman Ren1e427202013-03-07 01:42:00 +000031; CHECK-NEXT: total_length: 0x00000039
32; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
33; CHECK-NOT: file_names
Manman Ren4e042a62013-02-05 21:52:47 +000034
Eric Christopher33ff6972013-11-21 23:46:41 +000035; DWARF3: .debug_info contents:
36; DWARF3: DW_TAG_compile_unit
Eric Christopherfb8dd002014-01-29 22:06:27 +000037; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
Eric Christopher33ff6972013-11-21 23:46:41 +000038
39; DWARF3: DW_TAG_compile_unit
NAKAMURA Takumi17b73102013-12-30 09:26:10 +000040; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c)
Eric Christopher384f3fe2014-03-20 19:16:16 +000041
Eric Christopher33ff6972013-11-21 23:46:41 +000042
43; DWARF3: .debug_line contents:
44; DWARF3-NEXT: Line table prologue:
45; DWARF3-NEXT: total_length: 0x00000038
46; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple.c
47; DWARF3: Line table prologue:
48; DWARF3-NEXT: total_length: 0x00000039
49; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
50; DWARF3-NOT: file_names
51
Manman Ren9d4c7352013-05-21 00:57:22 +000052; PR15408
53; ASM: L__DWARF__debug_info_begin0:
David Blaikie34641612014-04-01 08:07:52 +000054; ASM: Lset3 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
55; ASM-NEXT: .long Lset3
Manman Ren9d4c7352013-05-21 00:57:22 +000056; ASM: L__DWARF__debug_info_begin1:
David Blaikie34641612014-04-01 08:07:52 +000057; ASM: Lset13 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
58; ASM-NEXT: .long Lset13
Manman Ren4e042a62013-02-05 21:52:47 +000059define i32 @test(i32 %a) nounwind uwtable ssp {
60entry:
61 %a.addr = alloca i32, align 4
62 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000063 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !15, metadata !{!"0x102"}), !dbg !16
Manman Ren4e042a62013-02-05 21:52:47 +000064 %0 = load i32* %a.addr, align 4, !dbg !17
65 %call = call i32 @fn(i32 %0), !dbg !17
66 ret i32 %call, !dbg !17
67}
68
Adrian Prantl87b7eb92014-10-01 18:55:02 +000069declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Manman Ren4e042a62013-02-05 21:52:47 +000070
71define i32 @fn(i32 %a) nounwind uwtable ssp {
72entry:
73 %a.addr = alloca i32, align 4
74 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000075 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !19, metadata !{!"0x102"}), !dbg !20
Manman Ren4e042a62013-02-05 21:52:47 +000076 %0 = load i32* %a.addr, align 4, !dbg !21
77 ret i32 %0, !dbg !21
78}
79
80!llvm.dbg.cu = !{!0, !10}
Manman Ren409558f2013-11-22 21:49:45 +000081!llvm.module.flags = !{!25}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000082!0 = !{!"0x11\0012\00clang version 3.3\000\00\000\00\001", !23, !1, !1, !3, !1, !1} ; [ DW_TAG_compile_unit ]
83!1 = !{}
84!3 = !{!5}
85!5 = !{!"0x2e\00test\00test\00\002\000\001\000\006\00256\000\003", !23, !6, !7, null, i32 (i32)* @test, null, null, !1} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 3] [test]
86!6 = !{!"0x29", !23} ; [ DW_TAG_file_type ]
87!7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
88!8 = !{!9, !9}
89!9 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
90!10 = !{!"0x11\0012\00clang version 3.3 (trunk 172862)\000\00\000\00\001", !24, !1, !1, !11, !1, !1} ; [ DW_TAG_compile_unit ]
91!11 = !{!13}
92!13 = !{!"0x2e\00fn\00fn\00\001\000\001\000\006\00256\000\001", !24, !14, !7, null, i32 (i32)* @fn, null, null, !1} ; [ DW_TAG_subprogram ] [line 1] [def] [fn]
93!14 = !{!"0x29", !24} ; [ DW_TAG_file_type ]
94!15 = !{!"0x101\00a\0016777218\000", !5, !6, !9} ; [ DW_TAG_arg_variable ] [a] [line 2]
95!16 = !{i32 2, i32 0, !5, null}
96!17 = !{i32 4, i32 0, !18, null}
97!18 = !{!"0xb\003\000\000", !23, !5} ; [ DW_TAG_lexical_block ]
98!19 = !{!"0x101\00a\0016777217\000", !13, !14, !9} ; [ DW_TAG_arg_variable ] [a] [line 1]
99!20 = !{i32 1, i32 0, !13, null}
100!21 = !{i32 2, i32 0, !22, null}
101!22 = !{!"0xb\001\000\000", !24, !13} ; [ DW_TAG_lexical_block ]
102!23 = !{!"simple.c", !"/private/tmp"}
103!24 = !{!"simple2.c", !"/private/tmp"}
104!25 = !{i32 1, !"Debug Info Version", i32 2}