1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

X86: convert object streamer selection to a switch

Change the object streamer selection to a switch from a series of if conditions.
Rather than defaulting to ELF, require that an ELF format is requested.  The
Windows/!ELF is maintained as MachO would have been selected first and will
still provide a MachO format.  Add an assertion that if COFF is requested that
the target platform is Windows as only WinCOFF object emission is currently
supported.

llvm-svn: 207200
This commit is contained in:
Saleem Abdulrasool 2014-04-25 06:29:36 +00:00
parent f342831239
commit 10443ee9e4

View File

@ -358,13 +358,16 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
bool NoExecStack) {
Triple TheTriple(TT);
if (TheTriple.isOSBinFormatMachO())
switch (TheTriple.getObjectFormat()) {
default: llvm_unreachable("unsupported object format");
case Triple::MachO:
return createMachOStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll);
if (TheTriple.isOSWindows() && !TheTriple.isOSBinFormatELF())
case Triple::COFF:
assert(TheTriple.isOSWindows() && "only Windows COFF is supported");
return createWinCOFFStreamer(Ctx, MAB, *_Emitter, _OS, RelaxAll);
return createELFStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll, NoExecStack);
case Triple::ELF:
return createELFStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll, NoExecStack);
}
}
static MCInstPrinter *createX86MCInstPrinter(const Target &T,