1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[DWARF][NFC] Overload AsmPrinter::emitDwarfStringOffsets() to take a DwarfStringPoolEntry

record.

Differential Revision: https://reviews.llvm.org/D41920

llvm-svn: 322250
This commit is contained in:
Wolfgang Pieb 2018-01-11 02:35:00 +00:00
parent f51ea3e080
commit 4698ad4a47
3 changed files with 12 additions and 4 deletions

View File

@ -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; }

View File

@ -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; }

View File

@ -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);
}
//===----------------------------------------------------------------------===//