class APInt

Declaration

class APInt { /* full declaration omitted */ };

Description

Class for arbitrary precision integers. APInt is a functional replacement for common case unsigned integer type like "unsigned", "unsigned long" or "uint64_t", but also allows non-byte-width integer sizes and large integer value types such as 3-bits, 15-bits, or more than 64-bits of precision. APInt provides a variety of arithmetic operators and methods to manipulate integer values of any bit-width. It supports both the typical integer arithmetic and comparison operations as well as bitwise manipulation. The class has several invariants worth noting: * All bit, byte, and word positions are zero-based. * Once the bit width is set, it doesn't change except by the Truncate, SignExtend, or ZeroExtend operations. * All binary operators must be on APInt instances of the same bit width. Attempting to use these operators on instances with different bit widths will yield an assertion. * The value is stored canonically as an unsigned value. For operations where it makes a difference, there are both signed and unsigned variants of the operation. For example, sdiv and udiv. However, because the bit widths must be the same, operations such as Mul and Add produce the same results regardless of whether the values are interpreted as signed or not. * In general, the class tries to follow the style of computation that LLVM uses in its IR. This simplifies its use for LLVM. * APInt supports zero-bit-width values, but operations that require bits are not defined on it (e.g. you cannot ask for the sign of a zero-bit integer). This means that operations like zero extension and logical shifts are defined, but sign extension and ashr is not. Zero bit values compare and hash equal to themselves, and countLeadingZeros returns 0.

Declared at: llvm/include/llvm/ADT/APInt.h:75

Member Variables

private union(unnamed union at / home / hdoc / tmp / llvm - project / llvm / include / llvm / ADT / APInt.h : 1822 : 3) U
private unsigned int BitWidth = 1
The number of bits in this APInt.
public static const llvm::APInt::WordType WORDTYPE_MAX = ~unsigned long(0)

Method Overview

  • public APInt(unsigned int numBits, ArrayRef<uint64_t> bigVal)
  • public APInt(unsigned int numBits, unsigned int numWords, const uint64_t * bigVal)
  • public APInt(unsigned int numBits, llvm::StringRef str, uint8_t radix)
  • public APInt()
  • public APInt(const llvm::APInt & that)
  • public APInt(llvm::APInt && that)
  • public APInt(unsigned int numBits, uint64_t val, bool isSigned = false)
  • private APInt(uint64_t * val, unsigned int bits)
  • public void Profile(llvm::FoldingSetNodeID & id) const
  • public llvm::APInt abs() const
  • private void andAssignSlowCase(const llvm::APInt & RHS)
  • public llvm::APInt ashr(unsigned int ShiftAmt) const
  • public llvm::APInt ashr(const llvm::APInt & ShiftAmt) const
  • public void ashrInPlace(unsigned int ShiftAmt)
  • public void ashrInPlace(const llvm::APInt & shiftAmt)
  • private void ashrSlowCase(unsigned int ShiftAmt)
  • private void assignSlowCase(const llvm::APInt & RHS)
  • public double bitsToDouble() const
  • public float bitsToFloat() const
  • public llvm::APInt byteSwap() const
  • public unsigned int ceilLogBase2() const
  • public void clearAllBits()
  • public void clearBit(unsigned int BitPosition)
  • public void clearLowBits(unsigned int loBits)
  • public void clearSignBit()
  • private llvm::APInt & clearUnusedBits()
  • private int compare(const llvm::APInt & RHS) const
  • private int compareSigned(const llvm::APInt & RHS) const
  • public llvm::APInt concat(const llvm::APInt & NewLSB) const
  • private llvm::APInt concatSlowCase(const llvm::APInt & NewLSB) const
  • public unsigned int countLeadingOnes() const
  • private unsigned int countLeadingOnesSlowCase() const
  • public unsigned int countLeadingZeros() const
  • private unsigned int countLeadingZerosSlowCase() const
  • public unsigned int countPopulation() const
  • private unsigned int countPopulationSlowCase() const
  • public unsigned int countTrailingOnes() const
  • private unsigned int countTrailingOnesSlowCase() const
  • public unsigned int countTrailingZeros() const
  • private unsigned int countTrailingZerosSlowCase() const
  • private static void divide(const llvm::APInt::WordType * LHS, unsigned int lhsWords, const llvm::APInt::WordType * RHS, unsigned int rhsWords, llvm::APInt::WordType * Quotient, llvm::APInt::WordType * Remainder)
  • public static llvm::APInt doubleToBits(double V)
  • public void dump() const
  • public bool eq(const llvm::APInt & RHS) const
  • private bool equalSlowCase(const llvm::APInt & RHS) const
  • public int32_t exactLogBase2() const
  • public llvm::APInt extractBits(unsigned int numBits, unsigned int bitPosition) const
  • public uint64_t extractBitsAsZExtValue(unsigned int numBits, unsigned int bitPosition) const
  • public void flipAllBits()
  • private void flipAllBitsSlowCase()
  • public void flipBit(unsigned int bitPosition)
  • public static llvm::APInt floatToBits(float V)
  • private void fromString(unsigned int numBits, llvm::StringRef str, uint8_t radix)
  • public unsigned int getActiveBits() const
  • public unsigned int getActiveWords() const
  • public static llvm::APInt getAllOnes(unsigned int numBits)
  • public static llvm::APInt getAllOnesValue(unsigned int numBits)
  • public unsigned int getBitWidth() const
  • public static unsigned int getBitsNeeded(llvm::StringRef str, uint8_t radix)
  • public static llvm::APInt getBitsSet(unsigned int numBits, unsigned int loBit, unsigned int hiBit)
  • public static llvm::APInt getBitsSetFrom(unsigned int numBits, unsigned int loBit)
  • public static llvm::APInt getBitsSetWithWrap(unsigned int numBits, unsigned int loBit, unsigned int hiBit)
  • public bool getBoolValue() const
  • public llvm::APInt getHiBits(unsigned int numBits) const
  • public static llvm::APInt getHighBitsSet(unsigned int numBits, unsigned int hiBitsSet)
  • public uint64_t getLimitedValue(uint64_t Limit = (18446744073709551615UL)) const
  • public llvm::APInt getLoBits(unsigned int numBits) const
  • public static llvm::APInt getLowBitsSet(unsigned int numBits, unsigned int loBitsSet)
  • public static llvm::APInt getMaxValue(unsigned int numBits)
  • public unsigned int getMinSignedBits() const
  • public static llvm::APInt getMinValue(unsigned int numBits)
  • public static llvm::APInt getNullValue(unsigned int numBits)
  • public unsigned int getNumSignBits() const
  • public static unsigned int getNumWords(unsigned int BitWidth)
  • public unsigned int getNumWords() const
  • public static llvm::APInt getOneBitSet(unsigned int numBits, unsigned int BitNo)
  • public const uint64_t * getRawData() const
  • public int64_t getSExtValue() const
  • public static llvm::APInt getSignMask(unsigned int BitWidth)
  • public static llvm::APInt getSignedMaxValue(unsigned int numBits)
  • public static llvm::APInt getSignedMinValue(unsigned int numBits)
  • public unsigned int getSignificantBits() const
  • public static llvm::APInt getSplat(unsigned int NewLen, const llvm::APInt & V)
  • public static unsigned int getSufficientBitsNeeded(llvm::StringRef Str, uint8_t Radix)
  • private uint64_t getWord(unsigned int bitPosition) const
  • public uint64_t getZExtValue() const
  • public static llvm::APInt getZero(unsigned int numBits)
  • public static llvm::APInt getZeroWidth()
  • private void initFromArray(ArrayRef<uint64_t> array)
  • private void initSlowCase(uint64_t val, bool isSigned)
  • private void initSlowCase(const llvm::APInt & that)
  • public void insertBits(const llvm::APInt & SubBits, unsigned int bitPosition)
  • public void insertBits(uint64_t SubBits, unsigned int bitPosition, unsigned int numBits)
  • public bool intersects(const llvm::APInt & RHS) const
  • private bool intersectsSlowCase(const llvm::APInt & RHS) const
  • public bool isAllOnes() const
  • public bool isAllOnesValue() const
  • public bool isIntN(unsigned int N) const
  • public bool isMask() const
  • public bool isMask(unsigned int numBits) const
  • public bool isMaxSignedValue() const
  • public bool isMaxValue() const
  • public bool isMinSignedValue() const
  • public bool isMinValue() const
  • public bool isNegatedPowerOf2() const
  • public bool isNegative() const
  • public bool isNonNegative() const
  • public bool isNonPositive() const
  • public bool isNullValue() const
  • public bool isOne() const
  • public bool isOneValue() const
  • public bool isPowerOf2() const
  • public static bool isSameValue(const llvm::APInt & I1, const llvm::APInt & I2)
  • public bool isShiftedMask() const
  • public bool isShiftedMask(unsigned int & MaskIdx, unsigned int & MaskLen) const
  • public bool isSignBitClear() const
  • public bool isSignBitSet() const
  • public bool isSignMask() const
  • public bool isSignedIntN(unsigned int N) const
  • public bool isSingleWord() const
  • public bool isSplat(unsigned int SplatSizeInBits) const
  • public bool isStrictlyPositive() const
  • public bool isSubsetOf(const llvm::APInt & RHS) const
  • private bool isSubsetOfSlowCase(const llvm::APInt & RHS) const
  • public bool isZero() const
  • public unsigned int logBase2() const
  • public llvm::APInt lshr(unsigned int shiftAmt) const
  • public llvm::APInt lshr(const llvm::APInt & ShiftAmt) const
  • public void lshrInPlace(unsigned int ShiftAmt)
  • public void lshrInPlace(const llvm::APInt & ShiftAmt)
  • private void lshrSlowCase(unsigned int ShiftAmt)
  • private static uint64_t maskBit(unsigned int bitPosition)
  • public llvm::APInt multiplicativeInverse(const llvm::APInt & modulo) const
  • public bool ne(const llvm::APInt & RHS) const
  • public unsigned int nearestLogBase2() const
  • public bool needsCleanup() const
  • public void negate()
  • private void orAssignSlowCase(const llvm::APInt & RHS)
  • public void print(llvm::raw_ostream & OS, bool isSigned) const
  • private void reallocate(unsigned int NewBitWidth)
  • public llvm::APInt reverseBits() const
  • public llvm::APInt rotl(unsigned int rotateAmt) const
  • public llvm::APInt rotl(const llvm::APInt & rotateAmt) const
  • public llvm::APInt rotr(unsigned int rotateAmt) const
  • public llvm::APInt rotr(const llvm::APInt & rotateAmt) const
  • public double roundToDouble() const
  • public double roundToDouble(bool isSigned) const
  • public llvm::APInt sadd_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public llvm::APInt sadd_sat(const llvm::APInt & RHS) const
  • public llvm::APInt sdiv(const llvm::APInt & RHS) const
  • public llvm::APInt sdiv(int64_t RHS) const
  • public llvm::APInt sdiv_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public static void sdivrem(const llvm::APInt & LHS, const llvm::APInt & RHS, llvm::APInt & Quotient, llvm::APInt & Remainder)
  • public static void sdivrem(const llvm::APInt & LHS, int64_t RHS, llvm::APInt & Quotient, int64_t & Remainder)
  • public void setAllBits()
  • public void setBit(unsigned int BitPosition)
  • public void setBitVal(unsigned int BitPosition, bool BitValue)
  • public void setBits(unsigned int loBit, unsigned int hiBit)
  • public void setBitsFrom(unsigned int loBit)
  • private void setBitsSlowCase(unsigned int loBit, unsigned int hiBit)
  • public void setBitsWithWrap(unsigned int loBit, unsigned int hiBit)
  • public void setHighBits(unsigned int hiBits)
  • public void setLowBits(unsigned int loBits)
  • public void setSignBit()
  • public llvm::APInt sext(unsigned int width) const
  • public llvm::APInt sextOrTrunc(unsigned int width) const
  • public bool sge(const llvm::APInt & RHS) const
  • public bool sge(int64_t RHS) const
  • public bool sgt(const llvm::APInt & RHS) const
  • public bool sgt(int64_t RHS) const
  • public llvm::APInt shl(unsigned int shiftAmt) const
  • public llvm::APInt shl(const llvm::APInt & ShiftAmt) const
  • private void shlSlowCase(unsigned int ShiftAmt)
  • public double signedRoundToDouble() const
  • public bool sle(const llvm::APInt & RHS) const
  • public bool sle(uint64_t RHS) const
  • public bool slt(const llvm::APInt & RHS) const
  • public bool slt(int64_t RHS) const
  • public llvm::APInt smul_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public llvm::APInt smul_sat(const llvm::APInt & RHS) const
  • public llvm::APInt sqrt() const
  • public llvm::APInt srem(const llvm::APInt & RHS) const
  • public int64_t srem(int64_t RHS) const
  • public llvm::APInt sshl_ov(const llvm::APInt & Amt, bool & Overflow) const
  • public llvm::APInt sshl_sat(const llvm::APInt & RHS) const
  • public llvm::APInt ssub_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public llvm::APInt ssub_sat(const llvm::APInt & RHS) const
  • public static llvm::APInt::WordType tcAdd(llvm::APInt::WordType *, const llvm::APInt::WordType *, llvm::APInt::WordType carry, unsigned int)
  • public static llvm::APInt::WordType tcAddPart(llvm::APInt::WordType *, llvm::APInt::WordType, unsigned int)
  • public static void tcAssign(llvm::APInt::WordType *, const llvm::APInt::WordType *, unsigned int)
  • public static void tcClearBit(llvm::APInt::WordType *, unsigned int bit)
  • public static int tcCompare(const llvm::APInt::WordType *, const llvm::APInt::WordType *, unsigned int)
  • public static llvm::APInt::WordType tcDecrement(llvm::APInt::WordType * dst, unsigned int parts)
  • public static int tcDivide(llvm::APInt::WordType * lhs, const llvm::APInt::WordType * rhs, llvm::APInt::WordType * remainder, llvm::APInt::WordType * scratch, unsigned int parts)
  • public static void tcExtract(llvm::APInt::WordType *, unsigned int dstCount, const llvm::APInt::WordType *, unsigned int srcBits, unsigned int srcLSB)
  • public static int tcExtractBit(const llvm::APInt::WordType *, unsigned int bit)
  • public static void tcFullMultiply(llvm::APInt::WordType *, const llvm::APInt::WordType *, const llvm::APInt::WordType *, unsigned int, unsigned int)
  • public static llvm::APInt::WordType tcIncrement(llvm::APInt::WordType * dst, unsigned int parts)
  • public static bool tcIsZero(const llvm::APInt::WordType *, unsigned int)
  • public static unsigned int tcLSB(const llvm::APInt::WordType *, unsigned int n)
  • public static unsigned int tcMSB(const llvm::APInt::WordType * parts, unsigned int n)
  • public static int tcMultiply(llvm::APInt::WordType *, const llvm::APInt::WordType *, const llvm::APInt::WordType *, unsigned int)
  • public static int tcMultiplyPart(llvm::APInt::WordType * dst, const llvm::APInt::WordType * src, llvm::APInt::WordType multiplier, llvm::APInt::WordType carry, unsigned int srcParts, unsigned int dstParts, bool add)
  • public static void tcNegate(llvm::APInt::WordType *, unsigned int)
  • public static void tcSet(llvm::APInt::WordType *, llvm::APInt::WordType, unsigned int)
  • public static void tcSetBit(llvm::APInt::WordType *, unsigned int bit)
  • public static void tcShiftLeft(llvm::APInt::WordType *, unsigned int Words, unsigned int Count)
  • public static void tcShiftRight(llvm::APInt::WordType *, unsigned int Words, unsigned int Count)
  • public static llvm::APInt::WordType tcSubtract(llvm::APInt::WordType *, const llvm::APInt::WordType *, llvm::APInt::WordType carry, unsigned int)
  • public static llvm::APInt::WordType tcSubtractPart(llvm::APInt::WordType *, llvm::APInt::WordType, unsigned int)
  • public void toString(SmallVectorImpl<char> & Str, unsigned int Radix, bool Signed, bool formatAsCLiteral = false) const
  • public void toStringSigned(SmallVectorImpl<char> & Str, unsigned int Radix = 10) const
  • public void toStringUnsigned(SmallVectorImpl<char> & Str, unsigned int Radix = 10) const
  • public llvm::APInt trunc(unsigned int width) const
  • public llvm::APInt truncSSat(unsigned int width) const
  • public llvm::APInt truncUSat(unsigned int width) const
  • public llvm::APInt uadd_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public llvm::APInt uadd_sat(const llvm::APInt & RHS) const
  • public llvm::APInt udiv(const llvm::APInt & RHS) const
  • public llvm::APInt udiv(uint64_t RHS) const
  • public static void udivrem(const llvm::APInt & LHS, const llvm::APInt & RHS, llvm::APInt & Quotient, llvm::APInt & Remainder)
  • public static void udivrem(const llvm::APInt & LHS, uint64_t RHS, llvm::APInt & Quotient, uint64_t & Remainder)
  • public bool uge(uint64_t RHS) const
  • public bool uge(const llvm::APInt & RHS) const
  • public bool ugt(const llvm::APInt & RHS) const
  • public bool ugt(uint64_t RHS) const
  • public bool ule(const llvm::APInt & RHS) const
  • public bool ule(uint64_t RHS) const
  • public bool ult(uint64_t RHS) const
  • public bool ult(const llvm::APInt & RHS) const
  • public llvm::APInt umul_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public llvm::APInt umul_sat(const llvm::APInt & RHS) const
  • public uint64_t urem(uint64_t RHS) const
  • public llvm::APInt urem(const llvm::APInt & RHS) const
  • public llvm::APInt ushl_ov(const llvm::APInt & Amt, bool & Overflow) const
  • public llvm::APInt ushl_sat(const llvm::APInt & RHS) const
  • public llvm::APInt usub_ov(const llvm::APInt & RHS, bool & Overflow) const
  • public llvm::APInt usub_sat(const llvm::APInt & RHS) const
  • private static unsigned int whichBit(unsigned int bitPosition)
  • private static unsigned int whichWord(unsigned int bitPosition)
  • private void xorAssignSlowCase(const llvm::APInt & RHS)
  • public llvm::APInt zext(unsigned int width) const
  • public llvm::APInt zextOrTrunc(unsigned int width) const
  • public ~APInt()

