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

Side by Side Diff: src/IceCompiler.cpp

Issue 1961743002: Subzero: Update for LLVM 3.9 (trunk). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero@master
Patch Set: Remove unnecessary variable 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/IceConverter.cpp » ('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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Ctx.emitFileHeader(); 79 Ctx.emitFileHeader();
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 std::unique_ptr<llvm::StreamingMemoryObject> MemObj( 90 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(
90 new llvm::StreamingMemoryObjectImpl(InputStream.release())); 91 new llvm::StreamingMemoryObjectImpl(InputStream.release()));
92 #else // !PNACL_LLVM
93 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(
94 new llvm::StreamingMemoryObject(std::move(InputStream)));
95 #endif // !PNACL_LLVM
91 PTranslator->translate(IRFilename, std::move(MemObj)); 96 PTranslator->translate(IRFilename, std::move(MemObj));
92 Translator.reset(PTranslator.release()); 97 Translator.reset(PTranslator.release());
93 } else if (WasmBuildOnRead) { 98 } else if (WasmBuildOnRead) {
94 if (BuildDefs::wasm()) { 99 if (BuildDefs::wasm()) {
95 #if !ALLOW_WASM 100 #if !ALLOW_WASM
96 assert(false && "wasm not allowed"); 101 assert(false && "wasm not allowed");
97 #else 102 #else
98 std::unique_ptr<WasmTranslator> WTranslator(new WasmTranslator(&Ctx)); 103 std::unique_ptr<WasmTranslator> WTranslator(new WasmTranslator(&Ctx));
99 104
100 WTranslator->translate(IRFilename, std::move(InputStream)); 105 WTranslator->translate(IRFilename, std::move(InputStream));
(...skipping 12 matching lines...) Expand all
113 Ctx.getErrorStatus()->assign(EC_Args); 118 Ctx.getErrorStatus()->assign(EC_Args);
114 Ctx.waitForWorkerThreads(); 119 Ctx.waitForWorkerThreads();
115 return; 120 return;
116 } 121 }
117 // Globals must be kept alive after lowering when converting from LLVM to 122 // Globals must be kept alive after lowering when converting from LLVM to
118 // Ice. 123 // Ice.
119 Ctx.setDisposeGlobalVariablesAfterLowering(false); 124 Ctx.setDisposeGlobalVariablesAfterLowering(false);
120 // Parse the input LLVM IR file into a module. 125 // Parse the input LLVM IR file into a module.
121 llvm::SMDiagnostic Err; 126 llvm::SMDiagnostic Err;
122 TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); 127 TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
128 #ifdef PNACL_LLVM
123 llvm::DiagnosticHandlerFunction DiagnosticHandler = 129 llvm::DiagnosticHandlerFunction DiagnosticHandler =
124 Flags.getLLVMVerboseErrors() 130 Flags.getLLVMVerboseErrors()
125 ? redirectNaClDiagnosticToStream(llvm::errs()) 131 ? redirectNaClDiagnosticToStream(llvm::errs())
126 : nullptr; 132 : nullptr;
127 std::unique_ptr<llvm::Module> Mod = 133 std::unique_ptr<llvm::Module> Mod =
128 NaClParseIRFile(IRFilename, Flags.getInputFileFormat(), Err, 134 NaClParseIRFile(IRFilename, Flags.getInputFileFormat(), Err,
129 llvm::getGlobalContext(), DiagnosticHandler); 135 llvm::getGlobalContext(), DiagnosticHandler);
136 #else // !PNACL_LLVM
137 llvm::LLVMContext Context;
138 std::unique_ptr<llvm::Module> Mod = parseIRFile(IRFilename, Err, Context);
139 #endif // !PNACL_LLVM
130 if (!Mod) { 140 if (!Mod) {
131 Err.print(Flags.getAppName().c_str(), llvm::errs()); 141 Err.print(Flags.getAppName().c_str(), llvm::errs());
132 Ctx.getErrorStatus()->assign(EC_Bitcode); 142 Ctx.getErrorStatus()->assign(EC_Bitcode);
133 Ctx.waitForWorkerThreads(); 143 Ctx.waitForWorkerThreads();
134 return; 144 return;
135 } 145 }
136 146
137 std::unique_ptr<Converter> Converter(new class Converter(Mod.get(), &Ctx)); 147 std::unique_ptr<Converter> Converter(new class Converter(Mod.get(), &Ctx));
138 Converter->convertToIce(); 148 Converter->convertToIce();
139 Translator.reset(Converter.release()); 149 Translator.reset(Converter.release());
(...skipping 25 matching lines...) Expand all
165 Ctx.dumpTimers(); 175 Ctx.dumpTimers();
166 176
167 if (getFlags().getTimeEachFunction()) { 177 if (getFlags().getTimeEachFunction()) {
168 constexpr bool NoDumpCumulative = false; 178 constexpr bool NoDumpCumulative = false;
169 Ctx.dumpTimers(GlobalContext::TSK_Funcs, NoDumpCumulative); 179 Ctx.dumpTimers(GlobalContext::TSK_Funcs, NoDumpCumulative);
170 } 180 }
171 Ctx.dumpStats(); 181 Ctx.dumpStats();
172 } 182 }
173 183
174 } // end of namespace Ice 184 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCompileServer.cpp ('k') | src/IceConverter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698