summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-05-24 16:14:59 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-05-24 16:14:59 +0000
commit1a65e4ade4e77ad56a57502dcb0cb21b2850df7a (patch)
treebf8347914756152c8d7abb2f14be13e0b89173ee /llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
parent004e73420d1d8ffdc75ff7d9c88911f33c6c6278 (diff)
downloadbcm5719-llvm-1a65e4ade4e77ad56a57502dcb0cb21b2850df7a.tar.gz
bcm5719-llvm-1a65e4ade4e77ad56a57502dcb0cb21b2850df7a.zip
AsmPrinter: Emit the DwarfStringPool offset directly when possible
Change `DwarfStringPool` to calculate byte offsets on-the-fly, and update `DwarfUnit::getLocalString()` to use a `DIEInteger` instead of a `DIEDelta` when Dwarf doesn't use relocations (i.e., Mach-O). This eliminates another call to `EmitLabelDifference()`, and drops memory usage from 865 MB down to 861 MB, around 0.5%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238114
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
index ba0d595c140..77b6ffaa9f1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -25,8 +25,14 @@ class StringRef;
// A String->Symbol mapping of strings used by indirect
// references.
class DwarfStringPool {
- StringMap<std::pair<MCSymbol *, unsigned>, BumpPtrAllocator &> Pool;
+ struct EntryTy {
+ MCSymbol *Symbol;
+ unsigned Offset;
+ unsigned Index;
+ };
+ StringMap<EntryTy, BumpPtrAllocator &> Pool;
StringRef Prefix;
+ unsigned NumBytes = 0;
public:
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
@@ -38,19 +44,24 @@ public:
/// \brief Returns an entry into the string pool with the given
/// string text.
MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str) {
- return getEntry(Asm, Str).first;
+ return getEntry(Asm, Str).Symbol;
+ }
+
+ /// Get a byte offset into the string pool with the given text.
+ unsigned getOffset(AsmPrinter &Asm, StringRef Str) {
+ return getEntry(Asm, Str).Offset;
}
/// \brief Returns the index into the string pool with the given
/// string text.
unsigned getIndex(AsmPrinter &Asm, StringRef Str) {
- return getEntry(Asm, Str).second;
+ return getEntry(Asm, Str).Index;
}
bool empty() const { return Pool.empty(); }
private:
- std::pair<MCSymbol *, unsigned> &getEntry(AsmPrinter &Asm, StringRef Str);
+ EntryTy &getEntry(AsmPrinter &Asm, StringRef Str);
};
}
#endif
OpenPOWER on IntegriCloud