LLVM API Documentation
Represent an integer comparison operator. More...
#include <Instructions.h>


Public Member Functions | |
| ICmpInst (Instruction *InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="") | |
| Constructor with insert-before-instruction semantics. | |
| ICmpInst (BasicBlock &InsertAtEnd, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="") | |
| Constructor with insert-at-end semantics. | |
| ICmpInst (Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="") | |
| Constructor with no-insertion semantics. | |
| Predicate | getSignedPredicate () const |
| Return the signed version of the predicate. | |
| Predicate | getUnsignedPredicate () const |
| Return the unsigned version of the predicate. | |
| bool | isEquality () const |
| bool | isCommutative () const |
| Determine if this relation is commutative. | |
| bool | isRelational () const |
| void | swapOperands () |
| Swap operands and adjust predicate. | |
Static Public Member Functions | |
| static Predicate | getSignedPredicate (Predicate pred) |
| Return the signed version of the predicate. | |
| static Predicate | getUnsignedPredicate (Predicate pred) |
| Return the unsigned version of the predicate. | |
| static bool | isEquality (Predicate P) |
| static bool | isRelational (Predicate P) |
| static ConstantRange | makeConstantRange (Predicate pred, const APInt &C) |
| Make a ConstantRange for a relation with a constant value. | |
| static bool | classof (const Instruction *I) |
| Methods for support type inquiry through isa, cast, and dyn_cast: | |
| static bool | classof (const Value *V) |
| Methods for support type inquiry through isa, cast, and dyn_cast: | |
Protected Member Functions | |
| virtual ICmpInst * | clone_impl () const |
| Clone an identical ICmpInst. | |
Represent an integer comparison operator.
This instruction compares its operands according to the predicate given to the constructor. It only operates on integers or pointers. The operands must be identical types.
Definition at line 913 of file Instructions.h.
| llvm::ICmpInst::ICmpInst | ( | Instruction * | InsertBefore, |
| Predicate | pred, | ||
| Value * | LHS, | ||
| Value * | RHS, | ||
| const Twine & | NameStr = "" |
||
| ) | [inline] |
Constructor with insert-before-instruction semantics.
| InsertBefore | Where to insert |
| pred | The predicate to use for the comparison |
| LHS | The left-hand-side of the expression |
| RHS | The right-hand-side of the expression |
| NameStr | Name of the instruction |
Definition at line 919 of file Instructions.h.
References llvm::CmpInst::FIRST_ICMP_PREDICATE, getType(), and llvm::CmpInst::LAST_ICMP_PREDICATE.
Referenced by clone_impl().
| llvm::ICmpInst::ICmpInst | ( | BasicBlock & | InsertAtEnd, |
| Predicate | pred, | ||
| Value * | LHS, | ||
| Value * | RHS, | ||
| const Twine & | NameStr = "" |
||
| ) | [inline] |
Constructor with insert-at-end semantics.
| InsertAtEnd | Block to insert into. |
| pred | The predicate to use for the comparison |
| LHS | The left-hand-side of the expression |
| RHS | The right-hand-side of the expression |
| NameStr | Name of the instruction |
Definition at line 940 of file Instructions.h.
References llvm::CmpInst::FIRST_ICMP_PREDICATE, getType(), and llvm::CmpInst::LAST_ICMP_PREDICATE.
| llvm::ICmpInst::ICmpInst | ( | Predicate | pred, |
| Value * | LHS, | ||
| Value * | RHS, | ||
| const Twine & | NameStr = "" |
||
| ) | [inline] |
Constructor with no-insertion semantics.
| pred | The predicate to use for the comparison |
| LHS | The left-hand-side of the expression |
| RHS | The right-hand-side of the expression |
| NameStr | Name of the instruction |
Definition at line 961 of file Instructions.h.
References llvm::CmpInst::FIRST_ICMP_PREDICATE, getType(), and llvm::CmpInst::LAST_ICMP_PREDICATE.
| static bool llvm::ICmpInst::classof | ( | const Instruction * | I | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::CmpInst.
Definition at line 1046 of file Instructions.h.
References llvm::Instruction::getOpcode(), and llvm::ICmp.
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::CmpInst.
Definition at line 1049 of file Instructions.h.
| ICmpInst * ICmpInst::clone_impl | ( | ) | const [protected, virtual] |
Clone an identical ICmpInst.
Implements llvm::Instruction.
Definition at line 3396 of file Instructions.cpp.
References llvm::CmpInst::getPredicate(), and ICmpInst().
| Predicate llvm::ICmpInst::getSignedPredicate | ( | ) | const [inline] |
Return the signed version of the predicate.
For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
Definition at line 983 of file Instructions.h.
Referenced by computePointerICmp(), llvm::InstCombiner::FoldGEPICmp(), SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
| ICmpInst::Predicate ICmpInst::getSignedPredicate | ( | Predicate | pred | ) | [static] |
Return the signed version of the predicate.
This is a static version that you can use without an instruction.
Definition at line 2968 of file Instructions.cpp.
References llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and llvm_unreachable.
| Predicate llvm::ICmpInst::getUnsignedPredicate | ( | ) | const [inline] |
Return the unsigned version of the predicate.
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
Definition at line 995 of file Instructions.h.
Referenced by SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithCastAndCast(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
| ICmpInst::Predicate ICmpInst::getUnsignedPredicate | ( | Predicate | pred | ) | [static] |
Return the unsigned version of the predicate.
This is a static version that you can use without an instruction.
Definition at line 2981 of file Instructions.cpp.
References llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and llvm_unreachable.
| bool llvm::ICmpInst::isCommutative | ( | ) | const [inline] |
Determine if this relation is commutative.
Reimplemented from llvm::CmpInst.
Definition at line 1017 of file Instructions.h.
isEquality - Return true if this predicate is either EQ or NE. This also tests for commutativity.
Definition at line 1005 of file Instructions.h.
Referenced by llvm::InstCombiner::FoldICmpDivCst(), llvm::InstCombiner::FoldICmpShrCst(), foldSelectICmpAnd(), foldSelectICmpAndOr(), getEdgeValueLocal(), isAllocSiteRemovable(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithCastAndCast(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
| bool llvm::ICmpInst::isEquality | ( | ) | const [inline] |
isEquality - Return true if this predicate is either EQ or NE. This also tests for commutativity.
Reimplemented from llvm::CmpInst.
Definition at line 1011 of file Instructions.h.
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::InstCombiner::FoldAndOfICmps(), foldLogOpOfMaskedICmps(), foldLogOpOfMaskedICmpsHelper(), llvm::InstCombiner::FoldOrOfICmps(), llvm::PredicatesFoldable(), SimplifyICmpInst(), and llvm::InstCombiner::visitICmpInst().
| bool llvm::ICmpInst::isRelational | ( | ) | const [inline] |
isRelational - Return true if the predicate is relational (not EQ or NE).
Definition at line 1021 of file Instructions.h.
Referenced by isSignTest().
isRelational - Return true if the predicate is relational (not EQ or NE).
Definition at line 1027 of file Instructions.h.
| ConstantRange ICmpInst::makeConstantRange | ( | Predicate | pred, |
| const APInt & | C | ||
| ) | [static] |
Make a ConstantRange for a relation with a constant value.
Initialize a set of values that all satisfy the predicate with C.
Initialize a set of values that all satisfy the condition with C.
Definition at line 2997 of file Instructions.cpp.
References llvm::APInt::getBitWidth(), llvm::APInt::getMinValue(), llvm::APInt::getSignedMinValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and llvm_unreachable.
Referenced by llvm::LazyValueInfo::getPredicateOnEdge(), SimplifyICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
| void llvm::ICmpInst::swapOperands | ( | ) | [inline] |
Swap operands and adjust predicate.
Exchange the two operands to this instruction in such a way that it does not modify the semantics of the instruction. The predicate value may be changed to retain the same result if the predicate is order dependent (e.g. ult).
Reimplemented from llvm::CmpInst.
Definition at line 1040 of file Instructions.h.
References llvm::PPC::getSwappedPredicate(), and llvm::swap().
Referenced by llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldOrOfICmps(), and llvm::InstCombiner::visitICmpInst().