brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.3 KiB · ce9fc09 Raw
172 lines · plain
1# RUN: llc -emit-call-site-info -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier %s -o -| llvm-dwarfdump -| FileCheck %s2# Following code is used for producing this test case. Note that3# some of argument loading instruction are modified in order to4# cover certain cases.5#6# extern int func2(int,int,int*);7# int func1(int arg1, int arg2, int arg3) {8#   int a = func2(arg1 + 2, arg2 - 4, &arg3);9#   a += func2(arg3 - 16, arg1 + 8, &a);10#   return a++;11# }12#13# CHECK: DW_TAG_GNU_call_site14# CHECK-NEXT:   DW_AT_abstract_origin {{.*}}"func2")15# CHECK-NEXT:   DW_AT_low_pc 16# CHECK: DW_TAG_GNU_call_site_parameter17# CHECK-NEXT:   DW_AT_location      (DW_OP_reg2 R2)18# CHECK-NEXT:   DW_AT_GNU_call_site_value   (DW_OP_breg13 SP+4)19# CHECK-EMPTY: 20# CHECK-NEXT: DW_TAG_GNU_call_site_parameter21# CHECK-NEXT:   DW_AT_location      (DW_OP_reg1 R1)22# CHECK-NEXT:   DW_AT_GNU_call_site_value   (DW_OP_breg4 R4-4)23# CHECK: DW_TAG_GNU_call_site24# CHECK-NEXT:   DW_AT_abstract_origin {{.*}}"func2")25# CHECK-NEXT:   DW_AT_low_pc 26# CHECK-EMPTY: 27# CHECK-NEXT: DW_TAG_GNU_call_site_parameter28# R2 loads memory location. We can't rely that memory location won't be changed.29# CHECK-NOT:   DW_AT_location      (DW_OP_reg2 R2)30# CHECK-NEXT:   DW_AT_location      (DW_OP_reg1 R1)31# CHECK-NEXT:   DW_AT_GNU_call_site_value   (DW_OP_breg4 R4+8)32--- |33  ; ModuleID = 'dbgcall-site-interpretation.c'34  source_filename = "dbgcall-site-interpretation.c"35  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"36  target triple = "armv4t-unknown-linux-gnu"37  38  ; Function Attrs: nounwind39  define dso_local arm_aapcscc i32 @func1(i32 %arg1, i32 %arg2, i32 %arg3) local_unnamed_addr #0 !dbg !14 {40  entry:41    %arg3.addr = alloca i32, align 442    %a = alloca i32, align 443    call void @llvm.dbg.value(metadata i32 %arg1, metadata !18, metadata !DIExpression()), !dbg !2244    call void @llvm.dbg.value(metadata i32 %arg2, metadata !19, metadata !DIExpression()), !dbg !2245    call void @llvm.dbg.value(metadata i32 %arg3, metadata !20, metadata !DIExpression()), !dbg !2246    store i32 %arg3, ptr %arg3.addr, align 447    %0 = bitcast ptr %a to ptr, !dbg !2248    call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0), !dbg !2249    %add = add nsw i32 %arg1, 2, !dbg !2250    %sub = add nsw i32 %arg2, -4, !dbg !2251    call void @llvm.dbg.value(metadata ptr %arg3.addr, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !2252    %call = call arm_aapcscc i32 @func2(i32 %add, i32 %sub, ptr nonnull %arg3.addr), !dbg !2253    call void @llvm.dbg.value(metadata i32 %call, metadata !21, metadata !DIExpression()), !dbg !2254    store i32 %call, ptr %a, align 4, !dbg !2255    %1 = load i32, ptr %arg3.addr, align 4, !dbg !2256    call void @llvm.dbg.value(metadata i32 %1, metadata !20, metadata !DIExpression()), !dbg !2257    %sub1 = add nsw i32 %1, -16, !dbg !2258    %add2 = add nsw i32 %arg1, 8, !dbg !2259    call void @llvm.dbg.value(metadata ptr %a, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !2260    %call3 = call arm_aapcscc i32 @func2(i32 %sub1, i32 %add2, ptr nonnull %a), !dbg !2261    %2 = load i32, ptr %a, align 4, !dbg !2262    call void @llvm.dbg.value(metadata i32 %2, metadata !21, metadata !DIExpression()), !dbg !2263    %add4 = add nsw i32 %2, %call3, !dbg !2264    call void @llvm.dbg.value(metadata i32 %add4, metadata !21, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !2265    call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0), !dbg !2266    ret i32 %add4, !dbg !2267  }68  69  ; Function Attrs: argmemonly nounwind willreturn70  declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)71  72  declare !dbg !4 dso_local arm_aapcscc i32 @func2(i32, i32, ptr) local_unnamed_addr73  74  ; Function Attrs: argmemonly nounwind willreturn75  declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)76  77  ; Function Attrs: nounwind readnone speculatable willreturn78  declare void @llvm.dbg.value(metadata, metadata, metadata)79  80  ; Function Attrs: nounwind81  declare void @llvm.stackprotector(ptr, ptr)82  83  attributes #0 = { "frame-pointer"="all" "target-features"="+armv7-a" }84  85  !llvm.dbg.cu = !{!0}86  !llvm.module.flags = !{!9, !10, !11, !12}87  !llvm.ident = !{!13}88  89  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)90  !1 = !DIFile(filename: "dbgcall-site-interpretation.c", directory: "/")91  !2 = !{}92  !3 = !{!4}93  !4 = !DISubprogram(name: "func2", scope: !1, file: !1, line: 8, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)94  !5 = !DISubroutineType(types: !6)95  !6 = !{!7, !7, !7, !8}96  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)97  !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32)98  !9 = !{i32 2, !"Dwarf Version", i32 4}99  !10 = !{i32 2, !"Debug Info Version", i32 3}100  !11 = !{i32 1, !"wchar_size", i32 4}101  !12 = !{i32 1, !"min_enum_size", i32 4}102  !13 = !{!"clang version 10.0.0"}103  !14 = distinct !DISubprogram(name: "func1", scope: !1, file: !1, line: 9, type: !15, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)104  !15 = !DISubroutineType(types: !16)105  !16 = !{!7, !7, !7, !7}106  !17 = !{!18, !19, !20, !21}107  !18 = !DILocalVariable(name: "arg1", arg: 1, scope: !14, file: !1, line: 9, type: !7)108  !19 = !DILocalVariable(name: "arg2", arg: 2, scope: !14, file: !1, line: 9, type: !7)109  !20 = !DILocalVariable(name: "arg3", arg: 3, scope: !14, file: !1, line: 9, type: !7)110  !21 = !DILocalVariable(name: "a", scope: !14, file: !1, line: 10, type: !7)111  !22 = !DILocation(line: 0, scope: !14)112...113---114name:            func1115alignment:       4116callSites:117  - { bb: 0, offset: 22, fwdArgRegs: 118      - { arg: 0, reg: '$r0' }119      - { arg: 1, reg: '$r1' }120      - { arg: 2, reg: '$r2' } }121  - { bb: 0, offset: 32, fwdArgRegs: 122      - { arg: 0, reg: '$r0' }123      - { arg: 1, reg: '$r1' }124      - { arg: 2, reg: '$r2' } }125body:             |126  bb.0.entry:127    liveins: $r0, $r1, $r2, $r4, $r5, $r10, $lr128  129    DBG_VALUE $r0, $noreg, !18, !DIExpression(), debug-location !22130    DBG_VALUE $r1, $noreg, !19, !DIExpression(), debug-location !22131    DBG_VALUE $r1, $noreg, !19, !DIExpression(), debug-location !22132    DBG_VALUE $r2, $noreg, !20, !DIExpression(), debug-location !22133    DBG_VALUE $r2, $noreg, !20, !DIExpression(), debug-location !22134    $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $r10, $r11, killed $lr135    frame-setup CFI_INSTRUCTION def_cfa_offset 16136    frame-setup CFI_INSTRUCTION offset $lr, -4137    frame-setup CFI_INSTRUCTION offset $r11, -8138    frame-setup CFI_INSTRUCTION offset $r10, -12139    frame-setup CFI_INSTRUCTION offset $r4, -16140    $r11 = frame-setup ADDri $sp, 8, 14, $noreg, $noreg141    frame-setup CFI_INSTRUCTION def_cfa $r11, 8142    $sp = frame-setup SUBri $sp, 8, 14, $noreg, $noreg143    $r4 = MOVr $r0, 14, $noreg, $noreg144    DBG_VALUE $r4, $noreg, !18, !DIExpression(), debug-location !22145    STRi12 killed renamable $r2, $sp, 4, 14, $noreg :: (store (s32) into %ir.arg3.addr)146    DBG_VALUE $sp, $noreg, !20, !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref), debug-location !22147    renamable $r0 = nsw ADDri killed $r0, 2, 14, $noreg, $noreg, debug-location !22148    renamable $r1 = nsw SUBri renamable $r4, 4, 14, $noreg, $noreg, debug-location !22149    DBG_VALUE $r1, $noreg, !19, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !22150    renamable $r2 = ADDri $sp, 4, 14, $noreg, $noreg151    BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit killed $r2, implicit-def $sp, implicit-def $r0, debug-location !22152    DBG_VALUE $r0, $noreg, !21, !DIExpression(), debug-location !22153    STRi12 killed renamable $r0, $sp, 0, 14, $noreg, debug-location !22 :: (store (s32) into %ir.a)154    renamable $r0 = LDRi12 $sp, 4, 14, $noreg, debug-location !22 :: (dereferenceable load (s32) from %ir.arg3.addr)155    DBG_VALUE $sp, $noreg, !21, !DIExpression(DW_OP_deref), debug-location !22156    DBG_VALUE $r0, $noreg, !20, !DIExpression(), debug-location !22157    renamable $r1 = nsw ADDri killed renamable $r4, 8, 14, $noreg, $noreg, debug-location !22158    $r5 = MOVr $sp, 14, $noreg, $noreg159    renamable $r2 = LDRi12 killed $r5, 16, 14, $noreg160    renamable $r0 = nsw SUBri killed renamable $r0, 16, 14, $noreg, $noreg, debug-location !22161    BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit killed $r2, implicit-def $sp, implicit-def $r0, debug-location !22162    renamable $r1 = LDRi12 $sp, 0, 14, $noreg, debug-location !22 :: (dereferenceable load (s32) from %ir.a)163    DBG_VALUE $r1, $noreg, !21, !DIExpression(), debug-location !22164    renamable $r0 = nsw ADDrr killed renamable $r1, killed renamable $r0, 14, $noreg, $noreg, debug-location !22165    DBG_VALUE $r0, $noreg, !21, !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value), debug-location !22166    $sp = SUBri $r11, 8, 14, $noreg, $noreg, debug-location !22167    $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $r10, def $r11, def $lr, debug-location !22168    DBG_VALUE $r0, $noreg, !18, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !22169    BX_RET 14, $noreg, implicit killed $r0, debug-location !22170 171...172