[llvm] 51a15d9 - [RISCV] Simplify createRISCVELFStreamer registration

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 23:09:08 PST 2025


Author: Fangrui Song
Date: 2025-02-26T23:09:03-08:00
New Revision: 51a15d96fdb9818bf4e5439d4b551fc0950d3c69

URL: https://github.com/llvm/llvm-project/commit/51a15d96fdb9818bf4e5439d4b551fc0950d3c69
DIFF: https://github.com/llvm/llvm-project/commit/51a15d96fdb9818bf4e5439d4b551fc0950d3c69.diff

LOG: [RISCV] Simplify createRISCVELFStreamer registration

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
index ea0e9fcde21cf..9eabc61331832 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
@@ -186,13 +186,10 @@ void RISCVELFStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
   MCELFStreamer::emitValueImpl(Value, Size, Loc);
 }
 
-namespace llvm {
-MCELFStreamer *createRISCVELFStreamer(MCContext &C,
-                                      std::unique_ptr<MCAsmBackend> MAB,
-                                      std::unique_ptr<MCObjectWriter> MOW,
-                                      std::unique_ptr<MCCodeEmitter> MCE) {
-  RISCVELFStreamer *S =
-      new RISCVELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE));
-  return S;
-}
-} // namespace llvm
+MCStreamer *llvm::createRISCVELFStreamer(const Triple &, MCContext &C,
+                                         std::unique_ptr<MCAsmBackend> &&MAB,
+                                         std::unique_ptr<MCObjectWriter> &&MOW,
+                                         std::unique_ptr<MCCodeEmitter> &&MCE) {
+  return new RISCVELFStreamer(C, std::move(MAB), std::move(MOW),
+                              std::move(MCE));
+}

diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
index 47df31af3057d..e1765805b4a26 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
@@ -69,10 +69,10 @@ class RISCVTargetELFStreamer : public RISCVTargetStreamer {
   void finish() override;
 };
 
-MCELFStreamer *createRISCVELFStreamer(MCContext &C,
-                                      std::unique_ptr<MCAsmBackend> MAB,
-                                      std::unique_ptr<MCObjectWriter> MOW,
-                                      std::unique_ptr<MCCodeEmitter> MCE);
+MCStreamer *createRISCVELFStreamer(const Triple &, MCContext &C,
+                                   std::unique_ptr<MCAsmBackend> &&MAB,
+                                   std::unique_ptr<MCObjectWriter> &&MOW,
+                                   std::unique_ptr<MCCodeEmitter> &&MCE);
 } // namespace llvm
 
 #endif // LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H

diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
index 269f2e24bdf6b..868614cbdad6d 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
@@ -340,16 +340,6 @@ static MCInstrAnalysis *createRISCVInstrAnalysis(const MCInstrInfo *Info) {
   return new RISCVMCInstrAnalysis(Info);
 }
 
-namespace {
-MCStreamer *createRISCVELFStreamer(const Triple &T, MCContext &Context,
-                                   std::unique_ptr<MCAsmBackend> &&MAB,
-                                   std::unique_ptr<MCObjectWriter> &&MOW,
-                                   std::unique_ptr<MCCodeEmitter> &&MCE) {
-  return createRISCVELFStreamer(Context, std::move(MAB), std::move(MOW),
-                                std::move(MCE));
-}
-} // end anonymous namespace
-
 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTargetMC() {
   for (Target *T : {&getTheRISCV32Target(), &getTheRISCV64Target()}) {
     TargetRegistry::RegisterMCAsmInfo(*T, createRISCVMCAsmInfo);


        


More information about the llvm-commits mailing list