| 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 case IceType_NUM: | 871 case IceType_NUM: |
| 872 break; | 872 break; |
| 873 } | 873 } |
| 874 llvm_unreachable("Unknown type"); | 874 llvm_unreachable("Unknown type"); |
| 875 } | 875 } |
| 876 | 876 |
| 877 ConstantList GlobalContext::getConstantExternSyms() { | 877 ConstantList GlobalContext::getConstantExternSyms() { |
| 878 return getConstPool()->ExternRelocatables.getConstantPool(); | 878 return getConstPool()->ExternRelocatables.getConstantPool(); |
| 879 } | 879 } |
| 880 | 880 |
| 881 JumpTableDataList GlobalContext::getJumpTables() { |
| 882 JumpTableDataList JumpTables(*getJumpTableList()); |
| 883 if (getFlags().shouldReorderPooledConstants()) { |
| 884 // If reorder-pooled-constants option is set to true, we need to shuffle the |
| 885 // constant pool before emitting it. |
| 886 RandomShuffle(JumpTables.begin(), JumpTables.end(), [this](uint64_t N) { |
| 887 return (uint32_t)getRNG().next(N); |
| 888 }); |
| 889 } else { |
| 890 // Make order deterministic by sorting into functions and then ID of the |
| 891 // jump table within that function. |
| 892 std::sort(JumpTables.begin(), JumpTables.end(), [](const JumpTableData &A, |
| 893 const JumpTableData &B) { |
| 894 if (A.getFunctionName() != B.getFunctionName()) |
| 895 return A.getFunctionName() < B.getFunctionName(); |
| 896 return A.getId() < B.getId(); |
| 897 }); |
| 898 } |
| 899 return JumpTables; |
| 900 } |
| 901 |
| 881 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, | 902 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, |
| 882 SizeT NumTargets) { | 903 SizeT NumTargets) { |
| 883 auto JumpTables = getJumpTables(); | 904 auto JumpTableList = getJumpTableList(); |
| 884 JumpTables->emplace_back(FuncName, Id, NumTargets); | 905 JumpTableList->emplace_back(FuncName, Id, NumTargets); |
| 885 return JumpTables->back(); | 906 return JumpTableList->back(); |
| 886 } | 907 } |
| 887 | 908 |
| 888 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { | 909 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { |
| 889 if (!BuildDefs::dump()) | 910 if (!BuildDefs::dump()) |
| 890 return 0; | 911 return 0; |
| 891 auto Timers = getTimers(); | 912 auto Timers = getTimers(); |
| 892 TimerStackIdT NewID = Timers->size(); | 913 TimerStackIdT NewID = Timers->size(); |
| 893 Timers->push_back(TimerStack(Name)); | 914 Timers->push_back(TimerStack(Name)); |
| 894 return NewID; | 915 return NewID; |
| 895 } | 916 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 Ctx = Func->getContext(); | 1013 Ctx = Func->getContext(); |
| 993 Active = | 1014 Active = |
| 994 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1015 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 995 if (Active) | 1016 if (Active) |
| 996 Ctx->pushTimer(ID, StackID); | 1017 Ctx->pushTimer(ID, StackID); |
| 997 } | 1018 } |
| 998 | 1019 |
| 999 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1020 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1000 | 1021 |
| 1001 } // end of namespace Ice | 1022 } // end of namespace Ice |
| OLD | NEW |