[llvm] b38fdfc - [AArch64] Simplify ELFStreamer and WinCOFFStreamer
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 23:33:23 PST 2025
Author: Fangrui Song
Date: 2025-02-26T23:33:18-08:00
New Revision: b38fdfc0f9bef696420a7d02fc1441416a146527
URL: https://github.com/llvm/llvm-project/commit/b38fdfc0f9bef696420a7d02fc1441416a146527
DIFF: https://github.com/llvm/llvm-project/commit/b38fdfc0f9bef696420a7d02fc1441416a146527.diff
LOG: [AArch64] Simplify ELFStreamer and WinCOFFStreamer
Added:
Modified:
llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.h
llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
index 08cff5a0fefac..88005553d721a 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
@@ -549,12 +549,11 @@ llvm::createAArch64AsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS,
return new AArch64TargetAsmStreamer(S, OS);
}
-MCELFStreamer *
-llvm::createAArch64ELFStreamer(MCContext &Context,
- std::unique_ptr<MCAsmBackend> TAB,
- std::unique_ptr<MCObjectWriter> OW,
- std::unique_ptr<MCCodeEmitter> Emitter) {
- AArch64ELFStreamer *S = new AArch64ELFStreamer(
- Context, std::move(TAB), std::move(OW), std::move(Emitter));
- return S;
+MCStreamer *
+llvm::createAArch64ELFStreamer(const Triple &, MCContext &Context,
+ std::unique_ptr<MCAsmBackend> &&TAB,
+ std::unique_ptr<MCObjectWriter> &&OW,
+ std::unique_ptr<MCCodeEmitter> &&Emitter) {
+ return new AArch64ELFStreamer(Context, std::move(TAB), std::move(OW),
+ std::move(Emitter));
}
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.h
index e6df79ba19d4c..f756d417d3112 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.h
@@ -17,10 +17,10 @@
namespace llvm {
-MCELFStreamer *createAArch64ELFStreamer(MCContext &Context,
- std::unique_ptr<MCAsmBackend> TAB,
- std::unique_ptr<MCObjectWriter> OW,
- std::unique_ptr<MCCodeEmitter> Emitter);
+MCStreamer *createAArch64ELFStreamer(const Triple &, MCContext &Context,
+ std::unique_ptr<MCAsmBackend> &&TAB,
+ std::unique_ptr<MCObjectWriter> &&OW,
+ std::unique_ptr<MCCodeEmitter> &&Emitter);
}
#endif
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
index c7f44ec018f5a..7f781811a5058 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
@@ -378,14 +378,6 @@ static MCInstPrinter *createAArch64MCInstPrinter(const Triple &T,
return nullptr;
}
-static MCStreamer *createELFStreamer(const Triple &T, MCContext &Ctx,
- std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter) {
- return createAArch64ELFStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
-}
-
static MCStreamer *
createMachOStreamer(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
std::unique_ptr<MCObjectWriter> &&OW,
@@ -395,14 +387,6 @@ createMachOStreamer(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
/*LabelSections*/ true);
}
-static MCStreamer *
-createWinCOFFStreamer(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
- std::unique_ptr<MCObjectWriter> &&OW,
- std::unique_ptr<MCCodeEmitter> &&Emitter) {
- return createAArch64WinCOFFStreamer(Ctx, std::move(TAB), std::move(OW),
- std::move(Emitter));
-}
-
namespace {
class AArch64MCInstrAnalysis : public MCInstrAnalysis {
@@ -542,9 +526,9 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64TargetMC() {
TargetRegistry::RegisterMCCodeEmitter(*T, createAArch64MCCodeEmitter);
// Register the obj streamers.
- TargetRegistry::RegisterELFStreamer(*T, createELFStreamer);
+ TargetRegistry::RegisterELFStreamer(*T, createAArch64ELFStreamer);
TargetRegistry::RegisterMachOStreamer(*T, createMachOStreamer);
- TargetRegistry::RegisterCOFFStreamer(*T, createWinCOFFStreamer);
+ TargetRegistry::RegisterCOFFStreamer(*T, createAArch64WinCOFFStreamer);
// Register the obj target streamer.
TargetRegistry::RegisterObjectTargetStreamer(
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
index 8075f53ae3086..fb8a3e1215d90 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
@@ -284,11 +284,11 @@ void AArch64TargetWinCOFFStreamer::emitARM64WinCFISaveAnyRegQPX(unsigned Reg,
emitARM64WinUnwindCode(Win64EH::UOP_SaveAnyRegQPX, Reg, Offset);
}
-MCWinCOFFStreamer *
+MCStreamer *
llvm::createAArch64WinCOFFStreamer(MCContext &Context,
- std::unique_ptr<MCAsmBackend> MAB,
- std::unique_ptr<MCObjectWriter> OW,
- std::unique_ptr<MCCodeEmitter> Emitter) {
+ std::unique_ptr<MCAsmBackend> &&MAB,
+ std::unique_ptr<MCObjectWriter> &&OW,
+ std::unique_ptr<MCCodeEmitter> &&Emitter) {
return new AArch64WinCOFFStreamer(Context, std::move(MAB), std::move(Emitter),
std::move(OW));
}
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.h
index 5caf520a3aa37..68b15ae4e2d1e 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.h
@@ -18,9 +18,11 @@
namespace llvm {
-MCWinCOFFStreamer *createAArch64WinCOFFStreamer(
- MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
- std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter);
+MCStreamer *
+createAArch64WinCOFFStreamer(MCContext &Context,
+ std::unique_ptr<MCAsmBackend> &&TAB,
+ std::unique_ptr<MCObjectWriter> &&OW,
+ std::unique_ptr<MCCodeEmitter> &&Emitter);
} // end llvm namespace
#endif
More information about the llvm-commits
mailing list