| 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 |
| 11 /// \brief Defines aspects of the compilation that persist across multiple | 11 /// \brief Defines aspects of the compilation that persist across multiple |
| 12 /// functions. | 12 /// functions. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceGlobalContext.h" | 16 #include "IceGlobalContext.h" |
| 17 | 17 |
| 18 #include "IceCfg.h" | 18 #include "IceCfg.h" |
| 19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 20 #include "IceClFlags.h" | 20 #include "IceClFlags.h" |
| 21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
| 22 #include "IceELFObjectWriter.h" | 22 #include "IceELFObjectWriter.h" |
| 23 #include "IceGlobalInits.h" | 23 #include "IceGlobalInits.h" |
| 24 #include "IceLiveness.h" | 24 #include "IceLiveness.h" |
| 25 #include "IceOperand.h" | 25 #include "IceOperand.h" |
| 26 #include "IceRevision.h" |
| 26 #include "IceTargetLowering.h" | 27 #include "IceTargetLowering.h" |
| 27 #include "IceTimerTree.h" | 28 #include "IceTimerTree.h" |
| 28 #include "IceTypes.def" | 29 #include "IceTypes.def" |
| 29 #include "IceTypes.h" | 30 #include "IceTypes.h" |
| 30 | 31 |
| 31 #ifdef __clang__ | 32 #ifdef __clang__ |
| 32 #pragma clang diagnostic push | 33 #pragma clang diagnostic push |
| 33 #pragma clang diagnostic ignored "-Wunused-parameter" | 34 #pragma clang diagnostic ignored "-Wunused-parameter" |
| 34 #endif // __clang__ | 35 #endif // __clang__ |
| 35 | 36 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 #undef X | 351 #undef X |
| 351 ConstantTrue = getConstantInt1Internal(1); | 352 ConstantTrue = getConstantInt1Internal(1); |
| 352 // Define runtime helper functions. | 353 // Define runtime helper functions. |
| 353 #define X(Tag, Name) \ | 354 #define X(Tag, Name) \ |
| 354 RuntimeHelperFunc[static_cast<size_t>(RuntimeHelper::H_##Tag)] = \ | 355 RuntimeHelperFunc[static_cast<size_t>(RuntimeHelper::H_##Tag)] = \ |
| 355 getConstantExternSym(getGlobalString(Name)); | 356 getConstantExternSym(getGlobalString(Name)); |
| 356 RUNTIME_HELPER_FUNCTIONS_TABLE | 357 RUNTIME_HELPER_FUNCTIONS_TABLE |
| 357 #undef X | 358 #undef X |
| 358 | 359 |
| 359 TargetLowering::staticInit(this); | 360 TargetLowering::staticInit(this); |
| 361 |
| 362 if (getFlags().getEmitRevision()) { |
| 363 // Embed the Subzero revision into the compiled binary by creating a special |
| 364 // global variable initialized with the revision string. |
| 365 auto *Revision = VariableDeclaration::create(&Globals, true); |
| 366 Revision->setName(this, "__Sz_revision"); |
| 367 Revision->setIsConstant(true); |
| 368 const char *RevisionString = getSubzeroRevision(); |
| 369 Revision->addInitializer(VariableDeclaration::DataInitializer::create( |
| 370 &Globals, RevisionString, 1 + strlen(RevisionString))); |
| 371 Globals.push_back(Revision); |
| 372 } |
| 360 } | 373 } |
| 361 | 374 |
| 362 void GlobalContext::translateFunctions() { | 375 void GlobalContext::translateFunctions() { |
| 363 TimerMarker Timer(TimerStack::TT_translateFunctions, this); | 376 TimerMarker Timer(TimerStack::TT_translateFunctions, this); |
| 364 while (std::unique_ptr<OptWorkItem> OptItem = optQueueBlockingPop()) { | 377 while (std::unique_ptr<OptWorkItem> OptItem = optQueueBlockingPop()) { |
| 365 std::unique_ptr<EmitterWorkItem> Item; | 378 std::unique_ptr<EmitterWorkItem> Item; |
| 366 auto Func = OptItem->getParsedCfg(); | 379 auto Func = OptItem->getParsedCfg(); |
| 367 // Install Func in TLS for Cfg-specific container allocators. | 380 // Install Func in TLS for Cfg-specific container allocators. |
| 368 CfgLocalAllocatorScope _(Func.get()); | 381 CfgLocalAllocatorScope _(Func.get()); |
| 369 // Reset per-function stats being accumulated in TLS. | 382 // Reset per-function stats being accumulated in TLS. |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 void TimerMarker::pushCfg(const Cfg *Func) { | 1054 void TimerMarker::pushCfg(const Cfg *Func) { |
| 1042 Ctx = Func->getContext(); | 1055 Ctx = Func->getContext(); |
| 1043 Active = Func->getFocusedTiming() || getFlags().getSubzeroTimingEnabled(); | 1056 Active = Func->getFocusedTiming() || getFlags().getSubzeroTimingEnabled(); |
| 1044 if (Active) | 1057 if (Active) |
| 1045 Ctx->pushTimer(ID, StackID); | 1058 Ctx->pushTimer(ID, StackID); |
| 1046 } | 1059 } |
| 1047 | 1060 |
| 1048 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1061 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1049 | 1062 |
| 1050 } // end of namespace Ice | 1063 } // end of namespace Ice |
| OLD | NEW |