[llvm] 179344d - [MC] Move AIX specific function to PPCAsmPrinter
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 26 18:53:47 PST 2024
Author: Fangrui Song
Date: 2024-12-26T18:53:42-08:00
New Revision: 179344d9a85934ff83bed1f657c91d4c1ba12460
URL: https://github.com/llvm/llvm-project/commit/179344d9a85934ff83bed1f657c91d4c1ba12460
DIFF: https://github.com/llvm/llvm-project/commit/179344d9a85934ff83bed1f657c91d4c1ba12460.diff
LOG: [MC] Move AIX specific function to PPCAsmPrinter
https://reviews.llvm.org/D95518 used switchSectionNoPrint,
which seems buggy as .ll -> .s -> .o will be different from
.ll -> .o, but this change intends to be a NFC.
Added:
Modified:
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index 9115dcd2cb7167..21da4dac4872b4 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -1137,9 +1137,6 @@ class MCStreamer {
const MCSymbol *LastLabel,
const MCSymbol *Label,
unsigned PointerSize) {}
-
- /// Do finalization for the streamer at the end of a section.
- virtual void doFinalizationAtSectionEnd(MCSection *Section) {}
};
/// Create a dummy machine code streamer, which does nothing. This is useful for
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 32f1d632187490..01fe11ed205017 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -442,8 +442,6 @@ class MCAsmStreamer final : public MCStreamer {
void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel,
const MCSymbol *Label,
unsigned PointerSize) override;
-
- void doFinalizationAtSectionEnd(MCSection *Section) override;
};
} // end anonymous namespace.
@@ -2679,18 +2677,6 @@ void MCAsmStreamer::emitDwarfAdvanceLineAddr(int64_t LineDelta,
emitIntValue(dwarf::DW_LNS_copy, 1);
}
-void MCAsmStreamer::doFinalizationAtSectionEnd(MCSection *Section) {
- // Emit section end. This is used to tell the debug line section where the end
- // is for a text section if we don't use .loc to represent the debug line.
- assert(MAI->isAIX());
- switchSectionNoPrint(Section);
-
- MCSymbol *Sym = getCurrentSectionOnly()->getEndSymbol(getContext());
-
- if (!Sym->isInSection())
- emitLabel(Sym);
-}
-
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
std::unique_ptr<formatted_raw_ostream> OS,
MCInstPrinter *IP,
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 33e07915e735bf..162d11058266f3 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -3247,9 +3247,15 @@ void PPCAIXAsmPrinter::emitInstruction(const MachineInstr *MI) {
bool PPCAIXAsmPrinter::doFinalization(Module &M) {
// Do streamer related finalization for DWARF.
- if (hasDebugInfo())
- OutStreamer->doFinalizationAtSectionEnd(
- OutStreamer->getContext().getObjectFileInfo()->getTextSection());
+ if (hasDebugInfo()) {
+ // Emit section end. This is used to tell the debug line section where the
+ // end is for a text section if we don't use .loc to represent the debug
+ // line.
+ auto *Sec = OutContext.getObjectFileInfo()->getTextSection();
+ OutStreamer->switchSectionNoPrint(Sec);
+ MCSymbol *Sym = Sec->getEndSymbol(OutContext);
+ OutStreamer->emitLabel(Sym);
+ }
for (MCSymbol *Sym : ExtSymSDNodeSymbols)
OutStreamer->emitSymbolAttribute(Sym, MCSA_Extern);
More information about the llvm-commits
mailing list