summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-03-09 22:08:37 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-03-09 22:08:37 +0000
commit4f4ef15ade487778e6b290e7ad91bd293662c78d (patch)
tree19b8e3ddf0111fc2c7f59fd62c35a69b2f989cae /llvm/lib/CodeGen
parent7b1799c7f83668e0e8102a0a26b7607f3f27239b (diff)
downloadbcm5719-llvm-4f4ef15ade487778e6b290e7ad91bd293662c78d.tar.gz
bcm5719-llvm-4f4ef15ade487778e6b290e7ad91bd293662c78d.zip
Use a MapVector instead of an extra sort.
This also has the advantage of not depending on the brittle getLabelBeginName. llvm-svn: 231714
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 04dedbd3f65..a4e5b8d3aab 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -287,13 +287,6 @@ static StringRef getObjCMethodName(StringRef In) {
return In.slice(In.find(' ') + 1, In.find(']'));
}
-// Helper for sorting sections into a stable output order.
-static bool SectionSort(const MCSection *A, const MCSection *B) {
- std::string LA = (A ? A->getLabelBeginName() : "");
- std::string LB = (B ? B->getLabelBeginName() : "");
- return LA < LB;
-}
-
// Add the various names to the Dwarf accelerator table names.
// TODO: Determine whether or not we should add names for programs
// that do not have a DW_AT_name or DW_AT_linkage_name field - this
@@ -1739,7 +1732,7 @@ struct ArangeSpan {
// address we can tie back to a CU.
void DwarfDebug::emitDebugARanges() {
// Provides a unique id per text section.
- DenseMap<const MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
+ MapVector<const MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
// Filter labels by section.
for (const SymbolCU &SCU : ArangeLabels) {
@@ -1756,20 +1749,10 @@ void DwarfDebug::emitDebugARanges() {
}
}
- // Build a list of sections used.
- std::vector<const MCSection *> Sections;
- for (const auto &it : SectionMap) {
- const MCSection *Section = it.first;
- Sections.push_back(Section);
- }
-
- // Sort the sections into order.
- // This is only done to ensure consistent output order across different runs.
- std::sort(Sections.begin(), Sections.end(), SectionSort);
-
// Add terminating symbols for each section.
- for (unsigned ID = 0, E = Sections.size(); ID != E; ID++) {
- const MCSection *Section = Sections[ID];
+ unsigned ID = 0;
+ for (const auto &I : SectionMap) {
+ const MCSection *Section = I.first;
MCSymbol *Sym = nullptr;
if (Section) {
@@ -1784,12 +1767,14 @@ void DwarfDebug::emitDebugARanges() {
// Insert a final terminator.
SectionMap[Section].push_back(SymbolCU(nullptr, Sym));
+ ++ID;
}
DenseMap<DwarfCompileUnit *, std::vector<ArangeSpan>> Spans;
- for (const MCSection *Section : Sections) {
- SmallVector<SymbolCU, 8> &List = SectionMap[Section];
+ for (auto &I : SectionMap) {
+ const MCSection *Section = I.first;
+ SmallVector<SymbolCU, 8> &List = I.second;
if (List.size() < 2)
continue;
OpenPOWER on IntegriCloud