class ConstantExpr

Declaration

class ConstantExpr : public Constant { /* full declaration omitted */ };

Description

A constant value that is initialized with an expression using other constant values. This class uses the standard Instruction opcodes to define the various constant expressions. The Opcode field for the ConstantExpr class is maintained in the Value::SubclassData field.

Declared at: llvm/include/llvm/IR/Constants.h:972

Inherits from: Constant

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

  • protected ConstantExpr(llvm::Type * ty, unsigned int Opcode, llvm::Use * Ops, unsigned int NumOps)
  • public static bool classof(const llvm::Value * V)
  • private void destroyConstantImpl()
  • public static llvm::Constant * get(unsigned int Opcode, llvm::Constant * C1, unsigned int Flags = 0, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * get(unsigned int Opcode, llvm::Constant * C1, llvm::Constant * C2, unsigned int Flags = 0, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getAShr(llvm::Constant * C1, llvm::Constant * C2, bool isExact = false)
  • public static llvm::Constant * getAdd(llvm::Constant * C1, llvm::Constant * C2, bool HasNUW = false, bool HasNSW = false)
  • public static llvm::Constant * getAddrSpaceCast(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getAlignOf(llvm::Type * Ty)
  • public static llvm::Constant * getAnd(llvm::Constant * C1, llvm::Constant * C2)
  • public llvm::Instruction * getAsInstruction(llvm::Instruction * InsertBefore = nullptr) const
  • public static llvm::Constant * getBinOpAbsorber(unsigned int Opcode, llvm::Type * Ty)
  • public static llvm::Constant * getBinOpIdentity(unsigned int Opcode, llvm::Type * Ty, bool AllowRHSConstant = false, bool NSZ = false)
  • public static llvm::Constant * getBitCast(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getCast(unsigned int ops, llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getCompare(unsigned short pred, llvm::Constant * C1, llvm::Constant * C2, bool OnlyIfReduced = false)
  • public static llvm::Constant * getExactAShr(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getExactLShr(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getExactLogBase2(llvm::Constant * C)
  • public static llvm::Constant * getExtractElement(llvm::Constant * Vec, llvm::Constant * Idx, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getFCmp(unsigned short pred, llvm::Constant * LHS, llvm::Constant * RHS, bool OnlyIfReduced = false)
  • public static llvm::Constant * getFNeg(llvm::Constant * C)
  • public static llvm::Constant * getFPCast(llvm::Constant * C, llvm::Type * Ty)
  • public static llvm::Constant * getFPExtend(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getFPToSI(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getFPToUI(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getFPTrunc(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getGetElementPtr(llvm::Type * Ty, llvm::Constant * C, llvm::Constant * Idx, bool InBounds = false, Optional<unsigned int> InRangeIndex = None, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getGetElementPtr(llvm::Type * Ty, llvm::Constant * C, ArrayRef<llvm::Value *> IdxList, bool InBounds = false, Optional<unsigned int> InRangeIndex = None, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getGetElementPtr(llvm::Type * Ty, llvm::Constant * C, ArrayRef<llvm::Constant *> IdxList, bool InBounds = false, Optional<unsigned int> InRangeIndex = None, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getICmp(unsigned short pred, llvm::Constant * LHS, llvm::Constant * RHS, bool OnlyIfReduced = false)
  • public static llvm::Constant * getInBoundsGetElementPtr(llvm::Type * Ty, llvm::Constant * C, ArrayRef<llvm::Constant *> IdxList)
  • public static llvm::Constant * getInBoundsGetElementPtr(llvm::Type * Ty, llvm::Constant * C, llvm::Constant * Idx)
  • public static llvm::Constant * getInBoundsGetElementPtr(llvm::Type * Ty, llvm::Constant * C, ArrayRef<llvm::Value *> IdxList)
  • public static llvm::Constant * getInsertElement(llvm::Constant * Vec, llvm::Constant * Elt, llvm::Constant * Idx, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getIntToPtr(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getIntegerCast(llvm::Constant * C, llvm::Type * Ty, bool IsSigned)
  • public static llvm::Constant * getLShr(llvm::Constant * C1, llvm::Constant * C2, bool isExact = false)
  • public static llvm::Constant * getMul(llvm::Constant * C1, llvm::Constant * C2, bool HasNUW = false, bool HasNSW = false)
  • public static llvm::Constant * getNSWAdd(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNSWMul(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNSWNeg(llvm::Constant * C)
  • public static llvm::Constant * getNSWShl(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNSWSub(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNUWAdd(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNUWMul(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNUWNeg(llvm::Constant * C)
  • public static llvm::Constant * getNUWShl(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNUWSub(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getNeg(llvm::Constant * C, bool HasNUW = false, bool HasNSW = false)
  • public static llvm::Constant * getNot(llvm::Constant * C)
  • public static llvm::Constant * getOffsetOf(llvm::StructType * STy, unsigned int FieldNo)
  • public static llvm::Constant * getOffsetOf(llvm::Type * Ty, llvm::Constant * FieldNo)
  • public unsigned int getOpcode() const
  • public const char * getOpcodeName() const
  • public static llvm::Constant * getOr(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getPointerBitCastOrAddrSpaceCast(llvm::Constant * C, llvm::Type * Ty)
  • public static llvm::Constant * getPointerCast(llvm::Constant * C, llvm::Type * Ty)
  • public unsigned int getPredicate() const
  • public static llvm::Constant * getPtrToInt(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getSExt(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getSExtOrBitCast(llvm::Constant * C, llvm::Type * Ty)
  • public static llvm::Constant * getSExtOrTrunc(llvm::Constant * C, llvm::Type * Ty)
  • public static llvm::Constant * getSIToFP(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getSelect(llvm::Constant * C, llvm::Constant * V1, llvm::Constant * V2, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getShl(llvm::Constant * C1, llvm::Constant * C2, bool HasNUW = false, bool HasNSW = false)
  • public ArrayRef<int> getShuffleMask() const
  • public llvm::Constant * getShuffleMaskForBitcode() const
  • public static llvm::Constant * getShuffleVector(llvm::Constant * V1, llvm::Constant * V2, ArrayRef<int> Mask, llvm::Type * OnlyIfReducedTy = nullptr)
  • public static llvm::Constant * getSizeOf(llvm::Type * Ty)
  • public static llvm::Constant * getSub(llvm::Constant * C1, llvm::Constant * C2, bool HasNUW = false, bool HasNSW = false)
  • public static llvm::Constant * getTrunc(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getTruncOrBitCast(llvm::Constant * C, llvm::Type * Ty)
  • public static llvm::Constant * getUIToFP(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getUMin(llvm::Constant * C1, llvm::Constant * C2)
  • public llvm::Constant * getWithOperands(ArrayRef<llvm::Constant *> Ops) const
  • public llvm::Constant * getWithOperands(ArrayRef<llvm::Constant *> Ops, llvm::Type * Ty, bool OnlyIfReduced = false, llvm::Type * SrcTy = nullptr) const
  • public static llvm::Constant * getXor(llvm::Constant * C1, llvm::Constant * C2)
  • public static llvm::Constant * getZExt(llvm::Constant * C, llvm::Type * Ty, bool OnlyIfReduced = false)
  • public static llvm::Constant * getZExtOrBitCast(llvm::Constant * C, llvm::Type * Ty)
  • private llvm::Value * handleOperandChangeImpl(llvm::Value * From, llvm::Value * To)
  • public bool isCast() const
  • public bool isCompare() const
  • public static bool isDesirableBinOp(unsigned int Opcode)
  • public static bool isSupportedBinOp(unsigned int Opcode)
  • private void setValueSubclassData(unsigned short D)
  • protected ~ConstantExpr()

Inherited from Constant:

Inherited from User:

Inherited from Value:

Methods

ConstantExpr(llvm::Type* ty,
             unsigned int Opcode,
             llvm::Use* Ops,
             unsigned int NumOps)

Declared at: llvm/include/llvm/IR/Constants.h:980

Parameters

llvm::Type* ty
unsigned int Opcode
llvm::Use* Ops
unsigned int NumOps

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

Description

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

Declared at: llvm/include/llvm/IR/Constants.h:1336

Parameters

const llvm::Value* V

void destroyConstantImpl()

Declared at: llvm/include/llvm/IR/Constants.h:976

static llvm::Constant* get(
    unsigned int Opcode,
    llvm::Constant* C1,
    unsigned int Flags = 0,
    llvm::Type* OnlyIfReducedTy = nullptr)

Description

get - Return a unary operator constant expression, folding if possible.

Declared at: llvm/include/llvm/IR/Constants.h:1197

Parameters

unsigned int Opcode
llvm::Constant* C1
unsigned int Flags = 0
llvm::Type* OnlyIfReducedTy = nullptr
see \a getWithOperands() docs.

static llvm::Constant* get(
    unsigned int Opcode,
    llvm::Constant* C1,
    llvm::Constant* C2,
    unsigned int Flags = 0,
    llvm::Type* OnlyIfReducedTy = nullptr)

Description

get - Return a binary or shift operator constant expression, folding if possible.

Declared at: llvm/include/llvm/IR/Constants.h:1204

Parameters

unsigned int Opcode
llvm::Constant* C1
llvm::Constant* C2
unsigned int Flags = 0
llvm::Type* OnlyIfReducedTy = nullptr
see \a getWithOperands() docs.

static llvm::Constant* getAShr(
    llvm::Constant* C1,
    llvm::Constant* C2,
    bool isExact = false)

Declared at: llvm/include/llvm/IR/Constants.h:1031

Parameters

llvm::Constant* C1
llvm::Constant* C2
bool isExact = false

static llvm::Constant* getAdd(llvm::Constant* C1,
                              llvm::Constant* C2,
                              bool HasNUW = false,
                              bool HasNSW = false)

Declared at: llvm/include/llvm/IR/Constants.h:1018

Parameters

llvm::Constant* C1
llvm::Constant* C2
bool HasNUW = false
bool HasNSW = false

static llvm::Constant* getAddrSpaceCast(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1049

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getAlignOf(llvm::Type* Ty)

Description

getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the return type is an i64).

Declared at: llvm/include/llvm/IR/Constants.h:996

Parameters

llvm::Type* Ty

static llvm::Constant* getAnd(llvm::Constant* C1,
                              llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1024

Parameters

llvm::Constant* C1
llvm::Constant* C2

llvm::Instruction* getAsInstruction(
    llvm::Instruction* InsertBefore =
        nullptr) const

Description

Returns an Instruction which implements the same operation as this ConstantExpr. If \p InsertBefore is not null, the new instruction is inserted before it, otherwise it is not inserted into any basic block. A better approach to this could be to have a constructor for Instruction which would take a ConstantExpr parameter, but that would have spread implementation details of ConstantExpr outside of Constants.cpp, which would make it harder to remove ConstantExprs altogether.

Declared at: llvm/include/llvm/IR/Constants.h:1325

Parameters

llvm::Instruction* InsertBefore = nullptr

static llvm::Constant* getBinOpAbsorber(
    unsigned int Opcode,
    llvm::Type* Ty)

Description

Return the absorbing element for the given binary operation, i.e. a constant C such that X op C = C and C op X = C for every X. For example, this returns zero for integer multiplication. It returns null if the operator doesn't have an absorbing element.

Declared at: llvm/include/llvm/IR/Constants.h:1118

Parameters

unsigned int Opcode
llvm::Type* Ty

static llvm::Constant* getBinOpIdentity(
    unsigned int Opcode,
    llvm::Type* Ty,
    bool AllowRHSConstant = false,
    bool NSZ = false)

Description

Return the identity constant for a binary opcode. The identity constant C is defined as X op C = X and C op X = X for every X when the binary operation is commutative. If the binop is not commutative, callers can acquire the operand 1 identity constant by setting AllowRHSConstant to true. For example, any shift has a zero identity constant for operand 1: X shift 0 = X. If this is a fadd/fsub operation and we don't care about signed zeros, then setting NSZ to true returns the identity +0.0 instead of -0.0. Return nullptr if the operator does not have an identity constant.

Declared at: llvm/include/llvm/IR/Constants.h:1110

Parameters

unsigned int Opcode
llvm::Type* Ty
bool AllowRHSConstant = false
bool NSZ = false

static llvm::Constant* getBitCast(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1047

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getCast(
    unsigned int ops,
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Description

Convenience function for getting a Cast operation.

Declared at: llvm/include/llvm/IR/Constants.h:1129

Parameters

unsigned int ops
The opcode for the conversion
llvm::Constant* C
The constant to be converted
llvm::Type* Ty
The type to which the constant is converted
bool OnlyIfReduced = false
see \a getWithOperands() docs.

static llvm::Constant* getCompare(
    unsigned short pred,
    llvm::Constant* C1,
    llvm::Constant* C2,
    bool OnlyIfReduced = false)

Description

Return an ICmp or FCmp comparison operator constant expression.

Declared at: llvm/include/llvm/IR/Constants.h:1210

Parameters

unsigned short pred
llvm::Constant* C1
llvm::Constant* C2
bool OnlyIfReduced = false
see \a getWithOperands() docs.

static llvm::Constant* getExactAShr(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1087

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getExactLShr(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1091

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getExactLogBase2(
    llvm::Constant* C)

Description

If C is a scalar/fixed width vector of known powers of 2, then this function returns a new scalar/fixed width vector obtained from logBase2 of C. Undef vector elements are set to zero. Return a null pointer otherwise.

Declared at: llvm/include/llvm/IR/Constants.h:1099

Parameters

llvm::Constant* C

static llvm::Constant* getExtractElement(
    llvm::Constant* Vec,
    llvm::Constant* Idx,
    llvm::Type* OnlyIfReducedTy = nullptr)

Declared at: llvm/include/llvm/IR/Constants.h:1269

Parameters

llvm::Constant* Vec
llvm::Constant* Idx
llvm::Type* OnlyIfReducedTy = nullptr

static llvm::Constant* getFCmp(
    unsigned short pred,
    llvm::Constant* LHS,
    llvm::Constant* RHS,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1218

Parameters

unsigned short pred
llvm::Constant* LHS
llvm::Constant* RHS
bool OnlyIfReduced = false

static llvm::Constant* getFNeg(llvm::Constant* C)

Declared at: llvm/include/llvm/IR/Constants.h:1016

Parameters

llvm::Constant* C

static llvm::Constant* getFPCast(
    llvm::Constant* C,
    llvm::Type* Ty)

Description

Create a FPExt, Bitcast or FPTrunc for fp -> fp casts

Declared at: llvm/include/llvm/IR/Constants.h:1177

Parameters

llvm::Constant* C
llvm::Type* Ty

static llvm::Constant* getFPExtend(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1037

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getFPToSI(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1042

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getFPToUI(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1041

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getFPTrunc(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1035

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getGetElementPtr(
    llvm::Type* Ty,
    llvm::Constant* C,
    llvm::Constant* Idx,
    bool InBounds = false,
    Optional<unsigned int> InRangeIndex = None,
    llvm::Type* OnlyIfReducedTy = nullptr)

Declared at: llvm/include/llvm/IR/Constants.h:1235

Parameters

llvm::Type* Ty
llvm::Constant* C
llvm::Constant* Idx
bool InBounds = false
Optional<unsigned int> InRangeIndex = None
llvm::Type* OnlyIfReducedTy = nullptr

static llvm::Constant* getGetElementPtr(
    llvm::Type* Ty,
    llvm::Constant* C,
    ArrayRef<llvm::Value*> IdxList,
    bool InBounds = false,
    Optional<unsigned int> InRangeIndex = None,
    llvm::Type* OnlyIfReducedTy = nullptr)

Declared at: llvm/include/llvm/IR/Constants.h:1245

Parameters

llvm::Type* Ty
llvm::Constant* C
ArrayRef<llvm::Value*> IdxList
bool InBounds = false
Optional<unsigned int> InRangeIndex = None
llvm::Type* OnlyIfReducedTy = nullptr

static llvm::Constant* getGetElementPtr(
    llvm::Type* Ty,
    llvm::Constant* C,
    ArrayRef<llvm::Constant*> IdxList,
    bool InBounds = false,
    Optional<unsigned int> InRangeIndex = None,
    llvm::Type* OnlyIfReducedTy = nullptr)

Description

Getelementptr form. Value* is only accepted for convenience; all elements must be Constants.

Declared at: llvm/include/llvm/IR/Constants.h:1226

Parameters

llvm::Type* Ty
llvm::Constant* C
ArrayRef<llvm::Constant*> IdxList
bool InBounds = false
Optional<unsigned int> InRangeIndex = None
the inrange index if present or None.
llvm::Type* OnlyIfReducedTy = nullptr
see \a getWithOperands() docs.

static llvm::Constant* getICmp(
    unsigned short pred,
    llvm::Constant* LHS,
    llvm::Constant* RHS,
    bool OnlyIfReduced = false)

Description

get* - Return some common constants without having to specify the full Instruction::OPCODE identifier.

Declared at: llvm/include/llvm/IR/Constants.h:1216

Parameters

unsigned short pred
llvm::Constant* LHS
llvm::Constant* RHS
bool OnlyIfReduced = false

static llvm::Constant* getInBoundsGetElementPtr(
    llvm::Type* Ty,
    llvm::Constant* C,
    ArrayRef<llvm::Constant*> IdxList)

Description

Create an "inbounds" getelementptr. See the documentation for the "inbounds" flag in LangRef.html for details.

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

Parameters

llvm::Type* Ty
llvm::Constant* C
ArrayRef<llvm::Constant*> IdxList

static llvm::Constant* getInBoundsGetElementPtr(
    llvm::Type* Ty,
    llvm::Constant* C,
    llvm::Constant* Idx)

Declared at: llvm/include/llvm/IR/Constants.h:1257

Parameters

llvm::Type* Ty
llvm::Constant* C
llvm::Constant* Idx

static llvm::Constant* getInBoundsGetElementPtr(
    llvm::Type* Ty,
    llvm::Constant* C,
    ArrayRef<llvm::Value*> IdxList)

Declared at: llvm/include/llvm/IR/Constants.h:1264

Parameters

llvm::Type* Ty
llvm::Constant* C
ArrayRef<llvm::Value*> IdxList

static llvm::Constant* getInsertElement(
    llvm::Constant* Vec,
    llvm::Constant* Elt,
    llvm::Constant* Idx,
    llvm::Type* OnlyIfReducedTy = nullptr)

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

Parameters

llvm::Constant* Vec
llvm::Constant* Elt
llvm::Constant* Idx
llvm::Type* OnlyIfReducedTy = nullptr

static llvm::Constant* getIntToPtr(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1045

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getIntegerCast(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool IsSigned)

Description

Create a ZExt, Bitcast or Trunc for integer -> integer casts

Declared at: llvm/include/llvm/IR/Constants.h:1171

Parameters

llvm::Constant* C
llvm::Type* Ty
bool IsSigned

static llvm::Constant* getLShr(
    llvm::Constant* C1,
    llvm::Constant* C2,
    bool isExact = false)

Declared at: llvm/include/llvm/IR/Constants.h:1030

Parameters

llvm::Constant* C1
llvm::Constant* C2
bool isExact = false

static llvm::Constant* getMul(llvm::Constant* C1,
                              llvm::Constant* C2,
                              bool HasNUW = false,
                              bool HasNSW = false)

Declared at: llvm/include/llvm/IR/Constants.h:1022

Parameters

llvm::Constant* C1
llvm::Constant* C2
bool HasNUW = false
bool HasNSW = false

static llvm::Constant* getNSWAdd(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1055

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNSWMul(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1071

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNSWNeg(
    llvm::Constant* C)

Declared at: llvm/include/llvm/IR/Constants.h:1052

Parameters

llvm::Constant* C

static llvm::Constant* getNSWShl(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1079

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNSWSub(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1063

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNUWAdd(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1059

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNUWMul(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1075

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNUWNeg(
    llvm::Constant* C)

Declared at: llvm/include/llvm/IR/Constants.h:1053

Parameters

llvm::Constant* C

static llvm::Constant* getNUWShl(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1083

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNUWSub(
    llvm::Constant* C1,
    llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1067

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getNeg(llvm::Constant* C,
                              bool HasNUW = false,
                              bool HasNSW = false)

Declared at: llvm/include/llvm/IR/Constants.h:1014

Parameters

llvm::Constant* C
bool HasNUW = false
bool HasNSW = false

static llvm::Constant* getNot(llvm::Constant* C)

Declared at: llvm/include/llvm/IR/Constants.h:1017

Parameters

llvm::Constant* C

static llvm::Constant* getOffsetOf(
    llvm::StructType* STy,
    unsigned int FieldNo)

Description

getOffsetOf constant expr - computes the offset of a struct field in a target independent way (Note: the return type is an i64).

Declared at: llvm/include/llvm/IR/Constants.h:1007

Parameters

llvm::StructType* STy
unsigned int FieldNo

static llvm::Constant* getOffsetOf(
    llvm::Type* Ty,
    llvm::Constant* FieldNo)

Description

getOffsetOf constant expr - This is a generalized form of getOffsetOf, which supports any aggregate type, and any Constant index.

Declared at: llvm/include/llvm/IR/Constants.h:1012

Parameters

llvm::Type* Ty
llvm::Constant* FieldNo

unsigned int getOpcode() const

Description

Return the opcode at the root of this constant expression

Declared at: llvm/include/llvm/IR/Constants.h:1278

const char* getOpcodeName() const

Description

Return a string representation for an opcode.

Declared at: llvm/include/llvm/IR/Constants.h:1295

static llvm::Constant* getOr(llvm::Constant* C1,
                             llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1025

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant*
getPointerBitCastOrAddrSpaceCast(
    llvm::Constant* C,
    llvm::Type* Ty)

Description

Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.

Declared at: llvm/include/llvm/IR/Constants.h:1164

Parameters

llvm::Constant* C
llvm::Type* Ty

static llvm::Constant* getPointerCast(
    llvm::Constant* C,
    llvm::Type* Ty)

Description

Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.

Declared at: llvm/include/llvm/IR/Constants.h:1158

Parameters

llvm::Constant* C
llvm::Type* Ty

unsigned int getPredicate() const

Description

Return the ICMP or FCMP predicate value. Assert if this is not an ICMP or FCMP constant expression.

Declared at: llvm/include/llvm/IR/Constants.h:1282

static llvm::Constant* getPtrToInt(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1043

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getSExt(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1033

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getSExtOrBitCast(
    llvm::Constant* C,
    llvm::Type* Ty)

Declared at: llvm/include/llvm/IR/Constants.h:1140

Parameters

llvm::Constant* C
llvm::Type* Ty

static llvm::Constant* getSExtOrTrunc(
    llvm::Constant* C,
    llvm::Type* Ty)

Description

Create either an sext, trunc or nothing, depending on whether Ty is wider, narrower or the same as C->getType(). This only works with integer or vector of integer types.

Declared at: llvm/include/llvm/IR/Constants.h:1153

Parameters

llvm::Constant* C
llvm::Type* Ty

static llvm::Constant* getSIToFP(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1040

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getSelect(
    llvm::Constant* C,
    llvm::Constant* V1,
    llvm::Constant* V2,
    llvm::Type* OnlyIfReducedTy = nullptr)

Description

Select constant expr

Declared at: llvm/include/llvm/IR/Constants.h:1190

Parameters

llvm::Constant* C
llvm::Constant* V1
llvm::Constant* V2
llvm::Type* OnlyIfReducedTy = nullptr
see \a getWithOperands() docs.

static llvm::Constant* getShl(llvm::Constant* C1,
                              llvm::Constant* C2,
                              bool HasNUW = false,
                              bool HasNSW = false)

Declared at: llvm/include/llvm/IR/Constants.h:1028

Parameters

llvm::Constant* C1
llvm::Constant* C2
bool HasNUW = false
bool HasNSW = false

ArrayRef<int> getShuffleMask() const

Description

Assert that this is a shufflevector and return the mask. See class ShuffleVectorInst for a description of the mask representation.

Declared at: llvm/include/llvm/IR/Constants.h:1286

llvm::Constant* getShuffleMaskForBitcode() const

Description

Assert that this is a shufflevector and return the mask. TODO: This is a temporary hack until we update the bitcode format for shufflevector.

Declared at: llvm/include/llvm/IR/Constants.h:1292

static llvm::Constant* getShuffleVector(
    llvm::Constant* V1,
    llvm::Constant* V2,
    ArrayRef<int> Mask,
    llvm::Type* OnlyIfReducedTy = nullptr)

Declared at: llvm/include/llvm/IR/Constants.h:1273

Parameters

llvm::Constant* V1
llvm::Constant* V2
ArrayRef<int> Mask
llvm::Type* OnlyIfReducedTy = nullptr

static llvm::Constant* getSizeOf(llvm::Type* Ty)

Description

getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a target independent way (Note: the return type is an i64).

Declared at: llvm/include/llvm/IR/Constants.h:1002

Parameters

llvm::Type* Ty

static llvm::Constant* getSub(llvm::Constant* C1,
                              llvm::Constant* C2,
                              bool HasNUW = false,
                              bool HasNSW = false)

Declared at: llvm/include/llvm/IR/Constants.h:1020

Parameters

llvm::Constant* C1
llvm::Constant* C2
bool HasNUW = false
bool HasNSW = false

static llvm::Constant* getTrunc(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1032

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getTruncOrBitCast(
    llvm::Constant* C,
    llvm::Type* Ty)

Declared at: llvm/include/llvm/IR/Constants.h:1146

Parameters

llvm::Constant* C
llvm::Type* Ty

static llvm::Constant* getUIToFP(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1039

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getUMin(llvm::Constant* C1,
                               llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1027

Parameters

llvm::Constant* C1
llvm::Constant* C2

llvm::Constant* getWithOperands(
    ArrayRef<llvm::Constant*> Ops) const

Description

This returns the current constant expression with the operands replaced with the specified values. The specified array must have the same number of operands as our current one.

Declared at: llvm/include/llvm/IR/Constants.h:1300

Parameters

ArrayRef<llvm::Constant*> Ops

llvm::Constant* getWithOperands(
    ArrayRef<llvm::Constant*> Ops,
    llvm::Type* Ty,
    bool OnlyIfReduced = false,
    llvm::Type* SrcTy = nullptr) const

Description

Get the current expression with the operands replaced. Return the current constant expression with the operands replaced with \c Ops and the type with \c Ty. The new operands must have the same number as the current ones. If \c OnlyIfReduced is \c true, nullptr will be returned unless something gets constant-folded, the type changes, or the expression is otherwise canonicalized. This parameter should almost always be \c false.

Declared at: llvm/include/llvm/IR/Constants.h:1313

Parameters

ArrayRef<llvm::Constant*> Ops
llvm::Type* Ty
bool OnlyIfReduced = false
llvm::Type* SrcTy = nullptr

static llvm::Constant* getXor(llvm::Constant* C1,
                              llvm::Constant* C2)

Declared at: llvm/include/llvm/IR/Constants.h:1026

Parameters

llvm::Constant* C1
llvm::Constant* C2

static llvm::Constant* getZExt(
    llvm::Constant* C,
    llvm::Type* Ty,
    bool OnlyIfReduced = false)

Declared at: llvm/include/llvm/IR/Constants.h:1034

Parameters

llvm::Constant* C
llvm::Type* Ty
bool OnlyIfReduced = false

static llvm::Constant* getZExtOrBitCast(
    llvm::Constant* C,
    llvm::Type* Ty)

Declared at: llvm/include/llvm/IR/Constants.h:1134

Parameters

llvm::Constant* C
llvm::Type* Ty

llvm::Value* handleOperandChangeImpl(
    llvm::Value* From,
    llvm::Value* To)

Declared at: llvm/include/llvm/IR/Constants.h:977

Parameters

llvm::Value* From
llvm::Value* To

bool isCast() const

Description

Return true if this is a convert constant expression

Declared at: llvm/include/llvm/IR/Constants.h:1182

bool isCompare() const

Description

Return true if this is a compare constant expression

Declared at: llvm/include/llvm/IR/Constants.h:1185

static bool isDesirableBinOp(unsigned int Opcode)

Description

Whether creating a constant expression for this binary operator is desirable.

Declared at: llvm/include/llvm/IR/Constants.h:1329

Parameters

unsigned int Opcode

static bool isSupportedBinOp(unsigned int Opcode)

Description

Whether creating a constant expression for this binary operator is supported.

Declared at: llvm/include/llvm/IR/Constants.h:1333

Parameters

unsigned int Opcode

void setValueSubclassData(unsigned short D)

Declared at: llvm/include/llvm/IR/Constants.h:1343

Parameters

unsigned short D

~ConstantExpr()

Declared at: llvm/include/llvm/IR/Constants.h:986