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 | |
ICmpInst * | clone_impl () const override |
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 991 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 1009 of file Instructions.h.
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 1024 of file Instructions.h.
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 1039 of file Instructions.h.
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 1118 of file Instructions.h.
References llvm::Instruction::getOpcode().
static bool llvm::ICmpInst::classof | ( | const Value * | V | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::CmpInst.
Definition at line 1121 of file Instructions.h.
ICmpInst * ICmpInst::clone_impl | ( | ) | const [override, protected, virtual] |
Clone an identical ICmpInst.
Implements llvm::Instruction.
Definition at line 3625 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 1055 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 3221 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 1067 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 3234 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 1089 of file Instructions.h.
static bool llvm::ICmpInst::isEquality | ( | Predicate | P | ) | [inline, static] |
isEquality - Return true if this predicate is either EQ or NE. This also tests for commutativity.
Definition at line 1077 of file Instructions.h.
Referenced by llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldICmpDivCst(), llvm::InstCombiner::FoldICmpShrCst(), foldSelectICmpAnd(), foldSelectICmpAndOr(), getValueFromFromCondition(), 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 1083 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 1093 of file Instructions.h.
Referenced by isSignTest().
static bool llvm::ICmpInst::isRelational | ( | Predicate | P | ) | [inline, static] |
isRelational - Return true if the predicate is relational (not EQ or NE).
Definition at line 1099 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 3250 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 getPredicateResult(), 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 1112 of file Instructions.h.
References llvm::PPC::getSwappedPredicate(), and std::swap().
Referenced by llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldOrOfICmps(), and llvm::InstCombiner::visitICmpInst().