diff options
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
| -rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 14 | 
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index bad5b09553cd..bac0c204d04f 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -27,6 +27,7 @@  #include "llvm/IR/GlobalValue.h"  #include "llvm/IR/Metadata.h"  #include "llvm/MC/MachineLocation.h" +#include "llvm/MC/MCAsmInfo.h"  #include "llvm/MC/MCDwarf.h"  #include "llvm/MC/MCSection.h"  #include "llvm/MC/MCStreamer.h" @@ -73,8 +74,8 @@ bool DIEDwarfExpression::isFrameRegister(const TargetRegisterInfo &TRI,  DwarfUnit::DwarfUnit(dwarf::Tag UnitTag, const DICompileUnit *Node,                       AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU) -    : DIEUnit(A->getDwarfVersion(), A->getPointerSize(), UnitTag), CUNode(Node), -      Asm(A), DD(DW), DU(DWU), IndexTyDie(nullptr) { +    : DIEUnit(A->getDwarfVersion(), A->MAI->getCodePointerSize(), UnitTag), +      CUNode(Node), Asm(A), DD(DW), DU(DWU), IndexTyDie(nullptr) {  }  DwarfTypeUnit::DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A, @@ -471,12 +472,13 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die,    // variable's location.    DIELoc *Loc = new (DIEValueAllocator) DIELoc;    DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc); +  if (Location.isIndirect()) +    DwarfExpr.setMemoryLocationKind();    SmallVector<uint64_t, 9> Ops; -  if (Location.isIndirect()) { +  if (Location.isIndirect() && Location.getOffset()) {      Ops.push_back(dwarf::DW_OP_plus);      Ops.push_back(Location.getOffset()); -    Ops.push_back(dwarf::DW_OP_deref);    }    // If we started with a pointer to the __Block_byref... struct, then    // the first thing we need to do is dereference the pointer (DW_OP_deref). @@ -1546,7 +1548,7 @@ void DwarfUnit::emitCommonHeader(bool UseOffsets, dwarf::UnitType UT) {      Asm->OutStreamer->AddComment("DWARF Unit Type");      Asm->EmitInt8(UT);      Asm->OutStreamer->AddComment("Address Size (in bytes)"); -    Asm->EmitInt8(Asm->getDataLayout().getPointerSize()); +    Asm->EmitInt8(Asm->MAI->getCodePointerSize());    }    // We share one abbreviations table across all units so it's always at the @@ -1562,7 +1564,7 @@ void DwarfUnit::emitCommonHeader(bool UseOffsets, dwarf::UnitType UT) {    if (Version <= 4) {      Asm->OutStreamer->AddComment("Address Size (in bytes)"); -    Asm->EmitInt8(Asm->getDataLayout().getPointerSize()); +    Asm->EmitInt8(Asm->MAI->getCodePointerSize());    }  }  | 
