class ICmpInst

Declaration

class ICmpInst : public CmpInst { /* full declaration omitted */ };

Description

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. Represent an integer comparison operator.

Declared at: llvm/include/llvm/IR/Instructions.h:1186

Inherits from: CmpInst

Member Variables

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasMetadata
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 32
public static MaximumAlignment = 1ULL << MaxAlignmentExponent

Method Overview

  • private void AssertOK()
  • public ICmpInst(llvm::Instruction * InsertBefore, llvm::CmpInst::Predicate pred, llvm::Value * LHS, llvm::Value * RHS, const llvm::Twine & NameStr = "")
  • public ICmpInst(llvm::BasicBlock & InsertAtEnd, llvm::CmpInst::Predicate pred, llvm::Value * LHS, llvm::Value * RHS, const llvm::Twine & NameStr = "")
  • public ICmpInst(llvm::CmpInst::Predicate pred, llvm::Value * LHS, llvm::Value * RHS, const llvm::Twine & NameStr = "")
  • public static bool classof(const llvm::Value * V)
  • public static bool classof(const llvm::Instruction * I)
  • protected llvm::ICmpInst * cloneImpl() const
  • public static bool compare(const llvm::APInt & LHS, const llvm::APInt & RHS, ICmpInst::Predicate Pred)
  • public static llvm::CmpInst::Predicate getSignedPredicate(llvm::CmpInst::Predicate pred)
  • public llvm::CmpInst::Predicate getSignedPredicate() const
  • public llvm::CmpInst::Predicate getUnsignedPredicate() const
  • public static llvm::CmpInst::Predicate getUnsignedPredicate(llvm::CmpInst::Predicate pred)
  • public bool isCommutative() const
  • public static bool isEquality(llvm::CmpInst::Predicate P)
  • public bool isEquality() const
  • public static bool isGE(llvm::CmpInst::Predicate P)
  • public static bool isGT(llvm::CmpInst::Predicate P)
  • public static bool isLE(llvm::CmpInst::Predicate P)
  • public static bool isLT(llvm::CmpInst::Predicate P)
  • public bool isRelational() const
  • public static bool isRelational(llvm::CmpInst::Predicate P)
  • public static iota_range<llvm::CmpInst::Predicate> predicates()
  • public void swapOperands()

Inherited from CmpInst:

Inherited from Instruction:

Inherited from User:

Inherited from Value:

Methods

void AssertOK()

Declared at: llvm/include/llvm/IR/Instructions.h:1187

ICmpInst(llvm::Instruction* InsertBefore,
         llvm::CmpInst::Predicate pred,
         llvm::Value* LHS,
         llvm::Value* RHS,
         const llvm::Twine& NameStr = "")

Description

Constructor with insert-before-instruction semantics.

Declared at: llvm/include/llvm/IR/Instructions.h:1207

Parameters

llvm::Instruction* InsertBefore
llvm::CmpInst::Predicate pred
llvm::Value* LHS
llvm::Value* RHS
const llvm::Twine& NameStr = ""

ICmpInst(llvm::BasicBlock& InsertAtEnd,
         llvm::CmpInst::Predicate pred,
         llvm::Value* LHS,
         llvm::Value* RHS,
         const llvm::Twine& NameStr = "")

Description

Constructor with insert-at-end semantics.

Declared at: llvm/include/llvm/IR/Instructions.h:1222

Parameters

llvm::BasicBlock& InsertAtEnd
llvm::CmpInst::Predicate pred
llvm::Value* LHS
llvm::Value* RHS
const llvm::Twine& NameStr = ""

ICmpInst(llvm::CmpInst::Predicate pred,
         llvm::Value* LHS,
         llvm::Value* RHS,
         const llvm::Twine& NameStr = "")

Description

Constructor with no-insertion semantics

Declared at: llvm/include/llvm/IR/Instructions.h:1237

Parameters

llvm::CmpInst::Predicate pred
llvm::Value* LHS
llvm::Value* RHS
const llvm::Twine& NameStr = ""

static bool classof(const llvm::Value* V)

