Split the object streamer callback in one per file format.
There are two main advantages to doing this
* Targets that only need to handle one of the formats specially don't have
to worry about the others. For example, x86 now only registers a
constructor for the COFF streamer.
* Changes to the arguments passed to one format constructor will not impact
the other formats.
llvm-svn: 232699
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
index afcc953..2e1644d 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
@@ -344,22 +344,6 @@
return X;
}
-static MCStreamer *createMCStreamer(const Triple &T, MCContext &Ctx,
- MCAsmBackend &MAB, raw_ostream &OS,
- MCCodeEmitter *Emitter,
- const MCSubtargetInfo &STI, bool RelaxAll) {
- switch (T.getObjectFormat()) {
- default: llvm_unreachable("unsupported object format");
- case Triple::MachO:
- return createMachOStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
- case Triple::COFF:
- assert(T.isOSWindows() && "only Windows COFF is supported");
- return createX86WinCOFFStreamer(Ctx, MAB, Emitter, OS, RelaxAll);
- case Triple::ELF:
- return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
- }
-}
-
static MCInstPrinter *createX86MCInstPrinter(const Target &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI,
@@ -414,7 +398,7 @@
TargetRegistry::RegisterMCCodeEmitter(*T, createX86MCCodeEmitter);
// Register the object streamer.
- TargetRegistry::RegisterMCObjectStreamer(*T, createMCStreamer);
+ TargetRegistry::RegisterCOFFStreamer(*T, createX86WinCOFFStreamer);
// Register the MCInstPrinter.
TargetRegistry::RegisterMCInstPrinter(*T, createX86MCInstPrinter);