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

Side by Side Diff: src/IceBrowserCompileServer.cpp

Issue 1848303003: Simplify references to command line flags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 8 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/IceBrowserCompileServer.h ('k') | src/IceCfg.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/IceBrowserCompileServer.cpp - Browser compile server ---===// 1 //===- subzero/src/IceBrowserCompileServer.cpp - Browser compile server ---===//
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 void BrowserCompileServer::run() { 159 void BrowserCompileServer::run() {
160 gCompileServer = this; 160 gCompileServer = this;
161 getIRTInterfaces(); 161 getIRTInterfaces();
162 gIRTFuncs.serve_translate_request(&SubzeroCallbacks); 162 gIRTFuncs.serve_translate_request(&SubzeroCallbacks);
163 } 163 }
164 164
165 void BrowserCompileServer::getParsedFlags(uint32_t NumThreads, int argc, 165 void BrowserCompileServer::getParsedFlags(uint32_t NumThreads, int argc,
166 char **argv) { 166 char **argv) {
167 ClFlags::parseFlags(argc, argv); 167 ClFlags::parseFlags(argc, argv);
168 ClFlags::getParsedClFlags(*Flags); 168 ClFlags::getParsedClFlags(ClFlags::Flags);
169 // Set some defaults which aren't specified via the argv string. 169 // Set some defaults which aren't specified via the argv string.
170 Flags->setNumTranslationThreads(NumThreads); 170 ClFlags::Flags.setNumTranslationThreads(NumThreads);
171 Flags->setUseSandboxing(true); 171 ClFlags::Flags.setUseSandboxing(true);
172 Flags->setOutFileType(FT_Elf); 172 ClFlags::Flags.setOutFileType(FT_Elf);
173 Flags->setTargetArch(getTargetArch()); 173 ClFlags::Flags.setTargetArch(getTargetArch());
174 Flags->setBuildOnRead(true); 174 ClFlags::Flags.setInputFileFormat(llvm::PNaClFormat);
175 Flags->setInputFileFormat(llvm::PNaClFormat);
176 } 175 }
177 176
178 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) { 177 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) {
179 // If there was an earlier error, do not attempt to push bytes to the 178 // If there was an earlier error, do not attempt to push bytes to the
180 // QueueStreamer. Otherwise the thread could become blocked. 179 // QueueStreamer. Otherwise the thread could become blocked.
181 if (HadError.load()) 180 if (HadError.load())
182 return true; 181 return true;
183 return InputStream->PutBytes( 182 return InputStream->PutBytes(
184 const_cast<unsigned char *>( 183 const_cast<unsigned char *>(
185 reinterpret_cast<const unsigned char *>(Data)), 184 reinterpret_cast<const unsigned char *>(Data)),
(...skipping 26 matching lines...) Expand all
212 EmitStream = getOutputStream(ObjFD); 211 EmitStream = getOutputStream(ObjFD);
213 EmitStream->SetBufferSize(1 << 14); 212 EmitStream->SetBufferSize(1 << 14);
214 std::unique_ptr<StringStream> ErrStrm(new StringStream()); 213 std::unique_ptr<StringStream> ErrStrm(new StringStream());
215 ErrorStream = std::move(ErrStrm); 214 ErrorStream = std::move(ErrStrm);
216 ELFStream.reset(new ELFStreamer(*EmitStream.get())); 215 ELFStream.reset(new ELFStreamer(*EmitStream.get()));
217 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(), 216 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(),
218 &ErrorStream->getStream(), ELFStream.get())); 217 &ErrorStream->getStream(), ELFStream.get()));
219 CompileThread = std::thread([this]() { 218 CompileThread = std::thread([this]() {
220 llvm::install_fatal_error_handler(fatalErrorHandler, this); 219 llvm::install_fatal_error_handler(fatalErrorHandler, this);
221 Ctx->initParserThread(); 220 Ctx->initParserThread();
222 this->getCompiler().run(*Flags, *Ctx.get(), 221 this->getCompiler().run(ClFlags::Flags, *Ctx.get(),
223 // Retain original reference, but the compiler 222 // Retain original reference, but the compiler
224 // (LLVM's MemoryObject) wants to handle deletion. 223 // (LLVM's MemoryObject) wants to handle deletion.
225 std::unique_ptr<llvm::DataStreamer>(InputStream)); 224 std::unique_ptr<llvm::DataStreamer>(InputStream));
226 }); 225 });
227 } 226 }
228 227
229 } // end of namespace Ice 228 } // end of namespace Ice
230 229
231 #else // !PNACL_BROWSER_TRANSLATOR 230 #else // !PNACL_BROWSER_TRANSLATOR
232 231
233 #include "llvm/Support/ErrorHandling.h" 232 #include "llvm/Support/ErrorHandling.h"
234 233
235 namespace Ice { 234 namespace Ice {
236 235
237 BrowserCompileServer::~BrowserCompileServer() {} 236 BrowserCompileServer::~BrowserCompileServer() {}
238 237
239 void BrowserCompileServer::run() { 238 void BrowserCompileServer::run() {
240 llvm::report_fatal_error("no browser hookups"); 239 llvm::report_fatal_error("no browser hookups");
241 } 240 }
242 241
243 ErrorCode &BrowserCompileServer::getErrorCode() { 242 ErrorCode &BrowserCompileServer::getErrorCode() {
244 llvm::report_fatal_error("no browser hookups"); 243 llvm::report_fatal_error("no browser hookups");
245 } 244 }
246 245
247 } // end of namespace Ice 246 } // end of namespace Ice
248 247
249 #endif // PNACL_BROWSER_TRANSLATOR 248 #endif // PNACL_BROWSER_TRANSLATOR
OLDNEW
« no previous file with comments | « src/IceBrowserCompileServer.h ('k') | src/IceCfg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698