Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
- introduced in r300522 and found via the Swift LLDB testsuite.
The fix is to set the location kind to memory whenever an FrameIndex
location is emitted.
rdar://problem/31707602
llvm-svn: 300793
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
index 00734fd..203990d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
@@ -16,7 +16,6 @@
#include "llvm/IR/DebugInfo.h"
#include "llvm/Support/DataTypes.h"
-#include "llvm/MC/MachineLocation.h"
namespace llvm {
@@ -113,8 +112,6 @@
SubRegisterOffsetInBits = OffsetInBits;
}
- void setMemoryLocationKind();
-
/// Add masking operations to stencil out a subregister.
void maskSubRegister();
@@ -192,17 +189,24 @@
/// Emit an unsigned constant.
void addUnsignedConstant(const APInt &Value);
+ /// Lock this down to become a memory location description.
+ void setMemoryLocationKind() {
+ assert(LocationKind == Unknown);
+ LocationKind = Memory;
+ }
+
/// Emit a machine register location. As an optimization this may also consume
/// the prefix of a DwarfExpression if a more efficient representation for
/// combining the register location and the first operation exists.
///
- /// \param FragmentOffsetInBits If this is one fragment out of a fragmented
+ /// \param FragmentOffsetInBits If this is one fragment out of a
+ /// fragmented
/// location, this is the offset of the
/// fragment inside the entire variable.
/// \return false if no DWARF register exists
/// for MachineReg.
- bool addMachineLocExpression(const TargetRegisterInfo &TRI,
- DIExpressionCursor &Expr, MachineLocation Loc,
+ bool addMachineRegExpression(const TargetRegisterInfo &TRI,
+ DIExpressionCursor &Expr, unsigned MachineReg,
unsigned FragmentOffsetInBits = 0);
/// Emit all remaining operations in the DIExpressionCursor.
///