Methods

APInt(unsigned int numBits,
      ArrayRef<uint64_t> bigVal)

Description

Construct an APInt of numBits width, initialized as bigVal[]. Note that bigVal.size() can be smaller or larger than the corresponding bit width but any extraneous bits will be dropped.

Declared at: llvm/include/llvm/ADT/APInt.h:125

Parameters

unsigned int numBits
the bit width of the constructed APInt
ArrayRef<uint64_t> bigVal
a sequence of words to form the initial value of the APInt

APInt(unsigned int numBits,
      unsigned int numWords,
      const uint64_t* bigVal)

Description

Equivalent to APInt(numBits, ArrayRef <uint64 _t>(bigVal, numWords)), but deprecated because this constructor is prone to ambiguity with the APInt(unsigned, uint64_t, bool) constructor. If this overload is ever deleted, care should be taken to prevent calls from being incorrectly captured by the APInt(unsigned, uint64_t, bool) constructor.

Declared at: llvm/include/llvm/ADT/APInt.h:134

Parameters

unsigned int numBits
unsigned int numWords
const uint64_t* bigVal

APInt(unsigned int numBits,
      llvm::StringRef str,
      uint8_t radix)

Description

Construct an APInt from a string representation. This constructor interprets the string \p str in the given radix. The interpretation stops when the first character that is not suitable for the radix is encountered, or the end of the string. Acceptable radix values are 2, 8, 10, 16, and 36. It is an error for the value implied by the string to require more bits than numBits.

Declared at: llvm/include/llvm/ADT/APInt.h:147

Parameters

unsigned int numBits
the bit width of the constructed APInt
llvm::StringRef str
the string to be interpreted
uint8_t radix
the radix to use for the conversion

APInt()

Description

Default constructor that creates an APInt with a 1-bit zero value.

Declared at: llvm/include/llvm/ADT/APInt.h:150

APInt(const llvm::APInt& that)

Description

Copy Constructor.

Declared at: llvm/include/llvm/ADT/APInt.h:153

Parameters

const llvm::APInt& that

APInt(llvm::APInt&& that)

Description

