OLD | NEW |
1 //===- subzero/src/main.cpp - Driver for bitcode translation --------------===// | 1 //===- subzero/src/main.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 // This file defines a driver for translating PNaCl bitcode into native code. | 10 // This file defines a driver for translating PNaCl bitcode into native code. |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 std::ofstream Ofs; | 333 std::ofstream Ofs; |
334 switch (OutFileType) { | 334 switch (OutFileType) { |
335 case Ice::FT_Elf: { | 335 case Ice::FT_Elf: { |
336 if (OutputFilename == "-") { | 336 if (OutputFilename == "-") { |
337 *Ls << "Error: writing binary ELF to stdout is unsupported\n"; | 337 *Ls << "Error: writing binary ELF to stdout is unsupported\n"; |
338 return GetReturnValue(Ice::EC_Args); | 338 return GetReturnValue(Ice::EC_Args); |
339 } | 339 } |
340 std::error_code EC; | 340 std::error_code EC; |
341 raw_fd_ostream *FdOs = | 341 raw_fd_ostream *FdOs = |
342 new raw_fd_ostream(OutputFilename, EC, sys::fs::F_None); | 342 new raw_fd_ostream(OutputFilename, EC, sys::fs::F_None); |
| 343 // NaCl sets st_blksize to 0, and LLVM uses that to pick the |
| 344 // default preferred buffer size. Set to something non-zero. |
| 345 FdOs->SetBufferSize(1 << 14); |
343 Os.reset(FdOs); | 346 Os.reset(FdOs); |
344 if (EC) { | 347 if (EC) { |
345 *Ls << "Failed to open output file: " << OutputFilename << ":\n" | 348 *Ls << "Failed to open output file: " << OutputFilename << ":\n" |
346 << EC.message() << "\n"; | 349 << EC.message() << "\n"; |
347 return GetReturnValue(Ice::EC_Args); | 350 return GetReturnValue(Ice::EC_Args); |
348 } | 351 } |
349 ELFStr.reset(new Ice::ELFStreamer(*FdOs)); | 352 ELFStr.reset(new Ice::ELFStreamer(*FdOs)); |
350 } break; | 353 } break; |
351 case Ice::FT_Asm: | 354 case Ice::FT_Asm: |
352 case Ice::FT_Iasm: { | 355 case Ice::FT_Iasm: { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (SubzeroTimingEnabled) | 416 if (SubzeroTimingEnabled) |
414 Ctx.dumpTimers(); | 417 Ctx.dumpTimers(); |
415 if (TimeEachFunction) { | 418 if (TimeEachFunction) { |
416 const bool DumpCumulative = false; | 419 const bool DumpCumulative = false; |
417 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 420 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
418 } | 421 } |
419 const bool FinalStats = true; | 422 const bool FinalStats = true; |
420 Ctx.dumpStats("_FINAL_", FinalStats); | 423 Ctx.dumpStats("_FINAL_", FinalStats); |
421 return GetReturnValue(Ctx.getErrorStatus()->value()); | 424 return GetReturnValue(Ctx.getErrorStatus()->value()); |
422 } | 425 } |
OLD | NEW |