2013-07-25 06:23:00 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -o %t -filetype=obj
|
2013-01-26 05:44:53 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
2011-09-27 01:40:42 +08:00
|
|
|
|
|
|
|
; ModuleID = 'test.c'
|
|
|
|
|
2011-10-27 14:44:11 +08:00
|
|
|
@GLB = common global i32 0, align 4
|
2011-09-27 01:40:42 +08:00
|
|
|
|
|
|
|
define i32 @f() nounwind {
|
2011-10-27 14:44:11 +08:00
|
|
|
%LOC = alloca i32, align 4
|
2014-10-04 04:01:09 +08:00
|
|
|
call void @llvm.dbg.declare(metadata !{i32* %LOC}, metadata !15, metadata !{metadata !"0x102"}), !dbg !17
|
2011-10-27 14:44:11 +08:00
|
|
|
%1 = load i32* @GLB, align 4, !dbg !18
|
|
|
|
store i32 %1, i32* %LOC, align 4, !dbg !18
|
|
|
|
%2 = load i32* @GLB, align 4, !dbg !19
|
2011-09-27 01:40:42 +08:00
|
|
|
ret i32 %2, !dbg !19
|
|
|
|
}
|
|
|
|
|
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.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
|
2011-09-27 01:40:42 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-23 05:49:45 +08:00
|
|
|
!llvm.module.flags = !{!21}
|
2011-09-27 01:40:42 +08:00
|
|
|
|
2014-10-04 04:01:09 +08:00
|
|
|
!0 = metadata !{metadata !"0x11\0012\00clang version 3.0 (trunk)\000\00\000\00\000", metadata !20, metadata !1, metadata !1, metadata !3, metadata !12, metadata !1} ; [ DW_TAG_compile_unit ]
|
2014-02-04 09:23:52 +08:00
|
|
|
!1 = metadata !{}
|
2013-02-02 13:56:24 +08:00
|
|
|
!3 = metadata !{metadata !5}
|
2014-10-04 04:01:09 +08:00
|
|
|
!5 = metadata !{metadata !"0x2e\00f\00f\00\003\000\001\000\006\000\000\000", metadata !6, metadata !6, metadata !7, null, i32 ()* @f, null, null, null} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 0] [f]
|
|
|
|
!6 = metadata !{metadata !"0x29", metadata !20} ; [ DW_TAG_file_type ]
|
|
|
|
!7 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2011-09-27 01:40:42 +08:00
|
|
|
!8 = metadata !{metadata !9}
|
2014-10-04 04:01:09 +08:00
|
|
|
!9 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ]
|
2013-02-02 13:56:24 +08:00
|
|
|
!12 = metadata !{metadata !14}
|
2014-10-04 04:01:09 +08:00
|
|
|
!14 = metadata !{metadata !"0x34\00GLB\00GLB\00\001\000\001", null, metadata !6, metadata !9, i32* @GLB, null} ; [ DW_TAG_variable ]
|
|
|
|
!15 = metadata !{metadata !"0x100\00LOC\004\000", metadata !16, metadata !6, metadata !9} ; [ DW_TAG_auto_variable ]
|
|
|
|
!16 = metadata !{metadata !"0xb\003\009\000", metadata !20, metadata !5} ; [ DW_TAG_lexical_block ]
|
2011-09-27 01:40:42 +08:00
|
|
|
!17 = metadata !{i32 4, i32 9, metadata !16, null}
|
|
|
|
!18 = metadata !{i32 4, i32 23, metadata !16, null}
|
|
|
|
!19 = metadata !{i32 5, i32 5, metadata !16, null}
|
2013-03-18 05:13:55 +08:00
|
|
|
!20 = metadata !{metadata !"test.c", metadata !"/work/llvm/vanilla/test/DebugInfo"}
|
2011-09-27 01:40:42 +08:00
|
|
|
|
2013-10-29 13:49:41 +08:00
|
|
|
; CHECK: DW_TAG_variable
|
2014-06-14 05:52:33 +08:00
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB")
|
|
|
|
; CHECK-NOT: DW_TAG
|
2014-09-23 00:17:32 +08:00
|
|
|
; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
|
2014-06-14 05:52:33 +08:00
|
|
|
; CHECK-NOT: DW_TAG
|
2014-09-05 15:21:50 +08:00
|
|
|
; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
|
2012-12-27 10:13:55 +08:00
|
|
|
|
2013-10-29 13:49:41 +08:00
|
|
|
; CHECK: DW_TAG_variable
|
2014-06-14 05:52:33 +08:00
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC")
|
|
|
|
; CHECK-NOT: DW_TAG
|
2014-09-23 00:17:32 +08:00
|
|
|
; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
|
2014-06-14 05:52:33 +08:00
|
|
|
; CHECK-NOT: DW_TAG
|
2014-09-05 15:21:50 +08:00
|
|
|
; CHECK: DW_AT_decl_line [DW_FORM_data1] (4)
|
2011-09-27 01:40:42 +08:00
|
|
|
|
2014-10-04 04:01:09 +08:00
|
|
|
!21 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
|