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 |
| (...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 return A.getFunctionName() < B.getFunctionName() || A.getId() < B.getId(); | |
|
Jim Stichnoth
2015/08/04 20:22:52
Is this the right comparison function?
Usually wh
ascull
2015/08/04 20:36:38
Done.
| |
| 895 }); | |
| 896 } | |
| 897 return JumpTables; | |
| 898 } | |
| 899 | |
| 881 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, | 900 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, |
| 882 SizeT NumTargets) { | 901 SizeT NumTargets) { |
| 883 auto JumpTables = getJumpTables(); | 902 auto JumpTableList = getJumpTableList(); |
| 884 JumpTables->emplace_back(FuncName, Id, NumTargets); | 903 JumpTableList->emplace_back(FuncName, Id, NumTargets); |
| 885 return JumpTables->back(); | 904 return JumpTableList->back(); |
| 886 } | 905 } |
| 887 | 906 |
| 888 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { | 907 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { |
| 889 if (!BuildDefs::dump()) | 908 if (!BuildDefs::dump()) |
| 890 return 0; | 909 return 0; |
| 891 auto Timers = getTimers(); | 910 auto Timers = getTimers(); |
| 892 TimerStackIdT NewID = Timers->size(); | 911 TimerStackIdT NewID = Timers->size(); |
| 893 Timers->push_back(TimerStack(Name)); | 912 Timers->push_back(TimerStack(Name)); |
| 894 return NewID; | 913 return NewID; |
| 895 } | 914 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 992 Ctx = Func->getContext(); | 1011 Ctx = Func->getContext(); |
| 993 Active = | 1012 Active = |
| 994 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1013 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 995 if (Active) | 1014 if (Active) |
| 996 Ctx->pushTimer(ID, StackID); | 1015 Ctx->pushTimer(ID, StackID); |
| 997 } | 1016 } |
| 998 | 1017 |
| 999 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1018 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1000 | 1019 |
| 1001 } // end of namespace Ice | 1020 } // end of namespace Ice |
| OLD | NEW |