namespace llvm {
+class LLVMContext;
+
//===----------------------------------------------------------------------===//
// TerminatorInst Class
//===----------------------------------------------------------------------===//
virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
public:
- virtual Instruction *clone() const = 0;
+ virtual Instruction *clone(LLVMContext &Context) const = 0;
/// getNumSuccessors - Return the number of successors that this terminator
/// has.
/// CreateNeg, CreateNot - Create the NEG and NOT
/// instructions out of SUB and XOR instructions.
///
- static BinaryOperator *CreateNeg(Value *Op, const std::string &Name = "",
+ static BinaryOperator *CreateNeg(LLVMContext &Context,
+ Value *Op, const std::string &Name = "",
Instruction *InsertBefore = 0);
- static BinaryOperator *CreateNeg(Value *Op, const std::string &Name,
+ static BinaryOperator *CreateNeg(LLVMContext &Context,
+ Value *Op, const std::string &Name,
BasicBlock *InsertAtEnd);
- static BinaryOperator *CreateFNeg(Value *Op, const std::string &Name = "",
+ static BinaryOperator *CreateFNeg(LLVMContext &Context,
+ Value *Op, const std::string &Name = "",
Instruction *InsertBefore = 0);
- static BinaryOperator *CreateFNeg(Value *Op, const std::string &Name,
+ static BinaryOperator *CreateFNeg(LLVMContext &Context,
+ Value *Op, const std::string &Name,
BasicBlock *InsertAtEnd);
- static BinaryOperator *CreateNot(Value *Op, const std::string &Name = "",
+ static BinaryOperator *CreateNot(LLVMContext &Context,
+ Value *Op, const std::string &Name = "",
Instruction *InsertBefore = 0);
- static BinaryOperator *CreateNot(Value *Op, const std::string &Name,
+ static BinaryOperator *CreateNot(LLVMContext &Context,
+ Value *Op, const std::string &Name,
BasicBlock *InsertAtEnd);
/// isNeg, isFNeg, isNot - Check if the given Value is a
return static_cast<BinaryOps>(Instruction::getOpcode());
}
- virtual BinaryOperator *clone() const;
+ virtual BinaryOperator *clone(LLVMContext &Context) const;
/// swapOperands - Exchange the two operands to this instruction.
/// This instruction is safe to use on any binary instruction and
const Type *SrcTy, ///< SrcTy of 1st cast
const Type *MidTy, ///< DstTy of 1st cast & SrcTy of 2nd cast
const Type *DstTy, ///< DstTy of 2nd cast
- const Type *IntPtrTy ///< Integer type corresponding to Ptr types
+ const Type *IntPtrTy ///< Integer type corresponding to Ptr types, or null
);
/// @brief Return the opcode of this CastInst
/// instruction into a BasicBlock right before the specified instruction.
/// The specified Instruction is allowed to be a dereferenced end iterator.
/// @brief Create a CmpInst
- static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
+ static CmpInst *Create(LLVMContext &Context, OtherOps Op,
+ unsigned short predicate, Value *S1,
Value *S2, const std::string &Name = "",
Instruction *InsertBefore = 0);
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
- /// @brief Create a result type for fcmp/icmp
- static const Type* makeCmpResultType(const Type* opnd_type) {
- if (const VectorType* vt = dyn_cast<const VectorType>(opnd_type)) {
- return VectorType::get(Type::Int1Ty, vt->getNumElements());
- }
- return Type::Int1Ty;
- }
};