virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
public:
- virtual Instruction *clone(LLVMContext &Context) const = 0;
+ virtual TerminatorInst *clone(LLVMContext &Context) const = 0;
/// getNumSuccessors - Return the number of successors that this terminator
/// has.
class UnaryInstruction : public Instruction {
void *operator new(size_t, unsigned); // Do not implement
- UnaryInstruction(const UnaryInstruction&); // Do not implement
protected:
UnaryInstruction(const Type *Ty, unsigned iType, Value *V,
};
template <>
-struct OperandTraits<UnaryInstruction> : FixedNumOperandTraits<1> {
+struct OperandTraits<UnaryInstruction> : public FixedNumOperandTraits<1> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryInstruction, Value)
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateAdd(V1, V2, Name);
- cast<AddOperator>(BO)->setHasNoSignedOverflow(true);
+ BO->setHasNoSignedWrap(true);
return BO;
}
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
- cast<AddOperator>(BO)->setHasNoSignedOverflow(true);
+ BO->setHasNoSignedWrap(true);
return BO;
}
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
- cast<AddOperator>(BO)->setHasNoSignedOverflow(true);
+ BO->setHasNoSignedWrap(true);
return BO;
}
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateSDiv(V1, V2, Name);
- cast<SDivOperator>(BO)->setIsExact(true);
+ BO->setIsExact(true);
return BO;
}
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateSDiv(V1, V2, Name, BB);
- cast<SDivOperator>(BO)->setIsExact(true);
+ BO->setIsExact(true);
return BO;
}
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateSDiv(V1, V2, Name, I);
- cast<SDivOperator>(BO)->setIsExact(true);
+ BO->setIsExact(true);
return BO;
}
///
bool swapOperands();
+ /// setHasNoUnsignedWrap - Set or clear the nsw flag on this instruction,
+ /// which must be an operator which supports this flag. See LangRef.html
+ /// for the meaning of this flag.
+ void setHasNoUnsignedWrap(bool);
+
+ /// setHasNoSignedWrap - Set or clear the nsw flag on this instruction,
+ /// which must be an operator which supports this flag. See LangRef.html
+ /// for the meaning of this flag.
+ void setHasNoSignedWrap(bool);
+
+ /// setIsExact - Set or clear the exact flag on this instruction,
+ /// which must be an operator which supports this flag. See LangRef.html
+ /// for the meaning of this flag.
+ void setIsExact(bool);
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BinaryOperator *) { return true; }
static inline bool classof(const Instruction *I) {
};
template <>
-struct OperandTraits<BinaryOperator> : FixedNumOperandTraits<2> {
+struct OperandTraits<BinaryOperator> : public FixedNumOperandTraits<2> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryOperator, Value)
/// if (isa<CastInst>(Instr)) { ... }
/// @brief Base class of casting instructions.
class CastInst : public UnaryInstruction {
- /// @brief Copy constructor
- CastInst(const CastInst &CI)
- : UnaryInstruction(CI.getType(), CI.getOpcode(), CI.getOperand(0)) {
- }
- /// @brief Do not allow default construction
- CastInst();
protected:
/// @brief Constructor with insert-before-instruction semantics for subclasses
CastInst(const Type *Ty, unsigned iType, Value *S,
/// 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(LLVMContext &Context, OtherOps Op,
+ static CmpInst *Create(OtherOps Op,
unsigned short predicate, Value *S1,
Value *S2, const Twine &Name = "",
Instruction *InsertBefore = 0);
// FIXME: these are redundant if CmpInst < BinaryOperator
template <>
-struct OperandTraits<CmpInst> : FixedNumOperandTraits<2> {
+struct OperandTraits<CmpInst> : public FixedNumOperandTraits<2> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CmpInst, Value)