| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |