LLVM API Documentation
Class for constant integers. More...
#include <Constants.h>
Public Member Functions | |
const APInt & | getValue () const |
Return the constant's value. | |
unsigned | getBitWidth () const |
getBitWidth - Return the bitwidth of this constant. | |
uint64_t | getZExtValue () const |
Return the zero extended value. | |
int64_t | getSExtValue () const |
Return the sign extended value. | |
bool | equalsInt (uint64_t V) const |
Determine if this constant's value is same as an unsigned char. | |
IntegerType * | getType () const |
bool | isNegative () const |
bool | isZero () const |
bool | isOne () const |
Determine if the value is one. | |
bool | isMinusOne () const |
Determine if the value is all ones. | |
bool | isMaxValue (bool isSigned) const |
Determine if the value is maximal. | |
bool | isMinValue (bool isSigned) const |
Determine if the value is minimal. | |
bool | uge (uint64_t Num) const |
Determine if the value is greater or equal to the given number. | |
uint64_t | getLimitedValue (uint64_t Limit=~0ULL) const |
Get the constant's value with a saturation limit. | |
Static Public Member Functions | |
static ConstantInt * | getTrue (LLVMContext &Context) |
static ConstantInt * | getFalse (LLVMContext &Context) |
static Constant * | getTrue (Type *Ty) |
static Constant * | getFalse (Type *Ty) |
static Constant * | get (Type *Ty, uint64_t V, bool isSigned=false) |
static ConstantInt * | get (IntegerType *Ty, uint64_t V, bool isSigned=false) |
Get a ConstantInt for a specific value. | |
static ConstantInt * | getSigned (IntegerType *Ty, int64_t V) |
Get a ConstantInt for a specific signed value. | |
static Constant * | getSigned (Type *Ty, int64_t V) |
static ConstantInt * | get (LLVMContext &Context, const APInt &V) |
static ConstantInt * | get (IntegerType *Ty, StringRef Str, uint8_t radix) |
static Constant * | get (Type *Ty, const APInt &V) |
static bool | isValueValidForType (Type *Ty, uint64_t V) |
Determine if the value is in range for the given type. | |
static bool | isValueValidForType (Type *Ty, int64_t V) |
static bool | classof (const Value *V) |
Methods to support type inquiry through isa, cast, and dyn_cast. | |
Protected Member Functions | |
void * | operator new (size_t s) |
Class for constant integers.
This is the shared class of boolean and integer constants. This class represents both boolean and integral constants.
Definition at line 47 of file Constants.h.
static bool llvm::ConstantInt::classof | ( | const Value * | V | ) | [inline, static] |
Methods to support type inquiry through isa, cast, and dyn_cast.
Reimplemented from llvm::Constant.
Definition at line 219 of file Constants.h.
References llvm::Value::ConstantIntVal, and llvm::Value::getValueID().
bool llvm::ConstantInt::equalsInt | ( | uint64_t | V | ) | const [inline] |
Determine if this constant's value is same as an unsigned char.
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.
Definition at line 128 of file Constants.h.
Constant * ConstantInt::get | ( | Type * | Ty, |
uint64_t | V, | ||
bool | isSigned = false |
||
) | [static] |
If Ty is a vector type, return a Constant with a splat of the given value. Otherwise return a ConstantInt for the given value.
Definition at line 573 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getScalarType(), and llvm::ConstantVector::getSplat().
Referenced by llvm::Module::addModuleFlag(), llvm::AddOne(), AddWithOverflow(), AnalyzeLoadFromClobberingMemInst(), BitCastConstantVector(), CoerceAvailableValueToLoadType(), CollectInsertionElements(), CollectShuffleElements(), CollectSingleShuffleElements(), llvm::InstCombiner::commonIDivTransforms(), llvm::InstCombiner::commonShiftTransforms(), llvm::ObjectSizeOffsetEvaluator::compute(), llvm::ComputeMultiple(), computePointerICmp(), ConnectProlog(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldCompareInstruction(), ConstantFoldConvertToInt(), ConstantFoldGetElementPtrImpl(), llvm::ConstantFoldInsertElementInstruction(), llvm::ConstantFoldInstOperands(), llvm::ConstantFoldLoadFromConstPtr(), ConstantFoldScalarCall(), llvm::ConstantFoldSelectInstruction(), llvm::ConstantFoldShuffleVectorInstruction(), convertMemSetToLoop(), ConvertShiftToMul(), convertTransferToLoop(), llvm::IRBuilder< true, TargetFolder >::CreateAnd(), createAndInstr(), llvm::DIBuilder::createArrayType(), llvm::DIBuilder::createArtificialType(), llvm::IRBuilder< true, TargetFolder >::CreateAShr(), llvm::DIBuilder::createBasicType(), llvm::MDBuilder::createBranchWeights(), llvm::DIBuilder::createClassType(), llvm::DIBuilder::createCompileUnit(), llvm::DIBuilder::createComplexVariable(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP1_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP1_64(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP2_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstGEP2_64(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP1_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP1_64(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP2_32(), llvm::IRBuilder< true, TargetFolder >::CreateConstInBoundsGEP2_64(), llvm::DIBuilder::createEnumerationType(), llvm::DIBuilder::createEnumerator(), llvm::DIBuilder::createForwardDecl(), llvm::DIBuilder::createFriend(), createFunctionHelper(), llvm::IRBuilder< true, TargetFolder >::CreateGlobalStringPtr(), llvm::DIBuilder::createGlobalVariable(), createImportedModule(), llvm::DIBuilder::createInheritance(), llvm::DIBuilder::createLexicalBlock(), llvm::DIBuilder::createLexicalBlockFile(), llvm::DIBuilder::createLocalVariable(), llvm::IRBuilder< true, TargetFolder >::CreateLShr(), createMalloc(), llvm::DIBuilder::createMemberPointerType(), llvm::DIBuilder::createMemberType(), llvm::DIBuilder::createMethod(), llvm::DIBuilder::createNameSpace(), llvm::DIBuilder::createObjCIVar(), llvm::DIBuilder::createObjCProperty(), llvm::DIBuilder::createObjectPointerType(), llvm::IRBuilder< true, TargetFolder >::CreateOr(), llvm::DIBuilder::createPointerType(), createPrivateGlobalForSourceLoc(), CreatePrologue(), llvm::DIBuilder::createQualifiedType(), llvm::MDBuilder::createRange(), llvm::DIBuilder::createReferenceType(), llvm::DIBuilder::createReplaceableForwardDecl(), llvm::IRBuilder< true, TargetFolder >::CreateShl(), llvm::DIBuilder::createStaticMemberType(), createStaticVariableHelper(), llvm::DIBuilder::createStructType(), llvm::DIBuilder::createSubroutineType(), llvm::MDBuilder::createTBAANode(), llvm::MDBuilder::createTBAAScalarTypeNode(), llvm::MDBuilder::createTBAAStructNode(), llvm::MDBuilder::createTBAAStructTagNode(), llvm::MDBuilder::createTBAAStructTypeNode(), llvm::DIBuilder::createTemplateTypeParameter(), llvm::DIBuilder::createTypedef(), llvm::DIBuilder::createUnionType(), llvm::DIBuilder::createUnspecifiedType(), llvm::DIBuilder::createVariablePiece(), llvm::IRBuilder< true, TargetFolder >::CreateVectorSplat(), llvm::DIBuilder::createVectorType(), llvm::IRBuilder< true, TargetFolder >::CreateXor(), decomposeBitTestICmp(), DecomposeSimpleLinearExpr(), dyn_castNotVal(), llvm::EmitFWrite(), llvm::EmitGEPOffset(), llvm::Thumb2RegisterInfo::emitLoadConstPool(), llvm::Thumb1RegisterInfo::emitLoadConstPool(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::EmitStrChr(), EvaluateGEPOffsetExpression(), ExtractConstantBytes(), FactorOutConstant(), llvm::FastISel::fastEmit_ri_(), llvm::InstCombiner::FoldAndOfFCmps(), llvm::InstCombiner::FoldAndOfICmps(), FoldBitCast(), llvm::InstCombiner::FoldCmpLoadFromIndexedGlobal(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldICmpShrCst(), llvm::InstCombiner::FoldOrOfFCmps(), llvm::InstCombiner::FoldOrOfICmps(), FoldReinterpretLoadFromConstPtr(), foldSelectICmpAnd(), llvm::InstCombiner::FoldShiftByConstant(), foldUDivNegCst(), foldUDivPow2Cst(), foldUDivShl(), GatherConstantCompares(), get(), getAISize(), llvm::Constant::getAllOnesValue(), getBinOpsForFactorization(), llvm::LazyValueInfo::getConstant(), llvm::SelectionDAG::getConstant(), llvm::ScalarEvolution::getConstant(), GetConstantInt(), llvm::LazyValueInfo::getConstantOnEdge(), getEdgeValueLocal(), llvm::ConstantDataSequential::getElementAsConstant(), getFalse(), getFoldedAlignOf(), getFoldedSizeOf(), llvm::getICmpValue(), getIdentityValue(), llvm::IRBuilderBase::getInt(), llvm::IRBuilderBase::getInt1(), llvm::IRBuilderBase::getInt16(), llvm::IRBuilderBase::getInt32(), llvm::IRBuilderBase::getInt64(), llvm::IRBuilderBase::getInt8(), llvm::Constant::getIntegerValue(), llvm::IRBuilderBase::getIntN(), getLogBase2Vector(), GetMemInstValueForLoad(), llvm::ScalarEvolution::getMulExpr(), llvm::Constant::getNullValue(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::ConstantExpr::getOffsetOf(), getOne(), llvm::DIBuilder::getOrCreateSubrange(), GetSelectFoldableConstant(), GetShiftedValue(), llvm::ScalarEvolution::getSMaxExpr(), GetTagConstant(), getTrue(), llvm::ScalarEvolution::getUMaxExpr(), INITIALIZE_TM_PASS(), llvm::InlineFunction(), llvm::DIBuilder::insertDbgValueIntrinsic(), insertSinCosCall(), llvm::isBytewiseValue(), LLVMConstInt(), LLVMConstIntOfArbitraryPrecision(), LLVMConstIntOfString(), LLVMConstIntOfStringAndSize(), llvm::XCoreInstrInfo::loadImmediate(), LowerBSWAP(), LowerCTLZ(), LowerCTPOP(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::MergeBasicBlockIntoOnlyPred(), PerformHeapAllocSRoA(), llvm::replaceDbgDeclareForAlloca(), replaceSymbolicStrideSCEV(), llvm::NVPTXLowerAggrCopies::runOnFunction(), llvm::FastISel::selectIntrinsicCall(), ShrinkDemandedConstant(), SimplifyCondBranchToCondBranch(), SimplifyDiv(), SimplifyFCmpInst(), SimplifyICmpInst(), simplifyOneLoop(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), SolveQuadraticEquation(), stripAndComputeConstantOffsets(), llvm::SubOne(), SubWithOverflow(), SymbolicallyEvaluateBinop(), SymbolicallyEvaluateGEP(), tryMergeRange(), TryToOptimizeStoreOfMallocToGlobal(), TryToShrinkGlobalToBoolean(), TurnSwitchRangeIntoICmp(), llvm::UnrollRuntimeLoopProlog(), llvm::UpgradeIntrinsicCall(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitAllocaInst(), llvm::ObjectSizeOffsetEvaluator::visitAllocaInst(), llvm::InstCombiner::visitAllocSite(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitExtractElementInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitSDiv(), llvm::InstCombiner::visitSelectInstWithICmp(), llvm::InstCombiner::visitSExt(), llvm::InstCombiner::visitShuffleVectorInst(), llvm::InstCombiner::visitTrunc(), llvm::InstCombiner::visitXor(), llvm::InstCombiner::visitZExt(), and llvm::BasicBlock::~BasicBlock().
ConstantInt * ConstantInt::get | ( | IntegerType * | Ty, |
uint64_t | V, | ||
bool | isSigned = false |
||
) | [static] |
Get a ConstantInt for a specific value.
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.
Definition at line 583 of file Constants.cpp.
References llvm::IntegerType::getBitWidth(), and llvm::Type::getContext().
ConstantInt * ConstantInt::get | ( | LLVMContext & | Context, |
const APInt & | V | ||
) | [static] |
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.
Definition at line 563 of file Constants.cpp.
References get(), llvm::APInt::getBitWidth(), and llvm::LLVMContext::pImpl.
ConstantInt * ConstantInt::get | ( | IntegerType * | Ty, |
StringRef | Str, | ||
uint8_t | radix | ||
) | [static] |
Return a ConstantInt constructed from the string strStart with the given radix.
Definition at line 608 of file Constants.cpp.
References llvm::IntegerType::getBitWidth(), and llvm::Type::getContext().
Constant * ConstantInt::get | ( | Type * | Ty, |
const APInt & | V | ||
) | [static] |
If Ty is a vector type, return a Constant with a splat of the given value. Otherwise return a ConstantInt for the given value.
Definition at line 596 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getContext(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), and getType().
unsigned llvm::ConstantInt::getBitWidth | ( | ) | const [inline] |
getBitWidth - Return the bitwidth of this constant.
Definition at line 106 of file Constants.h.
References llvm::APInt::getBitWidth().
Referenced by decomposeBitTestICmp(), emitGlobalConstantLargeInt(), foldSelectICmpAnd(), llvm::SelectionDAG::getConstant(), llvm::PatternMatch::specific_intval::match(), MultiplyOverflows(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
ConstantInt * ConstantInt::getFalse | ( | LLVMContext & | Context | ) | [static] |
Definition at line 526 of file Constants.cpp.
References get(), llvm::Type::getInt1Ty(), llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::TheFalseVal.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCompareInstruction(), getFalse(), OptimizeGlobalAddressOfMalloc(), SimplifyFCmpInst(), SimplifyICmpInst(), llvm::ScalarEvolution::SimplifyICmpOperands(), TryToShrinkGlobalToBoolean(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInst(), and llvm::SelectionDAGBuilder::visitSwitchCase().
Constant * ConstantInt::getFalse | ( | Type * | Ty | ) | [static] |
Definition at line 545 of file Constants.cpp.
References llvm::dyn_cast(), llvm::Type::getContext(), llvm::SequentialType::getElementType(), getFalse(), llvm::VectorType::getNumElements(), llvm::ConstantVector::getSplat(), and llvm::Type::isIntegerTy().
uint64_t llvm::ConstantInt::getLimitedValue | ( | uint64_t | Limit = ~0ULL | ) | const [inline] |
Get the constant's value with a saturation limit.
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.
Definition at line 214 of file Constants.h.
References llvm::APInt::getLimitedValue().
Referenced by CanEvaluateShifted(), CanEvaluateShuffled(), llvm::InstCombiner::FoldICmpShrCst(), llvm::InstCombiner::FoldShiftByConstant(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
int64_t llvm::ConstantInt::getSExtValue | ( | ) | const [inline] |
Return the sign extended value.
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.
Definition at line 120 of file Constants.h.
References llvm::APInt::getSExtValue().
Referenced by canFoldIVIncExpr(), EvaluateGEPOffsetExpression(), GetOffsetFromIndex(), isIndexInRangeOfSequentialType(), and X86ChooseCmpImmediateOpcode().
ConstantInt * ConstantInt::getSigned | ( | IntegerType * | Ty, |
int64_t | V | ||
) | [static] |
Get a ConstantInt for a specific signed value.
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.
Definition at line 588 of file Constants.cpp.
Referenced by llvm::InstCombiner::FoldOrOfICmps(), generateUnsignedDivisionCode(), insertFastDiv(), llvm::InstCombiner::visitLShr(), and llvm::InstCombiner::visitOr().
Constant * ConstantInt::getSigned | ( | Type * | Ty, |
int64_t | V | ||
) | [static] |
Definition at line 592 of file Constants.cpp.
ConstantInt * ConstantInt::getTrue | ( | LLVMContext & | Context | ) | [static] |
Definition at line 519 of file Constants.cpp.
References get(), llvm::Type::getInt1Ty(), llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::TheTrueVal.
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::SelectionDAGBuilder::EmitBranchForMergedCondition(), getTrue(), OptimizeGlobalAddressOfMalloc(), SimplifyICmpInst(), TurnSwitchRangeIntoICmp(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFree(), llvm::InstCombiner::visitICmpInst(), and llvm::SelectionDAGBuilder::visitSwitchCase().
Constant * ConstantInt::getTrue | ( | Type * | Ty | ) | [static] |
Definition at line 533 of file Constants.cpp.
References llvm::dyn_cast(), llvm::Type::getContext(), llvm::SequentialType::getElementType(), llvm::VectorType::getNumElements(), llvm::ConstantVector::getSplat(), getTrue(), and llvm::Type::isIntegerTy().
IntegerType* llvm::ConstantInt::getType | ( | ) | const [inline] |
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount of casting needed in parts of the compiler.
Reimplemented from llvm::Value.
Definition at line 135 of file Constants.h.
Referenced by llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), decomposeBitTestICmp(), emitGlobalConstantLargeInt(), llvm::InstCombiner::FoldAndOfICmps(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::InstCombiner::FoldOrOfICmps(), get(), GetConstantInt(), llvm::SCEVConstant::getType(), isRunOfOnes(), llvm::PatternMatch::specific_intval::match(), ShrinkDemandedConstant(), SwitchToLookupTable(), tryMergeRange(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitXor().
const APInt& llvm::ConstantInt::getValue | ( | ) | const [inline] |
Return the constant's value.
Return the constant as an APInt value reference. This allows clients to obtain a copy of the value, with all its precision in tact.
Definition at line 101 of file Constants.h.
Referenced by llvm::GEPOperator::accumulateConstantOffset(), llvm::DwarfUnit::addConstantValue(), CanEvaluateShifted(), canFoldIVIncExpr(), llvm::computeKnownBitsFromRangeMetadata(), llvm::ComputeMultiple(), computePointerICmp(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldInsertElementInstruction(), llvm::ConstantFoldTerminator(), ConstantIntSortPredicate(), decomposeBitTestICmp(), DemandedBitsLHSMask(), emitDebugValueComment(), emitGlobalConstantLargeInt(), ExtractBranchMetadata(), FactorOutConstant(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldICmpDivCst(), foldLogOpOfMaskedICmps(), llvm::InstCombiner::FoldOrOfICmps(), llvm::InstCombiner::FoldOrWithConstants(), foldSelectICmpAnd(), llvm::InstCombiner::FoldXorWithConstants(), GatherConstantCompares(), gcd(), GetBranchWeights(), llvm::SelectionDAG::getConstant(), getExactSDiv(), llvm::MDNode::getMostGenericRange(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), getPredicateResult(), GetShiftedValue(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::ScalarEvolution::getSmallConstantTripMultiple(), getTypeOfMaskedICmp(), llvm::ScalarEvolution::getUDivExpr(), getValueFromFromCondition(), HasAddOverflow(), HasSubOverflow(), isDereferenceablePointer(), llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing(), isHighOnes(), isIndexInRangeOfSequentialType(), isLikelyComplexAddressComputation(), llvm::SCEV::isNonConstantNegative(), isRemainderZero(), isRunOfOnes(), isSignBitCheck(), isStridedPtr(), MaintainNoSignedWrap(), MultiplyOverflows(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), sdiv(), ShrinkDemandedConstant(), SimplifyAndOfICmps(), SimplifyICmpInst(), SimplifyOrInst(), SimplifyOrOfICmps(), srem(), SwitchToLookupTable(), tryMergeRange(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitAnd(), llvm::ObjectSizeOffsetVisitor::visitCallSite(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitOr(), llvm::InstCombiner::visitSelectInstWithICmp(), llvm::InstCombiner::visitSub(), and llvm::InstCombiner::visitXor().
uint64_t llvm::ConstantInt::getZExtValue | ( | ) | const [inline] |
Return the zero extended value.
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.
Definition at line 112 of file Constants.h.
References llvm::APInt::getZExtValue().
Referenced by llvm::GEPOperator::accumulateConstantOffset(), AnalyzeLoadFromClobberingMemInst(), cacheAnnotationFromMD(), CanEvaluateShifted(), CollectInsertionElements(), computeKnownBitsFromAssume(), llvm::ComputeMultiple(), llvm::MachineInstr::emitError(), EvaluateGEPOffsetExpression(), EvaluateStoreInto(), ExtractConstantBytes(), llvm::InstCombiner::FoldCmpLoadFromIndexedGlobal(), FoldCondBranchOnPHI(), llvm::InstCombiner::FoldShiftByConstant(), llvm::MemIntrinsic::getAlignment(), llvm::getConstantStringInfo(), GetOffsetFromIndex(), GetShiftedValue(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::ScalarEvolution::getSmallConstantTripMultiple(), llvm::CompositeType::indexValid(), isDereferenceablePointer(), isGEPKnownNonNull(), llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing(), IsUserOfGlobalSafeForSRA(), llvm::PatternMatch::specific_intval::match(), matchPairwiseReduction(), matchVectorSplittingReduction(), OptimizeGlobalAddressOfMalloc(), OptimizeIntToFloatBitCast(), llvm::FunctionLoweringInfo::set(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitTrunc().
bool llvm::ConstantInt::isMaxValue | ( | bool | isSigned | ) | const [inline] |
Determine if the value is maximal.
This function will return true iff this constant represents the largest value that may be represented by the constant's type.
Definition at line 181 of file Constants.h.
References llvm::APInt::isMaxSignedValue(), and llvm::APInt::isMaxValue().
Referenced by isSignBitCheck().
bool llvm::ConstantInt::isMinusOne | ( | ) | const [inline] |
Determine if the value is all ones.
This function will return true iff every bit in this constant is set to true.
Definition at line 172 of file Constants.h.
References llvm::APInt::isAllOnesValue().
bool llvm::ConstantInt::isMinValue | ( | bool | isSigned | ) | const [inline] |
Determine if the value is minimal.
This function will return true iff this constant represents the smallest value that may be represented by this constant's type.
Definition at line 193 of file Constants.h.
References llvm::APInt::isMinSignedValue(), and llvm::APInt::isMinValue().
bool llvm::ConstantInt::isNegative | ( | ) | const [inline] |
Definition at line 151 of file Constants.h.
References llvm::APInt::isNegative().
Referenced by llvm::InstCombiner::FoldICmpDivCst(), HasAddOverflow(), HasSubOverflow(), SimplifyICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
bool llvm::ConstantInt::isOne | ( | ) | const [inline] |
Determine if the value is one.
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().
Definition at line 164 of file Constants.h.
Referenced by llvm::ConstantFoldCastInstruction(), llvm::FoldBranchToCommonDest(), llvm::InstCombiner::FoldICmpDivCst(), IsConstantOne(), isSelect01(), and isSignTest().
bool ConstantInt::isValueValidForType | ( | Type * | Ty, |
uint64_t | V | ||
) | [static] |
Determine if the value is in range for the given type.
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.
Definition at line 1258 of file Constants.cpp.
References llvm::Type::getIntegerBitWidth(), and llvm::Type::isIntegerTy().
bool ConstantInt::isValueValidForType | ( | Type * | Ty, |
int64_t | V | ||
) | [static] |
Definition at line 1268 of file Constants.cpp.
References llvm::Type::getIntegerBitWidth(), and llvm::Type::isIntegerTy().
bool llvm::ConstantInt::isZero | ( | ) | const [inline] |
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().
Definition at line 156 of file Constants.h.
Referenced by llvm::GEPOperator::accumulateConstantOffset(), decomposeBitTestICmp(), evaluateFCmpRelation(), EvaluateGEPOffsetExpression(), evaluateICmpRelation(), FactorOutConstant(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldICmpDivCst(), llvm::InstCombiner::FoldOrOfICmps(), foldSelectICmpAnd(), GEPToVectorIndex(), llvm::getConstantStringInfo(), getMergedGlobalExpr(), GetOffsetFromIndex(), getTypeOfMaskedICmp(), InstructionDereferencesPointer(), isDereferenceablePointer(), isSelect01(), isSignBitCheck(), isSignTest(), isSimpleEnoughPointerToCommit(), llvm::MemIntrinsic::isVolatile(), llvm::FastISel::selectIntrinsicCall(), SimplifyICmpInst(), llvm::InstCombiner::visitAllocSite(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
void* llvm::ConstantInt::operator new | ( | size_t | s | ) | [inline, protected] |
Reimplemented from llvm::User.
Definition at line 55 of file Constants.h.
bool llvm::ConstantInt::uge | ( | uint64_t | Num | ) | const [inline] |
Determine if the value is greater or equal to the given number.
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.
Definition at line 205 of file Constants.h.
References llvm::APInt::getActiveBits(), and llvm::APInt::getZExtValue().
Referenced by llvm::InstCombiner::FoldShiftByConstant(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().