LLVM API Documentation
Class for constant integers. More...
#include <Constants.h>
Public Member Functions | |
const APInt & | getValue () const |
Return the constant's value. More... | |
unsigned | getBitWidth () const |
getBitWidth - Return the bitwidth of this constant. More... | |
uint64_t | getZExtValue () const |
Return the zero extended value. More... | |
int64_t | getSExtValue () const |
Return the sign extended value. More... | |
bool | equalsInt (uint64_t V) const |
Determine if this constant's value is same as an unsigned char. More... | |
IntegerType * | getType () const |
bool | isNegative () const |
bool | isZero () const |
bool | isOne () const |
Determine if the value is one. More... | |
bool | isMinusOne () const |
Determine if the value is all ones. More... | |
bool | isMaxValue (bool isSigned) const |
Determine if the value is maximal. More... | |
bool | isMinValue (bool isSigned) const |
Determine if the value is minimal. More... | |
bool | uge (uint64_t Num) const |
Determine if the value is greater or equal to the given number. More... | |
uint64_t | getLimitedValue (uint64_t Limit=~0ULL) const |
Get the constant's value with a saturation limit. More... | |
![]() | |
bool | isNullValue () const |
bool | isAllOnesValue () const |
bool | isNegativeZeroValue () const |
bool | isZeroValue () const |
Return true if the value is negative zero or null value. More... | |
bool | canTrap () const |
bool | isThreadDependent () const |
isThreadDependent - Return true if the value can vary between threads. More... | |
bool | isConstantUsed () const |
PossibleRelocationsTy | getRelocationInfo () const |
Constant * | getAggregateElement (unsigned Elt) const |
Constant * | getAggregateElement (Constant *Elt) const |
Constant * | getSplatValue () const |
const APInt & | getUniqueInteger () const |
virtual void | destroyConstant () |
virtual void | replaceUsesOfWithOnConstant (Value *, Value *, Use *) |
void | removeDeadConstantUsers () const |
![]() | |
~User () | |
void | operator delete (void *Usr) |
operator delete - free memory allocated for User and Use objects More... | |
void | operator delete (void *, unsigned) |
placement delete - required by std, but never called. More... | |
void | operator delete (void *, unsigned, bool) |
placement delete - required by std, but never called. More... | |
Value * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Value *Val) |
const Use & | getOperandUse (unsigned i) const |
Use & | getOperandUse (unsigned i) |
unsigned | getNumOperands () const |
op_iterator | op_begin () |
const_op_iterator | op_begin () const |
op_iterator | op_end () |
const_op_iterator | op_end () const |
value_op_iterator | value_op_begin () |
value_op_iterator | value_op_end () |
void | dropAllReferences () |
void | replaceUsesOfWith (Value *From, Value *To) |
![]() | |
virtual | ~Value () |
void | dump () const |
dump - Support for debugging, callable in GDB: V->dump() More... | |
void | print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const |
Type * | getType () const |
LLVMContext & | getContext () const |
All values hold a context through their type. More... | |
bool | hasName () const |
ValueName * | getValueName () const |
void | setValueName (ValueName *VN) |
StringRef | getName () const |
void | setName (const Twine &Name) |
void | takeName (Value *V) |
void | replaceAllUsesWith (Value *V) |
bool | use_empty () const |
use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
User * | use_back () |
const User * | use_back () const |
bool | hasOneUse () const |
bool | hasNUses (unsigned N) const |
bool | hasNUsesOrMore (unsigned N) const |
bool | isUsedInBasicBlock (const BasicBlock *BB) const |
unsigned | getNumUses () const |
void | addUse (Use &U) |
unsigned | getValueID () const |
unsigned | getRawSubclassOptionalData () const |
void | clearSubclassOptionalData () |
bool | hasSameSubclassOptionalData (const Value *V) const |
void | intersectOptionalDataWith (const Value *V) |
bool | hasValueHandle () const |
Value * | stripPointerCasts () |
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCasts () const |
Value * | stripPointerCastsNoFollowAliases () |
Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCastsNoFollowAliases () const |
Value * | stripInBoundsConstantOffsets () |
Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsConstantOffsets () const |
Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More... | |
const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
Value * | stripInBoundsOffsets () |
Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsOffsets () const |
bool | isDereferenceablePointer () const |
Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
void | mutateType (Type *Ty) |
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. More... | |
static ConstantInt * | getSigned (IntegerType *Ty, int64_t V) |
Get a ConstantInt for a specific signed value. More... | |
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. More... | |
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. More... | |
![]() | |
static bool | classof (const Value *V) |
static Constant * | getNullValue (Type *Ty) |
static Constant * | getAllOnesValue (Type *Ty) |
Get the all ones value. More... | |
static Constant * | getIntegerValue (Type *Ty, const APInt &V) |
![]() | |
static bool | classof (const Value *V) |
Protected Member Functions | |
void * | operator new (size_t s) |
![]() | |
Constant (Type *ty, ValueTy vty, Use *Ops, unsigned NumOps) | |
void | destroyConstantImpl () |
![]() | |
void * | operator new (size_t s, unsigned Us) |
User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps) | |
Use * | allocHungoffUses (unsigned) const |
void | dropHungoffUses () |
template<int Idx> | |
Use & | Op () |
template<int Idx> | |
const Use & | Op () const |
![]() | |
virtual void | printCustom (raw_ostream &O) const |
Value (Type *Ty, unsigned scid) | |
unsigned short | getSubclassDataFromValue () const |
void | setValueSubclassData (unsigned short D) |
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 51 of file Constants.h.
Methods to support type inquiry through isa, cast, and dyn_cast.
Definition at line 223 of file Constants.h.
References llvm::Value::ConstantIntVal, and llvm::Value::getValueID().
|
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 132 of file Constants.h.
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 492 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getScalarType(), and llvm::ConstantVector::getSplat().
Referenced by llvm::Module::addModuleFlag(), AddOne(), AddWithOverflow(), AnalyzeLoadFromClobberingMemInst(), BitCastConstantVector(), llvm::X86TargetLowering::BuildFILD(), CoerceAvailableValueToLoadType(), CollectInsertionElements(), CollectShuffleElements(), CollectSingleShuffleElements(), llvm::InstCombiner::commonShiftTransforms(), llvm::ComputeMultiple(), computePointerICmp(), ConnectProlog(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCall(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldCompareInstruction(), ConstantFoldConvertToInt(), ConstantFoldGetElementPtrImpl(), llvm::ConstantFoldInsertElementInstruction(), llvm::ConstantFoldInstOperands(), llvm::ConstantFoldLoadFromConstPtr(), 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(), llvm::DIBuilder::createFunction(), llvm::IRBuilder< true, TargetFolder >::CreateGlobalStringPtr(), llvm::DIBuilder::createGlobalVariable(), llvm::DIBuilder::createImportedDeclaration(), createImportedModule(), llvm::DIBuilder::createInheritance(), llvm::DIBuilder::createLexicalBlock(), 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(), CreatePrologue(), llvm::DIBuilder::createQualifiedType(), llvm::MDBuilder::createRange(), llvm::DIBuilder::createReferenceType(), llvm::IRBuilder< true, TargetFolder >::CreateShl(), llvm::DIBuilder::createStaticMemberType(), llvm::DIBuilder::createStaticVariable(), 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::IRBuilder< true, TargetFolder >::CreateVectorSplat(), llvm::DIBuilder::createVectorType(), llvm::IRBuilder< true, TargetFolder >::CreateXor(), decomposeBitTestICmp(), DecomposeSimpleLinearExpr(), dyn_castFoldableMul(), dyn_castNotVal(), llvm::EmitFWrite(), llvm::EmitGEPOffset(), llvm::Thumb2RegisterInfo::emitLoadConstPool(), llvm::Thumb1RegisterInfo::emitLoadConstPool(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), llvm::EmitStrChr(), EvaluateGEPOffsetExpression(), ExtractConstantBytes(), FactorOutConstant(), llvm::FastISel::FastEmit_ri_(), llvm::InstCombiner::FoldAndOfFCmps(), llvm::InstCombiner::FoldAndOfICmps(), FoldBitCast(), llvm::InstCombiner::FoldCmpLoadFromIndexedGlobal(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::InstCombiner::FoldICmpShrCst(), llvm::InstCombiner::FoldOrOfFCmps(), FoldReinterpretLoadFromConstPtr(), foldSelectICmpAnd(), llvm::InstCombiner::FoldShiftByConstant(), foldUDivNegCst(), foldUDivPow2Cst(), foldUDivShl(), for(), GatherConstantCompares(), getAISize(), llvm::ConstantExpr::getAlignOf(), llvm::Constant::getAllOnesValue(), llvm::DebugLoc::getAsMDNode(), llvm::ConstantExpr::getBinOpIdentity(), llvm::LazyValueInfo::getConstant(), llvm::SelectionDAG::getConstant(), llvm::ScalarEvolution::getConstant(), GetConstantInt(), llvm::LazyValueInfo::getConstantOnEdge(), getEdgeValueLocal(), llvm::ConstantDataSequential::getElementAsConstant(), getFalse(), getFoldedAlignOf(), getFoldedSizeOf(), llvm::getICmpValue(), llvm::IRBuilderBase::getInt(), llvm::IRBuilderBase::getInt1(), llvm::IRBuilderBase::getInt16(), llvm::IRBuilderBase::getInt32(), llvm::IRBuilderBase::getInt64(), llvm::IRBuilderBase::getInt8(), llvm::Constant::getIntegerValue(), getLogBase2Vector(), GetMemInstValueForLoad(), llvm::MDNode::getMostGenericTBAA(), llvm::ScalarEvolution::getMulExpr(), llvm::Constant::getNullValue(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::ConstantExpr::getOffsetOf(), getOne(), llvm::DIBuilder::getOrCreateSubrange(), GetSelectFoldableConstant(), GetShiftedValue(), llvm::ConstantExpr::getSizeOf(), llvm::ScalarEvolution::getSMaxExpr(), GetTagConstant(), getTrue(), llvm::ScalarEvolution::getUMaxExpr(), HandleByValArgument(), llvm::InlineFunction(), llvm::DIBuilder::insertDbgValueIntrinsic(), InstallGlobalCtors(), llvm::isBytewiseValue(), LLVMConstInt(), LLVMConstIntOfArbitraryPrecision(), LLVMConstIntOfString(), LLVMConstIntOfStringAndSize(), LowerBSWAP(), LowerCTLZ(), LowerCTPOP(), llvm::IntrinsicLowering::LowerIntrinsicCall(), LowerSIGN_EXTEND_AVX512(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::ObjectSizeOffsetEvaluator::ObjectSizeOffsetEvaluator(), PerformHeapAllocSRoA(), llvm::replaceDbgDeclareForAlloca(), llvm::JIT::runFunction(), llvm::NVPTXLowerAggrCopies::runOnFunction(), ShrinkDemandedConstant(), SimplifyCondBranchToCondBranch(), SimplifyDiv(), SimplifyFCmpInst(), SimplifyICmpInst(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), SolveQuadraticEquation(), stripAndComputeConstantOffsets(), 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::visitSub(), llvm::InstCombiner::visitTrunc(), llvm::InstCombiner::visitXor(), llvm::InstCombiner::visitZExt(), and llvm::BasicBlock::~BasicBlock().
|
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 502 of file Constants.cpp.
References llvm::IntegerType::getBitWidth(), and llvm::Type::getContext().
|
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 482 of file Constants.cpp.
References llvm::IntegerType::get(), llvm::APInt::getBitWidth(), and llvm::LLVMContext::pImpl.
|
static |
Return a ConstantInt constructed from the string strStart with the given radix.
Definition at line 527 of file Constants.cpp.
References llvm::IntegerType::getBitWidth(), and llvm::Type::getContext().
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 515 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getContext(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), and getType().
|
inline |
getBitWidth - Return the bitwidth of this constant.
Definition at line 110 of file Constants.h.
References llvm::APInt::getBitWidth().
Referenced by emitGlobalConstantLargeInt(), foldSelectICmpAnd(), llvm::SelectionDAG::getConstant(), MultiplyOverflows(), ProcessUGT_ADDCST_ADD(), SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitUDiv().
|
static |
Definition at line 445 of file Constants.cpp.
References get(), llvm::Type::getInt1Ty(), llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::TheFalseVal.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCompareInstruction(), getFalse(), llvm::IRBuilderBase::getFalse(), HandleByValArgument(), OptimizeGlobalAddressOfMalloc(), SimplifyFCmpInst(), SimplifyICmpInst(), llvm::ScalarEvolution::SimplifyICmpOperands(), TryToShrinkGlobalToBoolean(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInst(), and llvm::SelectionDAGBuilder::visitSwitchCase().
Definition at line 464 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().
|
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 218 of file Constants.h.
References llvm::APInt::getLimitedValue().
Referenced by CanEvaluateShifted(), CanEvaluateShuffled(), dyn_castFoldableMul(), llvm::InstCombiner::FoldICmpShrCst(), llvm::InstCombiner::FoldShiftByConstant(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitUDiv().
|
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 124 of file Constants.h.
References llvm::APInt::getSExtValue().
Referenced by canFoldIVIncExpr(), EvaluateGEPOffsetExpression(), GetOffsetFromIndex(), isIndexInRangeOfSequentialType(), and X86ChooseCmpImmediateOpcode().
|
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 507 of file Constants.cpp.
Referenced by llvm::InstCombiner::FoldOrOfICmps(), generateUnsignedDivisionCode(), insertFastDiv(), llvm::InstCombiner::visitLShr(), and llvm::InstCombiner::visitOr().
Definition at line 511 of file Constants.cpp.
|
static |
Definition at line 438 of file Constants.cpp.
References get(), llvm::Type::getInt1Ty(), llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::TheTrueVal.
Referenced by llvm::ComputeMaskedBits(), llvm::ConstantFoldCompareInstruction(), llvm::SelectionDAGBuilder::EmitBranchForMergedCondition(), getFCmpValue(), getTrue(), llvm::IRBuilderBase::getTrue(), OptimizeGlobalAddressOfMalloc(), SimplifyFCmpInst(), SimplifyICmpInst(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFree(), llvm::InstCombiner::visitICmpInst(), and llvm::SelectionDAGBuilder::visitSwitchCase().
Definition at line 452 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().
|
inline |
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount of casting needed in parts of the compiler.
Definition at line 139 of file Constants.h.
References llvm::Value::getType().
Referenced by llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), emitGlobalConstantLargeInt(), llvm::InstCombiner::FoldAndOfICmps(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::InstCombiner::FoldICmpAddOpCst(), get(), GetConstantInt(), llvm::SCEVConstant::getType(), isRunOfOnes(), ShrinkDemandedConstant(), SwitchToLookupTable(), tryMergeRange(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitXor().
|
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 105 of file Constants.h.
Referenced by llvm::GEPOperator::accumulateConstantOffset(), llvm::CompileUnit::addConstantValue(), AddOne(), CanEvaluateShifted(), canFoldIVIncExpr(), llvm::computeMaskedBitsLoad(), llvm::ComputeMultiple(), computePointerICmp(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldInsertElementInstruction(), llvm::ConstantFoldTerminator(), ConstantIntSortPredicate(), DemandedBitsLHSMask(), emitDebugValueComment(), emitGlobalConstantLargeInt(), ExtractBranchMetadata(), FactorOutConstant(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::InstCombiner::FoldICmpDivCst(), foldLogOpOfMaskedICmps(), llvm::InstCombiner::FoldOrOfICmps(), llvm::InstCombiner::FoldOrWithConstants(), foldSelectICmpAnd(), GatherConstantCompares(), gcd(), GetBranchWeights(), llvm::SelectionDAG::getConstant(), getEdgeValueLocal(), getExactSDiv(), llvm::MDNode::getMostGenericRange(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::LazyValueInfo::getPredicateOnEdge(), GetShiftedValue(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::ScalarEvolution::getSmallConstantTripMultiple(), getTypeOfMaskedICmp(), llvm::ScalarEvolution::getUDivExpr(), HasAddOverflow(), HasSubOverflow(), isDereferenceablePointer(), llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing(), isHighOnes(), isIndexInRangeOfSequentialType(), isLikelyComplexAddressComputation(), llvm::SCEV::isNonConstantNegative(), isRemainderZero(), isRunOfOnes(), isSignBitCheck(), isStridedPtr(), MaintainNoSignedWrap(), MultiplyOverflows(), ProcessUGT_ADDCST_ADD(), sdiv(), ShrinkDemandedConstant(), SimplifyICmpInst(), srem(), SubOne(), 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().
|
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 116 of file Constants.h.
References llvm::APInt::getZExtValue().
Referenced by llvm::GEPOperator::accumulateConstantOffset(), AnalyzeLoadFromClobberingMemInst(), cacheAnnotationFromMD(), CanEvaluateShifted(), CollectInsertionElements(), llvm::ComputeMultiple(), llvm::MachineInstr::emitError(), EvaluateGEPOffsetExpression(), EvaluateStoreInto(), ExtractConstantBytes(), llvm::InstCombiner::FoldCmpLoadFromIndexedGlobal(), FoldCondBranchOnPHI(), llvm::InstCombiner::FoldShiftByConstant(), llvm::MemIntrinsic::getAlignment(), llvm::getConstantStringInfo(), llvm::Module::getModuleFlagsMetadata(), GetOffsetFromIndex(), GetShiftedValue(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::ScalarEvolution::getSmallConstantTripMultiple(), llvm::CompositeType::indexValid(), isDereferenceablePointer(), isGEPKnownNonNull(), llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing(), IsUserOfGlobalSafeForSRA(), matchPairwiseReduction(), matchVectorSplittingReduction(), OptimizeGlobalAddressOfMalloc(), OptimizeIntToFloatBitCast(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitTrunc().
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 185 of file Constants.h.
References llvm::APInt::isMaxSignedValue(), and llvm::APInt::isMaxValue().
Referenced by isSignBitCheck().
|
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 176 of file Constants.h.
References llvm::APInt::isAllOnesValue().
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 197 of file Constants.h.
References llvm::APInt::isMinSignedValue(), and llvm::APInt::isMinValue().
|
inline |
Definition at line 155 of file Constants.h.
References llvm::APInt::isNegative().
Referenced by llvm::InstCombiner::FoldICmpDivCst(), HasAddOverflow(), HasSubOverflow(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
|
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 168 of file Constants.h.
Referenced by llvm::ConstantFoldCastInstruction(), llvm::FoldBranchToCommonDest(), llvm::InstCombiner::FoldICmpDivCst(), IsOneHotValue(), isSelect01(), and isSignTest().
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 1159 of file Constants.cpp.
References llvm::Type::getIntegerBitWidth(), and llvm::Type::isIntegerTy().
Referenced by llvm::X86TargetLowering::LowerAsmOperandForConstraint().
Definition at line 1169 of file Constants.cpp.
References llvm::Type::getIntegerBitWidth(), and llvm::Type::isIntegerTy().
|
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 160 of file Constants.h.
Referenced by llvm::GEPOperator::accumulateConstantOffset(), evaluateFCmpRelation(), EvaluateGEPOffsetExpression(), evaluateICmpRelation(), FactorOutConstant(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::InstCombiner::FoldICmpDivCst(), llvm::InstCombiner::FoldOrOfICmps(), foldSelectICmpAnd(), llvm::getConstantStringInfo(), getMergedGlobalExpr(), GetOffsetFromIndex(), getTypeOfMaskedICmp(), InstructionDereferencesPointer(), isDereferenceablePointer(), isSelect01(), isSignBitCheck(), isSignTest(), isSimpleEnoughPointerToCommit(), llvm::MemIntrinsic::isVolatile(), SimplifyICmpInst(), llvm::InstCombiner::visitAllocSite(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
|
inlineprotected |
Definition at line 59 of file Constants.h.
|
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 209 of file Constants.h.
References llvm::APInt::getActiveBits(), and llvm::APInt::getZExtValue().
Referenced by llvm::InstCombiner::FoldShiftByConstant(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().