diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index 5d6a03080c4..b13f394b4c0 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -46,8 +46,9 @@ void DebugLocDwarfExpression::EmitUnsigned(unsigned Value) { BS.EmitULEB128(Value, Twine(Value)); } -unsigned DebugLocDwarfExpression::getFrameRegister() { - llvm_unreachable("not available"); +bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) { + // This information is not available while emitting .debug_loc entries. + return false; } //===----------------------------------------------------------------------===// diff --git a/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index 1df0ea4f79f..a3cd000b871 100644 --- a/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -79,7 +79,7 @@ bool DwarfExpression::AddMachineRegIndirect(unsigned MachineReg, int Offset) { if (DwarfReg < 0) return false; - if (MachineReg == getFrameRegister()) { + if (isFrameRegister(MachineReg)) { // If variable offset is based in frame register then use fbreg. EmitOp(dwarf::DW_OP_fbreg); EmitSigned(Offset); diff --git a/lib/CodeGen/AsmPrinter/DwarfExpression.h b/lib/CodeGen/AsmPrinter/DwarfExpression.h index 9e93a573a3d..9aba3f82ffb 100644 --- a/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -40,7 +40,7 @@ public: virtual void EmitSigned(int Value) = 0; virtual void EmitUnsigned(unsigned Value) = 0; - virtual unsigned getFrameRegister() = 0; + virtual bool isFrameRegister(unsigned MachineReg) = 0; /// Emit a dwarf register operation. void AddReg(int DwarfReg, const char* Comment = nullptr); @@ -92,7 +92,7 @@ public: void EmitOp(uint8_t Op, const char *Comment) override; void EmitSigned(int Value) override; void EmitUnsigned(unsigned Value) override; - unsigned getFrameRegister() override; + bool isFrameRegister(unsigned MachineReg) override; }; } diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 99a9205b8b2..7b32831c77f 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -55,7 +55,7 @@ public: void EmitOp(uint8_t Op, const char* Comment = nullptr) override; void EmitSigned(int Value) override; void EmitUnsigned(unsigned Value) override; - unsigned getFrameRegister() override; + bool isFrameRegister(unsigned MachineReg) override; }; void DIEDwarfExpression::EmitOp(uint8_t Op, const char* Comment) { @@ -67,8 +67,8 @@ void DIEDwarfExpression::EmitSigned(int Value) { void DIEDwarfExpression::EmitUnsigned(unsigned Value) { DU.addUInt(DIE, dwarf::DW_FORM_udata, Value); } -unsigned DIEDwarfExpression::getFrameRegister() { - return getTRI()->getFrameRegister(*AP.MF); +bool DIEDwarfExpression::isFrameRegister(unsigned MachineReg) { + return MachineReg == getTRI()->getFrameRegister(*AP.MF); }