Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: src/IceGlobalContext.cpp

Issue 920953002: Subzero: Use -filetype instead of -ias and -elf-writer. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Explicitly set the output file type for unit tests Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceDefs.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index d0f84d0665208f57e46eaf025997f381c47a191d..bfd874f6b2c4c14e3726fb54b2702414d1f1350b 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -158,8 +158,13 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit,
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 @@ void GlobalContext::translateFunctions() {
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 @@ void GlobalContext::translateFunctions() {
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 @@ void GlobalContext::emitItems() {
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
« no previous file with comments | « src/IceDefs.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698