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 /// \file | 10 /// \file |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 Cfg::setCurrentCfg(nullptr); | 302 Cfg::setCurrentCfg(nullptr); |
303 continue; // Func goes out of scope and gets deleted | 303 continue; // Func goes out of scope and gets deleted |
304 } | 304 } |
305 | 305 |
306 Func->translate(); | 306 Func->translate(); |
307 EmitterWorkItem *Item = nullptr; | 307 EmitterWorkItem *Item = nullptr; |
308 if (Func->hasError()) { | 308 if (Func->hasError()) { |
309 getErrorStatus()->assign(EC_Translation); | 309 getErrorStatus()->assign(EC_Translation); |
310 OstreamLocker L(this); | 310 OstreamLocker L(this); |
311 getStrError() << "ICE translation error: " << Func->getFunctionName() | 311 getStrError() << "ICE translation error: " << Func->getFunctionName() |
312 << ": " << Func->getError() << "\n"; | 312 << ": " << Func->getError() << ": " |
| 313 << Func->getFunctionNameAndSize() << "\n"; |
313 Item = new EmitterWorkItem(Func->getSequenceNumber()); | 314 Item = new EmitterWorkItem(Func->getSequenceNumber()); |
314 } else { | 315 } else { |
315 Func->getAssembler<>()->setInternal(Func->getInternal()); | 316 Func->getAssembler<>()->setInternal(Func->getInternal()); |
316 switch (getFlags().getOutFileType()) { | 317 switch (getFlags().getOutFileType()) { |
317 case FT_Elf: | 318 case FT_Elf: |
318 case FT_Iasm: { | 319 case FT_Iasm: { |
319 Func->emitIAS(); | 320 Func->emitIAS(); |
320 // The Cfg has already emitted into the assembly buffer, so | 321 // The Cfg has already emitted into the assembly buffer, so |
321 // stats have been fully collected into this thread's TLS. | 322 // stats have been fully collected into this thread's TLS. |
322 // Dump them before TLS is reset for the next Cfg. | 323 // Dump them before TLS is reset for the next Cfg. |
323 dumpStats(Func->getFunctionName()); | 324 dumpStats(Func->getFunctionNameAndSize()); |
324 Assembler *Asm = Func->releaseAssembler(); | 325 Assembler *Asm = Func->releaseAssembler(); |
325 // Copy relevant fields into Asm before Func is deleted. | 326 // Copy relevant fields into Asm before Func is deleted. |
326 Asm->setFunctionName(Func->getFunctionName()); | 327 Asm->setFunctionName(Func->getFunctionName()); |
327 Item = new EmitterWorkItem(Func->getSequenceNumber(), Asm); | 328 Item = new EmitterWorkItem(Func->getSequenceNumber(), Asm); |
328 Item->setGlobalInits(Func->getGlobalInits()); | 329 Item->setGlobalInits(Func->getGlobalInits()); |
329 } break; | 330 } break; |
330 case FT_Asm: | 331 case FT_Asm: |
331 // The Cfg has not been emitted yet, so stats are not ready | 332 // The Cfg has not been emitted yet, so stats are not ready |
332 // to be dumped. | 333 // to be dumped. |
333 std::unique_ptr<VariableDeclarationList> GlobalInits = | 334 std::unique_ptr<VariableDeclarationList> GlobalInits = |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 accumulateGlobals(Item->getGlobalInits()); | 543 accumulateGlobals(Item->getGlobalInits()); |
543 | 544 |
544 assert(getFlags().getOutFileType() == FT_Asm); | 545 assert(getFlags().getOutFileType() == FT_Asm); |
545 std::unique_ptr<Cfg> Func = Item->getCfg(); | 546 std::unique_ptr<Cfg> Func = Item->getCfg(); |
546 // Unfortunately, we have to temporarily install the Cfg in TLS | 547 // Unfortunately, we have to temporarily install the Cfg in TLS |
547 // because Variable::asType() uses the allocator to create the | 548 // because Variable::asType() uses the allocator to create the |
548 // differently-typed copy. | 549 // differently-typed copy. |
549 Cfg::setCurrentCfg(Func.get()); | 550 Cfg::setCurrentCfg(Func.get()); |
550 Func->emit(); | 551 Func->emit(); |
551 Cfg::setCurrentCfg(nullptr); | 552 Cfg::setCurrentCfg(nullptr); |
552 dumpStats(Func->getFunctionName()); | 553 dumpStats(Func->getFunctionNameAndSize()); |
553 } break; | 554 } break; |
554 } | 555 } |
555 } | 556 } |
556 // Update the start index for next shuffling queue | 557 // Update the start index for next shuffling queue |
557 ShuffleStartIndex = ShuffleEndIndex; | 558 ShuffleStartIndex = ShuffleEndIndex; |
558 } | 559 } |
559 | 560 |
560 // In case there are no code to be generated, we invoke the conditional | 561 // In case there are no code to be generated, we invoke the conditional |
561 // lowerGlobals again -- this is a no-op if code has been emitted. | 562 // lowerGlobals again -- this is a no-op if code has been emitted. |
562 lowerGlobalsIfNoCodeHasBeenSeen(); | 563 lowerGlobalsIfNoCodeHasBeenSeen(); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 Ctx = Func->getContext(); | 1016 Ctx = Func->getContext(); |
1016 Active = | 1017 Active = |
1017 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1018 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
1018 if (Active) | 1019 if (Active) |
1019 Ctx->pushTimer(ID, StackID); | 1020 Ctx->pushTimer(ID, StackID); |
1020 } | 1021 } |
1021 | 1022 |
1022 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1023 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
1023 | 1024 |
1024 } // end of namespace Ice | 1025 } // end of namespace Ice |
OLD | NEW |