mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-12 13:48:45 +00:00
Provide a getOpcode() method on CmpInst to ensure the opcode is returned
as the right type. Use this to shorten some code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7d3223eef2
commit
6b538cfc5c
@ -521,6 +521,11 @@ public:
|
|||||||
/// @brief Implement superclass method.
|
/// @brief Implement superclass method.
|
||||||
virtual CmpInst *clone() const;
|
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 predicate for CmpInst is defined by the subclasses but stored in
|
||||||
/// the SubclassData field (see Value.h). We allow it to be fetched here
|
/// 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
|
/// as the predicate but there is no enum type for it, just the raw unsigned
|
||||||
|
@ -378,8 +378,7 @@ struct VISIBILITY_HIDDEN CompareConstantExpr : public ConstantExpr {
|
|||||||
Use Ops[2];
|
Use Ops[2];
|
||||||
CompareConstantExpr(Instruction::OtherOps opc, unsigned short pred,
|
CompareConstantExpr(Instruction::OtherOps opc, unsigned short pred,
|
||||||
Constant* LHS, Constant* RHS)
|
Constant* LHS, Constant* RHS)
|
||||||
: ConstantExpr(Type::BoolTy, Instruction::OtherOps(opc), Ops, 2),
|
: ConstantExpr(Type::BoolTy, opc, Ops, 2), predicate(pred) {
|
||||||
predicate(pred) {
|
|
||||||
OperandList[0].init(LHS, this);
|
OperandList[0].init(LHS, this);
|
||||||
OperandList[1].init(RHS, this);
|
OperandList[1].init(RHS, this);
|
||||||
}
|
}
|
||||||
|
@ -2252,8 +2252,7 @@ BinaryOperator *BinaryOperator::clone() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CmpInst* CmpInst::clone() const {
|
CmpInst* CmpInst::clone() const {
|
||||||
return create(Instruction::OtherOps(getOpcode()), getPredicate(),
|
return create(getOpcode(), getPredicate(), Ops[0], Ops[1]);
|
||||||
Ops[0], Ops[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MallocInst *MallocInst::clone() const { return new MallocInst(*this); }
|
MallocInst *MallocInst::clone() const { return new MallocInst(*this); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user