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. More... | |
ICmpInst (BasicBlock &InsertAtEnd, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="") | |
Constructor with insert-at-end semantics. More... | |
ICmpInst (Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="") | |
Constructor with no-insertion semantics. More... | |
Predicate | getSignedPredicate () const |
Return the signed version of the predicate. More... | |
Predicate | getUnsignedPredicate () const |
Return the unsigned version of the predicate. More... | |
bool | isEquality () const |
bool | isCommutative () const |
Determine if this relation is commutative. More... | |
bool | isRelational () const |
void | swapOperands () |
Swap operands and adjust predicate. More... | |
![]() | |
void * | operator new (size_t s) |
OtherOps | getOpcode () const |
Get the opcode casted to the right type. More... | |
Predicate | getPredicate () const |
Return the predicate for this instruction. More... | |
void | setPredicate (Predicate P) |
Set the predicate for this instruction to the specified value. More... | |
bool | isFPPredicate () const |
bool | isIntPredicate () const |
Predicate | getInversePredicate () const |
Return the inverse of the instruction's predicate. More... | |
Predicate | getSwappedPredicate () const |
Return the predicate as if the operands were swapped. More... | |
DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value) | |
Provide more efficient getOperand methods. More... | |
void | swapOperands () |
Swap the operands and adjust predicate accordingly to retain the same comparison. More... | |
bool | isCommutative () const |
Determine if this CmpInst is commutative. More... | |
bool | isEquality () const |
Determine if this is an equals/not equals predicate. More... | |
bool | isSigned () const |
Determine if this instruction is using a signed comparison. More... | |
bool | isUnsigned () const |
Determine if this instruction is using an unsigned comparison. More... | |
bool | isTrueWhenEqual () const |
Determine if this is true when both operands are the same. More... | |
bool | isFalseWhenEqual () const |
Determine if this is false when both operands are the same. More... | |
![]() | |
~Instruction () | |
Instruction * | use_back () |
const Instruction * | use_back () const |
const BasicBlock * | getParent () const |
BasicBlock * | getParent () |
void | removeFromParent () |
void | eraseFromParent () |
void | insertBefore (Instruction *InsertPos) |
void | insertAfter (Instruction *InsertPos) |
void | moveBefore (Instruction *MovePos) |
unsigned | getOpcode () const |
getOpcode() returns a member of one of the enums like Instruction::Add. More... | |
const char * | getOpcodeName () const |
bool | isTerminator () const |
bool | isBinaryOp () const |
bool | isShift () |
bool | isCast () const |
bool | isLogicalShift () const |
bool | isArithmeticShift () const |
isArithmeticShift - Return true if this is an arithmetic shift right. More... | |
bool | hasMetadata () const |
bool | hasMetadataOtherThanDebugLoc () const |
MDNode * | getMetadata (unsigned KindID) const |
MDNode * | getMetadata (StringRef Kind) const |
void | getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
void | getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
void | setMetadata (unsigned KindID, MDNode *Node) |
void | setMetadata (StringRef Kind, MDNode *Node) |
void | setDebugLoc (const DebugLoc &Loc) |
setDebugLoc - Set the debug location information for this instruction. More... | |
const DebugLoc & | getDebugLoc () const |
getDebugLoc - Return the debug location for this node as a DebugLoc. More... | |
void | setHasUnsafeAlgebra (bool B) |
void | setHasNoNaNs (bool B) |
void | setHasNoInfs (bool B) |
void | setHasNoSignedZeros (bool B) |
void | setHasAllowReciprocal (bool B) |
void | setFastMathFlags (FastMathFlags FMF) |
bool | hasUnsafeAlgebra () const |
Determine whether the unsafe-algebra flag is set. More... | |
bool | hasNoNaNs () const |
Determine whether the no-NaNs flag is set. More... | |
bool | hasNoInfs () const |
Determine whether the no-infs flag is set. More... | |
bool | hasNoSignedZeros () const |
Determine whether the no-signed-zeros flag is set. More... | |
bool | hasAllowReciprocal () const |
Determine whether the allow-reciprocal flag is set. More... | |
FastMathFlags | getFastMathFlags () const |
void | copyFastMathFlags (const Instruction *I) |
Copy I's fast-math flags. More... | |
bool | isAssociative () const |
bool | isCommutative () const |
bool | isIdempotent () const |
bool | isNilpotent () const |
bool | mayWriteToMemory () const |
bool | mayReadFromMemory () const |
bool | mayReadOrWriteMemory () const |
bool | mayThrow () const |
bool | mayReturn () const |
bool | mayHaveSideEffects () const |
Instruction * | clone () const |
bool | isIdenticalTo (const Instruction *I) const |
bool | isIdenticalToWhenDefined (const Instruction *I) const |
bool | isSameOperationAs (const Instruction *I, unsigned flags=0) const |
Determine if one instruction is the same operation as another. More... | |
bool | isUsedOutsideOfBlock (const BasicBlock *BB) const |
![]() | |
~User () | |
void | operator delete (void *Usr) |
operator delete - free memory allocated for User and Use objects More... | |
void | operator delete (void *, unsigned) |
placement delete - required by std, but never called. More... | |
void | operator delete (void *, unsigned, bool) |
placement delete - required by std, but never called. More... | |
Value * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Value *Val) |
const Use & | getOperandUse (unsigned i) const |
Use & | getOperandUse (unsigned i) |
unsigned | getNumOperands () const |
op_iterator | op_begin () |
const_op_iterator | op_begin () const |
op_iterator | op_end () |
const_op_iterator | op_end () const |
value_op_iterator | value_op_begin () |
value_op_iterator | value_op_end () |
void | dropAllReferences () |
void | replaceUsesOfWith (Value *From, Value *To) |
![]() | |
virtual | ~Value () |
void | dump () const |
dump - Support for debugging, callable in GDB: V->dump() More... | |
void | print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const |
Type * | getType () const |
LLVMContext & | getContext () const |
All values hold a context through their type. More... | |
bool | hasName () const |
ValueName * | getValueName () const |
void | setValueName (ValueName *VN) |
StringRef | getName () const |
void | setName (const Twine &Name) |
void | takeName (Value *V) |
void | replaceAllUsesWith (Value *V) |
bool | use_empty () const |
use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
User * | use_back () |
const User * | use_back () const |
bool | hasOneUse () const |
bool | hasNUses (unsigned N) const |
bool | hasNUsesOrMore (unsigned N) const |
bool | isUsedInBasicBlock (const BasicBlock *BB) const |
unsigned | getNumUses () const |
void | addUse (Use &U) |
unsigned | getValueID () const |
unsigned | getRawSubclassOptionalData () const |
void | clearSubclassOptionalData () |
bool | hasSameSubclassOptionalData (const Value *V) const |
void | intersectOptionalDataWith (const Value *V) |
bool | hasValueHandle () const |
Value * | stripPointerCasts () |
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCasts () const |
Value * | stripPointerCastsNoFollowAliases () |
Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCastsNoFollowAliases () const |
Value * | stripInBoundsConstantOffsets () |
Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsConstantOffsets () const |
Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More... | |
const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
Value * | stripInBoundsOffsets () |
Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsOffsets () const |
bool | isDereferenceablePointer () const |
Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
void | mutateType (Type *Ty) |
![]() | |
Instruction * | getPrevNode () |
Get the previous node, or 0 for the list head. More... | |
const Instruction * | getPrevNode () const |
Get the previous node, or 0 for the list head. More... | |
Instruction * | getNextNode () |
Get the next node, or 0 for the list tail. More... | |
const Instruction * | getNextNode () const |
Get the next node, or 0 for the list tail. More... | |
Static Public Member Functions | |
static Predicate | getSignedPredicate (Predicate pred) |
Return the signed version of the predicate. More... | |
static Predicate | getUnsignedPredicate (Predicate pred) |
Return the unsigned version of the predicate. More... | |
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. More... | |
static bool | classof (const Instruction *I) |
static bool | classof (const Value *V) |
![]() | |
static CmpInst * | Create (OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=0) |
Create a CmpInst. More... | |
static CmpInst * | Create (OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const Twine &Name, BasicBlock *InsertAtEnd) |
Create a CmpInst. More... | |
static bool | isFPPredicate (Predicate P) |
static bool | isIntPredicate (Predicate P) |
static Predicate | getInversePredicate (Predicate pred) |
Return the inverse of a given predicate. More... | |
static Predicate | getSwappedPredicate (Predicate pred) |
Return the predicate as if the operands were swapped. More... | |
static bool | isUnsigned (unsigned short predicate) |
Determine if the predicate is an unsigned operation. More... | |
static bool | isSigned (unsigned short predicate) |
Determine if the predicate is an signed operation. More... | |
static bool | isOrdered (unsigned short predicate) |
Determine if the predicate is an ordered operation. More... | |
static bool | isUnordered (unsigned short predicate) |
Determine if the predicate is an unordered operation. More... | |
static bool | isTrueWhenEqual (unsigned short predicate) |
Determine if the predicate is true when comparing a value with itself. More... | |
static bool | isFalseWhenEqual (unsigned short predicate) |
Determine if the predicate is false when comparing a value with itself. More... | |
static bool | classof (const Instruction *I) |
Methods for support type inquiry through isa, cast, and dyn_cast: More... | |
static bool | classof (const Value *V) |
static Type * | makeCmpResultType (Type *opnd_type) |
Create a result type for fcmp/icmp. More... | |
![]() | |
static const char * | getOpcodeName (unsigned OpCode) |
static bool | isTerminator (unsigned OpCode) |
static bool | isBinaryOp (unsigned Opcode) |
static bool | isShift (unsigned Opcode) |
Determine if the Opcode is one of the shift instructions. More... | |
static bool | isCast (unsigned OpCode) |
Determine if the OpCode is one of the CastInst instructions. More... | |
static bool | isAssociative (unsigned op) |
static bool | isCommutative (unsigned op) |
static bool | isIdempotent (unsigned op) |
static bool | isNilpotent (unsigned op) |
static bool | classof (const Value *V) |
Methods for support type inquiry through isa, cast, and dyn_cast: More... | |
![]() | |
static bool | classof (const Value *V) |
Protected Member Functions | |
virtual ICmpInst * | clone_impl () const |
Clone an identical ICmpInst. More... | |
![]() | |
CmpInst (Type *ty, Instruction::OtherOps op, unsigned short pred, Value *LHS, Value *RHS, const Twine &Name="", Instruction *InsertBefore=0) | |
CmpInst (Type *ty, Instruction::OtherOps op, unsigned short pred, Value *LHS, Value *RHS, const Twine &Name, BasicBlock *InsertAtEnd) | |
virtual void | anchor () LLVM_OVERRIDE |
![]() | |
void | setInstructionSubclassData (unsigned short D) |
unsigned | getSubclassDataFromInstruction () const |
Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=0) | |
Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd) | |
![]() | |
void * | operator new (size_t s, unsigned Us) |
User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps) | |
Use * | allocHungoffUses (unsigned) const |
void | dropHungoffUses () |
template<int Idx> | |
Use & | Op () |
template<int Idx> | |
const Use & | Op () const |
![]() | |
virtual void | printCustom (raw_ostream &O) const |
Value (Type *Ty, unsigned scid) | |
unsigned short | getSubclassDataFromValue () const |
void | setValueSubclassData (unsigned short D) |
![]() | |
ilist_node () | |
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 911 of file Instructions.h.
|
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 929 of file Instructions.h.
Referenced by clone_impl().
|
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 944 of file Instructions.h.
|
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 959 of file Instructions.h.
|
inlinestatic |
Definition at line 1038 of file Instructions.h.
References llvm::Instruction::getOpcode().
Definition at line 1041 of file Instructions.h.
|
protectedvirtual |
Clone an identical ICmpInst.
Implements llvm::Instruction.
Definition at line 3523 of file Instructions.cpp.
References llvm::CmpInst::getPredicate(), and ICmpInst().
|
inline |
Return the signed version of the predicate.
For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
Definition at line 975 of file Instructions.h.
Referenced by computePointerICmp(), llvm::InstCombiner::FoldGEPICmp(), SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
|
static |
Return the signed version of the predicate.
This is a static version that you can use without an instruction.
Definition at line 3119 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.
|
inline |
Return the unsigned version of the predicate.
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
Definition at line 987 of file Instructions.h.
Referenced by SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithCastAndCast(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
|
static |
Return the unsigned version of the predicate.
This is a static version that you can use without an instruction.
Definition at line 3132 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.
|
inline |
Determine if this relation is commutative.
Definition at line 1009 of file Instructions.h.
isEquality - Return true if this predicate is either EQ or NE. This also tests for commutativity.
Definition at line 997 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().
|
inline |
isEquality - Return true if this predicate is either EQ or NE. This also tests for commutativity.
Definition at line 1003 of file Instructions.h.
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::InstCombiner::FoldAndOfICmps(), foldLogOpOfMaskedICmps(), foldLogOpOfMaskedICmpsHelper(), llvm::InstCombiner::FoldOrOfICmps(), llvm::PredicatesFoldable(), SimplifyICmpInst(), and llvm::InstCombiner::visitICmpInst().
|
inline |
isRelational - Return true if the predicate is relational (not EQ or NE).
Definition at line 1013 of file Instructions.h.
Referenced by isSignTest().
isRelational - Return true if the predicate is relational (not EQ or NE).
Definition at line 1019 of file Instructions.h.
|
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 3148 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().
|
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).
Definition at line 1032 of file Instructions.h.
References llvm::PPC::getSwappedPredicate(), and llvm::swap().
Referenced by llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldOrOfICmps(), and llvm::InstCombiner::visitICmpInst().