1# RUN: llc -emit-call-site-info -start-after=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s 2 3# Based on the following C reproducer: 4# 5# extern void call_int(int); 6# extern void call_int_int(int, int); 7# extern void call_long(long); 8# extern int global; 9# 10# int same_reg(int p) { 11# call_int(p); 12# return 0; 13# } 14# 15# int super_reg(unsigned p) { 16# call_long(p); 17# return 0; 18# } 19# 20# int sub_reg(int p, long q) { 21# call_int_int(q, global); 22# return p; 23# } 24 25--- | 26 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 27 target triple = "aarch64" 28 29 @global = external global i32, align 4 30 31 ; Function Attrs: noinline nounwind 32 define i32 @same_reg(i32 %p) #0 !dbg !19 { 33 entry: 34 call void @llvm.dbg.value(metadata i32 %p, metadata !23, metadata !DIExpression()), !dbg !24 35 tail call void @call_int(i32 %p), !dbg !25 36 ret i32 0, !dbg !26 37 } 38 39 declare !dbg !4 void @call_int(i32) 40 41 ; Function Attrs: noinline nounwind 42 define i32 @super_reg(i32 %p) #0 !dbg !27 { 43 entry: 44 call void @llvm.dbg.value(metadata i32 %p, metadata !32, metadata !DIExpression()), !dbg !33 45 %conv = zext i32 %p to i64, !dbg !34 46 tail call void @call_long(i64 %conv), !dbg !34 47 ret i32 0, !dbg !35 48 } 49 50 declare !dbg !8 void @call_long(i64) 51 52 ; Function Attrs: noinline nounwind 53 define i32 @sub_reg(i32 returned %p, i64 %q) #0 !dbg !36 { 54 entry: 55 call void @llvm.dbg.value(metadata i32 %p, metadata !40, metadata !DIExpression()), !dbg !42 56 call void @llvm.dbg.value(metadata i64 %q, metadata !41, metadata !DIExpression()), !dbg !42 57 %conv = trunc i64 %q to i32, !dbg !43 58 %0 = load i32, i32* @global, align 4, !dbg !43 59 tail call void @call_int_int(i32 %conv, i32 %0), !dbg !43 60 ret i32 %p, !dbg !44 61 } 62 63 declare !dbg !12 void @call_int_int(i32, i32) 64 65 ; Function Attrs: nounwind readnone speculatable willreturn 66 declare void @llvm.dbg.value(metadata, metadata, metadata) #1 67 68 attributes #0 = { noinline nounwind "frame-pointer"="all" } 69 attributes #1 = { nounwind readnone speculatable willreturn } 70 71 !llvm.dbg.cu = !{!0} 72 !llvm.module.flags = !{!15, !16, !17} 73 !llvm.ident = !{!18} 74 75 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (ssh://gerritmirror.rnd.ki.sw.ericsson.se:29418/flextools/llvm-project.git f76e863b549ddccd5e917e2f3ff50646915654d2)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None) 76 !1 = !DIFile(filename: "orrxrs.c", directory: "/repo/edasten/llvm-project/llvm") 77 !2 = !{} 78 !3 = !{!4, !8, !12} 79 !4 = !DISubprogram(name: "call_int", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 80 !5 = !DISubroutineType(types: !6) 81 !6 = !{null, !7} 82 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 83 !8 = !DISubprogram(name: "call_long", scope: !1, file: !1, line: 3, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 84 !9 = !DISubroutineType(types: !10) 85 !10 = !{null, !11} 86 !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed) 87 !12 = !DISubprogram(name: "call_int_int", scope: !1, file: !1, line: 2, type: !13, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 88 !13 = !DISubroutineType(types: !14) 89 !14 = !{null, !7, !7} 90 !15 = !{i32 2, !"Dwarf Version", i32 4} 91 !16 = !{i32 2, !"Debug Info Version", i32 3} 92 !17 = !{i32 1, !"wchar_size", i32 4} 93 !18 = !{!"clang version 10.0.0 (ssh://gerritmirror.rnd.ki.sw.ericsson.se:29418/flextools/llvm-project.git f76e863b549ddccd5e917e2f3ff50646915654d2)"} 94 !19 = distinct !DISubprogram(name: "same_reg", scope: !1, file: !1, line: 6, type: !20, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !22) 95 !20 = !DISubroutineType(types: !21) 96 !21 = !{!7, !7} 97 !22 = !{!23} 98 !23 = !DILocalVariable(name: "p", arg: 1, scope: !19, file: !1, line: 6, type: !7) 99 !24 = !DILocation(line: 0, scope: !19) 100 !25 = !DILocation(line: 7, scope: !19) 101 !26 = !DILocation(line: 8, scope: !19) 102 !27 = distinct !DISubprogram(name: "super_reg", scope: !1, file: !1, line: 11, type: !28, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !31) 103 !28 = !DISubroutineType(types: !29) 104 !29 = !{!7, !30} 105 !30 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) 106 !31 = !{!32} 107 !32 = !DILocalVariable(name: "p", arg: 1, scope: !27, file: !1, line: 11, type: !30) 108 !33 = !DILocation(line: 0, scope: !27) 109 !34 = !DILocation(line: 12, scope: !27) 110 !35 = !DILocation(line: 13, scope: !27) 111 !36 = distinct !DISubprogram(name: "sub_reg", scope: !1, file: !1, line: 16, type: !37, scopeLine: 16, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !39) 112 !37 = !DISubroutineType(types: !38) 113 !38 = !{!7, !7, !11} 114 !39 = !{!40, !41} 115 !40 = !DILocalVariable(name: "p", arg: 1, scope: !36, file: !1, line: 16, type: !7) 116 !41 = !DILocalVariable(name: "q", arg: 2, scope: !36, file: !1, line: 16, type: !11) 117 !42 = !DILocation(line: 0, scope: !36) 118 !43 = !DILocation(line: 17, scope: !36) 119 !44 = !DILocation(line: 18, scope: !36) 120 121... 122--- 123name: same_reg 124alignment: 4 125tracksRegLiveness: true 126liveins: 127 - { reg: '$w0' } 128frameInfo: 129 stackSize: 16 130 maxAlignment: 8 131 adjustsStack: true 132 hasCalls: true 133 maxCallFrameSize: 0 134stack: 135 - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' } 136 - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' } 137callSites: 138 - { bb: 0, offset: 8, fwdArgRegs: 139 - { arg: 0, reg: '$w0' } } 140machineFunctionInfo: {} 141body: | 142 bb.0.entry: 143 liveins: $w0, $lr 144 145 DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24 146 DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24 147 DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24 148 early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store 8 into %stack.1), (store 8 into %stack.0) 149 $fp = frame-setup ADDXri $sp, 0, 0 150 frame-setup CFI_INSTRUCTION def_cfa $w29, 16 151 frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !25 152 frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !25 153 BL @call_int, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, debug-location !25 154 DBG_VALUE $w0, $noreg, !23, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !24 155 $w0 = ORRWrs $wzr, $wzr, 0, debug-location !26 156 early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !26 :: (load 8 from %stack.1), (load 8 from %stack.0) 157 RET undef $lr, implicit killed $w0, debug-location !26 158 159... 160 161# CHECK: DW_TAG_GNU_call_site 162# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int") 163# 164# CHECK: DW_TAG_GNU_call_site_parameter 165# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0) 166# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0)) 167 168--- 169name: super_reg 170alignment: 4 171tracksRegLiveness: true 172liveins: 173 - { reg: '$w0' } 174frameInfo: 175 stackSize: 16 176 maxAlignment: 8 177 adjustsStack: true 178 hasCalls: true 179 maxCallFrameSize: 0 180stack: 181 - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' } 182 - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' } 183callSites: 184 - { bb: 0, offset: 9, fwdArgRegs: 185 - { arg: 0, reg: '$x0' } } 186machineFunctionInfo: {} 187body: | 188 bb.0.entry: 189 liveins: $w0, $lr 190 191 DBG_VALUE $w0, $noreg, !32, !DIExpression(), debug-location !33 192 DBG_VALUE $w0, $noreg, !32, !DIExpression(), debug-location !33 193 early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store 8 into %stack.1), (store 8 into %stack.0) 194 $fp = frame-setup ADDXri $sp, 0, 0 195 frame-setup CFI_INSTRUCTION def_cfa $w29, 16 196 frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !34 197 frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !34 198 renamable $w0 = ORRWrs $wzr, killed renamable $w0, 0, implicit-def $x0, debug-location !34 199 DBG_VALUE $w0, $noreg, !32, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !33 200 BL @call_long, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !34 201 $w0 = ORRWrs $wzr, $wzr, 0, debug-location !35 202 early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !35 :: (load 8 from %stack.1), (load 8 from %stack.0) 203 RET undef $lr, implicit killed $w0, debug-location !35 204 205... 206 207# CHECK: DW_TAG_GNU_call_site 208# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_long") 209# 210# CHECK: DW_TAG_GNU_call_site_parameter 211# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0) 212# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0)) 213 214--- 215name: sub_reg 216alignment: 4 217tracksRegLiveness: true 218liveins: 219 - { reg: '$w0' } 220 - { reg: '$x1' } 221frameInfo: 222 stackSize: 32 223 maxAlignment: 16 224 adjustsStack: true 225 hasCalls: true 226 maxCallFrameSize: 0 227stack: 228 - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$x19' } 229 - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$lr' } 230 - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$fp' } 231callSites: 232 - { bb: 0, offset: 17, fwdArgRegs: 233 - { arg: 0, reg: '$w0' } 234 - { arg: 1, reg: '$w1' } } 235machineFunctionInfo: {} 236body: | 237 bb.0.entry: 238 liveins: $w0, $x1, $lr, $x19 239 240 DBG_VALUE $w0, $noreg, !40, !DIExpression(), debug-location !42 241 DBG_VALUE $x1, $noreg, !41, !DIExpression(), debug-location !42 242 early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -4 :: (store 8 into %stack.2), (store 8 into %stack.1) 243 frame-setup STRXui killed $x19, $sp, 2 :: (store 8 into %stack.0) 244 $fp = frame-setup ADDXri $sp, 0, 0 245 frame-setup CFI_INSTRUCTION def_cfa $w29, 32 246 frame-setup CFI_INSTRUCTION offset $w19, -16 247 frame-setup CFI_INSTRUCTION offset $w30, -24 248 frame-setup CFI_INSTRUCTION offset $w29, -32 249 renamable $x9 = ADRP target-flags(aarch64-page) @global, debug-location !43 250 $x8 = ORRXrs $xzr, killed $x1, 0 251 DBG_VALUE $x8, $noreg, !41, !DIExpression(), debug-location !42 252 renamable $w1 = LDRWui killed renamable $x9, target-flags(aarch64-pageoff, aarch64-nc) @global, debug-location !43 :: (dereferenceable load 4 from @global) 253 $w19 = ORRWrs $wzr, killed $w0, 0 254 DBG_VALUE $w19, $noreg, !40, !DIExpression(), debug-location !42 255 DBG_VALUE $w19, $noreg, !40, !DIExpression(), debug-location !42 256 $w0 = ORRWrs $wzr, killed $w8, 0, implicit $x8, debug-location !43 257 BL @call_int_int, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit-def $sp, debug-location !43 258 DBG_VALUE $x1, $noreg, !41, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !42 259 $w0 = ORRWrs $wzr, killed $w19, 0, debug-location !44 260 DBG_VALUE $w0, $noreg, !40, !DIExpression(), debug-location !42 261 $x19 = frame-destroy LDRXui $sp, 2, debug-location !44 :: (load 8 from %stack.0) 262 early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 4, debug-location !44 :: (load 8 from %stack.2), (load 8 from %stack.1) 263 RET undef $lr, implicit killed $w0, debug-location !44 264 265... 266 267# CHECK: DW_TAG_GNU_call_site 268# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int_int") 269# 270# CHECK: DW_TAG_GNU_call_site_parameter 271# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0) 272# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg1 W1)) 273