2013-07-25 06:23:00 +08:00
; RUN: llc < %s -o /dev/null
2010-03-31 06:09:52 +08:00
define void @baz ( i32 %i ) nounwind ssp {
entry:
2014-10-04 04:01:09 +08:00
call void @llvm.dbg.declare ( metadata !0 , metadata !1 , metadata ! { metadata !"0x102" } ) , !dbg !0
2010-03-31 06:09:52 +08:00
ret void , !dbg !0
}
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
2010-03-31 06:09:52 +08:00
2013-07-27 09:26:08 +08:00
!llvm.dbg.cu = ! { !5 }
2013-11-23 05:49:45 +08:00
!llvm.module.flags = ! { !22 }
2013-07-27 09:26:08 +08:00
2010-03-31 06:09:52 +08:00
!0 = metadata ! { { [ 0 x i8 ] } * * undef }
2014-10-04 04:01:09 +08:00
!1 = metadata ! { metadata !"0x100\00x\0011\000" , metadata !2 , metadata !4 , metadata !9 } ; [ DW_TAG_auto_variable ]
!2 = metadata ! { metadata !"0xb\008\000\000" , metadata !20 , metadata !3 } ; [ DW_TAG_lexical_block ]
!3 = metadata ! { metadata !"0x2e\00baz\00baz\00baz\008\001\001\000\006\000\000\000" , metadata !20 , null , metadata !6 , null , null , null , null , null } ; [ DW_TAG_subprogram ]
!4 = metadata ! { metadata !"0x29" , metadata !20 } ; [ DW_TAG_file_type ]
!5 = metadata ! { metadata !"0x11\001\004.2.1 (Based on Apple Inc. build 5658) (LLVM build)\001\00\000\00\000" , metadata !20 , metadata !21 , metadata !21 , null , null , null } ; [ DW_TAG_compile_unit ]
!6 = metadata ! { metadata !"0x15\00\000\000\000\000\000\000" , metadata !20 , metadata !4 , null , metadata !7 , null , null , null } ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
2010-03-31 06:09:52 +08:00
!7 = metadata ! { null , metadata !8 }
2014-10-04 04:01:09 +08:00
!8 = metadata ! { metadata !"0x24\00int\000\0032\0032\000\000\005" , metadata !20 , metadata !4 } ; [ DW_TAG_base_type ]
!9 = metadata ! { metadata !"0xf\00\000\0064\0064\000\000" , metadata !20 , metadata !4 , metadata !10 } ; [ DW_TAG_pointer_type ]
!10 = metadata ! { metadata !"0x13\00\0011\008\008\000\000\000" , metadata !20 , metadata !3 , null , metadata !11 , null , null , null } ; [ DW_TAG_structure_type ] [line 11, size 8, align 8, offset 0] [def] [from ]
2010-03-31 06:09:52 +08:00
!11 = metadata ! { metadata !12 }
2014-10-04 04:01:09 +08:00
!12 = metadata ! { metadata !"0xd\00b\0011\008\008\000\000" , metadata !20 , metadata !10 , metadata !13 } ; [ DW_TAG_member ]
!13 = metadata ! { metadata !"0x16\00A\0011\000\000\000\000" , metadata !20 , metadata !3 , metadata !14 } ; [ DW_TAG_typedef ]
!14 = metadata ! { metadata !"0x1\00\000\008\008\000\000" , metadata !20 , metadata !4 , metadata !15 , metadata !16 , i32 0 , null , null , null } ; [ DW_TAG_array_type ] [line 0, size 8, align 8, offset 0] [from char]
!15 = metadata ! { metadata !"0x24\00char\000\008\008\000\000\006" , metadata !20 , metadata !4 } ; [ DW_TAG_base_type ]
2010-03-31 06:09:52 +08:00
!16 = metadata ! { metadata !17 }
2014-10-04 04:01:09 +08:00
!17 = metadata ! { metadata !"0x21\000\001" } ; [ DW_TAG_subrange_type ]
2010-03-31 06:09:52 +08:00
!18 = metadata ! { metadata !"llvm.mdnode.fwdref.19" }
!19 = metadata ! { metadata !"llvm.mdnode.fwdref.23" }
2013-07-25 06:23:00 +08:00
!20 = metadata ! { metadata !"2007-12-VarArrayDebug.c" , metadata !"/Users/sabre/llvm/test/FrontendC/" }
2013-07-27 09:26:08 +08:00
!21 = metadata ! { i32 0 }
2014-10-04 04:01:09 +08:00
!22 = metadata ! { i32 1 , metadata !"Debug Info Version" , i32 2 }