aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-06-29 17:53:13 -0700
committerFangrui Song <i@maskray.me>2024-06-29 17:53:13 -0700
commitf6fc503b6791bd7d38ba62c249091eabed297471 (patch)
tree414c83fb1047c98bbf85efe4fe057790e8b01724
parent66518ad7fd3383d1f1b617914c0bc3437ac3a355 (diff)
downloadllvm-f6fc503b6791bd7d38ba62c249091eabed297471.zip
llvm-f6fc503b6791bd7d38ba62c249091eabed297471.tar.gz
llvm-f6fc503b6791bd7d38ba62c249091eabed297471.tar.bz2
[MC] Remove MCStreamer::SymbolOrdering
21101b32318647f600584d966c697d8773f59629 (2013) added SymbolOrdering, which essentially became useless when e3a20f57d927e422874a8e7730bb7590515b586d (2015) removed `AssignSection` from `EmitLabel`. `assignFragment` is still used in very few places like emitTBSSSymbol, which do not make a difference if we remove SymbolOrdering.
-rw-r--r--llvm/include/llvm/MC/MCStreamer.h10
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp14
-rw-r--r--llvm/lib/MC/MCStreamer.cpp5
3 files changed, 0 insertions, 29 deletions
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index baa9c33..fa8e5c6 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -228,10 +228,6 @@ class MCStreamer {
WinEH::FrameInfo *CurrentWinFrameInfo;
size_t CurrentProcWinFrameInfoStartIndex;
- /// Tracks an index to represent the order a symbol was emitted in.
- /// Zero means we did not emit that symbol.
- DenseMap<const MCSymbol *, unsigned> SymbolOrdering;
-
/// This is stack of current and previous section values saved by
/// pushSection.
SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
@@ -416,12 +412,6 @@ public:
return CurFrag;
}
- /// Returns an index to represent the order a symbol was emitted in.
- /// (zero if we did not emit that symbol)
- unsigned getSymbolOrder(const MCSymbol *Sym) const {
- return SymbolOrdering.lookup(Sym);
- }
-
/// Save the current and previous section on the section stack.
void pushSection() {
SectionStack.push_back(
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index dd7d9e5..2addf93 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -3028,20 +3028,6 @@ void DwarfDebug::emitDebugARanges() {
continue;
}
- // Sort the symbols by offset within the section.
- llvm::stable_sort(List, [&](const SymbolCU &A, const SymbolCU &B) {
- unsigned IA = A.Sym ? Asm->OutStreamer->getSymbolOrder(A.Sym) : 0;
- unsigned IB = B.Sym ? Asm->OutStreamer->getSymbolOrder(B.Sym) : 0;
-
- // Symbols with no order assigned should be placed at the end.
- // (e.g. section end labels)
- if (IA == 0)
- return false;
- if (IB == 0)
- return true;
- return IA < IB;
- });
-
// Insert a final terminator.
List.push_back(SymbolCU(nullptr, Asm->OutStreamer->endSection(Section)));
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 67cb14d..470c673 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -102,7 +102,6 @@ void MCStreamer::reset() {
DwarfFrameInfos.clear();
CurrentWinFrameInfo = nullptr;
WinFrameInfos.clear();
- SymbolOrdering.clear();
SectionStack.clear();
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
CurFrag = nullptr;
@@ -415,10 +414,6 @@ void MCStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
void MCStreamer::assignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
assert(Fragment);
Symbol->setFragment(Fragment);
-
- // As we emit symbols into a section, track the order so that they can
- // be sorted upon later. Zero is reserved to mean 'unemitted'.
- SymbolOrdering[Symbol] = 1 + SymbolOrdering.size();
}
void MCStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {