Add new SetCondInst::getInverseCondition() method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-08-20 18:17:12 +00:00
parent bacb8b9a00
commit e825bde125

View File

@ -122,3 +122,19 @@ SetCondInst::SetCondInst(BinaryOps opType, Value *S1, Value *S2,
// Make sure it's a valid type...
assert(getOpcodeName() != 0);
}
// getInverseCondition - Return the inverse of the current condition opcode.
// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
//
Instruction::BinaryOps SetCondInst::getInverseCondition() const {
switch (getOpcode()) {
default:
assert(0 && "Unknown setcc opcode!");
case SetEQ: return SetNE;
case SetNE: return SetEQ;
case SetGT: return SetLE;
case SetLT: return SetGE;
case SetGE: return SetLT;
case SetLE: return SetGT;
}
}