#include "llvm/Constant.h"
#include "llvm/Type.h"
-#include "llvm/Support/DataTypes.h"
namespace llvm {
int64_t Signed;
uint64_t Unsigned;
} Val;
- ConstantIntegral(const Type *Ty, uint64_t V);
+ ConstantIntegral(const Type *Ty, ValueTy VT, uint64_t V);
public:
/// getRawValue - return the underlying value of this constant as a 64-bit
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantIntegral *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isIntegral();
+ return V->getValueType() == ConstantBoolVal ||
+ V->getValueType() == ConstantSIntVal ||
+ V->getValueType() == ConstantUIntVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantBool *) { return true; }
static bool classof(const Value *V) {
- return (V == True) | (V == False);
+ return V->getValueType() == ConstantBoolVal;
}
};
class ConstantInt : public ConstantIntegral {
protected:
ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
- ConstantInt(const Type *Ty, uint64_t V);
+ ConstantInt(const Type *Ty, ValueTy VT, uint64_t V);
public:
/// equalsInt - Provide a helper method that can be used to determine if the
/// constant contained within is equal to a constant. This only works for
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantInt *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isInteger();
+ return V->getValueType() == ConstantSIntVal ||
+ V->getValueType() == ConstantUIntVal;
}
};
///
static inline bool classof(const ConstantSInt *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isSigned();
+ return V->getValueType() == ConstantSIntVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantUInt *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isUnsigned();
+ return V->getValueType() == ConstantUIntVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantFP *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isFloatingPoint();
+ return V->getValueType() == ConstantFPVal;
}
};
virtual bool isNullValue() const { return true; }
virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking = false);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
///
virtual bool isNullValue() const { return false; }
virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking = false);
+ virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantArray *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->getTypeID() == Type::ArrayTyID;
+ return V->getValueType() == ConstantArrayVal;
}
};
}
virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking = false);
+ virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantStruct *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->getTypeID() == Type::StructTyID;
+ return V->getValueType() == ConstantStructVal;
}
};
virtual bool isNullValue() const { return false; }
virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking = false);
+ virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantPacked *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->getTypeID() == Type::PackedTyID;
+ return V->getValueType() == ConstantPackedVal;
}
};
protected:
ConstantPointerNull(const PointerType *T)
: Constant(reinterpret_cast<const Type*>(T),
- Value::SimpleConstantVal, 0, 0) {}
+ Value::ConstantPointerNullVal, 0, 0) {}
public:
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantPointerNull *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- isa<PointerType>(V->getType());
+ return V->getValueType() == ConstantPointerNullVal;
}
};
Constant *C1, Constant *C2, Constant *C3);
static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
const std::vector<Value*> &IdxList);
+ static Constant *getExtractElementTy(const Type *Ty, Constant *Val,
+ Constant *Idx);
+ static Constant *getInsertElementTy(const Type *Ty, Constant *Val,
+ Constant *Elt, Constant *Idx);
+ static Constant *getShuffleVectorTy(const Type *Ty, Constant *V1,
+ Constant *V2, Constant *Mask);
public:
// Static methods to construct a ConstantExpr of different kinds. Note that
static Constant *getGetElementPtr(Constant *C,
const std::vector<Value*> &IdxList);
+ static Constant *getExtractElement(Constant *Vec, Constant *Idx);
+ static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant *Idx);
+ static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask);
+
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
virtual bool isNullValue() const { return false; }
const char *getOpcodeName() const;
virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking = false);
+ virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// Override methods to provide more type information...
inline Constant *getOperand(unsigned i) {