| 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() { | 881 JumpTableDataList GlobalContext::getJumpTables() { |
| 882 JumpTableDataList JumpTables(*getJumpTableList()); | 882 JumpTableDataList JumpTables(*getJumpTableList()); |
| 883 if (getFlags().shouldReorderPooledConstants()) { | 883 if (getFlags().shouldReorderPooledConstants()) { |
| 884 // If reorder-pooled-constants option is set to true, we need to shuffle the | 884 // If reorder-pooled-constants option is set to true, we need to shuffle the |
| 885 // constant pool before emitting it. | 885 // constant pool before emitting it. |
| 886 RandomShuffle(JumpTables.begin(), JumpTables.end(), [this](uint64_t N) { | 886 RandomShuffle(JumpTables.begin(), JumpTables.end(), |
| 887 return (uint32_t)getRNG().next(N); | 887 [this](uint64_t N) { return (uint32_t)getRNG().next(N); }); |
| 888 }); | |
| 889 } else { | 888 } else { |
| 890 // Make order deterministic by sorting into functions and then ID of the | 889 // Make order deterministic by sorting into functions and then ID of the |
| 891 // jump table within that function. | 890 // jump table within that function. |
| 892 std::sort(JumpTables.begin(), JumpTables.end(), [](const JumpTableData &A, | 891 std::sort(JumpTables.begin(), JumpTables.end(), |
| 893 const JumpTableData &B) { | 892 [](const JumpTableData &A, const JumpTableData &B) { |
| 894 if (A.getFunctionName() != B.getFunctionName()) | 893 if (A.getFunctionName() != B.getFunctionName()) |
| 895 return A.getFunctionName() < B.getFunctionName(); | 894 return A.getFunctionName() < B.getFunctionName(); |
| 896 return A.getId() < B.getId(); | 895 return A.getId() < B.getId(); |
| 897 }); | 896 }); |
| 898 } | 897 } |
| 899 return JumpTables; | 898 return JumpTables; |
| 900 } | 899 } |
| 901 | 900 |
| 902 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, | 901 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, |
| 903 SizeT NumTargets) { | 902 SizeT NumTargets) { |
| 904 auto JumpTableList = getJumpTableList(); | 903 auto JumpTableList = getJumpTableList(); |
| 905 JumpTableList->emplace_back(FuncName, Id, NumTargets); | 904 JumpTableList->emplace_back(FuncName, Id, NumTargets); |
| 906 return JumpTableList->back(); | 905 return JumpTableList->back(); |
| 907 } | 906 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 Ctx = Func->getContext(); | 1012 Ctx = Func->getContext(); |
| 1014 Active = | 1013 Active = |
| 1015 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1014 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 1016 if (Active) | 1015 if (Active) |
| 1017 Ctx->pushTimer(ID, StackID); | 1016 Ctx->pushTimer(ID, StackID); |
| 1018 } | 1017 } |
| 1019 | 1018 |
| 1020 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1019 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1021 | 1020 |
| 1022 } // end of namespace Ice | 1021 } // end of namespace Ice |
| OLD | NEW |