Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Side by Side Diff: src/IceGlobalContext.cpp

Issue 1019233002: Subzero: Fix floating-point constant pooling. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This file defines aspects of the compilation that persist across 10 // This file defines aspects of the compilation that persist across
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 ConstantList getConstantPool() const { 59 ConstantList getConstantPool() const {
60 ConstantList Constants; 60 ConstantList Constants;
61 Constants.reserve(Pool.size()); 61 Constants.reserve(Pool.size());
62 for (auto &I : Pool) 62 for (auto &I : Pool)
63 Constants.push_back(I.second); 63 Constants.push_back(I.second);
64 return Constants; 64 return Constants;
65 } 65 }
66 66
67 private: 67 private:
68 typedef std::unordered_map<KeyType, ValueType *> ContainerType; 68 struct compare {
69 bool operator()(const KeyType &Value1, const KeyType &Value2) const {
70 if (std::is_floating_point<KeyType>::value)
71 return !memcmp(&Value1, &Value2, sizeof(KeyType));
72 return std::equal_to<KeyType>()(Value1, Value2);
73 }
74 };
75 typedef std::unordered_map<KeyType, ValueType *, std::hash<KeyType>, compare>
76 ContainerType;
JF 2015/03/19 16:33:09 template<typename T> struct Compare { typename s
Jim Stichnoth 2015/03/19 18:07:04 Cool. I did it a slightly different way. It has
Jim Stichnoth 2015/03/19 19:57:49 Tweaked once more to combine integral types and Re
69 ContainerType Pool; 77 ContainerType Pool;
70 uint32_t NextPoolID; 78 uint32_t NextPoolID;
71 }; 79 };
72 80
73 // UndefPool maps ICE types to the corresponding ConstantUndef values. 81 // UndefPool maps ICE types to the corresponding ConstantUndef values.
74 class UndefPool { 82 class UndefPool {
75 UndefPool(const UndefPool &) = delete; 83 UndefPool(const UndefPool &) = delete;
76 UndefPool &operator=(const UndefPool &) = delete; 84 UndefPool &operator=(const UndefPool &) = delete;
77 85
78 public: 86 public:
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 Ctx = Func->getContext(); 749 Ctx = Func->getContext();
742 Active = 750 Active =
743 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); 751 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled();
744 if (Active) 752 if (Active)
745 Ctx->pushTimer(ID, StackID); 753 Ctx->pushTimer(ID, StackID);
746 } 754 }
747 755
748 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); 756 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS);
749 757
750 } // end of namespace Ice 758 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/abi-atomics.ll » ('j') | tests_lit/llvm2ice_tests/abi-atomics.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698