Debug Info: Move the complex expression handling (=the remainder) of
authorAdrian Prantl <aprantl@apple.com>
Tue, 13 Jan 2015 23:39:11 +0000 (23:39 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 13 Jan 2015 23:39:11 +0000 (23:39 +0000)
commit092d9489ede3c8cfc4f7c6d56f3c61fa13f1056c
treec3459216d30b0bc88156fc8a31ebcf1f535c4937
parentd23c88db156e5448f2386608a76ed9dc6cc8dd33
Debug Info: Move the complex expression handling (=the remainder) of
emitDebugLocValue() into DwarfExpression.

Ought to be NFC, but it actually uncovered a bug in the debug-loc-asan.ll
testcase. The testcase checks that the address of variable "y" is stored
at [RSP+16], which also lines up with the comment.
It also check(ed) that the *value* of "y" is stored in RDI before that,
but that is actually incorrect, since RDI is the very value that is
stored in [RSP+16]. Here's the assembler output:

movb 2147450880(%rcx), %r8b
#DEBUG_VALUE: bar:y <- RDI
cmpb $0, %r8b
movq %rax, 32(%rsp)          # 8-byte Spill
movq %rsi, 24(%rsp)          # 8-byte Spill
movq %rdi, 16(%rsp)          # 8-byte Spill
.Ltmp3:
#DEBUG_VALUE: bar:y <- [RSP+16]

Fixed the comment to spell out the correct register and the check to
expect an address rather than a value.

Note that the range that is emitted for the RDI location was and is still
wrong, it claims to begin at the function prologue, but really it should
start where RDI is first assigned.

llvm-svn: 225851
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
llvm/test/DebugInfo/X86/debug-loc-asan.ll