Chromium Code Reviews| Index: src/IceOperand.h |
| diff --git a/src/IceOperand.h b/src/IceOperand.h |
| index 00febc402327a24773d41be5e7c6cebc4cbb2b6b..75a6a720660f04dfdb410d0e4a6fdb5bb8f277e5 100644 |
| --- a/src/IceOperand.h |
| +++ b/src/IceOperand.h |
| @@ -32,6 +32,8 @@ public: |
| kConstDouble, |
| kConstRelocatable, |
| kConstUndef, |
| + kConstVector, |
| + kConstBitVector, |
| kConst_Num, |
| kVariable, |
| // Target-specific operand classes use kTarget as the starting |
| @@ -109,21 +111,20 @@ private: |
| Constant &operator=(const Constant &) LLVM_DELETED_FUNCTION; |
| }; |
| -// ConstantPrimitive<> wraps a primitive type. |
| +// ConstantValue<> wraps a concrete constant value |
|
jvoung (off chromium)
2014/06/26 23:33:46
nit: keep the period at the end of the sentence.
|
| template <typename T, Operand::OperandKind K> |
| -class ConstantPrimitive : public Constant { |
| +class ConstantValue : public Constant { |
| public: |
| - static ConstantPrimitive *create(GlobalContext *Ctx, Type Ty, T Value, |
| - uint32_t PoolEntryID) { |
| - return new (Ctx->allocate<ConstantPrimitive>()) |
| - ConstantPrimitive(Ty, Value, PoolEntryID); |
| + static ConstantValue *create(GlobalContext *Ctx, Type Ty, T Value, |
| + uint32_t PoolEntryID) { |
| + return new (Ctx->allocate<ConstantValue>()) |
| + ConstantValue(Ty, Value, PoolEntryID); |
| } |
| T getValue() const { return Value; } |
| + |
| using Constant::emit; |
| - virtual void emit(GlobalContext *Ctx) const { |
| - Ostream &Str = Ctx->getStrEmit(); |
| - Str << getValue(); |
| - } |
| + virtual void emit(GlobalContext *Ctx) const { (void)Ctx; } |
|
Jim Stichnoth
2014/06/27 18:30:16
Assuming this is just a stub that the target lower
wala
2014/06/27 21:09:19
Just declaring it works. There is enough variation
Jim Stichnoth
2014/06/27 23:11:05
Thanks. I think it was the original way before I
|
| + |
| using Constant::dump; |
| virtual void dump(GlobalContext *Ctx) const { |
| Ostream &Str = Ctx->getStrDump(); |
| @@ -135,17 +136,26 @@ public: |
| } |
| private: |
| - ConstantPrimitive(Type Ty, T Value, uint32_t PoolEntryID) |
| + ConstantValue(Type Ty, T Value, uint32_t PoolEntryID) |
| : Constant(K, Ty, PoolEntryID), Value(Value) {} |
| - ConstantPrimitive(const ConstantPrimitive &) LLVM_DELETED_FUNCTION; |
| - ConstantPrimitive &operator=(const ConstantPrimitive &) LLVM_DELETED_FUNCTION; |
| - virtual ~ConstantPrimitive() {} |
| + ConstantValue(const ConstantValue &) LLVM_DELETED_FUNCTION; |
| + ConstantValue &operator=(const ConstantValue &) LLVM_DELETED_FUNCTION; |
| + virtual ~ConstantValue() {} |
| const T Value; |
| }; |
| -typedef ConstantPrimitive<uint64_t, Operand::kConstInteger> ConstantInteger; |
| -typedef ConstantPrimitive<float, Operand::kConstFloat> ConstantFloat; |
| -typedef ConstantPrimitive<double, Operand::kConstDouble> ConstantDouble; |
| +// Wrappers for primitive types |
| +typedef ConstantValue<uint64_t, Operand::kConstInteger> ConstantInteger; |
| +typedef ConstantValue<float, Operand::kConstFloat> ConstantFloat; |
| +typedef ConstantValue<double, Operand::kConstDouble> ConstantDouble; |
| + |
| +// ConstantVector wraps a 128 bit value. |
| +typedef ConstantValue<Vect128, Operand::kConstVector> ConstantVector; |
| +template <> void ConstantVector::dump(GlobalContext *Ctx) const; |
| + |
| +// ConstantBitVector wraps a vector of I1s. |
| +typedef ConstantValue<BitVect, Operand::kConstBitVector> ConstantBitVector; |
| +template <> void ConstantBitVector::dump(GlobalContext *Ctx) const; |
| // RelocatableTuple bundles the parameters that are used to |
| // construct an ConstantRelocatable. It is done this way so that |