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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 template <typename T, Operand::OperandKind K> | 113 template <typename T, Operand::OperandKind K> |
114 class ConstantPrimitive : public Constant { | 114 class ConstantPrimitive : public Constant { |
115 public: | 115 public: |
116 static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value, | 116 static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value, |
117 uint32_t PoolEntryID) { | 117 uint32_t PoolEntryID) { |
118 return new (Ctx->allocate<ConstantPrimitive>()) | 118 return new (Ctx->allocate<ConstantPrimitive>()) |
119 ConstantPrimitive(Ty, Value, PoolEntryID); | 119 ConstantPrimitive(Ty, Value, PoolEntryID); |
120 } | 120 } |
121 T getValue() const { return Value; } | 121 T getValue() const { return Value; } |
122 using Constant::emit; | 122 using Constant::emit; |
123 virtual void emit(GlobalContext *Ctx) const { | 123 // The target needs to implement this for each ConstantPrimitive |
124 Ostream &Str = Ctx->getStrEmit(); | 124 // specialization. |
125 Str << getValue(); | 125 virtual void emit(GlobalContext *Ctx) const; |
126 } | |
127 using Constant::dump; | 126 using Constant::dump; |
128 virtual void dump(GlobalContext *Ctx) const { | 127 virtual void dump(GlobalContext *Ctx) const { |
129 Ostream &Str = Ctx->getStrDump(); | 128 Ostream &Str = Ctx->getStrDump(); |
130 Str << getValue(); | 129 Str << getValue(); |
131 } | 130 } |
132 | 131 |
133 static bool classof(const Operand *Operand) { | 132 static bool classof(const Operand *Operand) { |
134 return Operand->getKind() == K; | 133 return Operand->getKind() == K; |
135 } | 134 } |
136 | 135 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 Variable *LoVar; | 463 Variable *LoVar; |
465 Variable *HiVar; | 464 Variable *HiVar; |
466 // VarsReal (and Operand::Vars) are set up such that Vars[0] == | 465 // VarsReal (and Operand::Vars) are set up such that Vars[0] == |
467 // this. | 466 // this. |
468 Variable *VarsReal[1]; | 467 Variable *VarsReal[1]; |
469 }; | 468 }; |
470 | 469 |
471 } // end of namespace Ice | 470 } // end of namespace Ice |
472 | 471 |
473 #endif // SUBZERO_SRC_ICEOPERAND_H | 472 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |