Subzero: Use -filetype instead of -ias and -elf-writer.
This matches LLVM's -filetype={obj,asm} options, and also adds -filetype=iasm to get textual rendering with the integrated assembler.
It also removes the old illegal combination of -ias=0 -elf-writer.
BUG= none
R=jvoung@chromium.org, kschimpf@google.com
Review URL: https://codereview.chromium.org/920953002
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index d0f84d0..bfd874f 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -158,8 +158,13 @@
newTimerStackID("Per-function summary");
}
Timers.initInto(MyTLS->Timers);
- if (Flags.getUseELFWriter()) {
+ switch (Flags.getOutFileType()) {
+ case FT_Elf:
ObjectWriter.reset(new ELFObjectWriter(*this, *ELFStr));
+ break;
+ case FT_Asm:
+ case FT_Iasm:
+ break;
}
}
@@ -193,7 +198,9 @@
getStrDump() << "ICE translation error: " << Func->getError() << "\n";
Item = new EmitterWorkItem(Func->getSequenceNumber());
} else {
- if (getFlags().getUseIntegratedAssembler()) {
+ switch (getFlags().getOutFileType()) {
+ case FT_Elf:
+ case FT_Iasm: {
Func->emitIAS();
// The Cfg has already emitted into the assembly buffer, so
// stats have been fully collected into this thread's TLS.
@@ -204,10 +211,12 @@
Asm->setFunctionName(Func->getFunctionName());
Asm->setInternal(Func->getInternal());
Item = new EmitterWorkItem(Func->getSequenceNumber(), Asm);
- } else {
+ } break;
+ case FT_Asm:
// The Cfg has not been emitted yet, so stats are not ready
// to be dumped.
Item = new EmitterWorkItem(Func->getSequenceNumber(), Func.release());
+ break;
}
}
Cfg::setCurrentCfg(nullptr);
@@ -283,19 +292,25 @@
std::unique_ptr<Assembler> Asm = Item->getAsm();
Asm->alignFunction();
IceString MangledName = mangleName(Asm->getFunctionName());
- if (getFlags().getUseELFWriter()) {
+ switch (getFlags().getOutFileType()) {
+ case FT_Elf:
getObjectWriter()->writeFunctionCode(MangledName, Asm->getInternal(),
Asm.get());
- } else {
+ break;
+ case FT_Iasm: {
OstreamLocker L(this);
Cfg::emitTextHeader(MangledName, this, Asm.get());
Asm->emitIASBytes(this);
+ } break;
+ case FT_Asm:
+ llvm::report_fatal_error("Unexpected FT_Asm");
+ break;
}
} break;
case EmitterWorkItem::WI_Cfg: {
if (!ALLOW_DUMP)
llvm::report_fatal_error("WI_Cfg work item created inappropriately");
- assert(!getFlags().getUseIntegratedAssembler());
+ assert(getFlags().getOutFileType() == FT_Asm);
std::unique_ptr<Cfg> Func = Item->getCfg();
// Unfortunately, we have to temporarily install the Cfg in TLS
// because Variable::asType() uses the allocator to create the