brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.0 KiB · b52247f Raw
130 lines · plain
1# RUN: llc %s -o - -mtriple=x86_64-unknown-unknown \2# RUN:    -experimental-debug-variable-locations -run-pass=livedebugvalues\3# RUN:    | FileCheck %s4#5# Test that a DBG_INSTR_REF that refers to a DBG_PHI, will be translated into a6# DBG_VALUE of the value read at that DBG_PHI -- in this test, when the value7# is on the stack.8#9--- |10  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"11  target triple = "x86_64-unknown-linux-gnu"12 13  define dso_local i32 @foo(i64 %bar, i64 %baz) !dbg !7 {14    ret i32 015  }16 17  declare dso_local void @ext(i64)18 19  declare dso_local i64 @getlong()20 21  !llvm.dbg.cu = !{!0}22  !llvm.module.flags = !{!3, !4, !5}23  !llvm.ident = !{!6}24 25  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)26  !1 = !DIFile(filename: "test.c", directory: "/tmp/out.c")27  !2 = !{}28  !3 = !{i32 7, !"Dwarf Version", i32 4}29  !4 = !{i32 2, !"Debug Info Version", i32 3}30  !5 = !{i32 1, !"wchar_size", i32 4}31  !6 = !{!""}32  !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)33  !8 = !DISubroutineType(types: !9)34  !9 = !{!10, !11, !11}35  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)36  !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)37  !12 = !DILocalVariable(name: "bar", arg: 1, scope: !7, file: !1, line: 3, type: !11)38  !13 = !DILocation(line: 0, scope: !7)39  !14 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)40  !19 = distinct !DILexicalBlock(scope: !7, file: !1, line: 8, column: 7)41  !26 = !DILocation(line: 13, column: 3, scope: !7)42 43...44---45name:            foo46alignment:       1647tracksRegLiveness: true48debugInstrRef: true49liveins:50  - { reg: '$rdi' }51  - { reg: '$rsi' }52frameInfo:53  stackSize:       2454  offsetAdjustment: -2455  maxAlignment:    156  adjustsStack:    true57  hasCalls:        true58  maxCallFrameSize: 059  cvBytesOfCalleeSavedRegisters: 1660fixedStack:61  - { id: 0, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$rbx' }62  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$r14' }63machineFunctionInfo: {}64stack:65  - { id: 0, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8,66      stack-id: default, callee-saved-register: '', callee-saved-restored: true,67      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }68 69body:             |70  bb.0:71    liveins: $rdi, $rsi, $r14, $rbx72    ; CHECK-LABEL: bb.0:73 74    $r14 = MOV64rr $rsi75    $rbx = MOV64rr $rdi76    $rax = MOV64ri 077    MOV64mr $rsp, 1, $noreg, 16, $noreg, $rax :: (store 8 into %stack.0)78    $rax = MOV64ri 079 80    ;; A DBG_PHI of the stack should resolve to the stack location.81    DBG_PHI %stack.0, 1, 6482 83    ;; Reload value, clobber stack location.84    $rcx = MOV64rm $rsp, 1, $noreg, 8, $noreg :: (load 8 from %stack.0)85    MOV64mr $rsp, 1, $noreg, 16, $noreg, $rax :: (store 8 into %stack.0)86 87    ;; This should resolve to the loaded register.88    DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !1389    ; CHECK:      DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)90    ; CHECK-NEXT: DBG_VALUE_LIST {{.+}} $rcx91 92    ;; And if we say it's a smaller size, we should be able to pick out smaller93    ;; subregisters within the stack slot.94    DBG_PHI %stack.0, 2, 3295    $rax = MOV64ri 096    $rcx = MOV64rm $rsp, 1, $noreg, 8, $noreg :: (load 8 from %stack.0)97    MOV64mr $rsp, 1, $noreg, 16, $noreg, $rax :: (store 8 into %stack.0)98 99    ;; This should pick out the 32 bit value.100    DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !13101    ; CHECK:      DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0)102    ; CHECK-NEXT: DBG_VALUE_LIST {{.+}} $ecx103 104    ;; Try all the other subregs.105    DBG_PHI %stack.0, 3, 16106    $rax = MOV64ri 0107    $rcx = MOV64rm $rsp, 1, $noreg, 8, $noreg :: (load 8 from %stack.0)108    MOV64mr $rsp, 1, $noreg, 16, $noreg, $rax :: (store 8 into %stack.0)109 110    DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(3, 0), debug-location !13111    ; CHECK:      DBG_INSTR_REF {{.+}}, dbg-instr-ref(3, 0)112    ; CHECK-NEXT: DBG_VALUE_LIST {{.+}} $cx113 114    DBG_PHI %stack.0, 4, 8115    $rax = MOV64ri 0116    $rcx = MOV64rm $rsp, 1, $noreg, 8, $noreg :: (load 8 from %stack.0)117    MOV64mr $rsp, 1, $noreg, 16, $noreg, $rax :: (store 8 into %stack.0)118 119    DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(4, 0), debug-location !13120    ; CHECK:      DBG_INSTR_REF {{.+}}, dbg-instr-ref(4, 0)121    ; CHECK-NEXT: DBG_VALUE_LIST {{.+}} $cl122 123    ;; We can't, at this time, describe subregister fields with nonzero offset.124    ;; It's easily achieved by attaching more data to stack DBG_PHIs, but it's125    ;; not clear that LLVM will ever merge registers to generate such locations.126 127    RET64 implicit $eax, debug-location !26128 129...130