summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-01-13 23:39:11 +0000
committerAdrian Prantl <aprantl@apple.com>2015-01-13 23:39:11 +0000
commit092d9489ede3c8cfc4f7c6d56f3c61fa13f1056c (patch)
treec3459216d30b0bc88156fc8a31ebcf1f535c4937 /llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
parentd23c88db156e5448f2386608a76ed9dc6cc8dd33 (diff)
downloadbcm5719-llvm-092d9489ede3c8cfc4f7c6d56f3c61fa13f1056c.tar.gz
bcm5719-llvm-092d9489ede3c8cfc4f7c6d56f3c61fa13f1056c.zip
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
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
index 870b9716039..f164f1c8513 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
@@ -15,6 +15,7 @@
#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXPRESSION_H
#include "llvm/Support/DataTypes.h"
+#include "llvm/IR/DebugInfo.h"
namespace llvm {
@@ -81,8 +82,18 @@ public:
void AddSignedConstant(int Value);
/// Emit an unsigned constant.
void AddUnsignedConstant(unsigned Value);
-};
+ /// Emit an entire DIExpression on top of a machine register location.
+ /// \param PieceOffsetInBits If this is one piece out of a fragmented
+ /// location, this is the offset of the piece inside the entire variable.
+ void AddMachineRegExpression(DIExpression Expr, unsigned MachineReg,
+ unsigned PieceOffsetInBits = 0);
+ /// Emit a the operations in a DIExpression, starting from element I.
+ /// \param PieceOffsetInBits If this is one piece out of a fragmented
+ /// location, this is the offset of the piece inside the entire variable.
+ void AddExpression(DIExpression Expr, unsigned PieceOffsetInBits = 0,
+ unsigned I = 0);
+};
/// DwarfExpression implementation for .debug_loc entries.
class DebugLocDwarfExpression : public DwarfExpression {
OpenPOWER on IntegriCloud