/// @brief Implement superclass method.
virtual CmpInst *clone() const;
+ /// @brief Get the opcode casted to the right type
+ OtherOps getOpcode() const {
+ return static_cast<OtherOps>(Instruction::getOpcode());
+ }
+
/// The predicate for CmpInst is defined by the subclasses but stored in
/// the SubclassData field (see Value.h). We allow it to be fetched here
/// as the predicate but there is no enum type for it, just the raw unsigned
Use Ops[2];
CompareConstantExpr(Instruction::OtherOps opc, unsigned short pred,
Constant* LHS, Constant* RHS)
- : ConstantExpr(Type::BoolTy, Instruction::OtherOps(opc), Ops, 2),
- predicate(pred) {
+ : ConstantExpr(Type::BoolTy, opc, Ops, 2), predicate(pred) {
OperandList[0].init(LHS, this);
OperandList[1].init(RHS, this);
}
}
CmpInst* CmpInst::clone() const {
- return create(Instruction::OtherOps(getOpcode()), getPredicate(),
- Ops[0], Ops[1]);
+ return create(getOpcode(), getPredicate(), Ops[0], Ops[1]);
}
MallocInst *MallocInst::clone() const { return new MallocInst(*this); }