[llvm] r185189 - DebugInfo: Simplify the AddressPool representation
David Blaikie
dblaikie at gmail.com
Fri Jun 28 11:47:19 PDT 2013
Author: dblaikie
Date: Fri Jun 28 13:47:19 2013
New Revision: 185189
URL: http://llvm.org/viewvc/llvm-project?rev=185189&view=rev
Log:
DebugInfo: Simplify the AddressPool representation
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=185189&r1=185188&r2=185189&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 28 13:47:19 2013
@@ -248,12 +248,10 @@ unsigned DwarfUnits::getStringPoolIndex(
}
unsigned DwarfUnits::getAddrPoolIndex(const MCSymbol *Sym) {
- std::pair<const MCSymbol*, unsigned> &Entry = AddressPool[Sym];
- if (Entry.first) return Entry.second;
-
- Entry.second = NextAddrPoolNumber++;
- Entry.first = Sym;
- return Entry.second;
+ std::pair<DenseMap<const MCSymbol *, unsigned>::iterator, bool> P =
+ AddressPool.insert(std::make_pair(Sym, NextAddrPoolNumber));
+ NextAddrPoolNumber += P.second;
+ return P.first->second;
}
// Define a unique number for the abbreviation.
@@ -2356,23 +2354,20 @@ void DwarfUnits::emitAddresses(const MCS
// Start the dwarf addr section.
Asm->OutStreamer.SwitchSection(AddrSection);
- // Get all of the string pool entries and put them in an array by their ID so
+ // Get all of the address pool entries and put them in an array by their ID so
// we can sort them.
- SmallVector<std::pair<unsigned, std::pair<const MCSymbol *, unsigned> *>, 64>
- Entries;
+ SmallVector<std::pair<unsigned, const MCSymbol *>, 64> Entries;
- for (DenseMap<const MCSymbol *,
- std::pair<const MCSymbol *, unsigned> >::iterator
- I = AddressPool.begin(),
- E = AddressPool.end();
+ for (DenseMap<const MCSymbol *, unsigned>::iterator I = AddressPool.begin(),
+ E = AddressPool.end();
I != E; ++I)
- Entries.push_back(std::make_pair(I->second.second, &(I->second)));
+ Entries.push_back(std::make_pair(I->second, I->first));
array_pod_sort(Entries.begin(), Entries.end());
for (unsigned i = 0, e = Entries.size(); i != e; ++i) {
// Emit a label for reference from debug information entries.
- if (const MCSymbol *Sym = Entries[i].second->first)
+ if (const MCSymbol *Sym = Entries[i].second)
Asm->EmitLabelReference(Sym, Asm->getDataLayout().getPointerSize());
else
Asm->OutStreamer.EmitIntValue(0, Asm->getDataLayout().getPointerSize());
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=185189&r1=185188&r2=185189&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Jun 28 13:47:19 2013
@@ -195,10 +195,9 @@ public:
typedef StringMap<std::pair<MCSymbol*, unsigned>,
BumpPtrAllocator&> StrPool;
-// A Symbol->pair<Symbol, unsigned> mapping of addresses used by indirect
+// A Symbol->unsigned mapping of addresses used by indirect
// references.
-typedef DenseMap<const MCSymbol *, std::pair<const MCSymbol *, unsigned> >
- AddrPool;
+typedef DenseMap<const MCSymbol *, unsigned> AddrPool;
/// \brief Collects and handles information specific to a particular
/// collection of units.
More information about the llvm-commits
mailing list