| Index: src/IceOperand.h
|
| diff --git a/src/IceOperand.h b/src/IceOperand.h
|
| index 00febc402327a24773d41be5e7c6cebc4cbb2b6b..442470b4e325fbf72a31ec7868e10496877f2756 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,22 @@ private:
|
| Constant &operator=(const Constant &) LLVM_DELETED_FUNCTION;
|
| };
|
|
|
| -// ConstantPrimitive<> wraps a primitive type.
|
| +// ConstantValue<> wraps a concrete constant value.
|
| 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();
|
| - }
|
| + // The target needs to implement this for each ConstantValue
|
| + // specialization.
|
| + virtual void emit(GlobalContext *Ctx) const;
|
| +
|
| using Constant::dump;
|
| virtual void dump(GlobalContext *Ctx) const {
|
| Ostream &Str = Ctx->getStrDump();
|
| @@ -135,17 +138,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
|
|
|