diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-04-19 23:34:14 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-04-19 23:34:14 +0000 |
commit | 78ff122709b3ea3667d4892999cf003b360db61e (patch) | |
tree | 6f508fd1f8d94de5cd34178043714e60531d1357 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | a89fd60a913c3caaeef16e22e7760b7c1814442c (diff) | |
download | bcm5719-llvm-78ff122709b3ea3667d4892999cf003b360db61e.tar.gz bcm5719-llvm-78ff122709b3ea3667d4892999cf003b360db61e.zip |
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: 300790
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 4a092ffbdc0..738e062cb93 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -556,9 +556,9 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV, Ops.push_back(Offset); Ops.append(Expr->elements_begin(), Expr->elements_end()); DIExpressionCursor Cursor(Ops); - DwarfExpr.addMachineLocExpression( - *Asm->MF->getSubtarget().getRegisterInfo(), Cursor, - MachineLocation(FrameReg)); + DwarfExpr.setMemoryLocationKind(); + DwarfExpr.addMachineRegExpression( + *Asm->MF->getSubtarget().getRegisterInfo(), Cursor, FrameReg); DwarfExpr.addExpression(std::move(Cursor)); } addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize()); @@ -780,6 +780,8 @@ void DwarfCompileUnit::addAddress(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location) { DIELoc *Loc = new (DIEValueAllocator) DIELoc; DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc); + if (Location.isIndirect()) + DwarfExpr.setMemoryLocationKind(); SmallVector<uint64_t, 8> Ops; if (Location.isIndirect() && Location.getOffset()) { @@ -788,7 +790,7 @@ void DwarfCompileUnit::addAddress(DIE &Die, dwarf::Attribute Attribute, } DIExpressionCursor Cursor(Ops); const TargetRegisterInfo &TRI = *Asm->MF->getSubtarget().getRegisterInfo(); - if (!DwarfExpr.addMachineLocExpression(TRI, Cursor, Location)) + if (!DwarfExpr.addMachineRegExpression(TRI, Cursor, Location.getReg())) return; DwarfExpr.addExpression(std::move(Cursor)); @@ -807,6 +809,8 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die, DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc); const DIExpression *DIExpr = DV.getSingleExpression(); DwarfExpr.addFragmentOffset(DIExpr); + if (Location.isIndirect()) + DwarfExpr.setMemoryLocationKind(); SmallVector<uint64_t, 8> Ops; if (Location.isIndirect() && Location.getOffset()) { @@ -816,7 +820,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die, Ops.append(DIExpr->elements_begin(), DIExpr->elements_end()); DIExpressionCursor Cursor(Ops); const TargetRegisterInfo &TRI = *Asm->MF->getSubtarget().getRegisterInfo(); - if (!DwarfExpr.addMachineLocExpression(TRI, Cursor, Location)) + if (!DwarfExpr.addMachineRegExpression(TRI, Cursor, Location.getReg())) return; DwarfExpr.addExpression(std::move(Cursor)); |