2013-02-05 21:52:47 +00:00
|
|
|
; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
|
|
|
|
; RUN: llvm-dwarfdump %t | FileCheck %s
|
2013-11-21 23:46:41 +00:00
|
|
|
; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -dwarf-version=3
|
|
|
|
; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=DWARF3
|
2013-05-21 00:57:22 +00:00
|
|
|
; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM
|
2013-02-05 21:52:47 +00:00
|
|
|
|
|
|
|
; rdar://13067005
|
|
|
|
; CHECK: .debug_info contents:
|
|
|
|
; CHECK: DW_TAG_compile_unit
|
2013-12-30 09:26:10 +00:00
|
|
|
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
|
2014-01-29 22:22:56 +00:00
|
|
|
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
|
2014-03-20 19:16:16 +00:00
|
|
|
; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
|
|
|
|
; CHECK: DW_TAG_subprogram
|
|
|
|
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
|
|
|
|
; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
|
2013-02-05 21:52:47 +00:00
|
|
|
|
|
|
|
; CHECK: DW_TAG_compile_unit
|
2013-12-30 09:26:10 +00:00
|
|
|
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000003c)
|
2014-03-20 19:16:16 +00:00
|
|
|
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000010)
|
|
|
|
; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000009)
|
|
|
|
; CHECK: DW_TAG_subprogram
|
|
|
|
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000010)
|
|
|
|
; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000009)
|
|
|
|
|
2013-02-05 21:52:47 +00:00
|
|
|
|
|
|
|
; CHECK: .debug_line contents:
|
|
|
|
; CHECK-NEXT: Line table prologue:
|
2013-03-07 01:42:00 +00:00
|
|
|
; CHECK-NEXT: total_length: 0x00000038
|
|
|
|
; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple.c
|
2013-02-05 21:52:47 +00:00
|
|
|
; CHECK: Line table prologue:
|
2013-03-07 01:42:00 +00:00
|
|
|
; CHECK-NEXT: total_length: 0x00000039
|
|
|
|
; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
|
|
|
|
; CHECK-NOT: file_names
|
2013-02-05 21:52:47 +00:00
|
|
|
|
2013-11-21 23:46:41 +00:00
|
|
|
; DWARF3: .debug_info contents:
|
|
|
|
; DWARF3: DW_TAG_compile_unit
|
2014-01-29 22:06:27 +00:00
|
|
|
; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
|
2013-11-21 23:46:41 +00:00
|
|
|
|
|
|
|
; DWARF3: DW_TAG_compile_unit
|
2013-12-30 09:26:10 +00:00
|
|
|
; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c)
|
2014-03-20 19:16:16 +00:00
|
|
|
|
2013-11-21 23:46:41 +00:00
|
|
|
|
|
|
|
; DWARF3: .debug_line contents:
|
|
|
|
; DWARF3-NEXT: Line table prologue:
|
|
|
|
; DWARF3-NEXT: total_length: 0x00000038
|
|
|
|
; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple.c
|
|
|
|
; DWARF3: Line table prologue:
|
|
|
|
; DWARF3-NEXT: total_length: 0x00000039
|
|
|
|
; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
|
|
|
|
; DWARF3-NOT: file_names
|
|
|
|
|
2013-05-21 00:57:22 +00:00
|
|
|
; PR15408
|
|
|
|
; ASM: L__DWARF__debug_info_begin0:
|
2014-04-01 08:07:52 +00:00
|
|
|
; ASM: Lset3 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
|
|
|
|
; ASM-NEXT: .long Lset3
|
2013-05-21 00:57:22 +00:00
|
|
|
; ASM: L__DWARF__debug_info_begin1:
|
2014-04-01 08:07:52 +00:00
|
|
|
; ASM: Lset13 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
|
|
|
|
; ASM-NEXT: .long Lset13
|
2013-02-05 21:52:47 +00:00
|
|
|
define i32 @test(i32 %a) nounwind uwtable ssp {
|
|
|
|
entry:
|
|
|
|
%a.addr = alloca i32, align 4
|
|
|
|
store i32 %a, i32* %a.addr, align 4
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !15, metadata !{!"0x102"}), !dbg !16
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32* %a.addr, align 4, !dbg !17
|
2013-02-05 21:52:47 +00:00
|
|
|
%call = call i32 @fn(i32 %0), !dbg !17
|
|
|
|
ret i32 %call, !dbg !17
|
|
|
|
}
|
|
|
|
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
|
2013-02-05 21:52:47 +00:00
|
|
|
|
|
|
|
define i32 @fn(i32 %a) nounwind uwtable ssp {
|
|
|
|
entry:
|
|
|
|
%a.addr = alloca i32, align 4
|
|
|
|
store i32 %a, i32* %a.addr, align 4
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !19, metadata !{!"0x102"}), !dbg !20
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32* %a.addr, align 4, !dbg !21
|
2013-02-05 21:52:47 +00:00
|
|
|
ret i32 %0, !dbg !21
|
|
|
|
}
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0, !10}
|
2013-11-22 21:49:45 +00:00
|
|
|
!llvm.module.flags = !{!25}
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
!0 = !{!"0x11\0012\00clang version 3.3\000\00\000\00\001", !23, !1, !1, !3, !1, !1} ; [ DW_TAG_compile_unit ]
|
|
|
|
!1 = !{}
|
|
|
|
!3 = !{!5}
|
|
|
|
!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]
|
|
|
|
!6 = !{!"0x29", !23} ; [ DW_TAG_file_type ]
|
|
|
|
!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 ]
|
|
|
|
!8 = !{!9, !9}
|
|
|
|
!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]
|
|
|
|
!10 = !{!"0x11\0012\00clang version 3.3 (trunk 172862)\000\00\000\00\001", !24, !1, !1, !11, !1, !1} ; [ DW_TAG_compile_unit ]
|
|
|
|
!11 = !{!13}
|
|
|
|
!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]
|
|
|
|
!14 = !{!"0x29", !24} ; [ DW_TAG_file_type ]
|
|
|
|
!15 = !{!"0x101\00a\0016777218\000", !5, !6, !9} ; [ DW_TAG_arg_variable ] [a] [line 2]
|
2015-01-14 22:27:36 +00:00
|
|
|
!16 = !MDLocation(line: 2, scope: !5)
|
|
|
|
!17 = !MDLocation(line: 4, scope: !18)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
!18 = !{!"0xb\003\000\000", !23, !5} ; [ DW_TAG_lexical_block ]
|
|
|
|
!19 = !{!"0x101\00a\0016777217\000", !13, !14, !9} ; [ DW_TAG_arg_variable ] [a] [line 1]
|
2015-01-14 22:27:36 +00:00
|
|
|
!20 = !MDLocation(line: 1, scope: !13)
|
|
|
|
!21 = !MDLocation(line: 2, scope: !22)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
!22 = !{!"0xb\001\000\000", !24, !13} ; [ DW_TAG_lexical_block ]
|
|
|
|
!23 = !{!"simple.c", !"/private/tmp"}
|
|
|
|
!24 = !{!"simple2.c", !"/private/tmp"}
|
|
|
|
!25 = !{i32 1, !"Debug Info Version", i32 2}
|