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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 template <Type Ty, typename KeyType, typename ValueType> class TypePool { | 123 template <Type Ty, typename KeyType, typename ValueType> class TypePool { |
124 TypePool(const TypePool &) = delete; | 124 TypePool(const TypePool &) = delete; |
125 TypePool &operator=(const TypePool &) = delete; | 125 TypePool &operator=(const TypePool &) = delete; |
126 | 126 |
127 public: | 127 public: |
128 TypePool() = default; | 128 TypePool() = default; |
129 ValueType *getOrAdd(GlobalContext *Ctx, KeyType Key) { | 129 ValueType *getOrAdd(GlobalContext *Ctx, KeyType Key) { |
130 auto Iter = Pool.find(Key); | 130 auto Iter = Pool.find(Key); |
131 if (Iter != Pool.end()) | 131 if (Iter != Pool.end()) |
132 return Iter->second; | 132 return Iter->second; |
133 ValueType *Result = ValueType::create(Ctx, Ty, Key); | 133 auto *Result = ValueType::create(Ctx, Ty, Key); |
134 Pool[Key] = Result; | 134 Pool[Key] = Result; |
135 return Result; | 135 return Result; |
136 } | 136 } |
137 ConstantList getConstantPool() const { | 137 ConstantList getConstantPool() const { |
138 ConstantList Constants; | 138 ConstantList Constants; |
139 Constants.reserve(Pool.size()); | 139 Constants.reserve(Pool.size()); |
140 for (auto &I : Pool) | 140 for (auto &I : Pool) |
141 Constants.push_back(I.second); | 141 Constants.push_back(I.second); |
142 // The sort (and its KeyCompareLess machinery) is not strictly necessary, | 142 // The sort (and its KeyCompareLess machinery) is not strictly necessary, |
143 // but is desirable for producing output that is deterministic across | 143 // but is desirable for producing output that is deterministic across |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 Ctx = Func->getContext(); | 1009 Ctx = Func->getContext(); |
1010 Active = | 1010 Active = |
1011 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1011 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
1012 if (Active) | 1012 if (Active) |
1013 Ctx->pushTimer(ID, StackID); | 1013 Ctx->pushTimer(ID, StackID); |
1014 } | 1014 } |
1015 | 1015 |
1016 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1016 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
1017 | 1017 |
1018 } // end of namespace Ice | 1018 } // end of namespace Ice |
OLD | NEW |