[llvm] dd64e4f - [MC] Remove assignFragment
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 29 18:09:58 PDT 2024
Author: Fangrui Song
Date: 2024-06-29T18:09:53-07:00
New Revision: dd64e4fa2fd72bc806d4b5b9c07fc235053733e3
URL: https://github.com/llvm/llvm-project/commit/dd64e4fa2fd72bc806d4b5b9c07fc235053733e3
DIFF: https://github.com/llvm/llvm-project/commit/dd64e4fa2fd72bc806d4b5b9c07fc235053733e3.diff
LOG: [MC] Remove assignFragment
Follow-up to f6fc503b6791bd7d38ba62c249091eabed297471 ("[MC] Remove MCStreamer::SymbolOrdering").
Added:
Modified:
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index fa8e5c6fe8105..1d3057a140d8a 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -439,12 +439,6 @@ class MCStreamer {
MCSymbol *endSection(MCSection *Section);
- /// Sets the symbol's section.
- ///
- /// Each emitted symbol will be tracked in the ordering table,
- /// so we can sort on them later.
- void assignFragment(MCSymbol *Symbol, MCFragment *Fragment);
-
/// Returns the mnemonic for \p MI, if the streamer has access to a
/// instruction printer and returns an empty string otherwise.
virtual StringRef getMnemonic(MCInst &MI) { return ""; }
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index df5cedb27b8f6..0050923f3cd9d 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -1080,7 +1080,7 @@ void MCAsmStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, Align ByteAlignment,
SMLoc Loc) {
if (Symbol)
- assignFragment(Symbol, &Section->getDummyFragment());
+ Symbol->setFragment(&Section->getDummyFragment());
// Note: a .zerofill directive does not switch sections.
OS << ".zerofill ";
@@ -1106,9 +1106,8 @@ void MCAsmStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
// e.g. _a.
void MCAsmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, Align ByteAlignment) {
- assignFragment(Symbol, &Section->getDummyFragment());
+ Symbol->setFragment(&Section->getDummyFragment());
- assert(Symbol && "Symbol shouldn't be NULL!");
// Instead of using the Section we'll just use the shortcut.
assert(Section->getVariant() == MCSection::SV_MachO &&
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 470c673a897d8..a3f67941c1015 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -411,11 +411,6 @@ void MCStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
switchSection(getContext().getObjectFileInfo()->getTextSection());
}
-void MCStreamer::assignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
- assert(Fragment);
- Symbol->setFragment(Fragment);
-}
-
void MCStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
Symbol->redefineIfPossible();
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index 1eaa57e162607..53eb3610535f8 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -76,7 +76,7 @@ void PPCELFStreamer::emitPrefixedInstruction(const MCInst &Inst,
// label to the top of the fragment containing the aligned instruction that
// was just added.
if (InstLine == LabelLine) {
- assignFragment(LastLabel, InstructionFragment);
+ LastLabel->setFragment(InstructionFragment);
LastLabel->setOffset(0);
}
}
More information about the llvm-commits
mailing list