class ConstantInt
Declaration
class ConstantInt : public ConstantData { /* full declaration omitted */ };
Description
This is the shared class of boolean and integer constants. This class represents both boolean and integral constants. Class for constant integers.
Declared at: llvm/include/llvm/IR/Constants.h:83
Inherits from: ConstantData
Member Variables
Inherited from Value:
- protected SubclassOptionalData
- protected NumUserOperands
- protected IsUsedByMD
- protected HasName
- protected HasHungOffUses
- protected HasDescriptor
- public static MaxAlignmentExponent = 29
- public static MaximumAlignment = 1U << MaxAlignmentExponent
Method Overview
- public ConstantInt(const llvm::ConstantInt &)
- public static bool classof(const llvm::Value * V)
- public bool equalsInt(uint64_t V) const
- public static llvm::Constant * get(llvm::Type * Ty, uint64_t V, bool isSigned = false)
- public static llvm::ConstantInt * get(llvm::IntegerType * Ty, uint64_t V, bool isSigned = false)
- public static llvm::ConstantInt * get(llvm::LLVMContext & Context, const llvm::APInt & V)
- public static llvm::ConstantInt * get(llvm::IntegerType * Ty, llvm::StringRef Str, uint8_t radix)
- public static llvm::Constant * get(llvm::Type * Ty, const llvm::APInt & V)
- public unsigned int getBitWidth() const
- public static llvm::ConstantInt * getFalse(llvm::LLVMContext & Context)
- public static llvm::Constant * getFalse(llvm::Type * Ty)
- public uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const
- public inline int64_t getSExtValue() const
- public static llvm::ConstantInt * getSigned(llvm::IntegerType * Ty, int64_t V)
- public static llvm::Constant * getSigned(llvm::Type * Ty, int64_t V)
- public static llvm::ConstantInt * getTrue(llvm::LLVMContext & Context)
- public static llvm::Constant * getTrue(llvm::Type * Ty)
- public inline llvm::IntegerType * getType() const
- public inline const llvm::APInt & getValue() const
- public inline uint64_t getZExtValue() const
- public bool isMaxValue(bool isSigned) const
- public bool isMinValue(bool isSigned) const
- public bool isMinusOne() const
- public bool isNegative() const
- public bool isOne() const
- public static bool isValueValidForType(llvm::Type * Ty, uint64_t V)
- public static bool isValueValidForType(llvm::Type * Ty, int64_t V)
- public bool isZero() const
- public bool uge(uint64_t Num) const
Inherited from ConstantData:
Inherited from Constant:
- public canTrap
- public classof
- public containsConstantExpression
- public containsUndefElement
- public destroyConstant
- public getAggregateElement
- public getAggregateElement
- public getAllOnesValue
- public getIntegerValue
- public getNullValue
- public getSplatValue
- public getUniqueInteger
- public handleOperandChange
- public hasExactInverseFP
- public isAllOnesValue
- public isConstantUsed
- public isDLLImportDependent
- public isElementWiseEqual
- public isFiniteNonZeroFP
- public isMinSignedValue
- public isNaN
- public isNegativeZeroValue
- public isNormalFP
- public isNotMinSignedValue
- public isNotOneValue
- public isNullValue
- public isOneValue
- public isThreadDependent
- public isZeroValue
- public needsRelocation
- public removeDeadConstantUsers
- public replaceUndefsWith
- public stripPointerCasts
- public stripPointerCasts
Inherited from User:
- protected Op
- protected Op
- protected OpFrom
- protected allocHungoffUses
- public classof
- public dropAllReferences
- public getDescriptor
- public getDescriptor
- public getNumOperands
- public getOperand
- public getOperandList
- public getOperandList
- public getOperandUse
- public getOperandUse
- protected growHungoffUses
- public op_begin
- public op_begin
- public op_end
- public op_end
- public operand_values
- public operand_values
- public operands
- public operands
- public replaceUsesOfWith
- public setGlobalVariableNumOperands
- public setNumHungOffUseOperands
- public setOperand
- public value_op_begin
- public value_op_begin
- public value_op_end
- public value_op_end
Inherited from Value:
- public DoPHITranslation
- public DoPHITranslation
- public addUse
- public assertModuleIsMaterialized
- public assertModuleIsMaterializedImpl
- public clearSubclassOptionalData
- public deleteValue
- public dump
- public getContext
- public getName
- public getNumUses
- public getPointerAlignment
- public getPointerDereferenceableBytes
- public getRawSubclassOptionalData
- protected getSubclassDataFromValue
- public getType
- public getValueID
- public getValueName
- public hasNUses
- public hasNUsesOrMore
- public hasName
- public hasOneUse
- public hasSameSubclassOptionalData
- public hasValueHandle
- public isSwiftError
- public isUsedByMetadata
- public isUsedInBasicBlock
- public materialized_use_begin
- public materialized_use_begin
- public materialized_use_empty
- public materialized_user_begin
- public materialized_user_begin
- public materialized_users
- public materialized_users
- public materialized_uses
- public materialized_uses
- public mutateType
- public print
- public print
- public printAsOperand
- public printAsOperand
- public replaceAllUsesWith
- public replaceNonMetadataUsesWith
- public replaceUsesOutsideBlock
- public replaceUsesWithIf
- public reverseUseList
- public setName
- public setValueName
- protected setValueSubclassData
- public sortUseList
- public stripAndAccumulateConstantOffsets
- public stripAndAccumulateConstantOffsets
- public stripAndAccumulateInBoundsConstantOffsets
- public stripAndAccumulateInBoundsConstantOffsets
- public stripInBoundsConstantOffsets
- public stripInBoundsConstantOffsets
- public stripInBoundsOffsets
- public stripInBoundsOffsets
- public stripPointerCasts
- public stripPointerCasts
- public stripPointerCastsAndAliases
- public stripPointerCastsAndAliases
- public stripPointerCastsAndInvariantGroups
- public stripPointerCastsAndInvariantGroups
- public stripPointerCastsSameRepresentation
- public stripPointerCastsSameRepresentation
- public takeName
- public use_begin
- public use_begin
- public use_empty
- public use_end
- public use_end
- public user_back
- public user_back
- public user_begin
- public user_begin
- public user_empty
- public user_end
- public user_end
- public users
- public users
- public uses
- public uses
Methods
¶ConstantInt(const llvm::ConstantInt&)
ConstantInt(const llvm::ConstantInt&)
Declared at: llvm/include/llvm/IR/Constants.h:93
Parameters
- const llvm::ConstantInt&
¶static bool classof(const llvm::Value* V)
static bool classof(const llvm::Value* V)
Description
Methods to support type inquiry through isa, cast, and dyn_cast.
Declared at: llvm/include/llvm/IR/Constants.h:255
Parameters
- const llvm::Value* V
¶bool equalsInt(uint64_t V) const
bool equalsInt(uint64_t V) const
Description
A helper method that can be used to determine if the constant contained within is equal to a constant. This only works for very small values, because this is all that can be represented with all types. Determine if this constant's value is same as an unsigned char.
Declared at: llvm/include/llvm/IR/Constants.h:164
Parameters
- uint64_t V
¶static llvm::Constant* get(llvm::Type* Ty,
uint64_t V,
bool isSigned = false)
static llvm::Constant* get(llvm::Type* Ty,
uint64_t V,
bool isSigned = false)
Description
If Ty is a vector type, return a Constant with a splat of the given value. Otherwise return a ConstantInt for the given value.
Declared at: llvm/include/llvm/IR/Constants.h:102
Parameters
- llvm::Type* Ty
- uint64_t V
- bool isSigned = false
¶static llvm::ConstantInt* get(
llvm::IntegerType* Ty,
uint64_t V,
bool isSigned = false)
static llvm::ConstantInt* get(
llvm::IntegerType* Ty,
uint64_t V,
bool isSigned = false)
Description
Return a ConstantInt with the specified integer value for the specified type. If the type is wider than 64 bits, the value will be zero-extended to fit the type, unless isSigned is true, in which case the value will be interpreted as a 64-bit signed integer and sign-extended to fit the type. Get a ConstantInt for a specific value.
Declared at: llvm/include/llvm/IR/Constants.h:110
Parameters
- llvm::IntegerType* Ty
- uint64_t V
- bool isSigned = false
¶static llvm::ConstantInt* get(
llvm::LLVMContext& Context,
const llvm::APInt& V)
static llvm::ConstantInt* get(
llvm::LLVMContext& Context,
const llvm::APInt& V)
Description
Return a ConstantInt with the specified value and an implied Type. The type is the integer type that corresponds to the bit width of the value.
Declared at: llvm/include/llvm/IR/Constants.h:123
Parameters
- llvm::LLVMContext& Context
- const llvm::APInt& V
¶static llvm::ConstantInt* get(
llvm::IntegerType* Ty,
llvm::StringRef Str,
uint8_t radix)
static llvm::ConstantInt* get(
llvm::IntegerType* Ty,
llvm::StringRef Str,
uint8_t radix)
Description
Return a ConstantInt constructed from the string strStart with the given radix.
Declared at: llvm/include/llvm/IR/Constants.h:127
Parameters
- llvm::IntegerType* Ty
- llvm::StringRef Str
- uint8_t radix
¶static llvm::Constant* get(llvm::Type* Ty,
const llvm::APInt& V)
static llvm::Constant* get(llvm::Type* Ty,
const llvm::APInt& V)
Description
If Ty is a vector type, return a Constant with a splat of the given value. Otherwise return a ConstantInt for the given value.
Declared at: llvm/include/llvm/IR/Constants.h:132
Parameters
- llvm::Type* Ty
- const llvm::APInt& V
¶unsigned int getBitWidth() const
unsigned int getBitWidth() const
Description
getBitWidth - Return the bitwidth of this constant.
Declared at: llvm/include/llvm/IR/Constants.h:142
¶static llvm::ConstantInt* getFalse(
llvm::LLVMContext& Context)
static llvm::ConstantInt* getFalse(
llvm::LLVMContext& Context)
Declared at: llvm/include/llvm/IR/Constants.h:96
Parameters
- llvm::LLVMContext& Context
¶static llvm::Constant* getFalse(llvm::Type* Ty)
static llvm::Constant* getFalse(llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Constants.h:98
Parameters
- llvm::Type* Ty
¶uint64_t getLimitedValue(
uint64_t Limit = ~0ULL) const
uint64_t getLimitedValue(
uint64_t Limit = ~0ULL) const
Description
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the limit value. This causes the value to saturate to the limit.
Declared at: llvm/include/llvm/IR/Constants.h:250
Parameters
- uint64_t Limit = ~0ULL
Returns
the min of the value of the constant and the specified value Get the constant's value with a saturation limit
¶inline int64_t getSExtValue() const
inline int64_t getSExtValue() const
Description
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the type of this constant. Note that this method can assert if the value does not fit in 64 bits. Return the sign extended value.
Declared at: llvm/include/llvm/IR/Constants.h:156
¶static llvm::ConstantInt* getSigned(
llvm::IntegerType* Ty,
int64_t V)
static llvm::ConstantInt* getSigned(
llvm::IntegerType* Ty,
int64_t V)
Description
Return a ConstantInt with the specified value for the specified type. The value V will be canonicalized to a an unsigned APInt. Accessing it with either getSExtValue() or getZExtValue() will yield a correctly sized and signed value for the type Ty. Get a ConstantInt for a specific signed value.
Declared at: llvm/include/llvm/IR/Constants.h:118
Parameters
- llvm::IntegerType* Ty
- int64_t V
¶static llvm::Constant* getSigned(llvm::Type* Ty,
int64_t V)
static llvm::Constant* getSigned(llvm::Type* Ty,
int64_t V)
Declared at: llvm/include/llvm/IR/Constants.h:119
Parameters
- llvm::Type* Ty
- int64_t V
¶static llvm::ConstantInt* getTrue(
llvm::LLVMContext& Context)
static llvm::ConstantInt* getTrue(
llvm::LLVMContext& Context)
Declared at: llvm/include/llvm/IR/Constants.h:95
Parameters
- llvm::LLVMContext& Context
¶static llvm::Constant* getTrue(llvm::Type* Ty)
static llvm::Constant* getTrue(llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Constants.h:97
Parameters
- llvm::Type* Ty
¶inline llvm::IntegerType* getType() const
inline llvm::IntegerType* getType() const
Description
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount of casting needed in parts of the compiler.
Declared at: llvm/include/llvm/IR/Constants.h:171
¶inline const llvm::APInt& getValue() const
inline const llvm::APInt& getValue() const
Description
Return the constant as an APInt value reference. This allows clients to obtain a full-precision copy of the value. Return the constant's value.
Declared at: llvm/include/llvm/IR/Constants.h:137
¶inline uint64_t getZExtValue() const
inline uint64_t getZExtValue() const
Description
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate for the type of this constant. Note that this method can assert if the value does not fit in 64 bits. Return the zero extended value.
Declared at: llvm/include/llvm/IR/Constants.h:148
¶bool isMaxValue(bool isSigned) const
bool isMaxValue(bool isSigned) const
Description
This function will return true iff this constant represents the largest value that may be represented by the constant's type.
Declared at: llvm/include/llvm/IR/Constants.h:217
Parameters
- bool isSigned
Returns
true iff this is the largest value that may be represented by this type. Determine if the value is maximal.
¶bool isMinValue(bool isSigned) const
bool isMinValue(bool isSigned) const
Description
This function will return true iff this constant represents the smallest value that may be represented by this constant's type.
Declared at: llvm/include/llvm/IR/Constants.h:229
Parameters
- bool isSigned
Returns
true if this is the smallest value that may be represented by this type. Determine if the value is minimal.
¶bool isMinusOne() const
bool isMinusOne() const
Description
This function will return true iff every bit in this constant is set to true.
Declared at: llvm/include/llvm/IR/Constants.h:208
Returns
true iff this constant's bits are all set to true. Determine if the value is all ones.
¶bool isNegative() const
bool isNegative() const
Declared at: llvm/include/llvm/IR/Constants.h:187
¶bool isOne() const
bool isOne() const
Description
This is just a convenience method to make client code smaller for a common case. It also correctly performs the comparison without the potential for an assertion from getZExtValue(). Determine if the value is one.
Declared at: llvm/include/llvm/IR/Constants.h:200
¶static bool isValueValidForType(llvm::Type* Ty,
uint64_t V)
static bool isValueValidForType(llvm::Type* Ty,
uint64_t V)
Description
This static method returns true if the type Ty is big enough to represent the value V. This can be used to avoid having the get method assert when V is larger than Ty can represent. Note that there are two versions of this method, one for unsigned and one for signed integers. Although ConstantInt canonicalizes everything to an unsigned integer, the signed version avoids callers having to convert a signed quantity to the appropriate unsigned type before calling the method.
Declared at: llvm/include/llvm/IR/Constants.h:184
Parameters
- llvm::Type* Ty
- uint64_t V
Returns
true if V is a valid value for type Ty Determine if the value is in range for the given type.
¶static bool isValueValidForType(llvm::Type* Ty,
int64_t V)
static bool isValueValidForType(llvm::Type* Ty,
int64_t V)
Declared at: llvm/include/llvm/IR/Constants.h:185
Parameters
- llvm::Type* Ty
- int64_t V
¶bool isZero() const
bool isZero() const
Description
This is just a convenience method to make client code smaller for a common code. It also correctly performs the comparison without the potential for an assertion from getZExtValue().
Declared at: llvm/include/llvm/IR/Constants.h:192
¶bool uge(uint64_t Num) const
bool uge(uint64_t Num) const
Description
This function will return true iff this constant represents a value with active bits bigger than 64 bits or a value greater than the given uint64_t value.
Declared at: llvm/include/llvm/IR/Constants.h:241
Parameters
- uint64_t Num
Returns
true iff this constant is greater or equal to the given number. Determine if the value is greater or equal to the given number.