class VectorType;
class SequentialType;
-struct ConstantExprKeyType;
-template <class ConstantClass> struct ConstantAggrKeyType;
+template<class ConstantClass, class TypeClass, class ValType>
+struct ConstantCreator;
+template<class ConstantClass, class TypeClass>
+struct ConstantArrayCreator;
+template<class ConstantClass, class TypeClass>
+struct ConvertConstantType;
//===----------------------------------------------------------------------===//
/// This is the shared class of boolean and integer constants. This class
/// ConstantArray - Constant Array Declarations
///
class ConstantArray : public Constant {
- friend struct ConstantAggrKeyType<ConstantArray>;
+ friend struct ConstantArrayCreator<ConstantArray, ArrayType>;
ConstantArray(const ConstantArray &) LLVM_DELETED_FUNCTION;
protected:
ConstantArray(ArrayType *T, ArrayRef<Constant *> Val);
// ConstantArray accessors
static Constant *get(ArrayType *T, ArrayRef<Constant*> V);
-private:
- static Constant *getImpl(ArrayType *T, ArrayRef<Constant *> V);
-
-public:
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
// ConstantStruct - Constant Struct Declarations
//
class ConstantStruct : public Constant {
- friend struct ConstantAggrKeyType<ConstantStruct>;
+ friend struct ConstantArrayCreator<ConstantStruct, StructType>;
ConstantStruct(const ConstantStruct &) LLVM_DELETED_FUNCTION;
protected:
ConstantStruct(StructType *T, ArrayRef<Constant *> Val);
/// ConstantVector - Constant Vector Declarations
///
class ConstantVector : public Constant {
- friend struct ConstantAggrKeyType<ConstantVector>;
+ friend struct ConstantArrayCreator<ConstantVector, VectorType>;
ConstantVector(const ConstantVector &) LLVM_DELETED_FUNCTION;
protected:
ConstantVector(VectorType *T, ArrayRef<Constant *> Val);
// ConstantVector accessors
static Constant *get(ArrayRef<Constant*> V);
-private:
- static Constant *getImpl(ArrayRef<Constant *> V);
-
-public:
/// getSplat - Return a ConstantVector with the specified constant in each
/// element.
static Constant *getSplat(unsigned NumElts, Constant *Elt);
/// constant expressions. The Opcode field for the ConstantExpr class is
/// maintained in the Value::SubclassData field.
class ConstantExpr : public Constant {
- friend struct ConstantExprKeyType;
+ friend struct ConstantCreator<ConstantExpr,Type,
+ std::pair<unsigned, std::vector<Constant*> > >;
+ friend struct ConvertConstantType<ConstantExpr, Type>;
protected:
ConstantExpr(Type *ty, unsigned Opcode, Use *Ops, unsigned NumOps)
void setValueSubclassData(unsigned short D) {
Value::setValueSubclassData(D);
}
-
- /// \brief Check whether this can become its replacement.
- ///
- /// For use during \a replaceUsesOfWithOnConstant(), check whether we know
- /// how to turn this into \a Replacement, thereby reducing RAUW traffic.
- bool canBecomeReplacement(const Constant *Replacement) const;
};
template <>