[llvm] 97da085 - [PowerPC] Simplify ELFStreamer and XCOFFStreamer

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 22:26:12 PST 2025


Author: Fangrui Song
Date: 2025-02-27T22:26:07-08:00
New Revision: 97da0856b0fd895a76306bbb3d2023469ed8a0be

URL: https://github.com/llvm/llvm-project/commit/97da0856b0fd895a76306bbb3d2023469ed8a0be
DIFF: https://github.com/llvm/llvm-project/commit/97da0856b0fd895a76306bbb3d2023469ed8a0be.diff

LOG: [PowerPC] Simplify ELFStreamer and XCOFFStreamer

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index b9e03b6cb6d21..addac6f41a715 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -217,10 +217,11 @@ std::optional<bool> llvm::isPartOfGOTToPCRelPair(const MCInst &Inst,
   return (Inst.getOpcode() == PPC::PLDpc);
 }
 
-MCELFStreamer *llvm::createPPCELFStreamer(
-    MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
-    std::unique_ptr<MCObjectWriter> OW,
-    std::unique_ptr<MCCodeEmitter> Emitter) {
-  return new PPCELFStreamer(Context, std::move(MAB), std::move(OW),
+MCStreamer *
+llvm::createPPCELFStreamer(const Triple &T, MCContext &C,
+                           std::unique_ptr<MCAsmBackend> &&MAB,
+                           std::unique_ptr<MCObjectWriter> &&OW,
+                           std::unique_ptr<MCCodeEmitter> &&Emitter) {
+  return new PPCELFStreamer(C, std::move(MAB), std::move(OW),
                             std::move(Emitter));
 }

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
index 10204b184a49f..2b803950073f9 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
@@ -50,10 +50,10 @@ class PPCELFStreamer : public MCELFStreamer {
 std::optional<bool> isPartOfGOTToPCRelPair(const MCInst &Inst,
                                            const MCSubtargetInfo &STI);
 
-MCELFStreamer *createPPCELFStreamer(MCContext &Context,
-                                    std::unique_ptr<MCAsmBackend> MAB,
-                                    std::unique_ptr<MCObjectWriter> OW,
-                                    std::unique_ptr<MCCodeEmitter> Emitter);
+MCStreamer *createPPCELFStreamer(const Triple &, MCContext &,
+                                 std::unique_ptr<MCAsmBackend> &&MAB,
+                                 std::unique_ptr<MCObjectWriter> &&OW,
+                                 std::unique_ptr<MCCodeEmitter> &&Emitter);
 } // end namespace llvm
 
 #endif // LLVM_LIB_TARGET_PPC_MCELFSTREAMER_PPCELFSTREAMER_H

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
index 0a0facb10e48a..5dde48fba5605 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
@@ -199,24 +199,6 @@ static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI,
   return MAI;
 }
 
-static MCStreamer *
-createPPCELFStreamer(const Triple &T, MCContext &Context,
-                     std::unique_ptr<MCAsmBackend> &&MAB,
-                     std::unique_ptr<MCObjectWriter> &&OW,
-                     std::unique_ptr<MCCodeEmitter> &&Emitter) {
-  return createPPCELFStreamer(Context, std::move(MAB), std::move(OW),
-                              std::move(Emitter));
-}
-
-static MCStreamer *
-createPPCXCOFFStreamer(const Triple &T, MCContext &Context,
-                       std::unique_ptr<MCAsmBackend> &&MAB,
-                       std::unique_ptr<MCObjectWriter> &&OW,
-                       std::unique_ptr<MCCodeEmitter> &&Emitter) {
-  return createPPCXCOFFStreamer(Context, std::move(MAB), std::move(OW),
-                                std::move(Emitter));
-}
-
 namespace {
 
 class PPCTargetAsmStreamer : public PPCTargetStreamer {

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
index 72e3cff615662..2a6da4c097fc1 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
@@ -64,11 +64,11 @@ void PPCXCOFFStreamer::emitInstruction(const MCInst &Inst,
   emitPrefixedInstruction(Inst, STI);
 }
 
-MCXCOFFStreamer *
-llvm::createPPCXCOFFStreamer(MCContext &Context,
-                             std::unique_ptr<MCAsmBackend> MAB,
-                             std::unique_ptr<MCObjectWriter> OW,
-                             std::unique_ptr<MCCodeEmitter> Emitter) {
-  return new PPCXCOFFStreamer(Context, std::move(MAB), std::move(OW),
+MCStreamer *
+llvm::createPPCXCOFFStreamer(const Triple &, MCContext &C,
+                             std::unique_ptr<MCAsmBackend> &&MAB,
+                             std::unique_ptr<MCObjectWriter> &&OW,
+                             std::unique_ptr<MCCodeEmitter> &&Emitter) {
+  return new PPCXCOFFStreamer(C, std::move(MAB), std::move(OW),
                               std::move(Emitter));
 }

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.h
index 5fa35127b70b4..1e3671c817eb8 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.h
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.h
@@ -29,10 +29,10 @@ class PPCXCOFFStreamer : public MCXCOFFStreamer {
   void emitPrefixedInstruction(const MCInst &Inst, const MCSubtargetInfo &STI);
 };
 
-MCXCOFFStreamer *createPPCXCOFFStreamer(MCContext &Context,
-                                        std::unique_ptr<MCAsmBackend> MAB,
-                                        std::unique_ptr<MCObjectWriter> OW,
-                                        std::unique_ptr<MCCodeEmitter> Emitter);
+MCStreamer *createPPCXCOFFStreamer(const Triple &, MCContext &,
+                                   std::unique_ptr<MCAsmBackend> &&MAB,
+                                   std::unique_ptr<MCObjectWriter> &&OW,
+                                   std::unique_ptr<MCCodeEmitter> &&Emitter);
 } // end namespace llvm
 
 #endif // LLVM_LIB_TARGET_PPC_MCXCOFFSTREAMER_PPCXCOFFSTREAMER_H


        


More information about the llvm-commits mailing list