Chromium Code Reviews| 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 "IceClFlagsExtra.h" | |
| 21 #include "IceDefs.h" | 22 #include "IceDefs.h" |
| 22 #include "IceELFObjectWriter.h" | 23 #include "IceELFObjectWriter.h" |
| 23 #include "IceGlobalInits.h" | 24 #include "IceGlobalInits.h" |
| 24 #include "IceOperand.h" | 25 #include "IceOperand.h" |
| 25 #include "IceTargetLowering.h" | 26 #include "IceTargetLowering.h" |
| 26 #include "IceTimerTree.h" | 27 #include "IceTimerTree.h" |
| 27 #include "IceTypes.h" | 28 #include "IceTypes.h" |
| 28 | 29 |
| 29 #ifdef __clang__ | 30 #ifdef __clang__ |
| 30 #pragma clang diagnostic push | 31 #pragma clang diagnostic push |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 Str << "|i16=" << Pool->Integers16.size(); | 244 Str << "|i16=" << Pool->Integers16.size(); |
| 244 Str << "|i32=" << Pool->Integers32.size(); | 245 Str << "|i32=" << Pool->Integers32.size(); |
| 245 Str << "|i64=" << Pool->Integers64.size(); | 246 Str << "|i64=" << Pool->Integers64.size(); |
| 246 Str << "|Rel=" << Pool->Relocatables.size(); | 247 Str << "|Rel=" << Pool->Relocatables.size(); |
| 247 Str << "|ExtRel=" << Pool->ExternRelocatables.size(); | 248 Str << "|ExtRel=" << Pool->ExternRelocatables.size(); |
| 248 } | 249 } |
| 249 Str << "\n"; | 250 Str << "\n"; |
| 250 } | 251 } |
| 251 | 252 |
| 252 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, | 253 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, |
| 253 ELFStreamer *ELFStr, const ClFlags &Flags) | 254 ELFStreamer *ELFStr) |
| 254 : ConstPool(new ConstantPool()), ErrorStatus(), StrDump(OsDump), | 255 : ConstPool(new ConstantPool()), ErrorStatus(), StrDump(OsDump), |
| 255 StrEmit(OsEmit), StrError(OsError), Flags(Flags), ObjectWriter(), | 256 StrEmit(OsEmit), StrError(OsError), ObjectWriter(), |
| 256 OptQ(/*Sequential=*/Flags.isSequential(), | 257 OptQ(/*Sequential=*/Flags.isSequential(), |
| 257 /*MaxSize=*/Flags.getNumTranslationThreads()), | 258 /*MaxSize=*/Flags.getNumTranslationThreads()), |
| 258 // EmitQ is allowed unlimited size. | 259 // EmitQ is allowed unlimited size. |
| 259 EmitQ(/*Sequential=*/Flags.isSequential()), | 260 EmitQ(/*Sequential=*/Flags.isSequential()), |
| 260 DataLowering(TargetDataLowering::createLowering(this)) { | 261 DataLowering(TargetDataLowering::createLowering(this)) { |
| 261 assert(OsDump && "OsDump is not defined for GlobalContext"); | 262 assert(OsDump && "OsDump is not defined for GlobalContext"); |
| 262 assert(OsEmit && "OsEmit is not defined for GlobalContext"); | 263 assert(OsEmit && "OsEmit is not defined for GlobalContext"); |
| 263 assert(OsError && "OsError is not defined for GlobalContext"); | 264 assert(OsError && "OsError is not defined for GlobalContext"); |
| 264 // Make sure thread_local fields are properly initialized before any | 265 // Make sure thread_local fields are properly initialized before any |
| 265 // accesses are made. Do this here instead of at the start of | 266 // accesses are made. Do this here instead of at the start of |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 286 ObjectWriter.reset(new ELFObjectWriter(*this, *ELFStr)); | 287 ObjectWriter.reset(new ELFObjectWriter(*this, *ELFStr)); |
| 287 break; | 288 break; |
| 288 case FT_Asm: | 289 case FT_Asm: |
| 289 case FT_Iasm: | 290 case FT_Iasm: |
| 290 break; | 291 break; |
| 291 } | 292 } |
| 292 | 293 |
| 293 // ProfileBlockInfoVarDecl is initialized here because it takes this as a | 294 // ProfileBlockInfoVarDecl is initialized here because it takes this as a |
| 294 // parameter -- we want to | 295 // parameter -- we want to |
| 295 // ensure that at least this' member variables are initialized. | 296 // ensure that at least this' member variables are initialized. |
| 296 ProfileBlockInfoVarDecl = VariableDeclaration::create(this); | 297 ProfileBlockInfoVarDecl = VariableDeclaration::createExternal(this); |
| 297 ProfileBlockInfoVarDecl->setAlignment(typeWidthInBytes(IceType_i64)); | 298 ProfileBlockInfoVarDecl->setAlignment(typeWidthInBytes(IceType_i64)); |
| 298 ProfileBlockInfoVarDecl->setIsConstant(true); | 299 ProfileBlockInfoVarDecl->setIsConstant(true); |
| 299 | 300 |
| 300 // Note: if you change this symbol, make sure to update | 301 // Note: if you change this symbol, make sure to update |
| 301 // runtime/szrt_profiler.c as well. | 302 // runtime/szrt_profiler.c as well. |
| 302 ProfileBlockInfoVarDecl->setName("__Sz_block_profile_info"); | 303 ProfileBlockInfoVarDecl->setName("__Sz_block_profile_info"); |
| 303 ProfileBlockInfoVarDecl->setSuppressMangling(); | |
| 304 ProfileBlockInfoVarDecl->setLinkage(llvm::GlobalValue::ExternalLinkage); | |
| 305 | 304 |
| 306 TargetLowering::staticInit(this); | 305 TargetLowering::staticInit(this); |
| 307 } | 306 } |
| 308 | 307 |
| 309 void GlobalContext::translateFunctions() { | 308 void GlobalContext::translateFunctions() { |
| 310 while (std::unique_ptr<Cfg> Func = optQueueBlockingPop()) { | 309 while (std::unique_ptr<Cfg> Func = optQueueBlockingPop()) { |
| 311 // Install Func in TLS for Cfg-specific container allocators. | 310 // Install Func in TLS for Cfg-specific container allocators. |
| 312 CfgLocalAllocatorScope _(Func.get()); | 311 CfgLocalAllocatorScope _(Func.get()); |
| 313 // Reset per-function stats being accumulated in TLS. | 312 // Reset per-function stats being accumulated in TLS. |
| 314 resetStats(); | 313 resetStats(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 void GlobalContext::lowerGlobals(const IceString &SectionSuffix) { | 410 void GlobalContext::lowerGlobals(const IceString &SectionSuffix) { |
| 412 TimerMarker T(TimerStack::TT_emitGlobalInitializers, this); | 411 TimerMarker T(TimerStack::TT_emitGlobalInitializers, this); |
| 413 const bool DumpGlobalVariables = | 412 const bool DumpGlobalVariables = |
| 414 BuildDefs::dump() && | 413 BuildDefs::dump() && |
| 415 (Flags.getVerbose() & IceV_GlobalInit & Cfg::defaultVerboseMask()) && | 414 (Flags.getVerbose() & IceV_GlobalInit & Cfg::defaultVerboseMask()) && |
| 416 Flags.getVerboseFocusOn().empty(); | 415 Flags.getVerboseFocusOn().empty(); |
| 417 if (DumpGlobalVariables) { | 416 if (DumpGlobalVariables) { |
| 418 OstreamLocker L(this); | 417 OstreamLocker L(this); |
| 419 Ostream &Stream = getStrDump(); | 418 Ostream &Stream = getStrDump(); |
| 420 for (const Ice::VariableDeclaration *Global : Globals) { | 419 for (const Ice::VariableDeclaration *Global : Globals) { |
| 421 Global->dump(this, Stream); | 420 Global->dump(Stream); |
| 422 } | 421 } |
| 423 } | 422 } |
| 424 if (Flags.getDisableTranslation()) | 423 if (Flags.getDisableTranslation()) |
| 425 return; | 424 return; |
| 426 | 425 |
| 427 addBlockInfoPtrs(ProfileBlockInfoVarDecl); | 426 addBlockInfoPtrs(ProfileBlockInfoVarDecl); |
| 428 // If we need to shuffle the layout of global variables, shuffle them now. | 427 // If we need to shuffle the layout of global variables, shuffle them now. |
| 429 if (getFlags().shouldReorderGlobalVariables()) { | 428 if (getFlags().shouldReorderGlobalVariables()) { |
| 430 // Create a random number generator for global variable reordering. | 429 // Create a random number generator for global variable reordering. |
| 431 RandomNumberGenerator RNG(getFlags().getRandomSeed(), | 430 RandomNumberGenerator RNG(getFlags().getRandomSeed(), |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 break; | 537 break; |
| 539 case EmitterWorkItem::WI_GlobalInits: { | 538 case EmitterWorkItem::WI_GlobalInits: { |
| 540 accumulateGlobals(Item->getGlobalInits()); | 539 accumulateGlobals(Item->getGlobalInits()); |
| 541 } break; | 540 } break; |
| 542 case EmitterWorkItem::WI_Asm: { | 541 case EmitterWorkItem::WI_Asm: { |
| 543 lowerGlobalsIfNoCodeHasBeenSeen(); | 542 lowerGlobalsIfNoCodeHasBeenSeen(); |
| 544 accumulateGlobals(Item->getGlobalInits()); | 543 accumulateGlobals(Item->getGlobalInits()); |
| 545 | 544 |
| 546 std::unique_ptr<Assembler> Asm = Item->getAsm(); | 545 std::unique_ptr<Assembler> Asm = Item->getAsm(); |
| 547 Asm->alignFunction(); | 546 Asm->alignFunction(); |
| 548 IceString MangledName = mangleName(Asm->getFunctionName()); | 547 const IceString &Name = Asm->getFunctionName(); |
| 549 switch (getFlags().getOutFileType()) { | 548 switch (getFlags().getOutFileType()) { |
| 550 case FT_Elf: | 549 case FT_Elf: |
| 551 getObjectWriter()->writeFunctionCode(MangledName, Asm->getInternal(), | 550 getObjectWriter()->writeFunctionCode(Name, Asm->getInternal(), |
| 552 Asm.get()); | 551 Asm.get()); |
| 553 break; | 552 break; |
| 554 case FT_Iasm: { | 553 case FT_Iasm: { |
| 555 OstreamLocker L(this); | 554 OstreamLocker L(this); |
| 556 Cfg::emitTextHeader(MangledName, this, Asm.get()); | 555 Cfg::emitTextHeader(Name, this, Asm.get()); |
| 557 Asm->emitIASBytes(this); | 556 Asm->emitIASBytes(this); |
| 558 } break; | 557 } break; |
| 559 case FT_Asm: | 558 case FT_Asm: |
| 560 llvm::report_fatal_error("Unexpected FT_Asm"); | 559 llvm::report_fatal_error("Unexpected FT_Asm"); |
| 561 break; | 560 break; |
| 562 } | 561 } |
| 563 } break; | 562 } break; |
| 564 case EmitterWorkItem::WI_Cfg: { | 563 case EmitterWorkItem::WI_Cfg: { |
| 565 if (!BuildDefs::dump()) | 564 if (!BuildDefs::dump()) |
| 566 llvm::report_fatal_error("WI_Cfg work item created inappropriately"); | 565 llvm::report_fatal_error("WI_Cfg work item created inappropriately"); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 590 // Scan a string for S[0-9A-Z]*_ patterns and replace them with | 589 // Scan a string for S[0-9A-Z]*_ patterns and replace them with |
| 591 // S<num>_ where <num> is the next base-36 value. If a type name | 590 // S<num>_ where <num> is the next base-36 value. If a type name |
| 592 // legitimately contains that pattern, then the substitution will be | 591 // legitimately contains that pattern, then the substitution will be |
| 593 // made in error and most likely the link will fail. In this case, | 592 // made in error and most likely the link will fail. In this case, |
| 594 // the test classes can be rewritten not to use that pattern, which is | 593 // the test classes can be rewritten not to use that pattern, which is |
| 595 // much simpler and more reliable than implementing a full demangling | 594 // much simpler and more reliable than implementing a full demangling |
| 596 // parser. Another substitution-in-error may occur if a type | 595 // parser. Another substitution-in-error may occur if a type |
| 597 // identifier ends with the pattern S[0-9A-Z]*, because an immediately | 596 // identifier ends with the pattern S[0-9A-Z]*, because an immediately |
| 598 // following substitution string like "S1_" or "PS1_" may be combined | 597 // following substitution string like "S1_" or "PS1_" may be combined |
| 599 // with the previous type. | 598 // with the previous type. |
| 600 void GlobalContext::incrementSubstitutions(ManglerVector &OldName) const { | 599 void GlobalContext::incrementSubstitutions(ManglerVector &OldName) { |
| 601 const std::locale CLocale("C"); | 600 const std::locale CLocale("C"); |
| 602 // Provide extra space in case the length of <num> increases. | 601 // Provide extra space in case the length of <num> increases. |
| 603 ManglerVector NewName(OldName.size() * 2); | 602 ManglerVector NewName(OldName.size() * 2); |
| 604 size_t OldPos = 0; | 603 size_t OldPos = 0; |
| 605 size_t NewPos = 0; | 604 size_t NewPos = 0; |
| 606 size_t OldLen = OldName.size(); | 605 size_t OldLen = OldName.size(); |
| 607 for (; OldPos < OldLen; ++OldPos, ++NewPos) { | 606 for (; OldPos < OldLen; ++OldPos, ++NewPos) { |
| 608 if (OldName[OldPos] == '\0') | 607 if (OldName[OldPos] == '\0') |
| 609 break; | 608 break; |
| 610 if (OldName[OldPos] == 'S') { | 609 if (OldName[OldPos] == 'S') { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 } | 669 } |
| 671 NewName[NewPos] = OldName[OldPos]; | 670 NewName[NewPos] = OldName[OldPos]; |
| 672 } | 671 } |
| 673 assert(NewName[NewPos] == '\0'); | 672 assert(NewName[NewPos] == '\0'); |
| 674 OldName = NewName; | 673 OldName = NewName; |
| 675 } | 674 } |
| 676 | 675 |
| 677 // In this context, name mangling means to rewrite a symbol using a given | 676 // In this context, name mangling means to rewrite a symbol using a given |
| 678 // prefix. For a C++ symbol, nest the original symbol inside the "prefix" | 677 // prefix. For a C++ symbol, nest the original symbol inside the "prefix" |
| 679 // namespace. For other symbols, just prepend the prefix. | 678 // namespace. For other symbols, just prepend the prefix. |
| 680 IceString GlobalContext::mangleName(const IceString &Name) const { | 679 IceString GlobalContext::mangleName(const IceString &Name) { |
| 681 // An already-nested name like foo::bar() gets pushed down one level, making | 680 // An already-nested name like foo::bar() gets pushed down one level, making |
| 682 // it equivalent to Prefix::foo::bar(). | 681 // it equivalent to Prefix::foo::bar(). |
| 683 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz | 682 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz |
| 684 // A non-nested but mangled name like bar() gets nested, making it equivalent | 683 // A non-nested but mangled name like bar() gets nested, making it equivalent |
| 685 // to Prefix::bar(). | 684 // to Prefix::bar(). |
| 686 // _Z3barxyz ==> ZN6Prefix3barExyz | 685 // _Z3barxyz ==> ZN6Prefix3barExyz |
| 687 // An unmangled, extern "C" style name, gets a simple prefix: | 686 // An unmangled, extern "C" style name, gets a simple prefix: |
| 688 // bar ==> Prefixbar | 687 // bar ==> Prefixbar |
| 689 if (!BuildDefs::dump() || getFlags().getTestPrefix().empty()) | 688 if (!BuildDefs::dump() || getFlags().getTestPrefix().empty()) |
| 690 return Name; | 689 return Name; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 805 return getConstPool()->Floats.getOrAdd(this, ConstantFloat); | 804 return getConstPool()->Floats.getOrAdd(this, ConstantFloat); |
| 806 } | 805 } |
| 807 | 806 |
| 808 Constant *GlobalContext::getConstantDouble(double ConstantDouble) { | 807 Constant *GlobalContext::getConstantDouble(double ConstantDouble) { |
| 809 return getConstPool()->Doubles.getOrAdd(this, ConstantDouble); | 808 return getConstPool()->Doubles.getOrAdd(this, ConstantDouble); |
| 810 } | 809 } |
| 811 | 810 |
| 812 Constant *GlobalContext::getConstantSym(const RelocOffsetT Offset, | 811 Constant *GlobalContext::getConstantSym(const RelocOffsetT Offset, |
| 813 const RelocOffsetArray &OffsetExpr, | 812 const RelocOffsetArray &OffsetExpr, |
| 814 const IceString &Name, | 813 const IceString &Name, |
| 815 const IceString &EmitString, | 814 const IceString &EmitString) { |
| 816 bool SuppressMangling) { | |
| 817 return getConstPool()->Relocatables.getOrAdd( | 815 return getConstPool()->Relocatables.getOrAdd( |
| 818 this, | 816 this, RelocatableTuple(Offset, OffsetExpr, Name, EmitString)); |
| 819 RelocatableTuple(Offset, OffsetExpr, Name, EmitString, SuppressMangling)); | |
| 820 } | 817 } |
| 821 | 818 |
| 822 Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, | 819 Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, |
| 823 const IceString &Name, | 820 const IceString &Name) { |
| 824 bool SuppressMangling) { | |
| 825 constexpr char EmptyEmitString[] = ""; | 821 constexpr char EmptyEmitString[] = ""; |
| 826 return getConstantSym(Offset, {}, Name, EmptyEmitString, SuppressMangling); | 822 return getConstantSym(Offset, {}, Name, EmptyEmitString); |
| 827 } | 823 } |
| 828 | 824 |
| 829 Constant *GlobalContext::getConstantExternSym(const IceString &Name) { | 825 Constant *GlobalContext::getConstantExternSym(const IceString &Name) { |
| 830 constexpr RelocOffsetT Offset = 0; | 826 constexpr RelocOffsetT Offset = 0; |
| 831 constexpr bool SuppressMangling = true; | |
| 832 return getConstPool()->ExternRelocatables.getOrAdd( | 827 return getConstPool()->ExternRelocatables.getOrAdd( |
| 833 this, RelocatableTuple(Offset, {}, Name, SuppressMangling)); | 828 this, RelocatableTuple(Offset, {}, Name)); |
| 834 } | 829 } |
| 835 | 830 |
| 836 Constant *GlobalContext::getConstantUndef(Type Ty) { | 831 Constant *GlobalContext::getConstantUndef(Type Ty) { |
| 837 return getConstPool()->Undefs.getOrAdd(this, Ty); | 832 return getConstPool()->Undefs.getOrAdd(this, Ty); |
| 838 } | 833 } |
| 839 | 834 |
| 840 // All locking is done by the getConstant*() target function. | 835 // All locking is done by the getConstant*() target function. |
| 841 Constant *GlobalContext::getConstantZero(Type Ty) { | 836 Constant *GlobalContext::getConstantZero(Type Ty) { |
| 842 switch (Ty) { | 837 switch (Ty) { |
| 843 case IceType_i1: | 838 case IceType_i1: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 // jump tables as pooled constants. | 925 // jump tables as pooled constants. |
| 931 RandomNumberGenerator RNG(getFlags().getRandomSeed(), | 926 RandomNumberGenerator RNG(getFlags().getRandomSeed(), |
| 932 RPE_PooledConstantReordering); | 927 RPE_PooledConstantReordering); |
| 933 RandomShuffle(JumpTables.begin(), JumpTables.end(), | 928 RandomShuffle(JumpTables.begin(), JumpTables.end(), |
| 934 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); | 929 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); |
| 935 } | 930 } |
| 936 return JumpTables; | 931 return JumpTables; |
| 937 } | 932 } |
| 938 | 933 |
| 939 JumpTableData & | 934 JumpTableData & |
| 940 GlobalContext::addJumpTable(IceString FuncName, SizeT Id, | 935 GlobalContext::addJumpTable(const IceString &FuncName, SizeT Id, |
| 941 const JumpTableData::TargetList &TargetList) { | 936 const JumpTableData::TargetList &TargetList) { |
| 942 auto JumpTableList = getJumpTableList(); | 937 auto JumpTableList = getJumpTableList(); |
| 943 JumpTableList->emplace_back(FuncName, Id, TargetList); | 938 JumpTableList->emplace_back(FuncName, Id, TargetList); |
| 944 return JumpTableList->back(); | 939 return JumpTableList->back(); |
| 945 } | 940 } |
| 946 | 941 |
| 947 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { | 942 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { |
| 948 if (!BuildDefs::dump()) | 943 if (!BuildDefs::dump()) |
| 949 return 0; | 944 return 0; |
| 950 auto Timers = getTimers(); | 945 auto Timers = getTimers(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 | 1018 |
| 1024 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { | 1019 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { |
| 1025 if (!BuildDefs::dump()) | 1020 if (!BuildDefs::dump()) |
| 1026 return; | 1021 return; |
| 1027 auto Timers = getTimers(); | 1022 auto Timers = getTimers(); |
| 1028 assert(Timers->size() > StackID); | 1023 assert(Timers->size() > StackID); |
| 1029 OstreamLocker L(this); | 1024 OstreamLocker L(this); |
| 1030 Timers->at(StackID).dump(getStrDump(), DumpCumulative); | 1025 Timers->at(StackID).dump(getStrDump(), DumpCumulative); |
| 1031 } | 1026 } |
| 1032 | 1027 |
| 1028 ClFlags GlobalContext::Flags; | |
| 1029 ClFlagsExtra GlobalContext::ExtraFlags; | |
|
John
2016/03/06 22:39:38
Do these have constructors?
Jim Stichnoth
2016/03/07 00:03:10
Yes - and they get run as static initializers. I
| |
| 1030 | |
| 1033 void TimerMarker::push() { | 1031 void TimerMarker::push() { |
| 1034 switch (StackID) { | 1032 switch (StackID) { |
| 1035 case GlobalContext::TSK_Default: | 1033 case GlobalContext::TSK_Default: |
| 1036 Active = Ctx->getFlags().getSubzeroTimingEnabled(); | 1034 Active = Ctx->getFlags().getSubzeroTimingEnabled(); |
| 1037 break; | 1035 break; |
| 1038 case GlobalContext::TSK_Funcs: | 1036 case GlobalContext::TSK_Funcs: |
| 1039 Active = Ctx->getFlags().getTimeEachFunction(); | 1037 Active = Ctx->getFlags().getTimeEachFunction(); |
| 1040 break; | 1038 break; |
| 1041 default: | 1039 default: |
| 1042 break; | 1040 break; |
| 1043 } | 1041 } |
| 1044 if (Active) | 1042 if (Active) |
| 1045 Ctx->pushTimer(ID, StackID); | 1043 Ctx->pushTimer(ID, StackID); |
| 1046 } | 1044 } |
| 1047 | 1045 |
| 1048 void TimerMarker::pushCfg(const Cfg *Func) { | 1046 void TimerMarker::pushCfg(const Cfg *Func) { |
| 1049 Ctx = Func->getContext(); | 1047 Ctx = Func->getContext(); |
| 1050 Active = | 1048 Active = |
| 1051 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1049 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 1052 if (Active) | 1050 if (Active) |
| 1053 Ctx->pushTimer(ID, StackID); | 1051 Ctx->pushTimer(ID, StackID); |
| 1054 } | 1052 } |
| 1055 | 1053 |
| 1056 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1054 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1057 | 1055 |
| 1058 } // end of namespace Ice | 1056 } // end of namespace Ice |
| OLD | NEW |