diff options
author | Chris Lattner <sabre@nondot.org> | 2002-08-20 18:17:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-08-20 18:17:12 +0000 |
commit | e825bde1255a55d004a4c1f6cadf2ab68c3eef52 (patch) | |
tree | e5cf3b8784a6560d4ee5997635c925f14d890540 /lib/VMCore/iOperators.cpp | |
parent | bacb8b9a004d4737ff0f8bf9edef501aa73de94f (diff) |
Add new SetCondInst::getInverseCondition() method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3405 91177308-0d34-0410-b5e6-96231b3b80d8
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; + } +} |