1 # Check that llvm can describe a call site parameter which resides in a spill slot.
3 # RUN: llc -emit-call-site-info -debug-entry-values -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
6 # $ ~/src/builds/llvm-project-master-RA/bin/clang -g -Xclang -femit-debug-entry-values -O2 -c -o spill.o spill.cc -mllvm -stop-before=machineverifier -o spill.mir
9 ## extern void callee(int);
11 ## #define FORCE_SPILL() \
15 ## : "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "r8", "r9", \
16 ## "r10", "r11", "r12", "r13", "r14", "r15")
18 ## __attribute__((disable_tail_calls)) void caller(int x) {
23 # CHECK-LABEL: DW_TAG_call_site_parameter
24 # CHECK-NEXT: DW_AT_location (DW_OP_reg5 RDI)
25 # CHECK-NEXT: DW_AT_call_value (DW_OP_fbreg -44, DW_OP_deref_size 0x4)
28 ; ModuleID = 'spill.cc'
29 source_filename = "spill.cc"
30 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
31 target triple = "x86_64-apple-macosx10.14.0"
33 ; Function Attrs: ssp uwtable
34 define void @_Z6calleri(i32 %x) local_unnamed_addr #0 !dbg !13 {
36 call void @llvm.dbg.value(metadata i32 %x, metadata !15, metadata !DIExpression()), !dbg !16
37 call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !17, !srcloc !18
38 call void @_Z6calleei(i32 %x), !dbg !19
42 declare !dbg !4 void @_Z6calleei(i32) local_unnamed_addr
44 ; Function Attrs: nounwind readnone speculatable willreturn
45 declare void @llvm.dbg.value(metadata, metadata, metadata)
47 ; Function Attrs: nounwind
48 declare void @llvm.stackprotector(i8*, i8**)
50 attributes #0 = { "disable-tail-calls"="true" "frame-pointer"="all" }
53 !llvm.module.flags = !{!8, !9, !10, !11}
56 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0 (git@github.com:llvm/llvm-project.git 132f768649d8f21d577ee220e5e084904874cb3d)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
57 !1 = !DIFile(filename: "spill.cc", directory: "/Users/vsk/tmp/param-analysis")
60 !4 = !DISubprogram(name: "callee", linkageName: "_Z6calleei", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
61 !5 = !DISubroutineType(types: !6)
63 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
64 !8 = !{i32 2, !"Dwarf Version", i32 4}
65 !9 = !{i32 2, !"Debug Info Version", i32 3}
66 !10 = !{i32 1, !"wchar_size", i32 4}
67 !11 = !{i32 7, !"PIC Level", i32 2}
68 !12 = !{!"clang version 10.0.0 (git@github.com:llvm/llvm-project.git 132f768649d8f21d577ee220e5e084904874cb3d)"}
69 !13 = distinct !DISubprogram(name: "caller", linkageName: "_Z6calleri", scope: !1, file: !1, line: 10, type: !5, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
71 !15 = !DILocalVariable(name: "x", arg: 1, scope: !13, file: !1, line: 10, type: !7)
72 !16 = !DILocation(line: 0, scope: !13)
73 !17 = !DILocation(line: 11, column: 3, scope: !13)
74 !18 = !{i32 -2147469811}
75 !19 = !DILocation(line: 12, column: 3, scope: !13)
76 !20 = !DILocation(line: 13, column: 1, scope: !13)
82 exposesReturnsTwice: false
84 regBankSelected: false
87 tracksRegLiveness: true
91 - { reg: '$edi', virtual-reg: '' }
93 isFrameAddressTaken: false
94 isReturnAddressTaken: false
104 cvBytesOfCalleeSavedRegisters: 40
105 hasOpaqueSPAdjustment: false
107 hasMustTailInVarArgFunc: false
112 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
113 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
114 debug-info-expression: '', debug-info-location: '' }
115 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
116 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
117 debug-info-expression: '', debug-info-location: '' }
118 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
119 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
120 debug-info-expression: '', debug-info-location: '' }
121 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
122 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
123 debug-info-expression: '', debug-info-location: '' }
124 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
125 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
126 debug-info-expression: '', debug-info-location: '' }
127 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
128 callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '',
129 debug-info-expression: '', debug-info-location: '' }
131 - { id: 0, name: '', type: spill-slot, offset: -60, size: 4, alignment: 4,
132 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
133 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
135 - { bb: 0, offset: 23, fwdArgRegs:
136 - { arg: 0, reg: '$edi' } }
138 machineFunctionInfo: {}
141 liveins: $edi, $r15, $r14, $r13, $r12, $rbx
143 DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !16
144 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
145 CFI_INSTRUCTION def_cfa_offset 16
146 CFI_INSTRUCTION offset $rbp, -16
147 $rbp = frame-setup MOV64rr $rsp
148 CFI_INSTRUCTION def_cfa_register $rbp
149 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
150 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
151 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
152 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
153 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
154 frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
155 CFI_INSTRUCTION offset $rbx, -56
156 CFI_INSTRUCTION offset $r12, -48
157 CFI_INSTRUCTION offset $r13, -40
158 CFI_INSTRUCTION offset $r14, -32
159 CFI_INSTRUCTION offset $r15, -24
160 MOV32mr $rbp, 1, $noreg, -44, $noreg, $edi :: (store (s32) into %stack.0)
161 DBG_VALUE $rbp, 0, !15, !DIExpression(DW_OP_constu, 44, DW_OP_minus), debug-location !16
162 INLINEASM &"", 1, 12, implicit-def dead early-clobber $rax, 12, implicit-def dead early-clobber $rbx, 12, implicit-def dead early-clobber $rcx, 12, implicit-def dead early-clobber $rdx, 12, implicit-def dead early-clobber $rsi, 12, implicit-def dead early-clobber $rdi, 12, implicit-def early-clobber $rbp, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $df, 12, implicit-def early-clobber $fpsw, 12, implicit-def dead early-clobber $eflags, !18, debug-location !17
163 DBG_VALUE $edi, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !16
164 $edi = MOV32rm $rbp, 1, $noreg, -44, $noreg :: (load (s32) from %stack.0)
165 DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !16
166 CALL64pcrel32 @_Z6calleei, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, debug-location !19
167 DBG_VALUE $edi, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !16
168 $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !20
169 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20
170 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20
171 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20
172 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20
173 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20
174 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20
175 RETQ debug-location !20