diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-24 16:06:08 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-24 16:06:08 +0000 |
commit | 8c6499fa6dbe9d01fcedd9c5aa176fdf5ffca2c8 (patch) | |
tree | ccb486cc945c5e158f235c699625aa16585b9536 /llvm/lib/CodeGen/AsmPrinter | |
parent | 13d7728c3df43bdcfb200277273dfb056be07ba3 (diff) | |
download | bcm5719-llvm-8c6499fa6dbe9d01fcedd9c5aa176fdf5ffca2c8.tar.gz bcm5719-llvm-8c6499fa6dbe9d01fcedd9c5aa176fdf5ffca2c8.zip |
AsmPrinter: Refactor DwarfStringPool::getEntry(), NFC
Move `DwarfStringPool`'s `getEntry()` to the header (and make it a
member function) in preparation for calculating symbol offsets
on-the-fly.
llvm-svn: 238112
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h | 11 |
2 files changed, 11 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp index b7a421f5a1b..fc98ed4b784 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp @@ -12,10 +12,8 @@ using namespace llvm; -static std::pair<MCSymbol *, unsigned> & -getEntry(AsmPrinter &Asm, - StringMap<std::pair<MCSymbol *, unsigned>, BumpPtrAllocator &> &Pool, - StringRef Prefix, StringRef Str) { +std::pair<MCSymbol *, unsigned> &DwarfStringPool::getEntry(AsmPrinter &Asm, + StringRef Str) { std::pair<MCSymbol *, unsigned> &Entry = Pool[Str]; if (!Entry.first) { Entry.second = Pool.size() - 1; @@ -24,14 +22,6 @@ getEntry(AsmPrinter &Asm, return Entry; } -MCSymbol *DwarfStringPool::getSymbol(AsmPrinter &Asm, StringRef Str) { - return getEntry(Asm, Pool, Prefix, Str).first; -} - -unsigned DwarfStringPool::getIndex(AsmPrinter &Asm, StringRef Str) { - return getEntry(Asm, Pool, Prefix, Str).second; -} - void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection, MCSection *OffsetSection) { if (Pool.empty()) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h index 9f32b98e2b3..ba0d595c140 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h @@ -37,13 +37,20 @@ public: /// \brief Returns an entry into the string pool with the given /// string text. - MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str); + MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str) { + return getEntry(Asm, Str).first; + } /// \brief Returns the index into the string pool with the given /// string text. - unsigned getIndex(AsmPrinter &Asm, StringRef Str); + unsigned getIndex(AsmPrinter &Asm, StringRef Str) { + return getEntry(Asm, Str).second; + } bool empty() const { return Pool.empty(); } + +private: + std::pair<MCSymbol *, unsigned> &getEntry(AsmPrinter &Asm, StringRef Str); }; } #endif |