Declared at: llvm/include/llvm/IR/Instructions.h:1347

Parameters

const llvm::Value* V

static bool classof(const llvm::Instruction* I)

Declared at: llvm/include/llvm/IR/Instructions.h:1344

Parameters

const llvm::Instruction* I

llvm::ICmpInst* cloneImpl() const

Description

Clone an identical ICmpInst

Declared at: llvm/include/llvm/IR/Instructions.h:1203

static bool compare(const llvm::APInt& LHS,
                    const llvm::APInt& RHS,
                    ICmpInst::Predicate Pred)

Description

Return result of `LHS Pred RHS` comparison.

Declared at: llvm/include/llvm/IR/Instructions.h:1340

Parameters

const llvm::APInt& LHS
const llvm::APInt& RHS
ICmpInst::Predicate Pred

static llvm::CmpInst::Predicate
getSignedPredicate(llvm::CmpInst::Predicate pred)

Description

This is a static version that you can use without an instruction. Return the signed version of the predicate.

Declared at: llvm/include/llvm/IR/Instructions.h:1259

Parameters

llvm::CmpInst::Predicate pred

llvm::CmpInst::Predicate getSignedPredicate()
    const

Description

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

Declared at: llvm/include/llvm/IR/Instructions.h:1253

Returns

the predicate that would be the result if the operand were regarded as signed. Return the signed version of the predicate

llvm::CmpInst::Predicate getUnsignedPredicate()
    const

Description

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

Declared at: llvm/include/llvm/IR/Instructions.h:1265

Returns

the predicate that would be the result if the operand were regarded as unsigned. Return the unsigned version of the predicate

static llvm::CmpInst::Predicate
getUnsignedPredicate(
    llvm::CmpInst::Predicate pred)

Description

This is a static version that you can use without an instruction. Return the unsigned version of the predicate.

Declared at: llvm/include/llvm/IR/Instructions.h:1271

Parameters

llvm::CmpInst::Predicate pred

bool isCommutative() const

Declared at: llvm/include/llvm/IR/Instructions.h:1287

Returns

true if the predicate of this ICmpInst is commutative Determine if this relation is commutative.

static bool isEquality(llvm::CmpInst::Predicate P)

Description

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

Declared at: llvm/include/llvm/IR/Instructions.h:1275

Parameters

llvm::CmpInst::Predicate P

bool isEquality() const

Description

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

Declared at: llvm/include/llvm/IR/Instructions.h:1281

static bool isGE(llvm::CmpInst::Predicate P)

Description

Return true if the predicate is SGE or UGE.

Declared at: llvm/include/llvm/IR/Instructions.h:1315

Parameters

llvm::CmpInst::Predicate P

static bool isGT(llvm::CmpInst::Predicate P)

Description

Return true if the predicate is SGT or UGT.

Declared at: llvm/include/llvm/IR/Instructions.h:1303

Parameters

llvm::CmpInst::Predicate P

static bool isLE(llvm::CmpInst::Predicate P)

Description

Return true if the predicate is SLE or ULE.

Declared at: llvm/include/llvm/IR/Instructions.h:1321

Parameters

llvm::CmpInst::Predicate P

static bool isLT(llvm::CmpInst::Predicate P)

Description

Return true if the predicate is SLT or ULT.

Declared at: llvm/include/llvm/IR/Instructions.h:1309

Parameters

llvm::CmpInst::Predicate P

bool isRelational() const

Description

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

Declared at: llvm/include/llvm/IR/Instructions.h:1291

static bool isRelational(
    llvm::CmpInst::Predicate P)

Description

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

Declared at: llvm/include/llvm/IR/Instructions.h:1297

Parameters

llvm::CmpInst::Predicate P

static iota_range<llvm::CmpInst::Predicate>
predicates()

Description

Returns the sequence of all ICmp predicates.

Declared at: llvm/include/llvm/IR/Instructions.h:1327

void swapOperands()

Description

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). Swap operands and adjust predicate.

Declared at: llvm/include/llvm/IR/Instructions.h:1334