LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
llvm::CmpInst Class Reference

Abstract base class of comparison instructions. More...

#include <InstrTypes.h>

Inheritance diagram for llvm::CmpInst:
Inheritance graph
[legend]
Collaboration diagram for llvm::CmpInst:
Collaboration graph
[legend]

Public Types

enum  Predicate {
  FCMP_FALSE = 0, FCMP_OEQ = 1, FCMP_OGT = 2, FCMP_OGE = 3,
  FCMP_OLT = 4, FCMP_OLE = 5, FCMP_ONE = 6, FCMP_ORD = 7,
  FCMP_UNO = 8, FCMP_UEQ = 9, FCMP_UGT = 10, FCMP_UGE = 11,
  FCMP_ULT = 12, FCMP_ULE = 13, FCMP_UNE = 14, FCMP_TRUE = 15,
  FIRST_FCMP_PREDICATE = FCMP_FALSE, LAST_FCMP_PREDICATE = FCMP_TRUE, BAD_FCMP_PREDICATE = FCMP_TRUE + 1, ICMP_EQ = 32,
  ICMP_NE = 33, ICMP_UGT = 34, ICMP_UGE = 35, ICMP_ULT = 36,
  ICMP_ULE = 37, ICMP_SGT = 38, ICMP_SGE = 39, ICMP_SLT = 40,
  ICMP_SLE = 41, FIRST_ICMP_PREDICATE = ICMP_EQ, LAST_ICMP_PREDICATE = ICMP_SLE, BAD_ICMP_PREDICATE = ICMP_SLE + 1
}
 
- Public Types inherited from llvm::Instruction
enum  OperationEquivalenceFlags { CompareIgnoringAlignment = 1<<0, CompareUsingScalarTypes = 1<<1 }
 
enum  TermOps
 
enum  BinaryOps
 
enum  MemoryOps
 
enum  CastOps
 
enum  OtherOps
 
- Public Types inherited from llvm::User
typedef Useop_iterator
 
typedef const Useconst_op_iterator
 
- Public Types inherited from llvm::Value
enum  ValueTy {
  ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
  GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
  ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal, ConstantIntVal,
  ConstantFPVal, ConstantArrayVal, ConstantStructVal, ConstantVectorVal,
  ConstantPointerNullVal, MDNodeVal, MDStringVal, InlineAsmVal,
  PseudoSourceValueVal, FixedStackPseudoSourceValueVal, InstructionVal, ConstantFirstVal = FunctionVal,
  ConstantLastVal = ConstantPointerNullVal
}
 
typedef value_use_iterator< Useruse_iterator
 
typedef value_use_iterator
< const User
const_use_iterator
 

Public Member Functions

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...
 
- Public Member Functions inherited from llvm::Instruction
 ~Instruction ()
 
Instructionuse_back ()
 
const Instructionuse_back () const
 
const BasicBlockgetParent () const
 
BasicBlockgetParent ()
 
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
 
MDNodegetMetadata (unsigned KindID) const
 
MDNodegetMetadata (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 DebugLocgetDebugLoc () 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
 
Instructionclone () 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
 
- Public Member Functions inherited from llvm::User
 ~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...
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (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)
 
- Public Member Functions inherited from llvm::Value
virtual ~Value ()
 
void dump () const
 dump - Support for debugging, callable in GDB: V->dump() More...
 
void print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const
 
TypegetType () const
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () 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
 
Useruse_back ()
 
const Useruse_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
 
ValuestripPointerCasts ()
 Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsOffsets () const
 
bool isDereferenceablePointer () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 
- Public Member Functions inherited from llvm::ilist_node< Instruction >
InstructiongetPrevNode ()
 Get the previous node, or 0 for the list head. More...
 
const InstructiongetPrevNode () const
 Get the previous node, or 0 for the list head. More...
 
InstructiongetNextNode ()
 Get the next node, or 0 for the list tail. More...
 
const InstructiongetNextNode () const
 Get the next node, or 0 for the list tail. More...
 

Static Public Member Functions

static CmpInstCreate (OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=0)
 Create a CmpInst. More...
 
static CmpInstCreate (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 TypemakeCmpResultType (Type *opnd_type)
 Create a result type for fcmp/icmp. More...
 
- Static Public Member Functions inherited from llvm::Instruction
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 Public Member Functions inherited from llvm::User
static bool classof (const Value *V)
 

Protected Member Functions

 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
 
- Protected Member Functions inherited from llvm::Instruction
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)
 
virtual Instructionclone_impl () const =0
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t s, unsigned Us)
 
 User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps)
 
UseallocHungoffUses (unsigned) const
 
void dropHungoffUses ()
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
virtual void printCustom (raw_ostream &O) const
 
 Value (Type *Ty, unsigned scid)
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node< Instruction >
 ilist_node ()
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static const unsigned MaximumAlignment = 1u << 29
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::User
UseOperandList
 
unsigned NumOperands
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 

Detailed Description

Abstract base class of comparison instructions.

This class is the base class for the comparison instructions.

Definition at line 633 of file InstrTypes.h.

Member Enumeration Documentation

This enumeration lists the possible predicates for CmpInst subclasses. Values in the range 0-31 are reserved for FCmpInst, while values in the range 32-64 are reserved for ICmpInst. This is necessary to ensure the predicate values are not overlapping between the classes.

Enumerator
FCMP_FALSE 

0 0 0 0 Always false (always folded)

FCMP_OEQ 

0 0 0 1 True if ordered and equal

FCMP_OGT 

0 0 1 0 True if ordered and greater than

FCMP_OGE 

0 0 1 1 True if ordered and greater than or equal

FCMP_OLT 

0 1 0 0 True if ordered and less than

FCMP_OLE 

0 1 0 1 True if ordered and less than or equal

FCMP_ONE 

0 1 1 0 True if ordered and operands are unequal

FCMP_ORD 

0 1 1 1 True if ordered (no nans)

FCMP_UNO 

1 0 0 0 True if unordered: isnan(X) | isnan(Y)

FCMP_UEQ 

1 0 0 1 True if unordered or equal

FCMP_UGT 

1 0 1 0 True if unordered or greater than

FCMP_UGE 

1 0 1 1 True if unordered, greater than, or equal

FCMP_ULT 

1 1 0 0 True if unordered or less than

FCMP_ULE 

1 1 0 1 True if unordered, less than, or equal

FCMP_UNE 

1 1 1 0 True if unordered or not equal

FCMP_TRUE 

1 1 1 1 Always true (always folded)

FIRST_FCMP_PREDICATE 
LAST_FCMP_PREDICATE 
BAD_FCMP_PREDICATE 
ICMP_EQ 

equal

ICMP_NE 

not equal

ICMP_UGT 

unsigned greater than

ICMP_UGE 

unsigned greater or equal

ICMP_ULT 

unsigned less than

ICMP_ULE 

unsigned less or equal

ICMP_SGT 

signed greater than

ICMP_SGE 

signed greater or equal

ICMP_SLT 

signed less than

ICMP_SLE 

signed less or equal

FIRST_ICMP_PREDICATE 
LAST_ICMP_PREDICATE 
BAD_ICMP_PREDICATE 

Definition at line 651 of file InstrTypes.h.

Constructor & Destructor Documentation

CmpInst::CmpInst ( Type ty,
Instruction::OtherOps  op,
unsigned short  pred,
Value LHS,
Value RHS,
const Twine Name = "",
Instruction InsertBefore = 0 
)
protected

Definition at line 3008 of file Instructions.cpp.

References llvm::Value::setName(), and setPredicate().

CmpInst::CmpInst ( Type ty,
Instruction::OtherOps  op,
unsigned short  pred,
Value LHS,
Value RHS,
const Twine Name,
BasicBlock InsertAtEnd 
)
protected

Definition at line 3021 of file Instructions.cpp.

References llvm::Value::setName(), and setPredicate().

Member Function Documentation

void CmpInst::anchor ( )
protectedvirtual

Reimplemented from llvm::User.

Definition at line 3006 of file Instructions.cpp.

static bool llvm::CmpInst::classof ( const Instruction I)
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line 823 of file InstrTypes.h.

References llvm::Instruction::getOpcode().

Referenced by classof().

static bool llvm::CmpInst::classof ( const Value V)
inlinestatic

Definition at line 827 of file InstrTypes.h.

References classof().

CmpInst * CmpInst::Create ( OtherOps  Op,
unsigned short  predicate,
Value S1,
Value S2,
const Twine Name = "",
Instruction InsertBefore = 0 
)
static

Create a CmpInst.

Construct a compare instruction, given the opcode, the predicate and the two operands. Optionally (if InstBefore is specified) insert the instruction into a BasicBlock right before the specified instruction. The specified Instruction is allowed to be a dereferenced end iterator.

Definition at line 3035 of file Instructions.cpp.

Referenced by llvm::ConstantExpr::getAsInstruction(), OptimizeCmpExpression(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitXor().

CmpInst * CmpInst::Create ( OtherOps  Op,
unsigned short  predicate,
Value S1,
Value S2,
const Twine Name,
BasicBlock InsertAtEnd 
)
static

Create a CmpInst.

Construct a compare instruction, given the opcode, the predicate and the two operands. Also automatically insert this instruction to the end of the BasicBlock specified.

Definition at line 3056 of file Instructions.cpp.

llvm::CmpInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value  )

Provide more efficient getOperand methods.

Predicate llvm::CmpInst::getInversePredicate ( ) const
inline

Return the inverse of the instruction's predicate.

For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.

Returns
the inverse predicate for the instruction's current predicate.

Definition at line 737 of file InstrTypes.h.

References getPredicate().

Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::FoldBranchToCommonDest(), llvm::getICmpCode(), SimplifyICmpInst(), llvm::InstCombiner::visitBranchInst(), and llvm::InstCombiner::visitICmpInst().

CmpInst::Predicate CmpInst::getInversePredicate ( Predicate  pred)
static

Return the inverse of a given predicate.

For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.

Returns
the inverse predicate for predicate provided in pred.

Definition at line 3086 of file Instructions.cpp.

References FCMP_FALSE, FCMP_OEQ, FCMP_OGE, FCMP_OGT, FCMP_OLE, FCMP_OLT, FCMP_ONE, FCMP_ORD, FCMP_TRUE, FCMP_UEQ, FCMP_UGE, FCMP_UGT, FCMP_ULE, FCMP_ULT, FCMP_UNE, FCMP_UNO, ICMP_EQ, ICMP_NE, ICMP_SGE, ICMP_SGT, ICMP_SLE, ICMP_SLT, ICMP_UGE, ICMP_UGT, ICMP_ULE, ICMP_ULT, and llvm_unreachable.

OtherOps llvm::CmpInst::getOpcode ( ) const
inline

Get the opcode casted to the right type.

Definition at line 709 of file InstrTypes.h.

References llvm::Instruction::getOpcode().

Referenced by OptimizeCmpExpression(), and llvm::InstCombiner::visitXor().

Predicate llvm::CmpInst::getPredicate ( ) const
inline
Predicate llvm::CmpInst::getSwappedPredicate ( ) const
inline
CmpInst::Predicate CmpInst::getSwappedPredicate ( Predicate  pred)
static

Return the predicate as if the operands were swapped.

This is a static version that you can use without an instruction available.

Definition at line 3208 of file Instructions.cpp.

References FCMP_FALSE, FCMP_OEQ, FCMP_OGE, FCMP_OGT, FCMP_OLE, FCMP_OLT, FCMP_ONE, FCMP_ORD, FCMP_TRUE, FCMP_UEQ, FCMP_UGE, FCMP_UGT, FCMP_ULE, FCMP_ULT, FCMP_UNE, FCMP_UNO, ICMP_EQ, ICMP_NE, ICMP_SGE, ICMP_SGT, ICMP_SLE, ICMP_SLT, ICMP_UGE, ICMP_UGT, ICMP_ULE, ICMP_ULT, and llvm_unreachable.

bool CmpInst::isCommutative ( ) const

Determine if this CmpInst is commutative.

This is just a convenience that dispatches to the subclasses.

Definition at line 3073 of file Instructions.cpp.

bool CmpInst::isEquality ( ) const

Determine if this is an equals/not equals predicate.

This is just a convenience that dispatches to the subclasses.

Definition at line 3079 of file Instructions.cpp.

bool llvm::CmpInst::isFalseWhenEqual ( ) const
inline

Determine if this is false when both operands are the same.

This is just a convenience.

Definition at line 798 of file InstrTypes.h.

References getPredicate().

Referenced by SimplifyFCmpInst(), and llvm::ScalarEvolution::SimplifyICmpOperands().

bool CmpInst::isFalseWhenEqual ( unsigned short  predicate)
static

Determine if the predicate is false when comparing a value with itself.

Definition at line 3280 of file Instructions.cpp.

