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

Side by Side Diff: src/IceCompiler.cpp

Issue 1960393002: Subzero: Add necessary PNaCl files for standalone build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero@master
Patch Set: make format Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/IceCompileServer.cpp ('k') | src/IceInst.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCompiler.cpp - Driver for bitcode translation -------===// 1 //===- subzero/src/IceCompiler.cpp - Driver for bitcode translation -------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 Ctx.startWorkerThreads(); 80 Ctx.startWorkerThreads();
81 81
82 std::unique_ptr<Translator> Translator; 82 std::unique_ptr<Translator> Translator;
83 const std::string IRFilename = Flags.getIRFilename(); 83 const std::string IRFilename = Flags.getIRFilename();
84 const bool BuildOnRead = Flags.getBuildOnRead() && !llvmIRInput(IRFilename) && 84 const bool BuildOnRead = Flags.getBuildOnRead() && !llvmIRInput(IRFilename) &&
85 !wasmInput(IRFilename); 85 !wasmInput(IRFilename);
86 const bool WasmBuildOnRead = Flags.getBuildOnRead() && wasmInput(IRFilename); 86 const bool WasmBuildOnRead = Flags.getBuildOnRead() && wasmInput(IRFilename);
87 if (BuildOnRead) { 87 if (BuildOnRead) {
88 std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx)); 88 std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx));
89 #ifdef PNACL_LLVM 89 #ifdef PNACL_LLVM
90 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(new llvm::StreamingMemor yObjectImpl(InputStream.release())); 90 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(
91 #else // !PNACL_LLVM 91 new llvm::StreamingMemoryObjectImpl(InputStream.release()));
92 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(new llvm::StreamingMemor yObject(std::move(InputStream))); 92 #else // !PNACL_LLVM
93 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(
94 new llvm::StreamingMemoryObject(std::move(InputStream)));
93 #endif // !PNACL_LLVM 95 #endif // !PNACL_LLVM
94 PTranslator->translate(IRFilename, std::move(MemObj)); 96 PTranslator->translate(IRFilename, std::move(MemObj));
95 Translator.reset(PTranslator.release()); 97 Translator.reset(PTranslator.release());
96 } else if (WasmBuildOnRead) { 98 } else if (WasmBuildOnRead) {
97 if (BuildDefs::wasm()) { 99 if (BuildDefs::wasm()) {
98 #if !ALLOW_WASM 100 #if !ALLOW_WASM
99 assert(false && "wasm not allowed"); 101 assert(false && "wasm not allowed");
100 #else 102 #else
101 std::unique_ptr<WasmTranslator> WTranslator(new WasmTranslator(&Ctx)); 103 std::unique_ptr<WasmTranslator> WTranslator(new WasmTranslator(&Ctx));
102 104
(...skipping 21 matching lines...) Expand all
124 llvm::SMDiagnostic Err; 126 llvm::SMDiagnostic Err;
125 TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); 127 TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
126 #ifdef PNACL_LLVM 128 #ifdef PNACL_LLVM
127 llvm::DiagnosticHandlerFunction DiagnosticHandler = 129 llvm::DiagnosticHandlerFunction DiagnosticHandler =
128 Flags.getLLVMVerboseErrors() 130 Flags.getLLVMVerboseErrors()
129 ? redirectNaClDiagnosticToStream(llvm::errs()) 131 ? redirectNaClDiagnosticToStream(llvm::errs())
130 : nullptr; 132 : nullptr;
131 std::unique_ptr<llvm::Module> Mod = 133 std::unique_ptr<llvm::Module> Mod =
132 NaClParseIRFile(IRFilename, Flags.getInputFileFormat(), Err, 134 NaClParseIRFile(IRFilename, Flags.getInputFileFormat(), Err,
133 llvm::getGlobalContext(), DiagnosticHandler); 135 llvm::getGlobalContext(), DiagnosticHandler);
134 #else // !PNACL_LLVM 136 #else // !PNACL_LLVM
135 llvm::DiagnosticHandlerFunction DiagnosticHandler = nullptr; 137 llvm::DiagnosticHandlerFunction DiagnosticHandler = nullptr;
136 llvm::LLVMContext Context; 138 llvm::LLVMContext Context;
137 std::unique_ptr<llvm::Module> Mod = 139 std::unique_ptr<llvm::Module> Mod = parseIRFile(IRFilename, Err, Context);
138 parseIRFile(IRFilename, Err, Context);
139 #endif // !PNACL_LLVM 140 #endif // !PNACL_LLVM
140 if (!Mod) { 141 if (!Mod) {
141 Err.print(Flags.getAppName().c_str(), llvm::errs()); 142 Err.print(Flags.getAppName().c_str(), llvm::errs());
142 Ctx.getErrorStatus()->assign(EC_Bitcode); 143 Ctx.getErrorStatus()->assign(EC_Bitcode);
143 Ctx.waitForWorkerThreads(); 144 Ctx.waitForWorkerThreads();
144 return; 145 return;
145 } 146 }
146 147
147 std::unique_ptr<Converter> Converter(new class Converter(Mod.get(), &Ctx)); 148 std::unique_ptr<Converter> Converter(new class Converter(Mod.get(), &Ctx));
148 Converter->convertToIce(); 149 Converter->convertToIce();
(...skipping 26 matching lines...) Expand all
175 Ctx.dumpTimers(); 176 Ctx.dumpTimers();
176 177
177 if (getFlags().getTimeEachFunction()) { 178 if (getFlags().getTimeEachFunction()) {
178 constexpr bool NoDumpCumulative = false; 179 constexpr bool NoDumpCumulative = false;
179 Ctx.dumpTimers(GlobalContext::TSK_Funcs, NoDumpCumulative); 180 Ctx.dumpTimers(GlobalContext::TSK_Funcs, NoDumpCumulative);
180 } 181 }
181 Ctx.dumpStats(); 182 Ctx.dumpStats();
182 } 183 }
183 184
184 } // end of namespace Ice 185 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCompileServer.cpp ('k') | src/IceInst.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698