1# RUN: llc -emit-call-site-info -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier %s -o -| llvm-dwarfdump -| FileCheck %s 2# Following code is used for producing this test case. Note that 3# some of argument loading instruction are modified in order to 4# 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_site 14# CHECK-NEXT: DW_AT_abstract_origin {{.*}}"func2") 15# CHECK-NEXT: DW_AT_low_pc 16# CHECK: DW_TAG_GNU_call_site_parameter 17# 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_parameter 21# 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_site 24# 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_parameter 28# 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: nounwind 39 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 4 42 %a = alloca i32, align 4 43 call void @llvm.dbg.value(metadata i32 %arg1, metadata !18, metadata !DIExpression()), !dbg !22 44 call void @llvm.dbg.value(metadata i32 %arg2, metadata !19, metadata !DIExpression()), !dbg !22 45 call void @llvm.dbg.value(metadata i32 %arg3, metadata !20, metadata !DIExpression()), !dbg !22 46 store i32 %arg3, i32* %arg3.addr, align 4 47 %0 = bitcast i32* %a to i8*, !dbg !22 48 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0), !dbg !22 49 %add = add nsw i32 %arg1, 2, !dbg !22 50 %sub = add nsw i32 %arg2, -4, !dbg !22 51 call void @llvm.dbg.value(metadata i32* %arg3.addr, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !22 52 %call = call arm_aapcscc i32 @func2(i32 %add, i32 %sub, i32* nonnull %arg3.addr), !dbg !22 53 call void @llvm.dbg.value(metadata i32 %call, metadata !21, metadata !DIExpression()), !dbg !22 54 store i32 %call, i32* %a, align 4, !dbg !22 55 %1 = load i32, i32* %arg3.addr, align 4, !dbg !22 56 call void @llvm.dbg.value(metadata i32 %1, metadata !20, metadata !DIExpression()), !dbg !22 57 %sub1 = add nsw i32 %1, -16, !dbg !22 58 %add2 = add nsw i32 %arg1, 8, !dbg !22 59 call void @llvm.dbg.value(metadata i32* %a, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !22 60 %call3 = call arm_aapcscc i32 @func2(i32 %sub1, i32 %add2, i32* nonnull %a), !dbg !22 61 %2 = load i32, i32* %a, align 4, !dbg !22 62 call void @llvm.dbg.value(metadata i32 %2, metadata !21, metadata !DIExpression()), !dbg !22 63 %add4 = add nsw i32 %2, %call3, !dbg !22 64 call void @llvm.dbg.value(metadata i32 %add4, metadata !21, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !22 65 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0), !dbg !22 66 ret i32 %add4, !dbg !22 67 } 68 69 ; Function Attrs: argmemonly nounwind willreturn 70 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) 71 72 declare !dbg !4 dso_local arm_aapcscc i32 @func2(i32, i32, i32*) local_unnamed_addr 73 74 ; Function Attrs: argmemonly nounwind willreturn 75 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) 76 77 ; Function Attrs: nounwind readnone speculatable willreturn 78 declare void @llvm.dbg.value(metadata, metadata, metadata) 79 80 ; Function Attrs: nounwind 81 declare void @llvm.stackprotector(i8*, i8**) 82 83 attributes #0 = { "frame-pointer"="all"} 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: func1 115alignment: 4 116callSites: 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, $lr 128 129 DBG_VALUE $r0, $noreg, !18, !DIExpression(), debug-location !22 130 DBG_VALUE $r1, $noreg, !19, !DIExpression(), debug-location !22 131 DBG_VALUE $r1, $noreg, !19, !DIExpression(), debug-location !22 132 DBG_VALUE $r2, $noreg, !20, !DIExpression(), debug-location !22 133 DBG_VALUE $r2, $noreg, !20, !DIExpression(), debug-location !22 134 $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $r10, $r11, killed $lr 135 frame-setup CFI_INSTRUCTION def_cfa_offset 16 136 frame-setup CFI_INSTRUCTION offset $lr, -4 137 frame-setup CFI_INSTRUCTION offset $r11, -8 138 frame-setup CFI_INSTRUCTION offset $r10, -12 139 frame-setup CFI_INSTRUCTION offset $r4, -16 140 $r11 = frame-setup ADDri $sp, 8, 14, $noreg, $noreg 141 frame-setup CFI_INSTRUCTION def_cfa $r11, 8 142 $sp = frame-setup SUBri $sp, 8, 14, $noreg, $noreg 143 $r4 = MOVr $r0, 14, $noreg, $noreg 144 DBG_VALUE $r4, $noreg, !18, !DIExpression(), debug-location !22 145 STRi12 killed renamable $r2, $sp, 4, 14, $noreg :: (store 4 into %ir.arg3.addr) 146 DBG_VALUE $sp, $noreg, !20, !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref), debug-location !22 147 renamable $r0 = nsw ADDri killed $r0, 2, 14, $noreg, $noreg, debug-location !22 148 renamable $r1 = nsw SUBri renamable $r4, 4, 14, $noreg, $noreg, debug-location !22 149 DBG_VALUE $r1, $noreg, !19, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !22 150 renamable $r2 = ADDri $sp, 4, 14, $noreg, $noreg 151 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 !22 152 DBG_VALUE $r0, $noreg, !21, !DIExpression(), debug-location !22 153 STRi12 killed renamable $r0, $sp, 0, 14, $noreg, debug-location !22 :: (store 4 into %ir.a) 154 renamable $r0 = LDRi12 $sp, 4, 14, $noreg, debug-location !22 :: (dereferenceable load 4 from %ir.arg3.addr) 155 DBG_VALUE $sp, $noreg, !21, !DIExpression(DW_OP_deref), debug-location !22 156 DBG_VALUE $r0, $noreg, !20, !DIExpression(), debug-location !22 157 renamable $r1 = nsw ADDri killed renamable $r4, 8, 14, $noreg, $noreg, debug-location !22 158 $r5 = MOVr $sp, 14, $noreg, $noreg 159 renamable $r2 = LDRi12 killed $r5, 16, 14, $noreg 160 renamable $r0 = nsw SUBri killed renamable $r0, 16, 14, $noreg, $noreg, debug-location !22 161 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 !22 162 renamable $r1 = LDRi12 $sp, 0, 14, $noreg, debug-location !22 :: (dereferenceable load 4 from %ir.a) 163 DBG_VALUE $r1, $noreg, !21, !DIExpression(), debug-location !22 164 renamable $r0 = nsw ADDrr killed renamable $r1, killed renamable $r0, 14, $noreg, $noreg, debug-location !22 165 DBG_VALUE $r0, $noreg, !21, !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value), debug-location !22 166 $sp = SUBri $r11, 8, 14, $noreg, $noreg, debug-location !22 167 $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $r10, def $r11, def $lr, debug-location !22 168 DBG_VALUE $r0, $noreg, !18, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !22 169 BX_RET 14, $noreg, implicit killed $r0, debug-location !22 170 171... 172