Arbitrary-precision integer.
Declared in <llvm/ADT/APInt.h>
class [[nodiscard]] APInt;
| Name | Description |
|---|---|
WordType | Native limb type used to store APInt words. |
| Name | Description |
|---|---|
Rounding | Rounding mode for converting floating-point values to APInt. |
| Name | Description |
|---|---|
APInt [constructor] | Constructors |
~APInt [destructor] | Destructor. |
operator= | Assignment operators |
Profile | Profile this APInt into a FoldingSet node ID. |
abs | Return the absolute value of this APInt. |
ashr | Arithmetic right-shift function. |
ashrInPlace | ashrInPlace overloads |
bitsToDouble | Converts APInt bits to a double |
bitsToFloat | Converts APInt bits to a float |
bitsToQuad | |
byteSwap | Return a byte-swapped representation of this APInt. |
ceilLogBase2 | Return the ceil of the log base 2 of this APInt. |
clearAllBits | Set every bit to 0. |
clearBit | Clear the bit at BitPosition. |
clearBits | Clear bits from LoBit (inclusive) to HiBit (exclusive). |
clearHighBits | Clear the top hiBits bits. |
clearLowBits | Clear the bottom loBits bits. |
clearSignBit | Set the sign bit to 0. |
concat | Concatenate the bits from NewLSB onto the bottom of *this. |
countLeadingOnes | Alias for countl_one(). |
countLeadingZeros | Alias for countl_zero(). |
countTrailingOnes | Alias for countr_one(). |
countTrailingZeros | Alias for countr_zero(). |
countl_one | Count the number of leading one bits. |
countl_zero | The APInt version of std::countl_zero. |
countr_one | Count the number of trailing one bits. |
countr_zero | Count the number of trailing zero bits. |
dump | debug method |
eq | Equality comparison. |
exactLogBase2 | Return log base 2 if this APInt is an exact power of two, otherwise -1. |
extractBits | Return an APInt with bits [bitPosition, bitPosition+numBits).] |
extractBitsAsZExtValue | Extract bits as a zero-extended 64-bit value. |
flipAllBits | Toggle every bit to its opposite value. |
flipBit | Toggle the bit at bitPosition to its opposite value. |
getActiveBits | Compute the number of active bits in the value |
getActiveWords | Compute the number of active words in the value of this APInt. |
getBitWidth | Return the number of bits in the APInt. |
getBoolValue | Convert APInt to a boolean value. |
getHiBits | Compute an APInt containing numBits high bits from this APInt. |
getLimitedValue | Return this value, or Limit if this value is larger. |
getLoBits | Compute an APInt containing numBits low bits from this APInt. |
getNumSignBits | Computes the number of leading bits of this APInt that are equal to its sign bit. |
getNumWords | Get the number of words. |
getRawData | This function returns a pointer to the internal storage of the APInt. This is useful for writing out the APInt in binary form without any conversions. |
getSExtValue | Get sign extended value |
getSignificantBits | Get the minimum bit size for this signed APInt |
getZExtValue | Get zero extended value |
insertBits | insertBits overloads |
intersects | Return true if any corresponding bits are set in both this and RHS. |
isAligned | Return true if this APInt, interpreted as an address, is aligned to A. |
isAllOnes | Determine if all bits are set. This is true for zero-width values. |
isIntN | Check if this APInt has an N-bit unsigned integer value. |
isInverseOf | Return true if every bit is set in exactly one of this or RHS. |
isMask | isMask overloads |
isMaxSignedValue | Determine if this is the largest signed value. |
isMaxValue | Determine if this is the largest unsigned value. |
isMinSignedValue | Determine if this is the smallest signed value. |
isMinValue | Determine if this is the smallest unsigned value. |
isNegatedPowerOf2 | Check if this APInt's negated value is a power of two greater than zero. |
isNegative | Determine sign of this APInt. |
isNonNegative | Determine if this APInt Value is non-negative (>= 0) |
isNonPositive | Determine if this APInt Value is non-positive (<= 0). |
isOne | Determine if this is a value of 1. |
isOneBitSet | Determine if this APInt Value only has the specified bit set. |
isPowerOf2 | Check if this APInt's value is a power of two greater than zero. |
isShiftedMask | isShiftedMask overloads |
isSignBitClear | Determine if sign bit of this APInt is clear. |
isSignBitSet | Determine if sign bit of this APInt is set. |
isSignMask | Check if the APInt's value is returned by getSignMask. |
isSignedIntN | Check if this APInt has an N-bit signed integer value. |
isSingleWord | Determine if this APInt just has one word to store value. |
isSplat | Check if the APInt consists of a repeated bit pattern. |
isStrictlyPositive | Determine if this APInt Value is positive. |
isSubsetOf | Return true if every bit set in this APInt is also set in RHS. |
isZero | Determine if this value is zero, i.e. all bits are clear. |
logBase2 | Return the floor of the log base 2 of this APInt. |
lshr | Logical right-shift function. |
lshrInPlace | Logical right-shift this APInt by ShiftAmt in place. |
multiplicativeInverse | Return the multiplicative inverse of an odd APInt modulo 2^BitWidth. |
ne | Inequality comparison. |
nearestLogBase2 | NOTE: When we have a BitWidth of 1, we define: |
needsCleanup | Returns whether this instance allocated memory. |
negate | Negate this APInt in place. |
operator&= | Bitwise AND assignment operator. |
operator* | Multiplication operator. |
operator*= | Multiplication assignment operators |
operator++ | Increment operators |
operator+= | Addition assignment operators |
operator-- | Decrement operators |
operator-= | Subtraction assignment operators |
operator<<= | Left-shift assignment function. |
operator[] | Array-indexing support for individual bits. |
operator^= | Bitwise XOR assignment operator. |
operator|= | Bitwise OR assignment operator. |
popcount | Count the number of bits set. |
print | Print this APInt to a stream. |
relativeAShl | Relative arithmetic shift left (negative amounts shift right). |
relativeAShr | Relative arithmetic shift right (negative amounts shift left). |
relativeLShl | Relative logical shift left (negative amounts shift right). |
relativeLShr | Relative logical shift right (negative amounts shift left). |
reverseBits | Return this APInt with its bit representation reversed. |
rotl | Rotate left by rotateAmt. |
rotr | Rotate right by rotateAmt. |
roundToDouble | roundToDouble overloads |
sadd_ov | Operations that return overflow indicators. Signed add that records whether the result overflowed. |
sadd_sat | Operations that saturate on overflow. Signed add saturating to the signed min/max of the bit width. |
sdiv | sdiv overloads |
sdiv_ov | Signed divide that records whether the result overflowed. |
setAllBits | Set every bit to 1. |
setBit | Set the bit at BitPosition to 1. |
setBitVal | Set the bit at BitPosition to BitValue. |
setBits | Set bits from loBit (inclusive) to hiBit (exclusive). |
setBitsFrom | Set all bits from loBit through the top of the value. |
setBitsWithWrap | Set bits from loBit to hiBit, wrapping if loBit >= hiBit. |
setHighBits | Set the top hiBits bits. |
setLowBits | Set the bottom loBits bits. |
setSignBit | Set the sign bit to 1. |
sext | Sign-extend to a new width. |
sextOrTrunc | Sign-extend or truncate to width. |
sfloordiv_ov | Signed integer floor division that records overflow. |
sge | Signed greater or equal comparison |
sgt | Signed greater than comparison |
shl | Left-shift function. |
signedRoundToDouble | Converts this signed APInt to a double value. |
sle | Signed less or equal comparison |
slt | Signed less than comparison |
smul_ov | Signed multiply that records whether the result overflowed. |
smul_sat | Signed multiply saturating to the signed min/max of the bit width. |
sqrtFloor | Compute the floor of the square root of the unsigned value. |
srem | srem overloads |
sshl_ov | sshl_ov overloads |
sshl_sat | sshl_sat overloads |
ssub_ov | Signed subtract that records whether the result overflowed. |
ssub_sat | Signed subtract saturating to the signed min/max of the bit width. |
toString | Convert this APInt to a string and append it to Str. |
toStringSigned | Convert this APInt as signed into a string in the given radix. |
toStringUnsigned | Convert this APInt as unsigned into a string in the given radix. |
trunc | Truncate to a new width. |
truncSSat | Truncate to a new width with signed saturation to a signed result. |
truncSSatU | Truncate to a new width with signed saturation to an unsigned result. |
truncUSat | Truncate to a new width with unsigned saturation. |
trySExtValue | Get sign extended value if possible |
tryZExtValue | Get zero extended value if possible |
uadd_ov | Unsigned add that records whether the result overflowed. |
uadd_sat | Unsigned add saturating to the unsigned max of the bit width. |
udiv | udiv overloads |
uge | Unsigned greater or equal comparison |
ugt | Unsigned greater than comparison |
ule | Unsigned less or equal comparison |
ult | Unsigned less than comparison |
umul_ov | Unsigned multiply that records whether the result overflowed. |
umul_sat | Unsigned multiply saturating to the unsigned max of the bit width. |
urem | urem overloads |
ushl_ov | ushl_ov overloads |
ushl_sat | ushl_sat overloads |
usub_ov | Unsigned subtract that records whether the result overflowed. |
usub_sat | Unsigned subtract saturating at zero. |
zext | Zero-extend to a new width. |
zextOrTrunc | Zero-extend or truncate to width. |
operator<< | Left logical shift operator. |
operator! | Logical negation operation on this APInt returns true if zero, like normal integers. |
operator== | Equality operator. |
operator!= | Inequality operator. |
| Name | Description |
|---|---|
doubleToBits | Reinterpret the bits of a double as an APInt. |
floatToBits | Reinterpret the bits of a float as an APInt. |
getAllOnes | Return an APInt of a specified width with all bits set. |
getBitsNeeded | Determine how many bits are required to hold the value of a string. |
getBitsSet | Get a value with a block of bits set. |
getBitsSetFrom | Construct an APInt with bits set from loBit to the top of the value. |
getBitsSetWithWrap | Construct an APInt with a possibly wrapping contiguous range of bits set. |
getHighBitsSet | Constructs an APInt value that has the top hiBitsSet bits set. |
getLowBitsSet | Constructs an APInt value that has the bottom loBitsSet bits set. |
getMaxValue | Gets maximum unsigned value of APInt for specific bit width. |
getMinValue | Gets minimum unsigned value of APInt for a specific bit width. |
getNumWords | Get the number of words needed for a given bit width. |
getOneBitSet | Return an APInt with exactly one bit set in the result. |
getSignMask | Get the SignMask for a specific bit width. |
getSignedMaxValue | Gets maximum signed value of APInt for a specific bit width. |
getSignedMinValue | Gets minimum signed value of APInt for a specific bit width. |
getSplat | Return a value containing V broadcasted over NewLen bits. |
getSufficientBitsNeeded | Estimate bits needed for a string without fully parsing it. |
getZero | Get the '0' value for the specified bit-width. |
getZeroWidth | Return an APInt zero bits wide. |
isSameValue | Return true if two APInts have the same numeric value after matching widths. |
sdivrem | sdivrem overloads |
tcAdd | Add two bignums with an incoming carry and return the outgoing carry. |
tcAddPart | Add a single limb to a bignum and return the carry flag. |
tcAssign | Assign one bignum to another. |
tcClearBit | Clear the given zero-based bit of a bignum. |
tcCompare | Compare two bignums as unsigned values. |
tcDecrement | Decrement a bignum in-place and return the borrow flag. |
tcDivide | Divide bignums: set lhs to quotient and remainder to the remainder. |
tcExtract | Extract a contiguous bit-field from one bignum into another. |
tcExtractBit | Extract the given zero-based bit of a bignum; returns 0 or 1. |
tcFullMultiply | Multiply two bignums into a full-width (sum of widths) destination. |
tcIncrement | Increment a bignum in-place and return the carry flag. |
tcIsZero | Return true if a bignum is zero. |
tcLSB | Return the bit index of the least significant set bit in a bignum. |
tcMSB | Return the bit index of the most significant set bit in parts. |
tcMultiply | Multiply two equal-width bignums into a same-width destination. |
tcMultiplyPart | Multiply a bignum by a single limb, optionally adding into the destination. |
tcNegate | Negate a bignum in place (two's complement). |
tcSet | Set the least significant limb of a bignum and zero higher limbs. |
tcSetBit | Set the given zero-based bit of a bignum. |
tcShiftLeft | Shift a bignum left by Count bits; shifted-in bits are zero. |
tcShiftRight | Shift a bignum right by Count bits; shifted-in bits are zero. |
tcSubtract | Subtract a bignum plus carry from another and return the borrow flag. |
tcSubtractPart | Subtract a single limb from a bignum and return the borrow flag. |
udivrem | udivrem overloads |
| Name | Description |
|---|---|
APINT_BITS_PER_WORD | Bits in a word. |
APINT_WORD_SIZE | Byte size of a word. |
WORDTYPE_MAX | Maximum value representable in a single WordType limb. |
| Name | Description |
|---|---|
llvm::DynamicAPInt | Dynamically sized arbitrary-precision integer. |
llvm::APSInt | An arbitrary precision integer that knows its signedness. |
llvm::DenseMapInfo<APInt, void> | Provide DenseMapInfo for APInt. |
llvm::hash_value | Overload to compute a hash_code for an APInt value. |
| Name | Description |
|---|---|
ConstantFoldBinOp | Constant-fold a generic integer binary opcode on two register operands. |
ConstantFoldCastOp | Constant-fold a generic cast opcode producing an integer result. |
ConstantFoldExtOp | Constant-fold a generic extend opcode with an immediate second operand. |
ConstantFoldUnaryIntOp | Constant-fold a unary integer operation on Src. |
ConstantFoldVectorBinop | Tries to constant fold a vector binop with sources Op1 and Op2. Returns an empty vector on failure. |
LoadIntFromMemory | Load LoadBytes bytes from Src into IntVal. |
StoreIntToMemory | Fill StoreBytes bytes of memory starting at Dst with IntVal. |
getAllocSize | Return the size of the requested allocation. |
getIConstantFromReg | VReg is defined by a G_CONSTANT, return the corresponding value. |
getIConstantSplatVal | Return the scalar integral splat value defined by MI if possible. |
getIConstantSplatVal | Return the scalar integral splat value of Reg if possible. |
getIConstantVRegVal | If VReg is defined by a G_CONSTANT, return the corresponding value. |
getMinMaxLimit | Return the minimum or maximum constant value for the specified integer min/max flavor and type. |
isConstantOrConstantSplatVector | Determines if Def defines a constant integer or a splat vector of constant integers. |
operator& | Bitwise AND of two APInts. |
operator& | Bitwise AND of a 64-bit value and an APInt. |
operator& | Bitwise AND that prefers moving from b. |
operator& | Bitwise AND of an APInt and a 64-bit value. |
operator* | Multiply an APInt by a 64-bit value. |
operator* | Multiply a 64-bit value by an APInt. |
operator+ | Add two APInts. |
operator+ | Add an APInt and a 64-bit value. |
operator+ | Add that prefers moving from b. |
operator+ | Add a 64-bit value and an APInt. |
operator- | Subtract an APInt from a 64-bit value. |
operator- | Negate an APInt. |
operator- | Subtract that prefers moving from b. |
operator- | Subtract a 64-bit value from an APInt. |
operator- | Subtract two APInts. |
operator^ | Bitwise XOR of two APInts. |
operator^ | Bitwise XOR of an APInt and a 64-bit value. |
operator^ | Bitwise XOR that prefers moving from b. |
operator^ | Bitwise XOR of a 64-bit value and an APInt. |
operator| | Bitwise OR of an APInt and a 64-bit value. |
operator| | Bitwise OR of a 64-bit value and an APInt. |
operator| | Bitwise OR of two APInts. |
operator| | Bitwise OR that prefers moving from b. |
operator~ | Unary bitwise complement operator. |
possiblyDemandedEltsInMask | Return an APInt of active lanes for a <Y x i1> mask. |
readWideAPInt | Decode a wide APInt from a sequence of 64-bit words. |
toString | Convert an APInt to a std::string in the given radix. |
AArch64::getCpuSupportsMask | Compute the CPU-supports bitmask for the given FMV feature names. |
AArch64::getFMVPriority | Compute the FMV priority bitmask for the given feature names. |
APIntOps::GetMostSignificantDifferentBit | Return the index of the most significant bit that differs between two values. |
APIntOps::GreatestCommonDivisor | Compute the GCD of two APInt values using Stein's algorithm. |
APIntOps::RoundAPIntToDouble | Convert APIVal to a double, treating it as unsigned. |
APIntOps::RoundAPIntToFloat | Convert APIVal to a float, treating it as unsigned. |
APIntOps::RoundDoubleToAPInt | Convert a double value to an APInt of the given width. |
APIntOps::RoundFloatToAPInt | Convert a float value to an APInt of the given width. |
APIntOps::RoundSignedAPIntToDouble | Convert APIVal to a double, treating it as signed. |
APIntOps::RoundSignedAPIntToFloat | Convert APIVal to a float, treating it as signed. |
APIntOps::RoundingSDiv | Return A signed-divided by B, rounded by RM. |
APIntOps::RoundingUDiv | Return A unsigned-divided by B, rounded by RM. |
APIntOps::ScaleBitMask | Splat/merge neighboring bits to widen or narrow the bitmask in A. |
APIntOps::SolveQuadraticEquationWrap | Find the smallest n where quadratic q(n) = An^2 + Bn + C wraps the value range. |
APIntOps::abds | Determine the absolute difference of two APInts considered to be signed. |
APIntOps::abdu | Determine the absolute difference of two APInts considered to be unsigned. |
APIntOps::avgCeilS | Compute the ceil of the signed average of C1 and C2. |
APIntOps::avgCeilU | Compute the ceil of the unsigned average of C1 and C2. |
APIntOps::avgFloorS | Compute the floor of the signed average of C1 and C2. |
APIntOps::avgFloorU | Compute the floor of the unsigned average of C1 and C2. |
APIntOps::clmul | Perform a carry-less multiply, also known as XOR multiplication, and return low-bits. All arguments and result have the same bitwidth. |
APIntOps::clmulh | Perform a carry-less multiply, and return high-bits. All arguments and result have the same bitwidth. |
APIntOps::clmulr | Perform a reversed carry-less multiply. |
APIntOps::fshl | Perform a funnel shift left. |
APIntOps::fshr | Perform a funnel shift right. |
APIntOps::mulhs | Multiply sign-extended operands and return the high N bits of the product. |
APIntOps::mulhu | Multiply zero-extended operands and return the high N bits of the product. |
APIntOps::mulsExtended | Multiply sign-extended operands and return the full 2N-bit product. |
APIntOps::muluExtended | Multiply zero-extended operands and return the full 2N-bit product. |
APIntOps::pdep | Perform an "expand" operation, also known as pdep or bdep. |
APIntOps::pext | Perform a "compress" operation, also known as pext or bext. |
APIntOps::pow | Compute X raised to the power N for N >= 0. |
APIntOps::smax | Determine the larger of two APInts considered to be signed. |
APIntOps::smin | Determine the smaller of two APInts considered to be signed. |
APIntOps::umax | Determine the larger of two APInts considered to be unsigned. |
APIntOps::umin | Determine the smaller of two APInts considered to be unsigned. |
MIPatternMatch::m_GConstantOrFConstantBits | Matches a literal G_CONSTANT or G_FCONSTANT, binding raw bits to Bits. |
MIPatternMatch::m_ICst | Matches an integer constant, binding an APInt to Cst. |
MIPatternMatch::m_ICstOrSplat | Matches an integer constant or splat, binding an APInt to Cst. |
MIPatternMatch::m_SpecificICst | Matches a constant equal to RequestedValue. |
MIPatternMatch::m_SpecificICstOrSplat | Matches RequestedValue or a constant splat of that value. |
MIPatternMatch::m_SpecificICstSplat | Matches a constant splat of RequestedValue. |
MIPatternMatch::matchConstant | Match Reg as an APInt integer constant. |
MIPatternMatch::matchConstantSplat | Match Reg as an APInt constant splat. |
PatternMatch::m_APInt | Match a ConstantInt or splatted ConstantVector, binding the specified pointer to the contained APInt. |
PatternMatch::m_APIntAllowPoison | Match APInt while allowing poison in splat vector constants. |
PatternMatch::m_APIntForbidPoison | Match APInt while forbidding poison in splat vector constants. |
PatternMatch::m_LowBitMask | Match a low-bit-mask constant and bind the APInt. |
PatternMatch::m_LowBitMaskOrZero | Match a zero or low-bit-mask constant and bind the APInt. |
PatternMatch::m_MaxSignedValue | Match a max-signed-value constant and bind the APInt. |
PatternMatch::m_NegatedPower2 | Match a negated power-of-two constant and bind the APInt. |
PatternMatch::m_NegatedPower2OrZero | Match a zero or negated power-of-two constant and bind the APInt. |
PatternMatch::m_Negative | Match a negative constant and bind the APInt. |
PatternMatch::m_NonNegative | Match a non-negative constant and bind the APInt. |
PatternMatch::m_NonPositive | Match a non-positive constant and bind the APInt. |
PatternMatch::m_Power2 | Match a power-of-two constant and bind the APInt. |
PatternMatch::m_Power2OrZero | Match a zero or power-of-two constant and bind the APInt. |
PatternMatch::m_SpecificInt | Match a specific integer value or vector with all elements equal to the value. |
PatternMatch::m_SpecificIntAllowPoison | Match a specific integer allowing poison in splat vectors. |
PatternMatch::m_StrictlyPositive | Match a strictly positive constant and bind the APInt. |
SCEVPatternMatch::m_scev_APInt | Match an SCEV constant and bind it to an APInt. |
SDPatternMatch::m_ConstInt | Match any integer constants or splat of an integer constant; return the specific constant or constant splat value. |
SDPatternMatch::m_SpecificInt | Match a specific integer constant or constant splat value. |
| Name | Description |
|---|---|
APSInt | An arbitrary precision integer that knows its signedness. |
The return value should not be discarded.