| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 Constant() = delete; | 101 Constant() = delete; |
| 102 Constant(const Constant &) = delete; | 102 Constant(const Constant &) = delete; |
| 103 Constant &operator=(const Constant &) = delete; | 103 Constant &operator=(const Constant &) = delete; |
| 104 | 104 |
| 105 public: | 105 public: |
| 106 void emitPoolLabel(Ostream &Str) const { | 106 void emitPoolLabel(Ostream &Str) const { |
| 107 Str << ".L$" << getType() << "$" << PoolEntryID; | 107 Str << ".L$" << getType() << "$" << PoolEntryID; |
| 108 } | 108 } |
| 109 void emit(const Cfg *Func) const override { emit(Func->getContext()); } | 109 void emit(const Cfg *Func) const override { emit(Func->getContext()); } |
| 110 virtual void emit(GlobalContext *Ctx) const = 0; | 110 virtual void emit(GlobalContext *Ctx) const = 0; |
| 111 virtual void emitWithoutDollar(GlobalContext *Ctx) const = 0; |
| 111 | 112 |
| 112 static bool classof(const Operand *Operand) { | 113 static bool classof(const Operand *Operand) { |
| 113 OperandKind Kind = Operand->getKind(); | 114 OperandKind Kind = Operand->getKind(); |
| 114 return Kind >= kConst_Base && Kind <= kConst_Num; | 115 return Kind >= kConst_Base && Kind <= kConst_Num; |
| 115 } | 116 } |
| 116 | 117 |
| 117 protected: | 118 protected: |
| 118 Constant(OperandKind Kind, Type Ty, uint32_t PoolEntryID) | 119 Constant(OperandKind Kind, Type Ty, uint32_t PoolEntryID) |
| 119 : Operand(Kind, Ty), PoolEntryID(PoolEntryID) { | 120 : Operand(Kind, Ty), PoolEntryID(PoolEntryID) { |
| 120 Vars = nullptr; | 121 Vars = nullptr; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 142 assert(!Ctx->isIRGenerationDisabled() && | 143 assert(!Ctx->isIRGenerationDisabled() && |
| 143 "Attempt to build primitive constant when IR generation disabled"); | 144 "Attempt to build primitive constant when IR generation disabled"); |
| 144 return new (Ctx->allocate<ConstantPrimitive>()) | 145 return new (Ctx->allocate<ConstantPrimitive>()) |
| 145 ConstantPrimitive(Ty, Value, PoolEntryID); | 146 ConstantPrimitive(Ty, Value, PoolEntryID); |
| 146 } | 147 } |
| 147 PrimType getValue() const { return Value; } | 148 PrimType getValue() const { return Value; } |
| 148 using Constant::emit; | 149 using Constant::emit; |
| 149 // The target needs to implement this for each ConstantPrimitive | 150 // The target needs to implement this for each ConstantPrimitive |
| 150 // specialization. | 151 // specialization. |
| 151 void emit(GlobalContext *Ctx) const override; | 152 void emit(GlobalContext *Ctx) const override; |
| 153 void emitWithoutDollar(GlobalContext *Ctx) const override; |
| 152 using Constant::dump; | 154 using Constant::dump; |
| 153 void dump(const Cfg *, Ostream &Str) const override { | 155 void dump(const Cfg *, Ostream &Str) const override { |
| 154 if (ALLOW_DUMP) | 156 if (ALLOW_DUMP) |
| 155 Str << getValue(); | 157 Str << getValue(); |
| 156 } | 158 } |
| 157 | 159 |
| 158 static bool classof(const Operand *Operand) { | 160 static bool classof(const Operand *Operand) { |
| 159 return Operand->getKind() == K; | 161 return Operand->getKind() == K; |
| 160 } | 162 } |
| 161 | 163 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 Ty, Tuple.Offset, Tuple.Name, Tuple.SuppressMangling, PoolEntryID); | 229 Ty, Tuple.Offset, Tuple.Name, Tuple.SuppressMangling, PoolEntryID); |
| 228 } | 230 } |
| 229 | 231 |
| 230 RelocOffsetT getOffset() const { return Offset; } | 232 RelocOffsetT getOffset() const { return Offset; } |
| 231 const IceString &getName() const { return Name; } | 233 const IceString &getName() const { return Name; } |
| 232 void setSuppressMangling(bool Value) { SuppressMangling = Value; } | 234 void setSuppressMangling(bool Value) { SuppressMangling = Value; } |
| 233 bool getSuppressMangling() const { return SuppressMangling; } | 235 bool getSuppressMangling() const { return SuppressMangling; } |
| 234 using Constant::emit; | 236 using Constant::emit; |
| 235 using Constant::dump; | 237 using Constant::dump; |
| 236 void emit(GlobalContext *Ctx) const override; | 238 void emit(GlobalContext *Ctx) const override; |
| 237 void emitWithoutDollar(GlobalContext *Ctx) const; | 239 void emitWithoutDollar(GlobalContext *Ctx) const override; |
| 238 void dump(const Cfg *Func, Ostream &Str) const override; | 240 void dump(const Cfg *Func, Ostream &Str) const override; |
| 239 | 241 |
| 240 static bool classof(const Operand *Operand) { | 242 static bool classof(const Operand *Operand) { |
| 241 OperandKind Kind = Operand->getKind(); | 243 OperandKind Kind = Operand->getKind(); |
| 242 return Kind == kConstRelocatable; | 244 return Kind == kConstRelocatable; |
| 243 } | 245 } |
| 244 | 246 |
| 245 private: | 247 private: |
| 246 ConstantRelocatable(Type Ty, RelocOffsetT Offset, const IceString &Name, | 248 ConstantRelocatable(Type Ty, RelocOffsetT Offset, const IceString &Name, |
| 247 bool SuppressMangling, uint32_t PoolEntryID) | 249 bool SuppressMangling, uint32_t PoolEntryID) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 266 uint32_t PoolEntryID) { | 268 uint32_t PoolEntryID) { |
| 267 assert(!Ctx->isIRGenerationDisabled() && | 269 assert(!Ctx->isIRGenerationDisabled() && |
| 268 "Attempt to build undefined constant when IR generation disabled"); | 270 "Attempt to build undefined constant when IR generation disabled"); |
| 269 return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID); | 271 return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID); |
| 270 } | 272 } |
| 271 | 273 |
| 272 using Constant::emit; | 274 using Constant::emit; |
| 273 using Constant::dump; | 275 using Constant::dump; |
| 274 // The target needs to implement this. | 276 // The target needs to implement this. |
| 275 void emit(GlobalContext *Ctx) const override; | 277 void emit(GlobalContext *Ctx) const override; |
| 278 void emitWithoutDollar(GlobalContext *Ctx) const override; |
| 276 void dump(const Cfg *, Ostream &Str) const override { | 279 void dump(const Cfg *, Ostream &Str) const override { |
| 277 if (ALLOW_DUMP) | 280 if (ALLOW_DUMP) |
| 278 Str << "undef"; | 281 Str << "undef"; |
| 279 } | 282 } |
| 280 | 283 |
| 281 static bool classof(const Operand *Operand) { | 284 static bool classof(const Operand *Operand) { |
| 282 return Operand->getKind() == kConstUndef; | 285 return Operand->getKind() == kConstUndef; |
| 283 } | 286 } |
| 284 | 287 |
| 285 private: | 288 private: |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 private: | 634 private: |
| 632 const Cfg *Func; | 635 const Cfg *Func; |
| 633 MetadataKind Kind; | 636 MetadataKind Kind; |
| 634 std::vector<VariableTracking> Metadata; | 637 std::vector<VariableTracking> Metadata; |
| 635 const static InstDefList NoDefinitions; | 638 const static InstDefList NoDefinitions; |
| 636 }; | 639 }; |
| 637 | 640 |
| 638 } // end of namespace Ice | 641 } // end of namespace Ice |
| 639 | 642 |
| 640 #endif // SUBZERO_SRC_ICEOPERAND_H | 643 #endif // SUBZERO_SRC_ICEOPERAND_H |
| OLD | NEW |