Move Constructor.

Declared at: llvm/include/llvm/ADT/APInt.h:161

Parameters

llvm::APInt&& that

APInt(unsigned int numBits,
      uint64_t val,
      bool isSigned = false)

Description

Create a new APInt of numBits width, initialized as val. If isSigned is true then val is treated as if it were a signed value (i.e. as an int64_t) and the appropriate sign extension to the bit width will be done. Otherwise, no sign extension occurs (high order bits beyond the range of val are zero filled).

Declared at: llvm/include/llvm/ADT/APInt.h:108

Parameters

unsigned int numBits
the bit width of the constructed APInt
uint64_t val
the initial value of the APInt
bool isSigned = false
how to treat signedness of val

APInt(uint64_t* val, unsigned int bits)

Description

This constructor is used only internally for speed of construction of temporaries. It is unsafe since it takes ownership of the pointer, so it is not public.

Declared at: llvm/include/llvm/ADT/APInt.h:1835

Parameters

uint64_t* val
unsigned int bits

void Profile(llvm::FoldingSetNodeID& id) const

Description

Used to insert APInt objects, or objects that contain APInt objects, into FoldingSets.

Declared at: llvm/include/llvm/ADT/APInt.h:1811

Parameters

llvm::FoldingSetNodeID& id

llvm::APInt abs() const

Description

Get the absolute value. If *this is < 0 then return -(*this), otherwise *this. Note that the "most negative" signed number (e.g. -128 for 8 bit wide APInt) is unchanged due to how negation works.

Declared at: llvm/include/llvm/ADT/APInt.h:1686

void andAssignSlowCase(const llvm::APInt& RHS)

Description

out-of-line slow case for operator & =.

Declared at: llvm/include/llvm/ADT/APInt.h:1971

Parameters

const llvm::APInt& RHS

llvm::APInt ashr(unsigned int ShiftAmt) const

Description

Arithmetic right-shift function. Arithmetic right-shift this APInt by shiftAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:808

Parameters

unsigned int ShiftAmt

llvm::APInt ashr(
    const llvm::APInt& ShiftAmt) const

Description

Arithmetic right-shift function. Arithmetic right-shift this APInt by shiftAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:869

Parameters

const llvm::APInt& ShiftAmt

void ashrInPlace(unsigned int ShiftAmt)

Description

Arithmetic right-shift this APInt by ShiftAmt in place.

Declared at: llvm/include/llvm/ADT/APInt.h:815

Parameters

unsigned int ShiftAmt

void ashrInPlace(const llvm::APInt& shiftAmt)

Description

Arithmetic right-shift this APInt by shiftAmt in place.

Declared at: llvm/include/llvm/ADT/APInt.h:876

Parameters

const llvm::APInt& shiftAmt

void ashrSlowCase(unsigned int ShiftAmt)

Description

out-of-line slow case for ashr.

Declared at: llvm/include/llvm/ADT/APInt.h:1932

Parameters

unsigned int ShiftAmt

void assignSlowCase(const llvm::APInt& RHS)

Description

out-of-line slow case for operator=

Declared at: llvm/include/llvm/ADT/APInt.h:1935

Parameters

const llvm::APInt& RHS

double bitsToDouble() const

Description

Converts APInt bits to a double The conversion does not do a translation from integer to double, it just re-interprets the bits as a double. Note that it is valid to do this on any bit width. Exactly 64 bits will be translated.

Declared at: llvm/include/llvm/ADT/APInt.h:1620

float bitsToFloat() const

Description

Converts APInt bits to a float The conversion does not do a translation from integer to float, it just re-interprets the bits as a float. Note that it is valid to do this on any bit width. Exactly 32 bits will be translated.

Declared at: llvm/include/llvm/ADT/APInt.h:1627

llvm::APInt byteSwap() const

Declared at: llvm/include/llvm/ADT/APInt.h:1600

Returns

a byte-swapped representation of this APInt Value.

unsigned int ceilLogBase2() const

Declared at: llvm/include/llvm/ADT/APInt.h:1655

Returns

the ceil log base 2 of this APInt.

void clearAllBits()

Description

Set every bit to 0.

Declared at: llvm/include/llvm/ADT/APInt.h:1347

void clearBit(unsigned int BitPosition)

Description

Set a given bit to 0. Set the given bit to 0 whose position is given as "bitPosition".

Declared at: llvm/include/llvm/ADT/APInt.h:1357

Parameters

unsigned int BitPosition

void clearLowBits(unsigned int loBits)

Description

Set bottom loBits bits to 0.

Declared at: llvm/include/llvm/ADT/APInt.h:1367

Parameters

unsigned int loBits

void clearSignBit()

Description

Set the sign bit to 0.

Declared at: llvm/include/llvm/ADT/APInt.h:1374

llvm::APInt& clearUnusedBits()

Description

Clear unused high order bits This method is used internally to clear the top "N" bits in the high order word that are not used by the APInt. This is needed after the most significant word is assigned a value to ensure that those bits are zero'd out.

Declared at: llvm/include/llvm/ADT/APInt.h:1865

int compare(const llvm::APInt& RHS) const

Description

Unsigned comparison. Returns -1, 0, or 1 if this APInt is less than, equal to, or greater than RHS.

Declared at: llvm/include/llvm/ADT/APInt.h:1981

Parameters

const llvm::APInt& RHS

int compareSigned(const llvm::APInt& RHS) const

Description

Signed comparison. Returns -1, 0, or 1 if this APInt is less than, equal to, or greater than RHS.

Declared at: llvm/include/llvm/ADT/APInt.h:1985

Parameters

const llvm::APInt& RHS

llvm::APInt concat(
    const llvm::APInt& NewLSB) const

Description

Concatenate the bits from "NewLSB" onto the bottom of *this. This is equivalent to: (this->zext(NewWidth) < < NewLSB.getBitWidth()) | NewLSB.zext(NewWidth)

Declared at: llvm/include/llvm/ADT/APInt.h:908

Parameters

const llvm::APInt& NewLSB

llvm::APInt concatSlowCase(
    const llvm::APInt& NewLSB) const

Description

out-of-line slow case for concat.

Declared at: llvm/include/llvm/ADT/APInt.h:1968

Parameters

const llvm::APInt& NewLSB

unsigned int countLeadingOnes() const

Description

Count the number of leading one bits. This function is an APInt version of the countLeadingOnes functions in MathExtras.h. It counts the number of ones from the most significant bit to the first zero bit.

Declared at: llvm/include/llvm/ADT/APInt.h:1520

Returns

0 if the high order bit is not set, otherwise returns the number of 1 bits from the most significant to the least

unsigned int countLeadingOnesSlowCase() const

Description

out-of-line slow case for countLeadingOnes.

Declared at: llvm/include/llvm/ADT/APInt.h:1944

unsigned int countLeadingZeros() const

Description

The APInt version of the countLeadingZeros functions in MathExtras.h. It counts the number of zeros from the most significant bit to the first one bit.

Declared at: llvm/include/llvm/ADT/APInt.h:1504

Returns

BitWidth if the value is zero, otherwise returns the number of zeros from the most significant bit to the first one bits.

unsigned int countLeadingZerosSlowCase() const

Description

out-of-line slow case for countLeadingZeros

Declared at: llvm/include/llvm/ADT/APInt.h:1941

unsigned int countPopulation() const

Description

Count the number of bits set. This function is an APInt version of the countPopulation functions in MathExtras.h. It counts the number of 1 bits in the APInt value.

Declared at: llvm/include/llvm/ADT/APInt.h:1571

Returns

0 if the value is zero, otherwise returns the number of set bits.

unsigned int countPopulationSlowCase() const

Description

out-of-line slow case for countPopulation

Declared at: llvm/include/llvm/ADT/APInt.h:1953

unsigned int countTrailingOnes() const

Description

Count the number of trailing one bits. This function is an APInt version of the countTrailingOnes functions in MathExtras.h. It counts the number of ones from the least significant bit to the first zero bit.

Declared at: llvm/include/llvm/ADT/APInt.h:1559

Returns

BitWidth if the value is all ones, otherwise returns the number of ones from the least significant bit to the first zero bit.

unsigned int countTrailingOnesSlowCase() const

Description

out-of-line slow case for countTrailingOnes

Declared at: llvm/include/llvm/ADT/APInt.h:1950

unsigned int countTrailingZeros() const

Description

Count the number of trailing zero bits. This function is an APInt version of the countTrailingZeros functions in MathExtras.h. It counts the number of zeros from the least significant bit to the first set bit.

Declared at: llvm/include/llvm/ADT/APInt.h:1543

Returns

BitWidth if the value is zero, otherwise returns the number of zeros from the least significant bit to the first one bit.

unsigned int countTrailingZerosSlowCase() const

Description

out-of-line slow case for countTrailingZeros.

Declared at: llvm/include/llvm/ADT/APInt.h:1947

static void divide(
    const llvm::APInt::WordType* LHS,
    unsigned int lhsWords,
    const llvm::APInt::WordType* RHS,
    unsigned int rhsWords,
    llvm::APInt::WordType* Quotient,
    llvm::APInt::WordType* Remainder)

Description

An internal division function for dividing APInts. This is used by the toString method to divide by the radix. It simply provides a more convenient form of divide for internal use since KnuthDiv has specific constraints on its inputs. If those constraints are not met then it provides a simpler form of divide.

Declared at: llvm/include/llvm/ADT/APInt.h:1912

Parameters

const llvm::APInt::WordType* LHS
unsigned int lhsWords
const llvm::APInt::WordType* RHS
unsigned int rhsWords
llvm::APInt::WordType* Quotient
llvm::APInt::WordType* Remainder

static llvm::APInt doubleToBits(double V)

Description

Converts a double to APInt bits. The conversion does not do a translation from double to integer, it just re-interprets the bits of the double.

Declared at: llvm/include/llvm/ADT/APInt.h:1635

Parameters

double V

void dump() const

Description

debug method

Declared at: llvm/include/llvm/ADT/APInt.h:1814

bool eq(const llvm::APInt& RHS) const

Description

Equality comparison. Compares this APInt with RHS for the validity of the equality relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1029

Parameters

const llvm::APInt& RHS

Returns

true if *this == Val

bool equalSlowCase(const llvm::APInt& RHS) const

Description

out-of-line slow case for operator==

Declared at: llvm/include/llvm/ADT/APInt.h:1938

Parameters

const llvm::APInt& RHS

int32_t exactLogBase2() const

Declared at: llvm/include/llvm/ADT/APInt.h:1674

Returns

the log base 2 of this APInt if its an exact power of two, -1 otherwise

llvm::APInt extractBits(
    unsigned int numBits,
    unsigned int bitPosition) const

Description

Return an APInt with the extracted bits [bitPosition,bitPosition+numBits).

Declared at: llvm/include/llvm/ADT/APInt.h:1403

Parameters

unsigned int numBits
unsigned int bitPosition

uint64_t extractBitsAsZExtValue(
    unsigned int numBits,
    unsigned int bitPosition) const

Declared at: llvm/include/llvm/ADT/APInt.h:1404

Parameters

unsigned int numBits
unsigned int bitPosition

void flipAllBits()

Description

Toggle every bit to its opposite value.

Declared at: llvm/include/llvm/ADT/APInt.h:1377

void flipAllBitsSlowCase()

Description

out-of-line slow case for flipAllBits.

Declared at: llvm/include/llvm/ADT/APInt.h:1965

void flipBit(unsigned int bitPosition)

Description

Toggles a given bit to its opposite value. Toggle a given bit to its opposite value whose position is given as "bitPosition".

Declared at: llvm/include/llvm/ADT/APInt.h:1390

Parameters

unsigned int bitPosition

static llvm::APInt floatToBits(float V)

Description

Converts a float to APInt bits. The conversion does not do a translation from float to integer, it just re-interprets the bits of the float.

Declared at: llvm/include/llvm/ADT/APInt.h:1643

Parameters

float V

void fromString(unsigned int numBits,
                llvm::StringRef str,
                uint8_t radix)

Description

Convert a char array into an APInt This is used by the constructors that take string arguments. StringRef::getAsInteger is superficially similar but (1) does not assume that the string is well-formed and (2) grows the result to hold the input.

Declared at: llvm/include/llvm/ADT/APInt.h:1904

Parameters

unsigned int numBits
llvm::StringRef str
uint8_t radix
2, 8, 10, 16, or 36 Converts a string into a number. The string must be non-empty and well-formed as a number of the given base. The bit-width must be sufficient to hold the result.

unsigned int getActiveBits() const

Description

Compute the number of active bits in the value This function returns the number of active bits which is defined as the bit width minus the number of leading zeros. This is used in several computations to see how "wide" the value is.

Declared at: llvm/include/llvm/ADT/APInt.h:1435

unsigned int getActiveWords() const

Description

Compute the number of active words in the value of this APInt. This is used in conjunction with getActiveData to extract the raw value of the APInt.

Declared at: llvm/include/llvm/ADT/APInt.h:1441

static llvm::APInt getAllOnes(
    unsigned int numBits)

Description

Return an APInt of a specified width with all bits set.

Declared at: llvm/include/llvm/ADT/APInt.h:214

Parameters

unsigned int numBits

static llvm::APInt getAllOnesValue(
    unsigned int numBits)

Description

NOTE: This is soft-deprecated. Please use `getAllOnes()` instead.

Declared at: llvm/include/llvm/ADT/APInt.h:219

Parameters

unsigned int numBits

unsigned int getBitWidth() const

Description

Return the number of bits in the APInt.

Declared at: llvm/include/llvm/ADT/APInt.h:1411

static unsigned int getBitsNeeded(
    llvm::StringRef str,
    uint8_t radix)

Description

Get bits required for string value. This method determines how many bits are required to hold the APInt equivalent of the string given by \p str.

Declared at: llvm/include/llvm/ADT/APInt.h:1489

Parameters

llvm::StringRef str
uint8_t radix

static llvm::APInt getBitsSet(
    unsigned int numBits,
    unsigned int loBit,
    unsigned int hiBit)

Description

Get a value with a block of bits set. Constructs an APInt value that has a contiguous range of bits set. The bits from loBit (inclusive) to hiBit (exclusive) will be set. All other bits will be zero. For example, with parameters(32, 0, 16) you would get 0x0000FFFF. Please call getBitsSetWithWrap if \p loBit may be greater than\p hiBit.

Declared at: llvm/include/llvm/ADT/APInt.h:241

Parameters

unsigned int numBits
the intended bit width of the result
unsigned int loBit
the index of the lowest bit set.
unsigned int hiBit
the index of the highest bit set.

Returns

An APInt value with the requested bits set.

static llvm::APInt getBitsSetFrom(
    unsigned int numBits,
    unsigned int loBit)

Description

Constructs an APInt value that has a contiguous range of bits set. The bits from loBit (inclusive) to numBits (exclusive) will be set. All other bits will be zero. For example, with parameters(32, 12) you would get 0xFFFFF000.

Declared at: llvm/include/llvm/ADT/APInt.h:269

Parameters

unsigned int numBits
the intended bit width of the result
unsigned int loBit
the index of the lowest bit to set.

Returns

An APInt value with the requested bits set.

static llvm::APInt getBitsSetWithWrap(
    unsigned int numBits,
    unsigned int loBit,
    unsigned int hiBit)

Description

Wrap version of getBitsSet. If \p hiBit is bigger than \p loBit, this is same with getBitsSet. If \p hiBit is not bigger than \p loBit, the set bits "wrap". For example, with parameters (32, 28, 4), you would get 0xF000000F. If \p hiBit is equal to \p loBit, you would get a result with all bits set.

Declared at: llvm/include/llvm/ADT/APInt.h:253

Parameters

unsigned int numBits
unsigned int loBit
unsigned int hiBit

bool getBoolValue() const

Description

Convert APInt to a boolean value. This converts the APInt to a boolean value as a test against zero.

Declared at: llvm/include/llvm/ADT/APInt.h:452

llvm::APInt getHiBits(unsigned int numBits) const

Description

Compute an APInt containing numBits highbits from this APInt. Get an APInt with the same BitWidth as this APInt, just zero mask the low bits and right shift to the least significant bit.

Declared at: llvm/include/llvm/ADT/APInt.h:522

Parameters

unsigned int numBits

Returns

the high "numBits" bits of this APInt.

static llvm::APInt getHighBitsSet(
    unsigned int numBits,
    unsigned int hiBitsSet)

Description

Constructs an APInt value that has the top hiBitsSet bits set.

Declared at: llvm/include/llvm/ADT/APInt.h:279

Parameters

unsigned int numBits
the bitwidth of the result
unsigned int hiBitsSet
the number of high-order bits set in the result.

uint64_t getLimitedValue(
    uint64_t Limit =
        (18446744073709551615UL)) const

Description

If this 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/ADT/APInt.h:456

Parameters

uint64_t Limit = (18446744073709551615UL)

llvm::APInt getLoBits(unsigned int numBits) const

Description

Compute an APInt containing numBits lowbits from this APInt. Get an APInt with the same BitWidth as this APInt, just zero mask the high bits.

Declared at: llvm/include/llvm/ADT/APInt.h:530

Parameters

unsigned int numBits

Returns

the low "numBits" bits of this APInt.

static llvm::APInt getLowBitsSet(
    unsigned int numBits,
    unsigned int loBitsSet)

Description

Constructs an APInt value that has the bottom loBitsSet bits set.

Declared at: llvm/include/llvm/ADT/APInt.h:289

Parameters

unsigned int numBits
the bitwidth of the result
unsigned int loBitsSet
the number of low-order bits set in the result.

static llvm::APInt getMaxValue(
    unsigned int numBits)

Description

Gets maximum unsigned value of APInt for specific bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:186

Parameters

unsigned int numBits

unsigned int getMinSignedBits() const

Description

NOTE: This is soft-deprecated. Please use `getSignificantBits()` instead.

Declared at: llvm/include/llvm/ADT/APInt.h:1459

static llvm::APInt getMinValue(
    unsigned int numBits)

Description

Gets minimum unsigned value of APInt for a specific bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:196

Parameters

unsigned int numBits

static llvm::APInt getNullValue(
    unsigned int numBits)

Description

NOTE: This is soft-deprecated. Please use `getZero()` instead.

Declared at: llvm/include/llvm/ADT/APInt.h:180

Parameters

unsigned int numBits

unsigned int getNumSignBits() const

Description

Computes the number of leading bits of this APInt that are equal to its sign bit.

Declared at: llvm/include/llvm/ADT/APInt.h:1531

static unsigned int getNumWords(
    unsigned int BitWidth)

Description

Get the number of words. *NOTE* Here one word's bitwidth equals to that of uint64_t.

Declared at: llvm/include/llvm/ADT/APInt.h:1426

Parameters

unsigned int BitWidth

Returns

the number of words to hold the integer value with a given bit width.

unsigned int getNumWords() const

Description

Get the number of words. Here one word's bitwidth equals to that of uint64_t.

Declared at: llvm/include/llvm/ADT/APInt.h:1418

Returns

the number of words to hold the integer value of this APInt.

static llvm::APInt getOneBitSet(
    unsigned int numBits,
    unsigned int BitNo)

Description

Return an APInt with exactly one bit set in the result.

Declared at: llvm/include/llvm/ADT/APInt.h:222

Parameters

unsigned int numBits
unsigned int BitNo

const uint64_t* getRawData() const

Description

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.

Declared at: llvm/include/llvm/ADT/APInt.h:550

int64_t getSExtValue() const

Description

Get sign extended value This method attempts to return the value of this APInt as a sign extended int64_t. The bit width must be < = 64 or the value must fit within an int64_t. Otherwise an assertion will result.

Declared at: llvm/include/llvm/ADT/APInt.h:1478

static llvm::APInt getSignMask(
    unsigned int BitWidth)

Description

Get the SignMask for a specific bit width. This is just a wrapper function of getSignedMinValue(), and it helps code readability when we want to get a SignMask.

Declared at: llvm/include/llvm/ADT/APInt.h:209

Parameters

unsigned int BitWidth

static llvm::APInt getSignedMaxValue(
    unsigned int numBits)

Description

Gets maximum signed value of APInt for a specific bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:189

Parameters

unsigned int numBits

static llvm::APInt getSignedMinValue(
    unsigned int numBits)

Description

Gets minimum signed value of APInt for a specific bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:199

Parameters

unsigned int numBits

unsigned int getSignificantBits() const

Description

Get the minimum bit size for this signed APInt Computes the minimum bit width for this APInt while considering it to be a signed (and probably negative) value. If the value is not negative, this function returns the same value as getActiveBits()+1. Otherwise, it returns the smallest bit width that will retain the negative value. For example, -1 can be written as 0b1 or 0xFFFFFFFFFF. 0b1 is shorter and so for -1, this function will always return 1.

Declared at: llvm/include/llvm/ADT/APInt.h:1454

static llvm::APInt getSplat(unsigned int NewLen,
                            const llvm::APInt& V)

Description

Return a value containing V broadcasted over NewLen bits.

Declared at: llvm/include/llvm/ADT/APInt.h:296

Parameters

unsigned int NewLen
const llvm::APInt& V

static unsigned int getSufficientBitsNeeded(
    llvm::StringRef Str,
    uint8_t Radix)

Description

Get the bits that are sufficient to represent the string value. This may over estimate the amount of bits required, but it does not require parsing the value in the string.

Declared at: llvm/include/llvm/ADT/APInt.h:1494

Parameters

llvm::StringRef Str
uint8_t Radix

uint64_t getWord(unsigned int bitPosition) const

Description

Get the word corresponding to a bit position

Declared at: llvm/include/llvm/ADT/APInt.h:1883

Parameters

unsigned int bitPosition

Returns

the corresponding word for the specified bit position.

uint64_t getZExtValue() const

Description

Get zero extended value This method attempts to return the value of this APInt as a zero extended uint64_t. The bitwidth must be < = 64 or the value must fit within a uint64_t. Otherwise an assertion will result.

Declared at: llvm/include/llvm/ADT/APInt.h:1466

static llvm::APInt getZero(unsigned int numBits)

Description

Get the '0' value for the specified bit-width.

Declared at: llvm/include/llvm/ADT/APInt.h:177

Parameters

unsigned int numBits

static llvm::APInt getZeroWidth()

Description

Return an APInt zero bits wide.

Declared at: llvm/include/llvm/ADT/APInt.h:183

void initFromArray(ArrayRef<uint64_t> array)

Description

shared code between two array constructors

Declared at: llvm/include/llvm/ADT/APInt.h:1920

Parameters

ArrayRef<uint64_t> array

void initSlowCase(uint64_t val, bool isSigned)

Description

out-of-line slow case for inline constructor

Declared at: llvm/include/llvm/ADT/APInt.h:1917

Parameters

uint64_t val
bool isSigned

void initSlowCase(const llvm::APInt& that)

Description

out-of-line slow case for inline copy constructor

Declared at: llvm/include/llvm/ADT/APInt.h:1923

Parameters

const llvm::APInt& that

void insertBits(const llvm::APInt& SubBits,
                unsigned int bitPosition)

Description

Insert the bits from a smaller APInt starting at bitPosition.

Declared at: llvm/include/llvm/ADT/APInt.h:1399

Parameters

const llvm::APInt& SubBits
unsigned int bitPosition

void insertBits(uint64_t SubBits,
                unsigned int bitPosition,
                unsigned int numBits)

Declared at: llvm/include/llvm/ADT/APInt.h:1400

Parameters

uint64_t SubBits
unsigned int bitPosition
unsigned int numBits

bool intersects(const llvm::APInt& RHS) const

Description

This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are both set.

Declared at: llvm/include/llvm/ADT/APInt.h:1199

Parameters

const llvm::APInt& RHS

bool intersectsSlowCase(
    const llvm::APInt& RHS) const

Description

out-of-line slow case for intersects.

Declared at: llvm/include/llvm/ADT/APInt.h:1956

Parameters

const llvm::APInt& RHS

bool isAllOnes() const

Description

Determine if all bits are set. This is true for zero-width values.

Declared at: llvm/include/llvm/ADT/APInt.h:347

bool isAllOnesValue() const

Description

NOTE: This is soft-deprecated. Please use `isAllOnes()` instead.

Declared at: llvm/include/llvm/ADT/APInt.h:356

bool isIntN(unsigned int N) const

Description

Check if this APInt has an N-bits unsigned integer value.

Declared at: llvm/include/llvm/ADT/APInt.h:417

Parameters

unsigned int N

bool isMask() const

Declared at: llvm/include/llvm/ADT/APInt.h:482

Returns

true if this APInt is a non-empty sequence of ones starting at the least significant bit with the remainder zero. Ex. isMask(0x0000FFFFU) == true.

bool isMask(unsigned int numBits) const

Declared at: llvm/include/llvm/ADT/APInt.h:469

Parameters

unsigned int numBits
ones starting at the least significant bit with the remainder zero.

Returns

true if this APInt value is a sequence of

bool isMaxSignedValue() const

Description

Determine if this is the largest signed value. This checks to see if the value of this APInt is the maximum signed value for the APInt's bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:390

bool isMaxValue() const

Description

Determine if this is the largest unsigned value. This checks to see if the value of this APInt is the maximum unsigned value for the APInt's bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:384

bool isMinSignedValue() const

Description

Determine if this is the smallest signed value. This checks to see if the value of this APInt is the minimum signed value for the APInt's bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:408

bool isMinValue() const

Description

Determine if this is the smallest unsigned value. This checks to see if the value of this APInt is the minimum unsigned value for the APInt's bit width.

Declared at: llvm/include/llvm/ADT/APInt.h:402

bool isNegatedPowerOf2() const

Description

Check if this APInt's negated value is a power of two greater than zero.

Declared at: llvm/include/llvm/ADT/APInt.h:434

bool isNegative() const

Description

Determine sign of this APInt. This tests the high bit of this APInt to determine if it is set.

Declared at: llvm/include/llvm/ADT/APInt.h:312

Returns

true if this APInt is negative, false otherwise

bool isNonNegative() const

Description

Determine if this APInt Value is non-negative (>= 0) This tests the high bit of the APInt to determine if it is unset.

Declared at: llvm/include/llvm/ADT/APInt.h:317

bool isNonPositive() const

Description

Determine if this APInt Value is non-positive ( < = 0).

Declared at: llvm/include/llvm/ADT/APInt.h:344

Returns

true if this APInt is non-positive.

bool isNullValue() const

Description

NOTE: This is soft-deprecated. Please use `isZero()` instead.

Declared at: llvm/include/llvm/ADT/APInt.h:366

bool isOne() const

Description

Determine if this is a value of 1. This checks to see if the value of this APInt is one.

Declared at: llvm/include/llvm/ADT/APInt.h:371

bool isOneValue() const

Description

NOTE: This is soft-deprecated. Please use `isOne()` instead.

Declared at: llvm/include/llvm/ADT/APInt.h:378

bool isPowerOf2() const

Description

Check if this APInt's value is a power of two greater than zero.

Declared at: llvm/include/llvm/ADT/APInt.h:425

Returns

true if the argument APInt value is a power of two > 0.

static bool isSameValue(const llvm::APInt& I1,
                        const llvm::APInt& I2)

Description

Determine if two APInts have the same value, after zero-extending one of them (if needed!) to ensure that the bit-widths match.

Declared at: llvm/include/llvm/ADT/APInt.h:534

Parameters

const llvm::APInt& I1
const llvm::APInt& I2

bool isShiftedMask() const

Description

Return true if this APInt value contains a non-empty sequence of ones with the remainder zero.

Declared at: llvm/include/llvm/ADT/APInt.h:491

bool isShiftedMask(unsigned int& MaskIdx,
                   unsigned int& MaskLen) const

Description

Return true if this APInt value contains a non-empty sequence of ones with the remainder zero. If true, \p MaskIdx will specify the index of the lowest set bit and \p MaskLen is updated to specify the length of the mask, else neither are updated.

Declared at: llvm/include/llvm/ADT/APInt.h:503

Parameters

unsigned int& MaskIdx
unsigned int& MaskLen

bool isSignBitClear() const

Description

Determine if sign bit of this APInt is clear. This tests the high bit of this APInt to determine if it is clear.

Declared at: llvm/include/llvm/ADT/APInt.h:331

Returns

true if this APInt has its sign bit clear, false otherwise.

bool isSignBitSet() const

Description

Determine if sign bit of this APInt is set. This tests the high bit of this APInt to determine if it is set.

Declared at: llvm/include/llvm/ADT/APInt.h:324

Returns

true if this APInt has its sign bit set, false otherwise.

bool isSignMask() const

Description

Check if the APInt's value is returned by getSignMask.

Declared at: llvm/include/llvm/ADT/APInt.h:447

Returns

true if this is the value returned by getSignMask.

bool isSignedIntN(unsigned int N) const

Description

Check if this APInt has an N-bits signed integer value.

Declared at: llvm/include/llvm/ADT/APInt.h:420

Parameters

unsigned int N

bool isSingleWord() const

Description

Determine if this APInt just has one word to store value.

Declared at: llvm/include/llvm/ADT/APInt.h:305

Returns

true if the number of bits < = 64, false otherwise.

bool isSplat(unsigned int SplatSizeInBits) const

Description

Check if the APInt consists of a repeated bit pattern. e.g. 0x01010101 satisfies isSplat(8).

Declared at: llvm/include/llvm/ADT/APInt.h:465

Parameters

unsigned int SplatSizeInBits
The size of the pattern in bits. Must divide bit width without remainder.

bool isStrictlyPositive() const

Description

Determine if this APInt Value is positive. This tests if the value of this APInt is positive (> 0). Note that 0 is not a positive value.

Declared at: llvm/include/llvm/ADT/APInt.h:339

Returns

true if this APInt is positive.

bool isSubsetOf(const llvm::APInt& RHS) const

Description

This operation checks that all bits set in this APInt are also set in RHS.

Declared at: llvm/include/llvm/ADT/APInt.h:1207

Parameters

const llvm::APInt& RHS

bool isSubsetOfSlowCase(
    const llvm::APInt& RHS) const

Description

out-of-line slow case for isSubsetOf.

Declared at: llvm/include/llvm/ADT/APInt.h:1959

Parameters

const llvm::APInt& RHS

bool isZero() const

Description

Determine if this value is zero, i.e. all bits are clear.

Declared at: llvm/include/llvm/ADT/APInt.h:359

unsigned int logBase2() const

Declared at: llvm/include/llvm/ADT/APInt.h:1652

Returns

the floor log base 2 of this APInt.

llvm::APInt lshr(unsigned int shiftAmt) const

Description

Logical right-shift function. Logical right-shift this APInt by shiftAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:832

Parameters

unsigned int shiftAmt

llvm::APInt lshr(
    const llvm::APInt& ShiftAmt) const

Description

Logical right-shift function. Logical right-shift this APInt by shiftAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:881

Parameters

const llvm::APInt& ShiftAmt

void lshrInPlace(unsigned int ShiftAmt)

Description

Logical right-shift this APInt by ShiftAmt in place.

Declared at: llvm/include/llvm/ADT/APInt.h:839

Parameters

unsigned int ShiftAmt

void lshrInPlace(const llvm::APInt& ShiftAmt)

Description

Logical right-shift this APInt by ShiftAmt in place.

Declared at: llvm/include/llvm/ADT/APInt.h:888

Parameters

const llvm::APInt& ShiftAmt

void lshrSlowCase(unsigned int ShiftAmt)

Description

out-of-line slow case for lshr.

Declared at: llvm/include/llvm/ADT/APInt.h:1929

Parameters

unsigned int ShiftAmt

static uint64_t maskBit(unsigned int bitPosition)

Description

Get a single bit mask.

Declared at: llvm/include/llvm/ADT/APInt.h:1855

Parameters

unsigned int bitPosition

Returns

a uint64_t with only bit at "whichBit(bitPosition)" set This method generates and returns a uint64_t (word) mask for a single bit at a specific bit position. This is used to mask the bit in the corresponding word.

llvm::APInt multiplicativeInverse(
    const llvm::APInt& modulo) const

Declared at: llvm/include/llvm/ADT/APInt.h:1693

Parameters

const llvm::APInt& modulo

Returns

the multiplicative inverse for a given modulo.

bool ne(const llvm::APInt& RHS) const

Description

Inequality comparison Compares this APInt with RHS for the validity of the inequality relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1053

Parameters

const llvm::APInt& RHS

Returns

true if *this != Val

unsigned int nearestLogBase2() const

Description

NOTE: When we have a BitWidth of 1, we define: log2(0) = UINT32_MAX log2(1) = 0 to get around any mathematical concerns resulting from referencing 2 in a space where 2 does no exist.

Declared at: llvm/include/llvm/ADT/APInt.h:1670

Returns

the nearest log base 2 of this APInt. Ties round up.

bool needsCleanup() const

Description

Returns whether this instance allocated memory.

Declared at: llvm/include/llvm/ADT/APInt.h:1817

void negate()

Description

Negate this APInt in place.

Declared at: llvm/include/llvm/ADT/APInt.h:1393

void orAssignSlowCase(const llvm::APInt& RHS)

Description

out-of-line slow case for operator|=.

Declared at: llvm/include/llvm/ADT/APInt.h:1974

Parameters

const llvm::APInt& RHS

void print(llvm::raw_ostream& OS,
           bool isSigned) const

Description

@ } @ {

Declared at: llvm/include/llvm/ADT/APInt.h:1580

Parameters

llvm::raw_ostream& OS
bool isSigned

void reallocate(unsigned int NewBitWidth)

Description

Utility method to change the bit width of this APInt to new bit width, allocating and/or deallocating as necessary. There is no guarantee on the value of any bits upon return. Caller should populate the bits after.

Declared at: llvm/include/llvm/ADT/APInt.h:1890

Parameters

unsigned int NewBitWidth

llvm::APInt reverseBits() const

Declared at: llvm/include/llvm/ADT/APInt.h:1604

Returns

the value with the bit representation reversed of this APInt Value.

llvm::APInt rotl(unsigned int rotateAmt) const

Description

Rotate left by rotateAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:861

Parameters

unsigned int rotateAmt

llvm::APInt rotl(
    const llvm::APInt& rotateAmt) const

Description

Rotate left by rotateAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:900

Parameters

const llvm::APInt& rotateAmt

llvm::APInt rotr(unsigned int rotateAmt) const

Description

Rotate right by rotateAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:864

Parameters

unsigned int rotateAmt

llvm::APInt rotr(
    const llvm::APInt& rotateAmt) const

Description

Rotate right by rotateAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:903

Parameters

const llvm::APInt& rotateAmt

double roundToDouble() const

Description

Converts this unsigned APInt to a double value.

Declared at: llvm/include/llvm/ADT/APInt.h:1610

double roundToDouble(bool isSigned) const

Description

Converts this APInt to a double value.

Declared at: llvm/include/llvm/ADT/APInt.h:1607

Parameters

bool isSigned

llvm::APInt sadd_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:970

Parameters

const llvm::APInt& RHS
bool& Overflow

llvm::APInt sadd_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:981

Parameters

const llvm::APInt& RHS

llvm::APInt sdiv(const llvm::APInt& RHS) const

Description

Signed division function for APInt. Signed divide this APInt by APInt RHS. The result is rounded towards zero.

Declared at: llvm/include/llvm/ADT/APInt.h:931

Parameters

const llvm::APInt& RHS

llvm::APInt sdiv(int64_t RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:932

Parameters

int64_t RHS

llvm::APInt sdiv_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:974

Parameters

const llvm::APInt& RHS
bool& Overflow

static void sdivrem(const llvm::APInt& LHS,
                    const llvm::APInt& RHS,
                    llvm::APInt& Quotient,
                    llvm::APInt& Remainder)

Declared at: llvm/include/llvm/ADT/APInt.h:964

Parameters

const llvm::APInt& LHS
const llvm::APInt& RHS
llvm::APInt& Quotient
llvm::APInt& Remainder

static void sdivrem(const llvm::APInt& LHS,
                    int64_t RHS,
                    llvm::APInt& Quotient,
                    int64_t& Remainder)

Declared at: llvm/include/llvm/ADT/APInt.h:966

Parameters

const llvm::APInt& LHS
int64_t RHS
llvm::APInt& Quotient
int64_t& Remainder

void setAllBits()

Description

Set every bit to 1.

Declared at: llvm/include/llvm/ADT/APInt.h:1269

void setBit(unsigned int BitPosition)

Description

Set the given bit to 1 whose position is given as "bitPosition".

Declared at: llvm/include/llvm/ADT/APInt.h:1280

Parameters

unsigned int BitPosition

void setBitVal(unsigned int BitPosition,
               bool BitValue)

Description

Set a given bit to a given value.

Declared at: llvm/include/llvm/ADT/APInt.h:1293

Parameters

unsigned int BitPosition
bool BitValue

void setBits(unsigned int loBit,
             unsigned int hiBit)

Description

Set the bits from loBit (inclusive) to hiBit (exclusive) to 1. This function handles case when \p loBit < = \p hiBit.

Declared at: llvm/include/llvm/ADT/APInt.h:1317

Parameters

unsigned int loBit
unsigned int hiBit

void setBitsFrom(unsigned int loBit)

Description

Set the top bits starting from loBit.

Declared at: llvm/include/llvm/ADT/APInt.h:1336

Parameters

unsigned int loBit

void setBitsSlowCase(unsigned int loBit,
                     unsigned int hiBit)

Description

out-of-line slow case for setBits.

Declared at: llvm/include/llvm/ADT/APInt.h:1962

Parameters

unsigned int loBit
unsigned int hiBit

void setBitsWithWrap(unsigned int loBit,
                     unsigned int hiBit)

Description

Set the bits from loBit (inclusive) to hiBit (exclusive) to 1. This function handles "wrap" case when \p loBit >= \p hiBit, and calls setBits when \p loBit <\p hiBit. For \p loBit == \p hiBit wrap case, set every bit to 1.

Declared at: llvm/include/llvm/ADT/APInt.h:1304

Parameters

unsigned int loBit
unsigned int hiBit

void setHighBits(unsigned int hiBits)

Description

Set the top hiBits bits.

Declared at: llvm/include/llvm/ADT/APInt.h:1342

Parameters

unsigned int hiBits

void setLowBits(unsigned int loBits)

Description

Set the bottom loBits bits.

Declared at: llvm/include/llvm/ADT/APInt.h:1339

Parameters

unsigned int loBits

void setSignBit()

Description

Set the sign bit to 1.

Declared at: llvm/include/llvm/ADT/APInt.h:1290

llvm::APInt sext(unsigned int width) const

Description

Sign extend to a new width. This operation sign extends the APInt to a new width. If the high order bit is set, the fill on the left will be done with 1 bits, otherwise zero. It is an error to specify a width that is less than the current width.

Declared at: llvm/include/llvm/ADT/APInt.h:1243

Parameters

unsigned int width

llvm::APInt sextOrTrunc(unsigned int width) const

Description

Sign extend or truncate to width Make this APInt have the bit width given by \p width. The value is sign extended, truncated, or left alone to make it that width.

Declared at: llvm/include/llvm/ADT/APInt.h:1256

Parameters

unsigned int width

bool sge(const llvm::APInt& RHS) const

Description

Signed greater or equal comparison Regards both *this and RHS as signed quantities and compares them for validity of the greater-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1187

Parameters

const llvm::APInt& RHS

Returns

true if *this >= RHS when both are considered signed.

bool sge(int64_t RHS) const

Description

Signed greater or equal comparison Regards both *this as a signed quantity and compares it with RHS for the validity of the greater-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1195

Parameters

int64_t RHS

Returns

true if *this >= RHS when considered signed.

bool sgt(const llvm::APInt& RHS) const

Description

Signed greater than comparison Regards both *this and RHS as signed quantities and compares them for the validity of the greater-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1151

Parameters

const llvm::APInt& RHS

Returns

true if *this > RHS when both are considered signed.

bool sgt(int64_t RHS) const

Description

Signed greater than comparison Regards both *this as a signed quantity and compares it with RHS for the validity of the greater-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1159

Parameters

int64_t RHS

Returns

true if *this > RHS when considered signed.

llvm::APInt shl(unsigned int shiftAmt) const

Description

Left-shift function. Left-shift this APInt by shiftAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:854

Parameters

unsigned int shiftAmt

llvm::APInt shl(const llvm::APInt& ShiftAmt) const

Description

Left-shift function. Left-shift this APInt by shiftAmt.

Declared at: llvm/include/llvm/ADT/APInt.h:893

Parameters

const llvm::APInt& ShiftAmt

void shlSlowCase(unsigned int ShiftAmt)

Description

out-of-line slow case for shl

Declared at: llvm/include/llvm/ADT/APInt.h:1926

Parameters

unsigned int ShiftAmt

double signedRoundToDouble() const

Description

Converts this signed APInt to a double value.

Declared at: llvm/include/llvm/ADT/APInt.h:1613

bool sle(const llvm::APInt& RHS) const

Description

Signed less or equal comparison Regards both *this and RHS as signed quantities and compares them for validity of the less-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1116

Parameters

const llvm::APInt& RHS

Returns

true if *this < = RHS when both are considered signed.

bool sle(uint64_t RHS) const

Description

Signed less or equal comparison Regards both *this as a signed quantity and compares it with RHS for the validity of the less-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1124

Parameters

uint64_t RHS

Returns

true if *this < = RHS when considered signed.

bool slt(const llvm::APInt& RHS) const

Description

Signed less than comparison Regards both *this and RHS as signed quantities and compares them for validity of the less-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1080

Parameters

const llvm::APInt& RHS

Returns

true if *this < RHS when both are considered signed.

bool slt(int64_t RHS) const

Description

Signed less than comparison Regards both *this as a signed quantity and compares it with RHS for the validity of the less-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1088

Parameters

int64_t RHS

Returns

true if *this < RHS when considered signed.

llvm::APInt smul_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:975

Parameters

const llvm::APInt& RHS
bool& Overflow

llvm::APInt smul_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:985

Parameters

const llvm::APInt& RHS

llvm::APInt sqrt() const

Description

Compute the square root.

Declared at: llvm/include/llvm/ADT/APInt.h:1681

llvm::APInt srem(const llvm::APInt& RHS) const

Description

Function for signed remainder operation. Signed remainder operation on APInt.

Declared at: llvm/include/llvm/ADT/APInt.h:949

Parameters

const llvm::APInt& RHS

int64_t srem(int64_t RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:950

Parameters

int64_t RHS

llvm::APInt sshl_ov(const llvm::APInt& Amt,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:977

Parameters

const llvm::APInt& Amt
bool& Overflow

llvm::APInt sshl_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:987

Parameters

const llvm::APInt& RHS

llvm::APInt ssub_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:972

Parameters

const llvm::APInt& RHS
bool& Overflow

llvm::APInt ssub_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:983

Parameters

const llvm::APInt& RHS

static llvm::APInt::WordType tcAdd(
    llvm::APInt::WordType*,
    const llvm::APInt::WordType*,
    llvm::APInt::WordType carry,
    unsigned int)

Description

DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag.

Declared at: llvm/include/llvm/ADT/APInt.h:1740

Parameters

llvm::APInt::WordType*
const llvm::APInt::WordType*
llvm::APInt::WordType carry
unsigned int

static llvm::APInt::WordType tcAddPart(
    llvm::APInt::WordType*,
    llvm::APInt::WordType,
    unsigned int)

Description

DST += RHS. Returns the carry flag.

Declared at: llvm/include/llvm/ADT/APInt.h:1742

Parameters

llvm::APInt::WordType*
llvm::APInt::WordType
unsigned int

static void tcAssign(llvm::APInt::WordType*,
                     const llvm::APInt::WordType*,
                     unsigned int)

Description

Assign one bignum to another.

Declared at: llvm/include/llvm/ADT/APInt.h:1710

Parameters

llvm::APInt::WordType*
const llvm::APInt::WordType*
unsigned int

static void tcClearBit(llvm::APInt::WordType*,
                       unsigned int bit)

Description

Clear the given bit of a bignum. Zero-based.

Declared at: llvm/include/llvm/ADT/APInt.h:1729

Parameters

llvm::APInt::WordType*
unsigned int bit

static int tcCompare(const llvm::APInt::WordType*,
                     const llvm::APInt::WordType*,
                     unsigned int)

Description

Comparison (unsigned) of two bignums.

Declared at: llvm/include/llvm/ADT/APInt.h:1797

Parameters

const llvm::APInt::WordType*
const llvm::APInt::WordType*
unsigned int

static llvm::APInt::WordType tcDecrement(
    llvm::APInt::WordType* dst,
    unsigned int parts)

Description

Decrement a bignum in-place. Return the borrow flag.

Declared at: llvm/include/llvm/ADT/APInt.h:1805

Parameters

llvm::APInt::WordType* dst
unsigned int parts

static int tcDivide(
    llvm::APInt::WordType* lhs,
    const llvm::APInt::WordType* rhs,
    llvm::APInt::WordType* remainder,
    llvm::APInt::WordType* scratch,
    unsigned int parts)

Description

If RHS is zero LHS and REMAINDER are left unchanged, return one. Otherwise set LHS to LHS / RHS with the fractional part discarded, set REMAINDER to the remainder, return zero. i.e. OLD_LHS = RHS * LHS + REMAINDER SCRATCH is a bignum of the same size as the operands and result for use by the routine; its contents need not be initialized and are destroyed. LHS, REMAINDER and SCRATCH must be distinct.

Declared at: llvm/include/llvm/ADT/APInt.h:1785

Parameters

llvm::APInt::WordType* lhs
const llvm::APInt::WordType* rhs
llvm::APInt::WordType* remainder
llvm::APInt::WordType* scratch
unsigned int parts

static void tcExtract(
    llvm::APInt::WordType*,
    unsigned int dstCount,
    const llvm::APInt::WordType*,
    unsigned int srcBits,
    unsigned int srcLSB)

Description

Copy the bit vector of width srcBITS from SRC, starting at bit srcLSB, to DST, of dstCOUNT parts, such that the bit srcLSB becomes the least significant bit of DST. All high bits above srcBITS in DST are zero-filled.

Declared at: llvm/include/llvm/ADT/APInt.h:1722

Parameters

llvm::APInt::WordType*
unsigned int dstCount
const llvm::APInt::WordType*
unsigned int srcBits
unsigned int srcLSB

static int tcExtractBit(
    const llvm::APInt::WordType*,
    unsigned int bit)

Description

Extract the given bit of a bignum; returns 0 or 1. Zero-based.

Declared at: llvm/include/llvm/ADT/APInt.h:1716

Parameters

const llvm::APInt::WordType*
unsigned int bit

static void tcFullMultiply(
    llvm::APInt::WordType*,
    const llvm::APInt::WordType*,
    const llvm::APInt::WordType*,
    unsigned int,
    unsigned int)

Description

DST = LHS * RHS, where DST has width the sum of the widths of the operands. No overflow occurs. DST must be disjoint from both operands.

Declared at: llvm/include/llvm/ADT/APInt.h:1773

Parameters

llvm::APInt::WordType*
const llvm::APInt::WordType*
const llvm::APInt::WordType*
unsigned int
unsigned int

static llvm::APInt::WordType tcIncrement(
    llvm::APInt::WordType* dst,
    unsigned int parts)

Description

Increment a bignum in-place. Return the carry flag.

Declared at: llvm/include/llvm/ADT/APInt.h:1800

Parameters

llvm::APInt::WordType* dst
unsigned int parts

static bool tcIsZero(const llvm::APInt::WordType*,
                     unsigned int)

Description

Returns true if a bignum is zero, false otherwise.

Declared at: llvm/include/llvm/ADT/APInt.h:1713

Parameters

const llvm::APInt::WordType*
unsigned int

static unsigned int tcLSB(
    const llvm::APInt::WordType*,
    unsigned int n)

Description

Returns the bit number of the least or most significant set bit of a number. If the input number has no bits set -1U is returned.

Declared at: llvm/include/llvm/ADT/APInt.h:1733

Parameters

const llvm::APInt::WordType*
unsigned int n

static unsigned int tcMSB(
    const llvm::APInt::WordType* parts,
    unsigned int n)

Declared at: llvm/include/llvm/ADT/APInt.h:1734

Parameters

const llvm::APInt::WordType* parts
unsigned int n

static int tcMultiply(
    llvm::APInt::WordType*,
    const llvm::APInt::WordType*,
    const llvm::APInt::WordType*,
    unsigned int)

Description

DST = LHS * RHS, where DST has the same width as the operands and is filled with the least significant parts of the result. Returns one if overflow occurred, otherwise zero. DST must be disjoint from both operands.

Declared at: llvm/include/llvm/ADT/APInt.h:1768

Parameters

llvm::APInt::WordType*
const llvm::APInt::WordType*
const llvm::APInt::WordType*
unsigned int

static int tcMultiplyPart(
    llvm::APInt::WordType* dst,
    const llvm::APInt::WordType* src,
    llvm::APInt::WordType multiplier,
    llvm::APInt::WordType carry,
    unsigned int srcParts,
    unsigned int dstParts,
    bool add)

Description

DST += SRC * MULTIPLIER + PART if add is true DST = SRC * MULTIPLIER + PART if add is false Requires 0 < = DSTPARTS < = SRCPARTS + 1. If DST overlaps SRC they must start at the same point, i.e. DST == SRC. If DSTPARTS == SRC_PARTS + 1 no overflow occurs and zero is returned. Otherwise DST is filled with the least significant DSTPARTS parts of the result, and if all of the omitted higher parts were zero return zero, otherwise overflow occurred and return one.

Declared at: llvm/include/llvm/ADT/APInt.h:1760

Parameters

llvm::APInt::WordType* dst
const llvm::APInt::WordType* src
llvm::APInt::WordType multiplier
llvm::APInt::WordType carry
unsigned int srcParts
unsigned int dstParts
bool add

static void tcNegate(llvm::APInt::WordType*,
                     unsigned int)

Description

Negate a bignum in-place.

Declared at: llvm/include/llvm/ADT/APInt.h:1737

Parameters

llvm::APInt::WordType*
unsigned int

static void tcSet(llvm::APInt::WordType*,
                  llvm::APInt::WordType,
                  unsigned int)

Description

Sets the least significant part of a bignum to the input value, and zeroes out higher parts.

Declared at: llvm/include/llvm/ADT/APInt.h:1707

Parameters

llvm::APInt::WordType*
llvm::APInt::WordType
unsigned int

static void tcSetBit(llvm::APInt::WordType*,
                     unsigned int bit)

Description

Set the given bit of a bignum. Zero-based.

Declared at: llvm/include/llvm/ADT/APInt.h:1726

Parameters

llvm::APInt::WordType*
unsigned int bit

static void tcShiftLeft(llvm::APInt::WordType*,
                        unsigned int Words,
                        unsigned int Count)

Description

Shift a bignum left Count bits. Shifted in bits are zero. There are no restrictions on Count.

Declared at: llvm/include/llvm/ADT/APInt.h:1790

Parameters

llvm::APInt::WordType*
unsigned int Words
unsigned int Count

static void tcShiftRight(llvm::APInt::WordType*,
                         unsigned int Words,
                         unsigned int Count)

Description

Shift a bignum right Count bits. Shifted in bits are zero. There are no restrictions on Count.

Declared at: llvm/include/llvm/ADT/APInt.h:1794

Parameters

llvm::APInt::WordType*
unsigned int Words
unsigned int Count

static llvm::APInt::WordType tcSubtract(
    llvm::APInt::WordType*,
    const llvm::APInt::WordType*,
    llvm::APInt::WordType carry,
    unsigned int)

Description

DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag.

Declared at: llvm/include/llvm/ADT/APInt.h:1745

Parameters

llvm::APInt::WordType*
const llvm::APInt::WordType*
llvm::APInt::WordType carry
unsigned int

static llvm::APInt::WordType tcSubtractPart(
    llvm::APInt::WordType*,
    llvm::APInt::WordType,
    unsigned int)

Description

DST -= RHS. Returns the carry flag.

Declared at: llvm/include/llvm/ADT/APInt.h:1748

Parameters

llvm::APInt::WordType*
llvm::APInt::WordType
unsigned int

void toString(SmallVectorImpl<char>& Str,
              unsigned int Radix,
              bool Signed,
              bool formatAsCLiteral = false) const

Description

Converts an APInt to a string and append it to Str. Str is commonly a SmallString.

Declared at: llvm/include/llvm/ADT/APInt.h:1584

Parameters

SmallVectorImpl<char>& Str
unsigned int Radix
bool Signed
bool formatAsCLiteral = false

void toStringSigned(SmallVectorImpl<char>& Str,
                    unsigned int Radix = 10) const

Description

Considers the APInt to be signed and converts it into a string in the radix given. The radix can be 2, 8, 10, 16, or 36.

Declared at: llvm/include/llvm/ADT/APInt.h:1595

Parameters

SmallVectorImpl<char>& Str
unsigned int Radix = 10

void toStringUnsigned(
    SmallVectorImpl<char>& Str,
    unsigned int Radix = 10) const

Description

Considers the APInt to be unsigned and converts it into a string in the radix given. The radix can be 2, 8, 10 16, or 36.

Declared at: llvm/include/llvm/ADT/APInt.h:1589

Parameters

SmallVectorImpl<char>& Str
unsigned int Radix = 10

llvm::APInt trunc(unsigned int width) const

Description

Truncate to new width. Truncate the APInt to a specified width. It is an error to specify a width that is greater than the current width.

Declared at: llvm/include/llvm/ADT/APInt.h:1222

Parameters

unsigned int width

llvm::APInt truncSSat(unsigned int width) const

Description

Truncate to new width with signed saturation. If this APInt, treated as signed integer, can be losslessly truncated to the new bitwidth, then return truncated APInt. Else, return either signed min value if the APInt was negative, or signed max value.

Declared at: llvm/include/llvm/ADT/APInt.h:1235

Parameters

unsigned int width

llvm::APInt truncUSat(unsigned int width) const

Description

Truncate to new width with unsigned saturation. If the APInt, treated as unsigned integer, can be losslessly truncated to the new bitwidth, then return truncated APInt. Else, return max value.

Declared at: llvm/include/llvm/ADT/APInt.h:1228

Parameters

unsigned int width

llvm::APInt uadd_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:971

Parameters

const llvm::APInt& RHS
bool& Overflow

llvm::APInt uadd_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:982

Parameters

const llvm::APInt& RHS

llvm::APInt udiv(const llvm::APInt& RHS) const

Description

Unsigned division operation. Perform an unsigned divide operation on this APInt by RHS. Both this and RHS are treated as unsigned quantities for purposes of this division.

Declared at: llvm/include/llvm/ADT/APInt.h:923

Parameters

const llvm::APInt& RHS

Returns

a new APInt value containing the division result, rounded towards zero.

llvm::APInt udiv(uint64_t RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:924

Parameters

uint64_t RHS

static void udivrem(const llvm::APInt& LHS,
                    const llvm::APInt& RHS,
                    llvm::APInt& Quotient,
                    llvm::APInt& Remainder)

Description

Dual division/remainder interface. Sometimes it is convenient to divide two APInt values and obtain both the quotient and remainder. This function does both operations in the same computation making it a little more efficient. The pair of input arguments may overlap with the pair of output arguments. It is safe to call udivrem(X, Y, X, Y), for example.

Declared at: llvm/include/llvm/ADT/APInt.h:959

Parameters

const llvm::APInt& LHS
const llvm::APInt& RHS
llvm::APInt& Quotient
llvm::APInt& Remainder

static void udivrem(const llvm::APInt& LHS,
                    uint64_t RHS,
                    llvm::APInt& Quotient,
                    uint64_t& Remainder)

Declared at: llvm/include/llvm/ADT/APInt.h:961

Parameters

const llvm::APInt& LHS
uint64_t RHS
llvm::APInt& Quotient
uint64_t& Remainder

bool uge(uint64_t RHS) const

Description

Unsigned greater or equal comparison Regards both *this as an unsigned quantity and compares it with RHS for the validity of the greater-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1179

Parameters

uint64_t RHS

Returns

true if *this >= RHS when considered unsigned.

bool uge(const llvm::APInt& RHS) const

Description

Unsigned greater or equal comparison Regards both *this and RHS as unsigned quantities and compares them for validity of the greater-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1171

Parameters

const llvm::APInt& RHS

Returns

true if *this >= RHS when both are considered unsigned.

bool ugt(const llvm::APInt& RHS) const

Description

Unsigned greater than comparison Regards both *this and RHS as unsigned quantities and compares them for the validity of the greater-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1132

Parameters

const llvm::APInt& RHS

Returns

true if *this > RHS when both are considered unsigned.

bool ugt(uint64_t RHS) const

Description

Unsigned greater than comparison Regards both *this as an unsigned quantity and compares it with RHS for the validity of the greater-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1140

Parameters

uint64_t RHS

Returns

true if *this > RHS when considered unsigned.

bool ule(const llvm::APInt& RHS) const

Description

Unsigned less or equal comparison Regards both *this and RHS as unsigned quantities and compares them for validity of the less-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1100

Parameters

const llvm::APInt& RHS

Returns

true if *this < = RHS when both are considered unsigned.

bool ule(uint64_t RHS) const

Description

Unsigned less or equal comparison Regards both *this as an unsigned quantity and compares it with RHS for the validity of the less-or-equal relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1108

Parameters

uint64_t RHS

Returns

true if *this < = RHS when considered unsigned.

bool ult(uint64_t RHS) const

Description

Unsigned less than comparison Regards both *this as an unsigned quantity and compares it with RHS for the validity of the less-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1069

Parameters

uint64_t RHS

Returns

true if *this < RHS when considered unsigned.

bool ult(const llvm::APInt& RHS) const

Description

Unsigned less than comparison Regards both *this and RHS as unsigned quantities and compares them for the validity of the less-than relationship.

Declared at: llvm/include/llvm/ADT/APInt.h:1061

Parameters

const llvm::APInt& RHS

Returns

true if *this < RHS when both are considered unsigned.

llvm::APInt umul_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:976

Parameters

const llvm::APInt& RHS
bool& Overflow

llvm::APInt umul_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:986

Parameters

const llvm::APInt& RHS

uint64_t urem(uint64_t RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:944

Parameters

uint64_t RHS

llvm::APInt urem(const llvm::APInt& RHS) const

Description

Unsigned remainder operation. Perform an unsigned remainder operation on this APInt with RHS being the divisor. Both this and RHS are treated as unsigned quantities for purposes of this operation. Note that this is a true remainder operation and not a modulo operation because the sign follows the sign of the dividend which is *this.

Declared at: llvm/include/llvm/ADT/APInt.h:943

Parameters

const llvm::APInt& RHS

Returns

a new APInt value containing the remainder result

llvm::APInt ushl_ov(const llvm::APInt& Amt,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:978

Parameters

const llvm::APInt& Amt
bool& Overflow

llvm::APInt ushl_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:988

Parameters

const llvm::APInt& RHS

llvm::APInt usub_ov(const llvm::APInt& RHS,
                    bool& Overflow) const

Declared at: llvm/include/llvm/ADT/APInt.h:973

Parameters

const llvm::APInt& RHS
bool& Overflow

llvm::APInt usub_sat(const llvm::APInt& RHS) const

Declared at: llvm/include/llvm/ADT/APInt.h:984

Parameters

const llvm::APInt& RHS

static unsigned int whichBit(
    unsigned int bitPosition)

Description

Determine which bit in a word the specified bit position is in.

Declared at: llvm/include/llvm/ADT/APInt.h:1845

Parameters

unsigned int bitPosition

static unsigned int whichWord(
    unsigned int bitPosition)

Description

Determine which word a bit is in.

Declared at: llvm/include/llvm/ADT/APInt.h:1840

Parameters

unsigned int bitPosition

Returns

the word position for the specified bit position.

void xorAssignSlowCase(const llvm::APInt& RHS)

Description

out-of-line slow case for operator^=.

Declared at: llvm/include/llvm/ADT/APInt.h:1977

Parameters

const llvm::APInt& RHS

llvm::APInt zext(unsigned int width) const

Description

Zero extend to a new width. This operation zero extends the APInt to a new width. The high order bits are filled with 0 bits. It is an error to specify a width that is less than the current width.

Declared at: llvm/include/llvm/ADT/APInt.h:1250

Parameters

unsigned int width

llvm::APInt zextOrTrunc(unsigned int width) const

Description

Zero extend or truncate to width Make this APInt have the bit width given by \p width. The value is zero extended, truncated, or left alone to make it that width.

Declared at: llvm/include/llvm/ADT/APInt.h:1262

Parameters

unsigned int width

~APInt()

Description

Destructor.

Declared at: llvm/include/llvm/ADT/APInt.h:167