summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>2018-01-11 02:35:00 +0000
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>2018-01-11 02:35:00 +0000
commit20a745375c6aebc03432a25868472794de411f62 (patch)
tree6320b6d34e0cbb192e8a42b4ee4e9886bf2f2de0
parentddccd50313b5a0d9839aeba192baf73f0a77bc90 (diff)
downloadbcm5719-llvm-20a745375c6aebc03432a25868472794de411f62.tar.gz
bcm5719-llvm-20a745375c6aebc03432a25868472794de411f62.zip
[DWARF][NFC] Overload AsmPrinter::emitDwarfStringOffsets() to take a DwarfStringPoolEntry
record. Differential Revision: https://reviews.llvm.org/D41920 llvm-svn: 322250
-rw-r--r--llvm/include/llvm/CodeGen/AsmPrinter.h7
-rw-r--r--llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp7
3 files changed, 12 insertions, 4 deletions
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index b8944a66800..282d1a626f6 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -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; }
diff --git a/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h b/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
index fc2b5ddd2d2..e6c0483cfc3 100644
--- a/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
+++ b/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
@@ -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; }
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
index 08eb14e242c..e6e8871361b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
@@ -167,14 +167,15 @@ void AsmPrinter::emitDwarfSymbolReference(const MCSymbol *Label,
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);
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud