Skip to content

Commit 179344d

Browse files
committed
[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.
1 parent 47e1c87 commit 179344d

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

llvm/include/llvm/MC/MCStreamer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,6 @@ class MCStreamer {
11371137
const MCSymbol *LastLabel,
11381138
const MCSymbol *Label,
11391139
unsigned PointerSize) {}
1140-
1141-
/// Do finalization for the streamer at the end of a section.
1142-
virtual void doFinalizationAtSectionEnd(MCSection *Section) {}
11431140
};
11441141

11451142
/// Create a dummy machine code streamer, which does nothing. This is useful for

llvm/lib/MC/MCAsmStreamer.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,6 @@ class MCAsmStreamer final : public MCStreamer {
442442
void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel,
443443
const MCSymbol *Label,
444444
unsigned PointerSize) override;
445-
446-
void doFinalizationAtSectionEnd(MCSection *Section) override;
447445
};
448446

449447
} // end anonymous namespace.
@@ -2679,18 +2677,6 @@ void MCAsmStreamer::emitDwarfAdvanceLineAddr(int64_t LineDelta,
26792677
emitIntValue(dwarf::DW_LNS_copy, 1);
26802678
}
26812679

2682-
void MCAsmStreamer::doFinalizationAtSectionEnd(MCSection *Section) {
2683-
// Emit section end. This is used to tell the debug line section where the end
2684-
// is for a text section if we don't use .loc to represent the debug line.
2685-
assert(MAI->isAIX());
2686-
switchSectionNoPrint(Section);
2687-
2688-
MCSymbol *Sym = getCurrentSectionOnly()->getEndSymbol(getContext());
2689-
2690-
if (!Sym->isInSection())
2691-
emitLabel(Sym);
2692-
}
2693-
26942680
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
26952681
std::unique_ptr<formatted_raw_ostream> OS,
26962682
MCInstPrinter *IP,

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,9 +3247,15 @@ void PPCAIXAsmPrinter::emitInstruction(const MachineInstr *MI) {
32473247

32483248
bool PPCAIXAsmPrinter::doFinalization(Module &M) {
32493249
// Do streamer related finalization for DWARF.
3250-
if (hasDebugInfo())
3251-
OutStreamer->doFinalizationAtSectionEnd(
3252-
OutStreamer->getContext().getObjectFileInfo()->getTextSection());
3250+
if (hasDebugInfo()) {
3251+
// Emit section end. This is used to tell the debug line section where the
3252+
// end is for a text section if we don't use .loc to represent the debug
3253+
// line.
3254+
auto *Sec = OutContext.getObjectFileInfo()->getTextSection();
3255+
OutStreamer->switchSectionNoPrint(Sec);
3256+
MCSymbol *Sym = Sec->getEndSymbol(OutContext);
3257+
OutStreamer->emitLabel(Sym);
3258+
}
32533259

32543260
for (MCSymbol *Sym : ExtSymSDNodeSymbols)
32553261
OutStreamer->emitSymbolAttribute(Sym, MCSA_Extern);

0 commit comments

Comments
 (0)