Skip to content

Commit f6fc503

Browse files
committed
[MC] Remove MCStreamer::SymbolOrdering
21101b3 (2013) added SymbolOrdering, which essentially became useless when e3a20f5 (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.
1 parent 66518ad commit f6fc503

File tree

3 files changed

+0
-29
lines changed

3 files changed

+0
-29
lines changed

llvm/include/llvm/MC/MCStreamer.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ class MCStreamer {
228228
WinEH::FrameInfo *CurrentWinFrameInfo;
229229
size_t CurrentProcWinFrameInfoStartIndex;
230230

231-
/// Tracks an index to represent the order a symbol was emitted in.
232-
/// Zero means we did not emit that symbol.
233-
DenseMap<const MCSymbol *, unsigned> SymbolOrdering;
234-
235231
/// This is stack of current and previous section values saved by
236232
/// pushSection.
237233
SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
@@ -416,12 +412,6 @@ class MCStreamer {
416412
return CurFrag;
417413
}
418414

419-
/// Returns an index to represent the order a symbol was emitted in.
420-
/// (zero if we did not emit that symbol)
421-
unsigned getSymbolOrder(const MCSymbol *Sym) const {
422-
return SymbolOrdering.lookup(Sym);
423-
}
424-
425415
/// Save the current and previous section on the section stack.
426416
void pushSection() {
427417
SectionStack.push_back(

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3028,20 +3028,6 @@ void DwarfDebug::emitDebugARanges() {
30283028
continue;
30293029
}
30303030

3031-
// Sort the symbols by offset within the section.
3032-
llvm::stable_sort(List, [&](const SymbolCU &A, const SymbolCU &B) {
3033-
unsigned IA = A.Sym ? Asm->OutStreamer->getSymbolOrder(A.Sym) : 0;
3034-
unsigned IB = B.Sym ? Asm->OutStreamer->getSymbolOrder(B.Sym) : 0;
3035-
3036-
// Symbols with no order assigned should be placed at the end.
3037-
// (e.g. section end labels)
3038-
if (IA == 0)
3039-
return false;
3040-
if (IB == 0)
3041-
return true;
3042-
return IA < IB;
3043-
});
3044-
30453031
// Insert a final terminator.
30463032
List.push_back(SymbolCU(nullptr, Asm->OutStreamer->endSection(Section)));
30473033

llvm/lib/MC/MCStreamer.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ void MCStreamer::reset() {
102102
DwarfFrameInfos.clear();
103103
CurrentWinFrameInfo = nullptr;
104104
WinFrameInfos.clear();
105-
SymbolOrdering.clear();
106105
SectionStack.clear();
107106
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
108107
CurFrag = nullptr;
@@ -415,10 +414,6 @@ void MCStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
415414
void MCStreamer::assignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
416415
assert(Fragment);
417416
Symbol->setFragment(Fragment);
418-
419-
// As we emit symbols into a section, track the order so that they can
420-
// be sorted upon later. Zero is reserved to mean 'unemitted'.
421-
SymbolOrdering[Symbol] = 1 + SymbolOrdering.size();
422417
}
423418

424419
void MCStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {

0 commit comments

Comments
 (0)