diff options
Diffstat (limited to 'lib/VMCore/iOperators.cpp')
-rw-r--r-- | lib/VMCore/iOperators.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/VMCore/iOperators.cpp b/lib/VMCore/iOperators.cpp index d243dbc1fa..ba5aca1301 100644 --- a/lib/VMCore/iOperators.cpp +++ b/lib/VMCore/iOperators.cpp @@ -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; + } +} |