LLVM API Documentation

llvm::ICmpInst Class Reference

Represent an integer comparison operator. More...

#include <Instructions.h>

Inheritance diagram for llvm::ICmpInst:
[legend]
Collaboration diagram for llvm::ICmpInst:
[legend]

List of all members.

Public Member Functions

 ICmpInst (Predicate pred, Value *LHS, Value *RHS, const std::string &NameStr="", Instruction *InsertBefore=0)
 Constructor with insert-before-instruction semantics.
 ICmpInst (Predicate pred, Value *LHS, Value *RHS, const std::string &NameStr, BasicBlock *InsertAtEnd)
 Constructor with insert-at-block-end 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
bool isSignedPredicate () const
 Determine if this instruction's predicate is signed.
bool isTrueWhenEqual ()
 Determine if the ICmpInst returns true when both operands are equal.
void swapOperands ()
 Swap operands and adjust predicate.
virtual ICmpInst * clone () const

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 bool isSignedPredicate (Predicate pred)
 Determine if the predicate is signed.
static bool isTrueWhenEqual (ICmpInst::Predicate pred)
 Determine if the icmp is true when both operands are equal.
static ConstantRange makeConstantRange (Predicate pred, const APInt &C)
 Make a ConstantRange for a relation with a constant value.
static bool classof (const ICmpInst *)
static bool classof (const Instruction *I)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)


Detailed Description

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 624 of file Instructions.h.


Constructor & Destructor Documentation

llvm::ICmpInst::ICmpInst ( Predicate  pred,
Value *  LHS,
Value *  RHS,
const std::string &  NameStr = "",
Instruction *  InsertBefore = 0 
) [inline]

Constructor with insert-before-instruction semantics.

Parameters:
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
InsertBefore  Where to insert

Definition at line 627 of file Instructions.h.

References llvm::CmpInst::FIRST_ICMP_PREDICATE, llvm::Intrinsic::getType(), and llvm::CmpInst::LAST_ICMP_PREDICATE.

Referenced by clone().

llvm::ICmpInst::ICmpInst ( Predicate  pred,
Value *  LHS,
Value *  RHS,
const std::string &  NameStr,
BasicBlock *  InsertAtEnd 
) [inline]

Constructor with insert-at-block-end semantics.

Parameters:
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
InsertAtEnd  Block to insert into.

Definition at line 648 of file Instructions.h.

References llvm::CmpInst::FIRST_ICMP_PREDICATE, llvm::Intrinsic::getType(), and llvm::CmpInst::LAST_ICMP_PREDICATE.


Member Function Documentation

Predicate llvm::ICmpInst::getSignedPredicate (  )  const [inline]

Return the signed version of the predicate.

For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.

Returns:
the predicate that would be the result if the operand were regarded as signed.

Definition at line 672 of file Instructions.h.

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 2586 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, and llvm::CmpInst::ICMP_ULT.

Predicate llvm::ICmpInst::getUnsignedPredicate (  )  const [inline]

Return the unsigned version of the predicate.

For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.

Returns:
the predicate that would be the result if the operand were regarded as unsigned.

Definition at line 684 of file Instructions.h.

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 2599 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, and llvm::CmpInst::ICMP_ULT.

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 694 of file Instructions.h.

bool llvm::ICmpInst::isEquality (  )  const [inline]

isEquality - Return true if this predicate is either EQ or NE. This also tests for commutativity.

Definition at line 700 of file Instructions.h.

bool llvm::ICmpInst::isCommutative (  )  const [inline]

Determine if this relation is commutative.

Returns:
true if the predicate of this ICmpInst is commutative

Reimplemented from llvm::Instruction.

Definition at line 706 of file Instructions.h.

bool llvm::ICmpInst::isRelational (  )  const [inline]

isRelational - Return true if the predicate is relational (not EQ or NE).

Definition at line 710 of file Instructions.h.

static bool llvm::ICmpInst::isRelational ( Predicate  P  )  [inline, static]

isRelational - Return true if the predicate is relational (not EQ or NE).

Definition at line 716 of file Instructions.h.

bool llvm::ICmpInst::isSignedPredicate (  )  const [inline]

Determine if this instruction's predicate is signed.

Returns:
true if the predicate of this ICmpInst is signed, false otherwise

Definition at line 722 of file Instructions.h.

bool ICmpInst::isSignedPredicate ( Predicate  pred  )  [static]

Determine if the predicate is signed.

Returns:
true if the predicate provided is signed, false otherwise

Definition at line 2612 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, and llvm::CmpInst::ICMP_ULT.

static bool llvm::ICmpInst::isTrueWhenEqual ( ICmpInst::Predicate  pred  )  [inline, static]

Determine if the icmp is true when both operands are equal.

Returns:
true if the specified compare predicate is true when both operands are equal...

Definition at line 731 of file Instructions.h.

References llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_UGE, and llvm::CmpInst::ICMP_ULE.

bool llvm::ICmpInst::isTrueWhenEqual (  )  [inline]

Determine if the ICmpInst returns true when both operands are equal.

Returns:
true if the specified compare instruction is true when both operands are equal...

Definition at line 740 of file Instructions.h.

References llvm::ISD::isTrueWhenEqual().

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 2626 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, and llvm::CmpInst::ICMP_ULT.

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 753 of file Instructions.h.

References llvm::swap().

ICmpInst * ICmpInst::clone (  )  const [virtual]

clone() - Create a copy of 'this' instruction that is identical in all ways except the following: The instruction has no parent The instruction has no name

Implements llvm::Instruction.

Definition at line 2866 of file Instructions.cpp.

References llvm::CmpInst::getPredicate(), and ICmpInst().

static bool llvm::ICmpInst::classof ( const ICmpInst *   )  [inline, static]

Definition at line 761 of file Instructions.h.

static bool llvm::ICmpInst::classof ( const Instruction *   )  [inline, static]

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

Reimplemented from llvm::CmpInst.

Definition at line 762 of file Instructions.h.

References llvm::Instruction::getOpcode().

static bool llvm::ICmpInst::classof ( const Value *  V  )  [inline, static]

Reimplemented from llvm::CmpInst.

Definition at line 765 of file Instructions.h.


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