2013-05-07 00:18:29 +08:00
|
|
|
; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim < %s | FileCheck %s
|
2014-05-24 05:11:46 +08:00
|
|
|
; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim -filetype=obj < %s \
|
|
|
|
; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=DEBUG %s
|
2013-05-07 00:18:29 +08:00
|
|
|
;
|
|
|
|
; This is a regression test making sure the location of variables is correct in
|
|
|
|
; debugging information, even if they're addressed via the frame pointer.
|
2014-01-13 23:42:16 +08:00
|
|
|
; Originally a copy of the AArch64 test, commandeered for SystemZ.
|
2013-05-07 00:18:29 +08:00
|
|
|
;
|
|
|
|
; First make sure main_arr is where we expect it: %r11 + 164
|
|
|
|
;
|
|
|
|
; CHECK: main:
|
|
|
|
; CHECK: aghi %r15, -568
|
2013-06-27 17:42:10 +08:00
|
|
|
; CHECK: la %r2, 164(%r11)
|
2013-05-07 00:18:29 +08:00
|
|
|
; CHECK: brasl %r14, populate_array@PLT
|
2014-05-24 05:11:46 +08:00
|
|
|
|
|
|
|
; DEBUG: DW_TAG_variable
|
|
|
|
; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xa401 is SLEB128 encoded 164.
|
|
|
|
; DEBUG-NOT: DW_TAG
|
|
|
|
; DEBUG: DW_AT_location {{.*}}(<0x3> 91 a4 01 )
|
2014-06-14 06:18:23 +08:00
|
|
|
; DEBUG-NOT: DW_TAG
|
|
|
|
; DEBUG: DW_AT_name {{.*}} "main_arr"
|
2013-05-07 00:18:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
@.str = private unnamed_addr constant [13 x i8] c"Total is %d\0A\00", align 2
|
|
|
|
|
|
|
|
declare void @populate_array(i32*, i32) nounwind
|
|
|
|
|
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
|
2013-05-07 00:18:29 +08:00
|
|
|
|
|
|
|
declare i32 @sum_array(i32*, i32) nounwind
|
|
|
|
|
|
|
|
define i32 @main() nounwind {
|
|
|
|
entry:
|
|
|
|
%retval = alloca i32, align 4
|
|
|
|
%main_arr = alloca [100 x i32], align 4
|
|
|
|
%val = alloca i32, align 4
|
2014-01-13 23:42:16 +08:00
|
|
|
store volatile i32 0, i32* %retval
|
2014-10-04 04:01:09 +08:00
|
|
|
call void @llvm.dbg.declare(metadata !{[100 x i32]* %main_arr}, metadata !17, metadata !{metadata !"0x102"}), !dbg !22
|
|
|
|
call void @llvm.dbg.declare(metadata !{i32* %val}, metadata !23, metadata !{metadata !"0x102"}), !dbg !24
|
2013-05-07 00:18:29 +08:00
|
|
|
%arraydecay = getelementptr inbounds [100 x i32]* %main_arr, i32 0, i32 0, !dbg !25
|
|
|
|
call void @populate_array(i32* %arraydecay, i32 100), !dbg !25
|
|
|
|
%arraydecay1 = getelementptr inbounds [100 x i32]* %main_arr, i32 0, i32 0, !dbg !26
|
|
|
|
%call = call i32 @sum_array(i32* %arraydecay1, i32 100), !dbg !26
|
|
|
|
store i32 %call, i32* %val, align 4, !dbg !26
|
|
|
|
%0 = load i32* %val, align 4, !dbg !27
|
|
|
|
%call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0), i32 %0), !dbg !27
|
|
|
|
ret i32 0, !dbg !28
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @printf(i8*, ...)
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-23 05:49:45 +08:00
|
|
|
!llvm.module.flags = !{!30}
|
2013-05-07 00:18:29 +08:00
|
|
|
|
2014-10-04 04:01:09 +08:00
|
|
|
!0 = metadata !{metadata !"0x11\0012\00clang version 3.2 \000\00\000\00\000", metadata !29, metadata !1, metadata !1, metadata !3, metadata !1, metadata !1} ; [ DW_TAG_compile_unit ] [/home/timnor01/a64-trunk/build/simple.c] [DW_LANG_C99]
|
2014-02-04 09:23:52 +08:00
|
|
|
!1 = metadata !{}
|
2013-05-07 00:18:29 +08:00
|
|
|
!3 = metadata !{metadata !5, metadata !11, metadata !14}
|
2014-10-04 04:01:09 +08:00
|
|
|
!5 = metadata !{metadata !"0x2e\00populate_array\00populate_array\00\004\000\001\000\006\00256\000\004", metadata !29, metadata !6, metadata !7, null, void (i32*, i32)* @populate_array, null, null, metadata !1} ; [ DW_TAG_subprogram ] [line 4] [def] [populate_array]
|
|
|
|
!6 = metadata !{metadata !"0x29", metadata !29} ; [ 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 ]
|
2013-05-07 00:18:29 +08:00
|
|
|
!8 = metadata !{null, metadata !9, metadata !10}
|
2014-10-04 04:01:09 +08:00
|
|
|
!9 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
|
|
|
|
!10 = metadata !{metadata !"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]
|
|
|
|
!11 = metadata !{metadata !"0x2e\00sum_array\00sum_array\00\009\000\001\000\006\00256\000\009", metadata !29, metadata !6, metadata !12, null, i32 (i32*, i32)* @sum_array, null, null, metadata !1} ; [ DW_TAG_subprogram ] [line 9] [def] [sum_array]
|
|
|
|
!12 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !13, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2013-05-07 00:18:29 +08:00
|
|
|
!13 = metadata !{metadata !10, metadata !9, metadata !10}
|
2014-10-04 04:01:09 +08:00
|
|
|
!14 = metadata !{metadata !"0x2e\00main\00main\00\0018\000\001\000\006\00256\000\0018", metadata !29, metadata !6, metadata !15, null, i32 ()* @main, null, null, metadata !1} ; [ DW_TAG_subprogram ] [line 18] [def] [main]
|
|
|
|
!15 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !16, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2013-05-07 00:18:29 +08:00
|
|
|
!16 = metadata !{metadata !10}
|
2014-10-04 04:01:09 +08:00
|
|
|
!17 = metadata !{metadata !"0x100\00main_arr\0019\000", metadata !18, metadata !6, metadata !19} ; [ DW_TAG_auto_variable ] [main_arr] [line 19]
|
|
|
|
!18 = metadata !{metadata !"0xb\0018\0016\004", metadata !29, metadata !14} ; [ DW_TAG_lexical_block ] [/home/timnor01/a64-trunk/build/simple.c]
|
|
|
|
!19 = metadata !{metadata !"0x1\00\000\003200\0032\000\000", null, null, metadata !10, metadata !20, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 3200, align 32, offset 0] [from int]
|
|
|
|
!20 = metadata !{metadata !"0x21\000\0099"} ; [ DW_TAG_subrange_type ] [0, 99]
|
2013-05-07 00:18:29 +08:00
|
|
|
!22 = metadata !{i32 19, i32 7, metadata !18, null}
|
2014-10-04 04:01:09 +08:00
|
|
|
!23 = metadata !{metadata !"0x100\00val\0020\000", metadata !18, metadata !6, metadata !10} ; [ DW_TAG_auto_variable ] [val] [line 20]
|
2013-05-07 00:18:29 +08:00
|
|
|
!24 = metadata !{i32 20, i32 7, metadata !18, null}
|
|
|
|
!25 = metadata !{i32 22, i32 3, metadata !18, null}
|
|
|
|
!26 = metadata !{i32 23, i32 9, metadata !18, null}
|
|
|
|
!27 = metadata !{i32 24, i32 3, metadata !18, null}
|
|
|
|
!28 = metadata !{i32 26, i32 3, metadata !18, null}
|
|
|
|
!29 = metadata !{metadata !"simple.c", metadata !"/home/timnor01/a64-trunk/build"}
|
2014-10-04 04:01:09 +08:00
|
|
|
!30 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
|