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

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: Remove fixed TODO 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
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.setBuildOnRead(true);
Jim Stichnoth 2016/04/01 23:36:58 I think you can and should remove this because the
Karl 2016/04/02 16:55:55 Removed BuildOnRead, left InputFileFormat for anot
175 Flags->setInputFileFormat(llvm::PNaClFormat); 175 ClFlags::Flags.setInputFileFormat(llvm::PNaClFormat);
176 } 176 }
177 177
178 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) { 178 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) {
179 // If there was an earlier error, do not attempt to push bytes to the 179 // If there was an earlier error, do not attempt to push bytes to the
180 // QueueStreamer. Otherwise the thread could become blocked. 180 // QueueStreamer. Otherwise the thread could become blocked.
181 if (HadError.load()) 181 if (HadError.load())
182 return true; 182 return true;
183 return InputStream->PutBytes( 183 return InputStream->PutBytes(
184 const_cast<unsigned char *>( 184 const_cast<unsigned char *>(
185 reinterpret_cast<const unsigned char *>(Data)), 185 reinterpret_cast<const unsigned char *>(Data)),
(...skipping 26 matching lines...) Expand all
212 EmitStream = getOutputStream(ObjFD); 212 EmitStream = getOutputStream(ObjFD);
213 EmitStream->SetBufferSize(1 << 14); 213 EmitStream->SetBufferSize(1 << 14);
214 std::unique_ptr<StringStream> ErrStrm(new StringStream()); 214 std::unique_ptr<StringStream> ErrStrm(new StringStream());
215 ErrorStream = std::move(ErrStrm); 215 ErrorStream = std::move(ErrStrm);
216 ELFStream.reset(new ELFStreamer(*EmitStream.get())); 216 ELFStream.reset(new ELFStreamer(*EmitStream.get()));
217 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(), 217 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(),
218 &ErrorStream->getStream(), ELFStream.get())); 218 &ErrorStream->getStream(), ELFStream.get()));
219 CompileThread = std::thread([this]() { 219 CompileThread = std::thread([this]() {
220 llvm::install_fatal_error_handler(fatalErrorHandler, this); 220 llvm::install_fatal_error_handler(fatalErrorHandler, this);
221 Ctx->initParserThread(); 221 Ctx->initParserThread();
222 this->getCompiler().run(*Flags, *Ctx.get(), 222 this->getCompiler().run(ClFlags::Flags, *Ctx.get(),
223 // Retain original reference, but the compiler 223 // Retain original reference, but the compiler
224 // (LLVM's MemoryObject) wants to handle deletion. 224 // (LLVM's MemoryObject) wants to handle deletion.
225 std::unique_ptr<llvm::DataStreamer>(InputStream)); 225 std::unique_ptr<llvm::DataStreamer>(InputStream));
226 }); 226 });
227 } 227 }
228 228
229 } // end of namespace Ice 229 } // end of namespace Ice
230 230
231 #else // !PNACL_BROWSER_TRANSLATOR 231 #else // !PNACL_BROWSER_TRANSLATOR
232 232
233 #include "llvm/Support/ErrorHandling.h" 233 #include "llvm/Support/ErrorHandling.h"
234 234
235 namespace Ice { 235 namespace Ice {
236 236
237 BrowserCompileServer::~BrowserCompileServer() {} 237 BrowserCompileServer::~BrowserCompileServer() {}
238 238
239 void BrowserCompileServer::run() { 239 void BrowserCompileServer::run() {
240 llvm::report_fatal_error("no browser hookups"); 240 llvm::report_fatal_error("no browser hookups");
241 } 241 }
242 242
243 ErrorCode &BrowserCompileServer::getErrorCode() { 243 ErrorCode &BrowserCompileServer::getErrorCode() {
244 llvm::report_fatal_error("no browser hookups"); 244 llvm::report_fatal_error("no browser hookups");
245 } 245 }
246 246
247 } // end of namespace Ice 247 } // end of namespace Ice
248 248
249 #endif // PNACL_BROWSER_TRANSLATOR 249 #endif // PNACL_BROWSER_TRANSLATOR
OLDNEW
« no previous file with comments | « src/IceBrowserCompileServer.h ('k') | src/IceCfg.cpp » ('j') | src/IceFixups.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698