[llvm] 18f7ee5 - [MC] Remove unused Register*Streamer
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 20 11:23:25 PDT 2024
Author: Fangrui Song
Date: 2024-07-20T11:23:20-07:00
New Revision: 18f7ee5f13037acfc96d8324822b7a9d6c7a4f8b
URL: https://github.com/llvm/llvm-project/commit/18f7ee5f13037acfc96d8324822b7a9d6c7a4f8b
DIFF: https://github.com/llvm/llvm-project/commit/18f7ee5f13037acfc96d8324822b7a9d6c7a4f8b.diff
LOG: [MC] Remove unused Register*Streamer
Object streamers that do not need lib/Target customization do not need
Register*Streamer.
Added:
Modified:
llvm/include/llvm/MC/TargetRegistry.h
llvm/lib/MC/MCXCOFFStreamer.cpp
llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVMCTargetDesc.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h
index 68eb02076a8f6..bb4566aa65e03 100644
--- a/llvm/include/llvm/MC/TargetRegistry.h
+++ b/llvm/include/llvm/MC/TargetRegistry.h
@@ -107,10 +107,6 @@ MCStreamer *createWasmStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&CE);
-MCStreamer *createXCOFFStreamer(MCContext &Ctx,
- std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&CE);
MCStreamer *createSPIRVStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
@@ -194,10 +190,6 @@ class Target {
std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&Emitter);
- using GOFFStreamerCtorTy =
- MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter);
using MachOStreamerCtorTy =
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
@@ -206,27 +198,11 @@ class Target {
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&Emitter);
- using WasmStreamerCtorTy =
- MCStreamer *(*)(const Triple &T, MCContext &Ctx,
- std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter);
using XCOFFStreamerCtorTy =
MCStreamer *(*)(const Triple &T, MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&Emitter);
- using SPIRVStreamerCtorTy =
- MCStreamer *(*)(const Triple &T, MCContext &Ctx,
- std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter);
-
- using DXContainerStreamerCtorTy =
- MCStreamer *(*)(const Triple &T, MCContext &Ctx,
- std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter);
using NullTargetStreamerCtorTy = MCTargetStreamer *(*)(MCStreamer &S);
using AsmTargetStreamerCtorTy = MCTargetStreamer *(*)(
@@ -328,13 +304,9 @@ class Target {
// Construction functions for the various object formats, if registered.
COFFStreamerCtorTy COFFStreamerCtorFn = nullptr;
- GOFFStreamerCtorTy GOFFStreamerCtorFn = nullptr;
MachOStreamerCtorTy MachOStreamerCtorFn = nullptr;
ELFStreamerCtorTy ELFStreamerCtorFn = nullptr;
- WasmStreamerCtorTy WasmStreamerCtorFn = nullptr;
XCOFFStreamerCtorTy XCOFFStreamerCtorFn = nullptr;
- SPIRVStreamerCtorTy SPIRVStreamerCtorFn = nullptr;
- DXContainerStreamerCtorTy DXContainerStreamerCtorFn = nullptr;
/// Construction function for this target's null TargetStreamer, if
/// registered (default = nullptr).
@@ -586,44 +558,24 @@ class Target {
std::move(Emitter));
break;
case Triple::Wasm:
- if (WasmStreamerCtorFn)
- S = WasmStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
- else
- S = createWasmStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
+ S = createWasmStreamer(Ctx, std::move(TAB), std::move(OW),
+ std::move(Emitter));
break;
case Triple::GOFF:
- if (GOFFStreamerCtorFn)
- S = GOFFStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
- else
- S = createGOFFStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
+ S = createGOFFStreamer(Ctx, std::move(TAB), std::move(OW),
+ std::move(Emitter));
break;
case Triple::XCOFF:
- if (XCOFFStreamerCtorFn)
- S = XCOFFStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
- else
- S = createXCOFFStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
+ S = XCOFFStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
+ std::move(Emitter));
break;
case Triple::SPIRV:
- if (SPIRVStreamerCtorFn)
- S = SPIRVStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
- else
- S = createSPIRVStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
+ S = createSPIRVStreamer(Ctx, std::move(TAB), std::move(OW),
+ std::move(Emitter));
break;
case Triple::DXContainer:
- if (DXContainerStreamerCtorFn)
- S = DXContainerStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
- else
- S = createDXContainerStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
+ S = createDXContainerStreamer(Ctx, std::move(TAB), std::move(OW),
+ std::move(Emitter));
break;
}
if (ObjectTargetStreamerCtorFn)
@@ -1007,10 +959,6 @@ struct TargetRegistry {
T.COFFStreamerCtorFn = Fn;
}
- static void RegisterGOFFStreamer(Target &T, Target::GOFFStreamerCtorTy Fn) {
- T.GOFFStreamerCtorFn = Fn;
- }
-
static void RegisterMachOStreamer(Target &T, Target::MachOStreamerCtorTy Fn) {
T.MachOStreamerCtorFn = Fn;
}
@@ -1019,18 +967,6 @@ struct TargetRegistry {
T.ELFStreamerCtorFn = Fn;
}
- static void RegisterSPIRVStreamer(Target &T, Target::SPIRVStreamerCtorTy Fn) {
- T.SPIRVStreamerCtorFn = Fn;
- }
-
- static void RegisterDXContainerStreamer(Target &T, Target::DXContainerStreamerCtorTy Fn) {
- T.DXContainerStreamerCtorFn = Fn;
- }
-
- static void RegisterWasmStreamer(Target &T, Target::WasmStreamerCtorTy Fn) {
- T.WasmStreamerCtorFn = Fn;
- }
-
static void RegisterXCOFFStreamer(Target &T, Target::XCOFFStreamerCtorTy Fn) {
T.XCOFFStreamerCtorFn = Fn;
}
diff --git a/llvm/lib/MC/MCXCOFFStreamer.cpp b/llvm/lib/MC/MCXCOFFStreamer.cpp
index 175d7d6b6c31a..9cd46e504b554 100644
--- a/llvm/lib/MC/MCXCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCXCOFFStreamer.cpp
@@ -159,15 +159,6 @@ void MCXCOFFStreamer::emitInstToData(const MCInst &Inst,
DF->getContents().append(Code.begin(), Code.end());
}
-MCStreamer *llvm::createXCOFFStreamer(MCContext &Context,
- std::unique_ptr<MCAsmBackend> &&MAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&CE) {
- MCXCOFFStreamer *S = new MCXCOFFStreamer(Context, std::move(MAB),
- std::move(OW), std::move(CE));
- return S;
-}
-
void MCXCOFFStreamer::emitXCOFFLocalCommonSymbol(MCSymbol *LabelSym,
uint64_t Size,
MCSymbol *CsectSym,
diff --git a/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVMCTargetDesc.cpp b/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVMCTargetDesc.cpp
index 74ebaa9d0c004..2f302ed4c9e83 100644
--- a/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVMCTargetDesc.cpp
+++ b/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVMCTargetDesc.cpp
@@ -49,15 +49,6 @@ createSPIRVMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
return createSPIRVMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
}
-static MCStreamer *
-createSPIRVMCStreamer(const Triple &T, MCContext &Ctx,
- std::unique_ptr<MCAsmBackend> &&MAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter) {
- return createSPIRVStreamer(Ctx, std::move(MAB), std::move(OW),
- std::move(Emitter));
-}
-
static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &,
MCInstPrinter *, bool) {
@@ -94,7 +85,6 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSPIRVTargetMC() {
TargetRegistry::RegisterMCInstrInfo(*T, createSPIRVMCInstrInfo);
TargetRegistry::RegisterMCRegInfo(*T, createSPIRVMCRegisterInfo);
TargetRegistry::RegisterMCSubtargetInfo(*T, createSPIRVMCSubtargetInfo);
- TargetRegistry::RegisterSPIRVStreamer(*T, createSPIRVMCStreamer);
TargetRegistry::RegisterMCInstPrinter(*T, createSPIRVMCInstPrinter);
TargetRegistry::RegisterMCInstrAnalysis(*T, createSPIRVInstrAnalysis);
TargetRegistry::RegisterMCCodeEmitter(*T, createSPIRVMCCodeEmitter);
More information about the llvm-commits
mailing list