| OLD | NEW |
| 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 // 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const std::string LLSuffix = ".ll"; | 95 const std::string LLSuffix = ".ll"; |
| 96 const IceString &IRFilename = ExtraFlags.getIRFilename(); | 96 const IceString &IRFilename = ExtraFlags.getIRFilename(); |
| 97 bool BuildOnRead = ExtraFlags.getBuildOnRead(); | 97 bool BuildOnRead = ExtraFlags.getBuildOnRead(); |
| 98 if (ALLOW_LLVM_IR_AS_INPUT && IRFilename.length() >= LLSuffix.length() && | 98 if (ALLOW_LLVM_IR_AS_INPUT && IRFilename.length() >= LLSuffix.length() && |
| 99 IRFilename.compare(IRFilename.length() - LLSuffix.length(), | 99 IRFilename.compare(IRFilename.length() - LLSuffix.length(), |
| 100 LLSuffix.length(), LLSuffix) == 0) | 100 LLSuffix.length(), LLSuffix) == 0) |
| 101 BuildOnRead = false; | 101 BuildOnRead = false; |
| 102 | 102 |
| 103 TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); | 103 TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); |
| 104 | 104 |
| 105 if (Ctx.getFlags().getOutFileType() == FT_Elf) { | 105 Ctx.emitFileHeader(); |
| 106 TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx); | |
| 107 Ctx.getObjectWriter()->writeInitialELFHeader(); | |
| 108 } | |
| 109 | |
| 110 Ctx.startWorkerThreads(); | 106 Ctx.startWorkerThreads(); |
| 111 | 107 |
| 112 std::unique_ptr<Translator> Translator; | 108 std::unique_ptr<Translator> Translator; |
| 113 if (BuildOnRead) { | 109 if (BuildOnRead) { |
| 114 std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx)); | 110 std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx)); |
| 115 std::unique_ptr<llvm::StreamingMemoryObject> MemObj( | 111 std::unique_ptr<llvm::StreamingMemoryObject> MemObj( |
| 116 new llvm::StreamingMemoryObjectImpl(InputStream.release())); | 112 new llvm::StreamingMemoryObjectImpl(InputStream.release())); |
| 117 PTranslator->translate(IRFilename, std::move(MemObj)); | 113 PTranslator->translate(IRFilename, std::move(MemObj)); |
| 118 Translator.reset(PTranslator.release()); | 114 Translator.reset(PTranslator.release()); |
| 119 } else if (ALLOW_LLVM_IR) { | 115 } else if (ALLOW_LLVM_IR) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 Ctx.dumpTimers(); | 153 Ctx.dumpTimers(); |
| 158 if (Ctx.getFlags().getTimeEachFunction()) { | 154 if (Ctx.getFlags().getTimeEachFunction()) { |
| 159 const bool DumpCumulative = false; | 155 const bool DumpCumulative = false; |
| 160 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); | 156 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); |
| 161 } | 157 } |
| 162 const bool FinalStats = true; | 158 const bool FinalStats = true; |
| 163 Ctx.dumpStats("_FINAL_", FinalStats); | 159 Ctx.dumpStats("_FINAL_", FinalStats); |
| 164 } | 160 } |
| 165 | 161 |
| 166 } // end of namespace Ice | 162 } // end of namespace Ice |
| OLD | NEW |