[llvm] r322250 - [DWARF][NFC] Overload AsmPrinter::emitDwarfStringOffsets() to take a DwarfStringPoolEntry
Wolfgang Pieb via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 18:35:01 PST 2018
Author: wolfgangp
Date: Wed Jan 10 18:35:00 2018
New Revision: 322250
URL: http://llvm.org/viewvc/llvm-project?rev=322250&view=rev
Log:
[DWARF][NFC] Overload AsmPrinter::emitDwarfStringOffsets() to take a DwarfStringPoolEntry
record.
Differential Revision: https://reviews.llvm.org/D41920
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=322250&r1=322249&r2=322250&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Wed Jan 10 18:35:00 2018
@@ -508,7 +508,12 @@ public:
/// When possible, emit a DwarfStringPool section offset without any
/// relocations, and without using the symbol. Otherwise, defers to \a
/// emitDwarfSymbolReference().
- void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const;
+ void emitDwarfStringOffset(DwarfStringPoolEntry S) const;
+
+ /// Emit the 4-byte offset of a string from the start of its section.
+ void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const {
+ emitDwarfStringOffset(S.getEntry());
+ }
/// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
virtual unsigned getISAEncoding() { return 0; }
Modified: llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h?rev=322250&r1=322249&r2=322250&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h Wed Jan 10 18:35:00 2018
@@ -41,6 +41,8 @@ public:
unsigned getOffset() const { return I->second.Offset; }
unsigned getIndex() const { return I->second.Index; }
StringRef getString() const { return I->first(); }
+ /// Return the entire string pool entry for convenience.
+ DwarfStringPoolEntry getEntry() const { return I->getValue(); }
bool operator==(const DwarfStringPoolEntryRef &X) const { return I == X.I; }
bool operator!=(const DwarfStringPoolEntryRef &X) const { return I != X.I; }
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=322250&r1=322249&r2=322250&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Wed Jan 10 18:35:00 2018
@@ -167,14 +167,15 @@ void AsmPrinter::emitDwarfSymbolReferenc
EmitLabelDifference(Label, Label->getSection().getBeginSymbol(), 4);
}
-void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntryRef S) const {
+void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntry S) const {
if (MAI->doesDwarfUseRelocationsAcrossSections()) {
- emitDwarfSymbolReference(S.getSymbol());
+ assert(S.Symbol && "No symbol available");
+ emitDwarfSymbolReference(S.Symbol);
return;
}
// Just emit the offset directly; no need for symbol math.
- EmitInt32(S.getOffset());
+ EmitInt32(S.Offset);
}
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list