1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/test/DebugInfo/X86/dbg-value-frame-index.ll
Adrian Prantl 431b172354 Remove PrologEpilogInserter's usage of DBG_VALUE's offset field
In the last half-dozen commits to LLVM I removed code that became dead
after removing the offset parameter from llvm.dbg.value gradually
proceeding from IR towards the backend. Before I can move on to
DwarfDebug and friends there is one last side-called offset I need to
remove:  This patch modifies PrologEpilogInserter's use of the
DBG_VALUE's offset argument to use a DIExpression instead. Because the
PrologEpilogInserter runs at the Machine level I had to play a little
trick with a named llvm.dbg.mir node to get the DIExpressions to print
in MIR dumps (which print the llvm::Module followed by the
MachineFunction dump).

I also had to add rudimentary DwarfExpression support to CodeView and
as a side-effect also fixed a bug (CodeViewDebug::collectVariableInfo
was supposed to give up on variables with complex DIExpressions, but
would fail to do so for fragments, which are also modeled as
DIExpressions).

With this last holdover removed we will have only one canonical way of
representing offsets to debug locations which will simplify the code
in DwarfDebug (and future versions of CodeViewDebug once it starts
handling more complex expressions) and make it easier to reason about.

This patch is NFC-ish: All test case changes are for assembler
comments and the binary output does not change.

rdar://problem/33580047
Differential Revision: https://reviews.llvm.org/D36125

llvm-svn: 309751
2017-08-01 21:45:24 +00:00

44 lines
1.5 KiB
LLVM

; RUN: llc -mtriple=x86_64-unknown-unknown -o - %s | FileCheck %s
; RUN: llc -mtriple=x86_64-unknown-unknown -filetype=obj < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
define i1 @test() !dbg !4 {
entry:
%end = alloca i64, align 8
br label %while.cond
while.cond:
call void @llvm.dbg.value(metadata i64* %end, metadata !5, metadata !6), !dbg !7
%call = call i1 @fn(i64* %end, i64* %end, i64* null, i8* null, i64 0, i64* null, i32* null, i8* null), !dbg !7
br label %while.body
while.body:
br i1 0, label %while.end, label %while.cond
while.end:
ret i1 true
}
; CHECK-LABEL: test
; CHECK: #DEBUG_VALUE: test:w <- [DW_OP_plus_uconst 8] [%RSP+0]
; DWARF: Location description: 77 08
; DW_OP_breg7 +8
declare i1 @fn(i64*, i64*, i64*, i8*, i64, i64*, i32*, i8*)
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2,!3}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0", emissionKind: FullDebug)
!1 = !DIFile(filename: "test.c", directory: "/")
!2 = !{i32 2, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "test", type: !10, unit: !0)
!5 = !DILocalVariable(name: "w", scope: !4, type: !9)
!6 = !DIExpression()
!7 = !DILocation(line: 210, column: 12, scope: !4)
!8 = !{!9}
!9 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)
!10 = !DISubroutineType(types: !8)