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

Side by Side Diff: src/IceOperand.h

Issue 737513008: Subzero: Simplify the constant pools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Better fix for the int8/uint8 tests Created 6 years, 1 month 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
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===//
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 declares the Operand class and its target-independent 10 // This file declares the Operand class and its target-independent
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return Operand->getKind() == K; 162 return Operand->getKind() == K;
163 } 163 }
164 164
165 private: 165 private:
166 ConstantPrimitive(Type Ty, T Value, uint32_t PoolEntryID) 166 ConstantPrimitive(Type Ty, T Value, uint32_t PoolEntryID)
167 : Constant(K, Ty, PoolEntryID), Value(Value) {} 167 : Constant(K, Ty, PoolEntryID), Value(Value) {}
168 ~ConstantPrimitive() override {} 168 ~ConstantPrimitive() override {}
169 const T Value; 169 const T Value;
170 }; 170 };
171 171
172 typedef ConstantPrimitive<uint32_t, Operand::kConstInteger32> ConstantInteger32; 172 typedef ConstantPrimitive<int32_t, Operand::kConstInteger32> ConstantInteger32;
173 typedef ConstantPrimitive<uint64_t, Operand::kConstInteger64> ConstantInteger64; 173 typedef ConstantPrimitive<int64_t, Operand::kConstInteger64> ConstantInteger64;
174 typedef ConstantPrimitive<float, Operand::kConstFloat> ConstantFloat; 174 typedef ConstantPrimitive<float, Operand::kConstFloat> ConstantFloat;
175 typedef ConstantPrimitive<double, Operand::kConstDouble> ConstantDouble; 175 typedef ConstantPrimitive<double, Operand::kConstDouble> ConstantDouble;
176 176
177 template <> inline void ConstantInteger32::dump(const Cfg *, Ostream &Str) const { 177 template <> inline void ConstantInteger32::dump(const Cfg *, Ostream &Str) const {
178 if (!ALLOW_DUMP) 178 if (!ALLOW_DUMP)
179 return; 179 return;
180 if (getType() == IceType_i1) 180 if (getType() == IceType_i1)
181 Str << (getValue() ? "true" : "false"); 181 Str << (getValue() ? "true" : "false");
182 else 182 else
183 Str << static_cast<int32_t>(getValue()); 183 Str << static_cast<int32_t>(getValue());
184 } 184 }
185 185
186 template <> inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const { 186 template <> inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const {
187 if (!ALLOW_DUMP) 187 if (!ALLOW_DUMP)
188 return; 188 return;
189 assert(getType() == IceType_i64); 189 assert(getType() == IceType_i64);
190 Str << static_cast<int64_t>(getValue()); 190 Str << static_cast<int64_t>(getValue());
191 } 191 }
192 192
193 // RelocatableTuple bundles the parameters that are used to 193 // RelocatableTuple bundles the parameters that are used to
194 // construct an ConstantRelocatable. It is done this way so that 194 // construct an ConstantRelocatable. It is done this way so that
195 // ConstantRelocatable can fit into the global constant pool 195 // ConstantRelocatable can fit into the global constant pool
196 // template mechanism. 196 // template mechanism.
197 class RelocatableTuple { 197 class RelocatableTuple {
198 // RelocatableTuple(const RelocatableTuple &) = delete;
199 RelocatableTuple &operator=(const RelocatableTuple &) = delete; 198 RelocatableTuple &operator=(const RelocatableTuple &) = delete;
200 199
201 public: 200 public:
202 RelocatableTuple(const RelocOffsetT Offset, const IceString &Name, 201 RelocatableTuple(const RelocOffsetT Offset, const IceString &Name,
203 bool SuppressMangling) 202 bool SuppressMangling)
204 : Offset(Offset), Name(Name), SuppressMangling(SuppressMangling) {} 203 : Offset(Offset), Name(Name), SuppressMangling(SuppressMangling) {}
204 RelocatableTuple(const RelocatableTuple &) = default;
205 205
206 const RelocOffsetT Offset; 206 const RelocOffsetT Offset;
207 const IceString Name; 207 const IceString Name;
208 bool SuppressMangling; 208 bool SuppressMangling;
209 }; 209 };
210 210
211 bool operator<(const RelocatableTuple &A, const RelocatableTuple &B); 211 bool operator==(const RelocatableTuple &A, const RelocatableTuple &B);
212 212
213 // ConstantRelocatable represents a symbolic constant combined with 213 // ConstantRelocatable represents a symbolic constant combined with
214 // a fixed offset. 214 // a fixed offset.
215 class ConstantRelocatable : public Constant { 215 class ConstantRelocatable : public Constant {
216 ConstantRelocatable(const ConstantRelocatable &) = delete; 216 ConstantRelocatable(const ConstantRelocatable &) = delete;
217 ConstantRelocatable &operator=(const ConstantRelocatable &) = delete; 217 ConstantRelocatable &operator=(const ConstantRelocatable &) = delete;
218 218
219 public: 219 public:
220 static ConstantRelocatable *create(GlobalContext *Ctx, Type Ty, 220 static ConstantRelocatable *create(GlobalContext *Ctx, Type Ty,
221 const RelocatableTuple &Tuple, 221 const RelocatableTuple &Tuple,
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 private: 635 private:
636 const Cfg *Func; 636 const Cfg *Func;
637 MetadataKind Kind; 637 MetadataKind Kind;
638 std::vector<VariableTracking> Metadata; 638 std::vector<VariableTracking> Metadata;
639 const static InstDefList NoDefinitions; 639 const static InstDefList NoDefinitions;
640 }; 640 };
641 641
642 } // end of namespace Ice 642 } // end of namespace Ice
643 643
644 #endif // SUBZERO_SRC_ICEOPERAND_H 644 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698