brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.3 KiB · a5a5f76 Raw
178 lines · plain
1# Check that llvm can describe a call site parameter which resides in a spill slot.2#3# RUN: llc -emit-call-site-info -debug-entry-values -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s4# 5# Command:6# $ ~/src/builds/llvm-project-main-RA/bin/clang -g -Xclang -femit-debug-entry-values -O2 -c -o spill.o spill.cc -mllvm -stop-before=machineverifier -o spill.mir7#8# Source:9## extern void callee(int);10## 11## #define FORCE_SPILL()                                                          \12##   asm volatile(""                                                              \13##                :                                                               \14##                :                                                               \15##                : "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "r8", "r9",  \16##                  "r10", "r11", "r12", "r13", "r14", "r15")17## 18## __attribute__((disable_tail_calls)) void caller(int x) {19##   FORCE_SPILL();20##   callee(x);21## }22 23# CHECK-LABEL: DW_TAG_call_site_parameter24# 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)26 27--- |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"32  33  ; Function Attrs: ssp uwtable34  define void @_Z6calleri(i32 %x) local_unnamed_addr #0 !dbg !13 {35  entry:36    call void @llvm.dbg.value(metadata i32 %x, metadata !15, metadata !DIExpression()), !dbg !1637    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 !1838    call void @_Z6calleei(i32 %x), !dbg !1939    ret void, !dbg !2040  }41  42  declare !dbg !4 void @_Z6calleei(i32) local_unnamed_addr43  44  ; Function Attrs: nounwind readnone speculatable willreturn45  declare void @llvm.dbg.value(metadata, metadata, metadata)46  47  ; Function Attrs: nounwind48  declare void @llvm.stackprotector(ptr, ptr)49  50  attributes #0 = { "disable-tail-calls"="true" "frame-pointer"="all" }51  52  !llvm.dbg.cu = !{!0}53  !llvm.module.flags = !{!8, !9, !10, !11}54  !llvm.ident = !{!12}55  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")58  !2 = !{}59  !3 = !{!4}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)62  !6 = !{null, !7}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)70  !14 = !{!15}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)77 78...79---80name:            _Z6calleri81alignment:       1682exposesReturnsTwice: false83legalized:       false84regBankSelected: false85selected:        false86failedISel:      false87tracksRegLiveness: true88hasWinCFI:       false89registers:       []90liveins:91  - { reg: '$edi', virtual-reg: '' }92frameInfo:93  isFrameAddressTaken: false94  isReturnAddressTaken: false95  hasStackMap:     false96  hasPatchPoint:   false97  stackSize:       5698  offsetAdjustment: -5699  maxAlignment:    4100  adjustsStack:    true101  hasCalls:        true102  stackProtector:  ''103  maxCallFrameSize: 0104  cvBytesOfCalleeSavedRegisters: 40105  hasOpaqueSPAdjustment: false106  hasVAStart:      false107  hasMustTailInVarArgFunc: false108  localFrameSize:  0109  savePoint:       []110  restorePoint:    []111fixedStack: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: '' }130stack: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: '' }134callSites:135  - { bb: 0, offset: 23, fwdArgRegs: 136      - { arg: 0, reg: '$edi' } }137constants:       []138machineFunctionInfo: {}139body:             |140  bb.0.entry:141    liveins: $edi, $r15, $r14, $r13, $r12, $rbx142  143    DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !16144    frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp145    CFI_INSTRUCTION def_cfa_offset 16146    CFI_INSTRUCTION offset $rbp, -16147    $rbp = frame-setup MOV64rr $rsp148    CFI_INSTRUCTION def_cfa_register $rbp149    frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp150    frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp151    frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp152    frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp153    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp154    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp155    CFI_INSTRUCTION offset $rbx, -56156    CFI_INSTRUCTION offset $r12, -48157    CFI_INSTRUCTION offset $r13, -40158    CFI_INSTRUCTION offset $r14, -32159    CFI_INSTRUCTION offset $r15, -24160    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 !16162    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 !17163    DBG_VALUE $edi, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !16164    $edi = MOV32rm $rbp, 1, $noreg, -44, $noreg :: (load (s32) from %stack.0)165    DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !16166    CALL64pcrel32 @_Z6calleei, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, debug-location !19167    DBG_VALUE $edi, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !16168    $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !20169    $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20170    $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20171    $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20172    $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20173    $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20174    $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !20175    RET64 debug-location !20176 177...178