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

Side by Side Diff: src/llvm2ice.cpp

Issue 916653004: Subzero: Emit functions and global initializers in a separate thread. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Const change 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 unified diff | Download patch
« no previous file with comments | « src/assembler.h ('k') | tests_lit/llvm2ice_tests/arith-opt.ll » ('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/llvm2ice.cpp - Driver for testing ----------------------===// 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===//
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 // This file defines a driver that uses LLVM capabilities to parse a 10 // This file defines a driver that uses LLVM capabilities to parse a
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 if (UseELFWriter) { 367 if (UseELFWriter) {
368 Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx); 368 Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx);
369 Ctx.getObjectWriter()->writeInitialELFHeader(); 369 Ctx.getObjectWriter()->writeInitialELFHeader();
370 } 370 }
371 371
372 Ctx.startWorkerThreads(); 372 Ctx.startWorkerThreads();
373 373
374 std::unique_ptr<Ice::Translator> Translator; 374 std::unique_ptr<Ice::Translator> Translator;
375 if (BuildOnRead) { 375 if (BuildOnRead) {
376 std::unique_ptr<Ice::PNaClTranslator> PTranslator( 376 std::unique_ptr<Ice::PNaClTranslator> PTranslator(
377 new Ice::PNaClTranslator(&Ctx, Flags)); 377 new Ice::PNaClTranslator(&Ctx));
378 PTranslator->translate(IRFilename); 378 PTranslator->translate(IRFilename);
379 Translator.reset(PTranslator.release()); 379 Translator.reset(PTranslator.release());
380 } else if (ALLOW_LLVM_IR) { 380 } else if (ALLOW_LLVM_IR) {
381 // Parse the input LLVM IR file into a module. 381 // Parse the input LLVM IR file into a module.
382 SMDiagnostic Err; 382 SMDiagnostic Err;
383 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); 383 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
384 raw_ostream *Verbose = LLVMVerboseErrors ? &errs() : nullptr; 384 raw_ostream *Verbose = LLVMVerboseErrors ? &errs() : nullptr;
385 Module *Mod = NaClParseIRFile(IRFilename, InputFileFormat, Err, Verbose, 385 Module *Mod = NaClParseIRFile(IRFilename, InputFileFormat, Err, Verbose,
386 getGlobalContext()); 386 getGlobalContext());
387 387
388 if (!Mod) { 388 if (!Mod) {
389 Err.print(argv[0], errs()); 389 Err.print(argv[0], errs());
390 return GetReturnValue(Ice::EC_Bitcode); 390 return GetReturnValue(Ice::EC_Bitcode);
391 } 391 }
392 392
393 std::unique_ptr<Ice::Converter> Converter( 393 std::unique_ptr<Ice::Converter> Converter(new Ice::Converter(Mod, &Ctx));
394 new Ice::Converter(Mod, &Ctx, Flags));
395 Converter->convertToIce(); 394 Converter->convertToIce();
396 Translator.reset(Converter.release()); 395 Translator.reset(Converter.release());
397 } else { 396 } else {
398 *Ls << "Error: Build doesn't allow LLVM IR, " 397 *Ls << "Error: Build doesn't allow LLVM IR, "
399 << "--build-on-read=0 not allowed\n"; 398 << "--build-on-read=0 not allowed\n";
400 return GetReturnValue(Ice::EC_Args); 399 return GetReturnValue(Ice::EC_Args);
401 } 400 }
402 401
403 Ctx.waitForWorkerThreads(); 402 Ctx.waitForWorkerThreads();
404 Translator->transferErrorCode(); 403 Translator->transferErrorCode();
405 Translator->emitConstants(); 404 Translator->emitConstants();
406 405
407 if (UseELFWriter) { 406 if (UseELFWriter) {
408 Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx); 407 Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx);
409 Ctx.getObjectWriter()->setUndefinedSyms(Ctx.getConstantExternSyms()); 408 Ctx.getObjectWriter()->setUndefinedSyms(Ctx.getConstantExternSyms());
410 Ctx.getObjectWriter()->writeNonUserSections(); 409 Ctx.getObjectWriter()->writeNonUserSections();
411 } 410 }
412 if (SubzeroTimingEnabled) 411 if (SubzeroTimingEnabled)
413 Ctx.dumpTimers(); 412 Ctx.dumpTimers();
414 if (TimeEachFunction) { 413 if (TimeEachFunction) {
415 const bool DumpCumulative = false; 414 const bool DumpCumulative = false;
416 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); 415 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative);
417 } 416 }
418 const bool FinalStats = true; 417 const bool FinalStats = true;
419 Ctx.dumpStats("_FINAL_", FinalStats); 418 Ctx.dumpStats("_FINAL_", FinalStats);
420 return GetReturnValue(Ctx.getErrorStatus()->value()); 419 return GetReturnValue(Ctx.getErrorStatus()->value());
421 } 420 }
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | tests_lit/llvm2ice_tests/arith-opt.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698