| OLD | NEW |
| 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// | 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// |
| 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 aspects of the compilation that persist across | 10 // This file defines aspects of the compilation that persist across |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n"; | 207 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n"; |
| 208 Str << "|" << Name << "|Memory Usage|"; | 208 Str << "|" << Name << "|Memory Usage|"; |
| 209 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed()) | 209 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed()) |
| 210 Str << MemUsed; | 210 Str << MemUsed; |
| 211 else | 211 else |
| 212 Str << "(requires '-track-memory')"; | 212 Str << "(requires '-track-memory')"; |
| 213 Str << "\n"; | 213 Str << "\n"; |
| 214 } | 214 } |
| 215 | 215 |
| 216 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, | 216 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, |
| 217 ELFStreamer *ELFStr, const ClFlags &Flags) | 217 ELFStreamer *ELFStr, const ClFlags &Flags, |
| 218 Ostream *OsError) |
| 218 : ConstPool(new ConstantPool()), ErrorStatus(), StrDump(OsDump), | 219 : ConstPool(new ConstantPool()), ErrorStatus(), StrDump(OsDump), |
| 219 StrEmit(OsEmit), Flags(Flags), RNG(Flags.getRandomSeed()), ObjectWriter(), | 220 StrEmit(OsEmit), StrError(OsError), Flags(Flags), |
| 221 RNG(Flags.getRandomSeed()), ObjectWriter(), |
| 220 OptQ(/*Sequential=*/Flags.isSequential(), | 222 OptQ(/*Sequential=*/Flags.isSequential(), |
| 221 /*MaxSize=*/Flags.getNumTranslationThreads()), | 223 /*MaxSize=*/Flags.getNumTranslationThreads()), |
| 222 // EmitQ is allowed unlimited size. | 224 // EmitQ is allowed unlimited size. |
| 223 EmitQ(/*Sequential=*/Flags.isSequential()) { | 225 EmitQ(/*Sequential=*/Flags.isSequential()) { |
| 224 // Make sure thread_local fields are properly initialized before any | 226 // Make sure thread_local fields are properly initialized before any |
| 225 // accesses are made. Do this here instead of at the start of | 227 // accesses are made. Do this here instead of at the start of |
| 226 // main() so that all clients (e.g. unit tests) can benefit for | 228 // main() so that all clients (e.g. unit tests) can benefit for |
| 227 // free. | 229 // free. |
| 228 GlobalContext::TlsInit(); | 230 GlobalContext::TlsInit(); |
| 229 Cfg::TlsInit(); | 231 Cfg::TlsInit(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 getFlags().getTranslateOnly())) { | 273 getFlags().getTranslateOnly())) { |
| 272 Func->dump(); | 274 Func->dump(); |
| 273 Cfg::setCurrentCfg(nullptr); | 275 Cfg::setCurrentCfg(nullptr); |
| 274 continue; // Func goes out of scope and gets deleted | 276 continue; // Func goes out of scope and gets deleted |
| 275 } | 277 } |
| 276 Func->translate(); | 278 Func->translate(); |
| 277 EmitterWorkItem *Item = nullptr; | 279 EmitterWorkItem *Item = nullptr; |
| 278 if (Func->hasError()) { | 280 if (Func->hasError()) { |
| 279 getErrorStatus()->assign(EC_Translation); | 281 getErrorStatus()->assign(EC_Translation); |
| 280 OstreamLocker L(this); | 282 OstreamLocker L(this); |
| 281 getStrDump() << "ICE translation error: " << Func->getFunctionName() | 283 getStrError() << "ICE translation error: " << Func->getFunctionName() |
| 282 << ": " << Func->getError() << "\n"; | 284 << ": " << Func->getError() << "\n"; |
| 283 Item = new EmitterWorkItem(Func->getSequenceNumber()); | 285 Item = new EmitterWorkItem(Func->getSequenceNumber()); |
| 284 } else { | 286 } else { |
| 285 Func->getAssembler<>()->setInternal(Func->getInternal()); | 287 Func->getAssembler<>()->setInternal(Func->getInternal()); |
| 286 switch (getFlags().getOutFileType()) { | 288 switch (getFlags().getOutFileType()) { |
| 287 case FT_Elf: | 289 case FT_Elf: |
| 288 case FT_Iasm: { | 290 case FT_Iasm: { |
| 289 Func->emitIAS(); | 291 Func->emitIAS(); |
| 290 // The Cfg has already emitted into the assembly buffer, so | 292 // The Cfg has already emitted into the assembly buffer, so |
| 291 // stats have been fully collected into this thread's TLS. | 293 // stats have been fully collected into this thread's TLS. |
| 292 // Dump them before TLS is reset for the next Cfg. | 294 // Dump them before TLS is reset for the next Cfg. |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 Ctx = Func->getContext(); | 827 Ctx = Func->getContext(); |
| 826 Active = | 828 Active = |
| 827 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 829 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 828 if (Active) | 830 if (Active) |
| 829 Ctx->pushTimer(ID, StackID); | 831 Ctx->pushTimer(ID, StackID); |
| 830 } | 832 } |
| 831 | 833 |
| 832 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 834 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 833 | 835 |
| 834 } // end of namespace Ice | 836 } // end of namespace Ice |
| OLD | NEW |