References FCMP_FALSE, FCMP_OGT, FCMP_OLT, FCMP_ONE, ICMP_NE, ICMP_SGT, ICMP_SLT, ICMP_UGT, and ICMP_ULT.

static bool llvm::CmpInst::isFPPredicate ( Predicate  P)
inlinestatic

Definition at line 721 of file InstrTypes.h.

References FIRST_FCMP_PREDICATE, and LAST_FCMP_PREDICATE.

bool llvm::CmpInst::isFPPredicate ( ) const
inline

Definition at line 729 of file InstrTypes.h.

References getPredicate(), and isFPPredicate().

Referenced by isFPPredicate(), and SimplifyFCmpInst().

static bool llvm::CmpInst::isIntPredicate ( Predicate  P)
inlinestatic

Definition at line 725 of file InstrTypes.h.

References FIRST_ICMP_PREDICATE, and LAST_ICMP_PREDICATE.

bool llvm::CmpInst::isIntPredicate ( ) const
inline

Definition at line 730 of file InstrTypes.h.

References getPredicate(), and isIntPredicate().

Referenced by isIntPredicate(), SimplifyCmpInst(), and SimplifyICmpInst().

bool CmpInst::isOrdered ( unsigned short  predicate)
static

Determine if the predicate is an ordered operation.

Definition at line 3254 of file Instructions.cpp.

References FCMP_OEQ, FCMP_OGE, FCMP_OGT, FCMP_OLE, FCMP_OLT, FCMP_ONE, and FCMP_ORD.

Referenced by SimplifyFCmpInst().

bool llvm::CmpInst::isSigned ( ) const
inline
bool CmpInst::isSigned ( unsigned short  predicate)
static

Determine if the predicate is an signed operation.

Returns
true if the predicate is signed, false otherwise.

Definition at line 3246 of file Instructions.cpp.

References ICMP_SGE, ICMP_SGT, ICMP_SLE, and ICMP_SLT.

bool llvm::CmpInst::isTrueWhenEqual ( ) const
inline

Determine if this is true when both operands are the same.

This is just a convenience.

Definition at line 792 of file InstrTypes.h.

References getPredicate().

Referenced by computePointerICmp(), llvm::ConstantFoldCompareInstruction(), llvm::InstCombiner::FoldGEPICmp(), llvm::InstCombiner::FoldICmpAddOpCst(), SimplifyFCmpInst(), SimplifyICmpInst(), and llvm::ScalarEvolution::SimplifyICmpOperands().

bool CmpInst::isTrueWhenEqual ( unsigned short  predicate)
static

Determine if the predicate is true when comparing a value with itself.

Definition at line 3272 of file Instructions.cpp.

References FCMP_TRUE, FCMP_UEQ, FCMP_UGE, FCMP_ULE, ICMP_EQ, ICMP_SGE, ICMP_SLE, ICMP_UGE, and ICMP_ULE.

bool CmpInst::isUnordered ( unsigned short  predicate)
static

Determine if the predicate is an unordered operation.

Definition at line 3263 of file Instructions.cpp.

References FCMP_UEQ, FCMP_UGE, FCMP_UGT, FCMP_ULE, FCMP_ULT, FCMP_UNE, and FCMP_UNO.

Referenced by SimplifyFCmpInst().

bool llvm::CmpInst::isUnsigned ( ) const
inline

Determine if this instruction is using an unsigned comparison.

Returns
true if the comparison is unsigned, false otherwise.

Definition at line 786 of file InstrTypes.h.

References getPredicate().

Referenced by SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitSelectInstWithICmp().

bool CmpInst::isUnsigned ( unsigned short  predicate)
static

Determine if the predicate is an unsigned operation.

Returns
true if the predicate is unsigned, false otherwise.

Definition at line 3238 of file Instructions.cpp.

References ICMP_UGE, ICMP_UGT, ICMP_ULE, and ICMP_ULT.

static Type* llvm::CmpInst::makeCmpResultType ( Type opnd_type)
inlinestatic
void* llvm::CmpInst::operator new ( size_t  s)
inline

Definition at line 688 of file InstrTypes.h.

void llvm::CmpInst::setPredicate ( Predicate  P)
inline
void CmpInst::swapOperands ( )

Swap the operands and adjust predicate accordingly to retain the same comparison.

This is just a convenience that dispatches to the subclasses.

Definition at line 3066 of file Instructions.cpp.


The documentation for this class was generated from the following files: