Home | History | Annotate | Download | only in SystemZ
      1 ; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim < %s | FileCheck %s
      2 ;
      3 ; This is a regression test making sure the location of variables is correct in
      4 ; debugging information, even if they're addressed via the frame pointer.
      5 ; A copy of the AArch64 test, commandeered for SystemZ.
      6 ;
      7 ; First make sure main_arr is where we expect it: %r11 + 164
      8 ;
      9 ; CHECK: main:
     10 ; CHECK: aghi    %r15, -568
     11 ; CHECK: la      %r2, 164(%r11)
     12 ; CHECK: brasl   %r14, populate_array@PLT
     13 ;
     14 ; Now check that the debugging information reflects this:
     15 ; CHECK: DW_TAG_variable
     16 ; CHECK-NEXT: .long .Linfo_string7
     17 ;
     18 ; Rather hard-coded, but 145 => DW_OP_fbreg and the .ascii is the sleb128
     19 ; encoding of 164:
     20 ; CHECK: DW_AT_location
     21 ; CHECK-NEXT: .byte 145
     22 ; CHECK-NEXT: .ascii "\244\001"
     23 ;
     24 ; CHECK: .Linfo_string7:
     25 ; CHECK-NEXT: main_arr
     26 
     27 
     28 @.str = private unnamed_addr constant [13 x i8] c"Total is %d\0A\00", align 2
     29 
     30 declare void @populate_array(i32*, i32) nounwind
     31 
     32 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
     33 
     34 declare i32 @sum_array(i32*, i32) nounwind
     35 
     36 define i32 @main() nounwind {
     37 entry:
     38   %retval = alloca i32, align 4
     39   %main_arr = alloca [100 x i32], align 4
     40   %val = alloca i32, align 4
     41   store i32 0, i32* %retval
     42   call void @llvm.dbg.declare(metadata !{[100 x i32]* %main_arr}, metadata !17), !dbg !22
     43   call void @llvm.dbg.declare(metadata !{i32* %val}, metadata !23), !dbg !24
     44   %arraydecay = getelementptr inbounds [100 x i32]* %main_arr, i32 0, i32 0, !dbg !25
     45   call void @populate_array(i32* %arraydecay, i32 100), !dbg !25
     46   %arraydecay1 = getelementptr inbounds [100 x i32]* %main_arr, i32 0, i32 0, !dbg !26
     47   %call = call i32 @sum_array(i32* %arraydecay1, i32 100), !dbg !26
     48   store i32 %call, i32* %val, align 4, !dbg !26
     49   %0 = load i32* %val, align 4, !dbg !27
     50   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0), i32 %0), !dbg !27
     51   ret i32 0, !dbg !28
     52 }
     53 
     54 declare i32 @printf(i8*, ...)
     55 
     56 !llvm.dbg.cu = !{!0}
     57 
     58 !0 = metadata !{i32 786449, metadata !29, i32 12, metadata !"clang version 3.2 ", i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1,  metadata !1, metadata !""} ; [ DW_TAG_compile_unit ] [/home/timnor01/a64-trunk/build/simple.c] [DW_LANG_C99]
     59 !1 = metadata !{i32 0}
     60 !3 = metadata !{metadata !5, metadata !11, metadata !14}
     61 !5 = metadata !{i32 786478, metadata !29, metadata !6, metadata !"populate_array", metadata !"populate_array", metadata !"", i32 4, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32*, i32)* @populate_array, null, null, metadata !1, i32 4} ; [ DW_TAG_subprogram ] [line 4] [def] [populate_array]
     62 !6 = metadata !{i32 786473, metadata !29} ; [ DW_TAG_file_type ]
     63 !7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
     64 !8 = metadata !{null, metadata !9, metadata !10}
     65 !9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
     66 !10 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
     67 !11 = metadata !{i32 786478, metadata !29, metadata !6, metadata !"sum_array", metadata !"sum_array", metadata !"", i32 9, metadata !12, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32*, i32)* @sum_array, null, null, metadata !1, i32 9} ; [ DW_TAG_subprogram ] [line 9] [def] [sum_array]
     68 !12 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !13, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
     69 !13 = metadata !{metadata !10, metadata !9, metadata !10}
     70 !14 = metadata !{i32 786478, metadata !29, metadata !6, metadata !"main", metadata !"main", metadata !"", i32 18, metadata !15, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !1, i32 18} ; [ DW_TAG_subprogram ] [line 18] [def] [main]
     71 !15 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !16, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
     72 !16 = metadata !{metadata !10}
     73 !17 = metadata !{i32 786688, metadata !18, metadata !"main_arr", metadata !6, i32 19, metadata !19, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [main_arr] [line 19]
     74 !18 = metadata !{i32 786443, metadata !29, metadata !14, i32 18, i32 16, i32 4} ; [ DW_TAG_lexical_block ] [/home/timnor01/a64-trunk/build/simple.c]
     75 !19 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 3200, i64 32, i32 0, i32 0, metadata !10, metadata !20, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 3200, align 32, offset 0] [from int]
     76 !20 = metadata !{i32 786465, i64 0, i64 99}       ; [ DW_TAG_subrange_type ] [0, 99]
     77 !22 = metadata !{i32 19, i32 7, metadata !18, null}
     78 !23 = metadata !{i32 786688, metadata !18, metadata !"val", metadata !6, i32 20, metadata !10, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [val] [line 20]
     79 !24 = metadata !{i32 20, i32 7, metadata !18, null}
     80 !25 = metadata !{i32 22, i32 3, metadata !18, null}
     81 !26 = metadata !{i32 23, i32 9, metadata !18, null}
     82 !27 = metadata !{i32 24, i32 3, metadata !18, null}
     83 !28 = metadata !{i32 26, i32 3, metadata !18, null}
     84 !29 = metadata !{metadata !"simple.c", metadata !"/home/timnor01/a64-trunk/build"}
     85