friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
// allocate space for exactly zero operands
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
ConstantFP(Type *Ty, const APFloat& V);
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
explicit ConstantAggregateZero(Type *ty)
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
ConstantArray(ArrayType *T, ArrayRef<Constant *> Val);
return cast<ArrayType>(Value::getType());
}
- void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override;
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
return V->getValueID() == ConstantArrayVal;
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
ConstantStruct(StructType *T, ArrayRef<Constant *> Val);
return cast<StructType>(Value::getType());
}
- void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override;
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
return V->getValueID() == ConstantStructVal;
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
ConstantVector(VectorType *T, ArrayRef<Constant *> Val);
/// elements have the same value, return that value. Otherwise return NULL.
Constant *getSplatValue() const;
- void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override;
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
return V->getValueID() == ConstantVectorVal;
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
explicit ConstantPointerNull(PointerType *T)
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
/// formed with a vector or array of the specified element type.
/// ConstantDataArray only works with normal float and int types that are
/// stored densely in memory, not with things like i42 or x86_f80.
- static bool isElementTypeCompatible(const Type *Ty);
+ static bool isElementTypeCompatible(Type *Ty);
/// getElementAsInteger - If this is a sequential container of integers (of
/// any size), return the specified element in the low bits of a uint64_t.
}
};
+//===----------------------------------------------------------------------===//
+/// ConstantTokenNone - a constant token which is empty
+///
+class ConstantTokenNone : public Constant {
+ void *operator new(size_t, unsigned) = delete;
+ ConstantTokenNone(const ConstantTokenNone &) = delete;
+
+ friend class Constant;
+ void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
+
+protected:
+ explicit ConstantTokenNone(LLVMContext &Context)
+ : Constant(Type::getTokenTy(Context), ConstantTokenNoneVal, nullptr, 0) {}
+ // allocate space for exactly zero operands
+ void *operator new(size_t s) { return User::operator new(s, 0); }
+public:
+ /// Return the ConstantTokenNone.
+ static ConstantTokenNone *get(LLVMContext &Context);
+
+ /// @brief Methods to support type inquiry through isa, cast, and dyn_cast.
+ static bool classof(const Value *V) {
+ return V->getValueID() == ConstantTokenNoneVal;
+ }
+};
/// BlockAddress - The address of a basic block.
///
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
public:
/// get - Return a BlockAddress for the specified function and basic block.
Function *getFunction() const { return (Function*)Op<0>().get(); }
BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); }
- void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override;
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Value *V) {
return V->getValueID() == BlockAddressVal;
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
ConstantExpr(Type *ty, unsigned Opcode, Use *Ops, unsigned NumOps)
/// gets constant-folded, the type changes, or the expression is otherwise
/// canonicalized. This parameter should almost always be \c false.
Constant *getWithOperands(ArrayRef<Constant *> Ops, Type *Ty,
- bool OnlyIfReduced = false) const;
+ bool OnlyIfReduced = false,
+ Type *SrcTy = nullptr) const;
/// getAsInstruction - Returns an Instruction which implements the same
/// operation as this ConstantExpr. The instruction is not linked to any basic
/// would make it harder to remove ConstantExprs altogether.
Instruction *getAsInstruction();
- void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override;
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Value *V) {
return V->getValueID() == ConstantExprVal;
friend class Constant;
void destroyConstantImpl();
+ Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
protected:
explicit UndefValue(Type *T) : Constant(T, UndefValueVal, nullptr, 0) {}