LLVM API Documentation
Class for arbitrary precision integers. More...
#include <APInt.h>
Classes | |
struct | ms |
Magic data for optimising signed division by a constant. More... | |
struct | mu |
Magic data for optimising unsigned division by a constant. More... | |
Public Member Functions | |
bool | isNegative () const |
Determine sign of this APInt. | |
bool | isNonNegative () const |
Determine if this APInt Value is non-negative (>= 0) | |
bool | isStrictlyPositive () const |
Determine if this APInt Value is positive. | |
bool | isAllOnesValue () const |
Determine if all bits are set. | |
bool | isMaxValue () const |
Determine if this is the largest unsigned value. | |
bool | isMaxSignedValue () const |
Determine if this is the largest signed value. | |
bool | isMinValue () const |
Determine if this is the smallest unsigned value. | |
bool | isMinSignedValue () const |
Determine if this is the smallest signed value. | |
bool | isIntN (unsigned N) const |
Check if this APInt has an N-bits unsigned integer value. | |
bool | isSignedIntN (unsigned N) const |
Check if this APInt has an N-bits signed integer value. | |
bool | isPowerOf2 () const |
Check if this APInt's value is a power of two greater than zero. | |
bool | isSignBit () const |
Check if the APInt's value is returned by getSignBit. | |
bool | getBoolValue () const |
Convert APInt to a boolean value. | |
uint64_t | getLimitedValue (uint64_t Limit=~0ULL) const |
APInt | getHiBits (unsigned numBits) const |
Compute an APInt containing numBits highbits from this APInt. | |
APInt | getLoBits (unsigned numBits) const |
Compute an APInt containing numBits lowbits from this APInt. | |
const uint64_t * | getRawData () const |
const APInt | operator++ (int) |
Postfix increment operator. | |
APInt & | operator++ () |
Prefix increment operator. | |
const APInt | operator-- (int) |
Postfix decrement operator. | |
APInt & | operator-- () |
Prefix decrement operator. | |
APInt | operator~ () const |
Unary bitwise complement operator. | |
APInt | operator- () const |
Unary negation operator. | |
bool | operator! () const |
Logical negation operator. | |
APInt & | operator= (const APInt &RHS) |
Copy assignment operator. | |
APInt & | operator= (APInt &&that) |
Move assignment operator. | |
APInt & | operator= (uint64_t RHS) |
Assignment operator. | |
APInt & | operator&= (const APInt &RHS) |
Bitwise AND assignment operator. | |
APInt & | operator|= (const APInt &RHS) |
Bitwise OR assignment operator. | |
APInt & | operator|= (uint64_t RHS) |
Bitwise OR assignment operator. | |
APInt & | operator^= (const APInt &RHS) |
Bitwise XOR assignment operator. | |
APInt & | operator*= (const APInt &RHS) |
Multiplication assignment operator. | |
APInt & | operator+= (const APInt &RHS) |
Addition assignment operator. | |
APInt & | operator-= (const APInt &RHS) |
Subtraction assignment operator. | |
APInt & | operator<<= (unsigned shiftAmt) |
Left-shift assignment function. | |
APInt | operator& (const APInt &RHS) const |
Bitwise AND operator. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | And (const APInt &RHS) const |
APInt | operator| (const APInt &RHS) const |
Bitwise OR operator. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | Or (const APInt &RHS) const |
Bitwise OR function. | |
APInt | operator^ (const APInt &RHS) const |
Bitwise XOR operator. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | Xor (const APInt &RHS) const |
Bitwise XOR function. | |
APInt | operator* (const APInt &RHS) const |
Multiplication operator. | |
APInt | operator+ (const APInt &RHS) const |
Addition operator. | |
APInt | operator+ (uint64_t RHS) const |
APInt | operator- (const APInt &RHS) const |
Subtraction operator. | |
APInt | operator- (uint64_t RHS) const |
APInt | operator<< (unsigned Bits) const |
Left logical shift operator. | |
APInt | operator<< (const APInt &Bits) const |
Left logical shift operator. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | ashr (unsigned shiftAmt) const |
Arithmetic right-shift function. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | lshr (unsigned shiftAmt) const |
Logical right-shift function. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | shl (unsigned shiftAmt) const |
Left-shift function. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | rotl (unsigned rotateAmt) const |
Rotate left by rotateAmt. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | rotr (unsigned rotateAmt) const |
Rotate right by rotateAmt. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | ashr (const APInt &shiftAmt) const |
Arithmetic right-shift function. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | lshr (const APInt &shiftAmt) const |
Logical right-shift function. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | shl (const APInt &shiftAmt) const |
Left-shift function. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | rotl (const APInt &rotateAmt) const |
Rotate left by rotateAmt. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | rotr (const APInt &rotateAmt) const |
Rotate right by rotateAmt. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | udiv (const APInt &RHS) const |
Unsigned division operation. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | sdiv (const APInt &RHS) const |
Signed division function for APInt. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | urem (const APInt &RHS) const |
Unsigned remainder operation. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | srem (const APInt &RHS) const |
Function for signed remainder operation. | |
APInt | sadd_ov (const APInt &RHS, bool &Overflow) const |
APInt | uadd_ov (const APInt &RHS, bool &Overflow) const |
APInt | ssub_ov (const APInt &RHS, bool &Overflow) const |
APInt | usub_ov (const APInt &RHS, bool &Overflow) const |
APInt | sdiv_ov (const APInt &RHS, bool &Overflow) const |
APInt | smul_ov (const APInt &RHS, bool &Overflow) const |
APInt | umul_ov (const APInt &RHS, bool &Overflow) const |
APInt | sshl_ov (unsigned Amt, bool &Overflow) const |
bool | operator[] (unsigned bitPosition) const |
Array-indexing support. | |
bool | operator== (const APInt &RHS) const |
Equality operator. | |
bool | operator== (uint64_t Val) const |
Equality operator. | |
bool | eq (const APInt &RHS) const |
Equality comparison. | |
bool | operator!= (const APInt &RHS) const |
Inequality operator. | |
bool | operator!= (uint64_t Val) const |
Inequality operator. | |
bool | ne (const APInt &RHS) const |
Inequality comparison. | |
bool | ult (const APInt &RHS) const |
Unsigned less than comparison. | |
bool | ult (uint64_t RHS) const |
Unsigned less than comparison. | |
bool | slt (const APInt &RHS) const |
Signed less than comparison. | |
bool | slt (uint64_t RHS) const |
Signed less than comparison. | |
bool | ule (const APInt &RHS) const |
Unsigned less or equal comparison. | |
bool | ule (uint64_t RHS) const |
Unsigned less or equal comparison. | |
bool | sle (const APInt &RHS) const |
Signed less or equal comparison. | |
bool | sle (uint64_t RHS) const |
Signed less or equal comparison. | |
bool | ugt (const APInt &RHS) const |
Unsigned greather than comparison. | |
bool | ugt (uint64_t RHS) const |
Unsigned greater than comparison. | |
bool | sgt (const APInt &RHS) const |
Signed greather than comparison. | |
bool | sgt (uint64_t RHS) const |
Signed greater than comparison. | |
bool | uge (const APInt &RHS) const |
Unsigned greater or equal comparison. | |
bool | uge (uint64_t RHS) const |
Unsigned greater or equal comparison. | |
bool | sge (const APInt &RHS) const |
Signed greather or equal comparison. | |
bool | sge (uint64_t RHS) const |
Signed greater or equal comparison. | |
bool | intersects (const APInt &RHS) const |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | trunc (unsigned width) const |
Truncate to new width. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | sext (unsigned width) const |
Sign extend to a new width. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | zext (unsigned width) const |
Zero extend to a new width. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | sextOrTrunc (unsigned width) const |
Sign extend or truncate to width. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | zextOrTrunc (unsigned width) const |
Zero extend or truncate to width. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | sextOrSelf (unsigned width) const |
Sign extend or truncate to width. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | zextOrSelf (unsigned width) const |
Zero extend or truncate to width. | |
void | setAllBits () |
Set every bit to 1. | |
void | setBit (unsigned bitPosition) |
Set a given bit to 1. | |
void | clearAllBits () |
Set every bit to 0. | |
void | clearBit (unsigned bitPosition) |
Set a given bit to 0. | |
void | flipAllBits () |
Toggle every bit to its opposite value. | |
void | flipBit (unsigned bitPosition) |
Toggles a given bit to its opposite value. | |
unsigned | getBitWidth () const |
Return the number of bits in the APInt. | |
unsigned | getNumWords () const |
Get the number of words. | |
unsigned | getActiveBits () const |
Compute the number of active bits in the value. | |
unsigned | getActiveWords () const |
Compute the number of active words in the value of this APInt. | |
unsigned | getMinSignedBits () const |
Get the minimum bit size for this signed APInt. | |
uint64_t | getZExtValue () const |
Get zero extended value. | |
int64_t | getSExtValue () const |
Get sign extended value. | |
unsigned | countLeadingZeros () const |
The APInt version of the countLeadingZeros functions in MathExtras.h. | |
unsigned | countLeadingOnes () const |
Count the number of leading one bits. | |
unsigned | getNumSignBits () const |
unsigned | countTrailingZeros () const |
Count the number of trailing zero bits. | |
unsigned | countTrailingOnes () const |
Count the number of trailing one bits. | |
unsigned | countPopulation () const |
Count the number of bits set. | |
void | print (raw_ostream &OS, bool isSigned) const |
void | toString (SmallVectorImpl< char > &Str, unsigned Radix, bool Signed, bool formatAsCLiteral=false) const |
void | toStringUnsigned (SmallVectorImpl< char > &Str, unsigned Radix=10) const |
void | toStringSigned (SmallVectorImpl< char > &Str, unsigned Radix=10) const |
std::string | toString (unsigned Radix, bool Signed) const |
Return the APInt as a std::string. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | byteSwap () const |
double | roundToDouble (bool isSigned) const |
Converts this APInt to a double value. | |
double | roundToDouble () const |
Converts this unsigned APInt to a double value. | |
double | signedRoundToDouble () const |
Converts this signed APInt to a double value. | |
double | bitsToDouble () const |
Converts APInt bits to a double. | |
float | bitsToFloat () const |
Converts APInt bits to a double. | |
unsigned | logBase2 () const |
unsigned | ceilLogBase2 () const |
unsigned | nearestLogBase2 () const |
int32_t | exactLogBase2 () const |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | sqrt () const |
Compute the square root. | |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT | abs () const |
Get the absolute value;. | |
APInt | multiplicativeInverse (const APInt &modulo) const |
ms | magic () const |
mu | magicu (unsigned LeadingZeros=0) const |
void | dump () const |
debug method | |
Constructors | |
APInt (unsigned numBits, uint64_t val, bool isSigned=false) | |
Create a new APInt of numBits width, initialized as val. | |
APInt (unsigned numBits, ArrayRef< uint64_t > bigVal) | |
Construct an APInt of numBits width, initialized as bigVal[]. | |
APInt (unsigned numBits, unsigned numWords, const uint64_t bigVal[]) | |
APInt (unsigned numBits, StringRef str, uint8_t radix) | |
Construct an APInt from a string representation. | |
APInt (const APInt &that) | |
Copy Constructor. | |
APInt (APInt &&that) | |
Move Constructor. | |
~APInt () | |
Destructor. | |
APInt () | |
Default constructor that creates an uninitialized APInt. | |
bool | needsCleanup () const |
Returns whether this instance allocated memory. | |
void | Profile (FoldingSetNodeID &id) const |
Profile - This method 'profiles' an APInt for use with FoldingSet. | |
Static Public Member Functions | |
static APInt | getMaxValue (unsigned numBits) |
Gets maximum unsigned value of APInt for specific bit width. | |
static APInt | getSignedMaxValue (unsigned numBits) |
Gets maximum signed value of APInt for a specific bit width. | |
static APInt | getMinValue (unsigned numBits) |
Gets minimum unsigned value of APInt for a specific bit width. | |
static APInt | getSignedMinValue (unsigned numBits) |
Gets minimum signed value of APInt for a specific bit width. | |
static APInt | getSignBit (unsigned BitWidth) |
Get the SignBit for a specific bit width. | |
static APInt | getAllOnesValue (unsigned numBits) |
Get the all-ones value. | |
static APInt | getNullValue (unsigned numBits) |
Get the '0' value. | |
static APInt | getOneBitSet (unsigned numBits, unsigned BitNo) |
Return an APInt with exactly one bit set in the result. | |
static APInt | getBitsSet (unsigned numBits, unsigned loBit, unsigned hiBit) |
Get a value with a block of bits set. | |
static APInt | getHighBitsSet (unsigned numBits, unsigned hiBitsSet) |
Get a value with high bits set. | |
static APInt | getLowBitsSet (unsigned numBits, unsigned loBitsSet) |
Get a value with low bits set. | |
static APInt | getSplat (unsigned NewLen, const APInt &V) |
Return a value containing V broadcasted over NewLen bits. | |
static bool | isSameValue (const APInt &I1, const APInt &I2) |
Determine if two APInts have the same value, after zero-extending one of them (if needed!) to ensure that the bit-widths match. | |
static void | udivrem (const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder) |
Dual division/remainder interface. | |
static void | sdivrem (const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder) |
static unsigned | getNumWords (unsigned BitWidth) |
Get the number of words. | |
static unsigned | getBitsNeeded (StringRef str, uint8_t radix) |
Get bits required for string value. | |
static APInt LLVM_ATTRIBUTE_UNUSED_RESULT | doubleToBits (double V) |
Converts a double to APInt bits. | |
static APInt LLVM_ATTRIBUTE_UNUSED_RESULT | floatToBits (float V) |
Converts a float to APInt bits. | |
static void | tcSet (integerPart *, integerPart, unsigned int) |
static void | tcAssign (integerPart *, const integerPart *, unsigned int) |
Assign one bignum to another. | |
static bool | tcIsZero (const integerPart *, unsigned int) |
Returns true if a bignum is zero, false otherwise. | |
static int | tcExtractBit (const integerPart *, unsigned int bit) |
Extract the given bit of a bignum; returns 0 or 1. Zero-based. | |
static void | tcExtract (integerPart *, unsigned int dstCount, const integerPart *, unsigned int srcBits, unsigned int srcLSB) |
static void | tcSetBit (integerPart *, unsigned int bit) |
Set the given bit of a bignum. Zero-based. | |
static void | tcClearBit (integerPart *, unsigned int bit) |
Clear the given bit of a bignum. Zero-based. | |
static unsigned int | tcLSB (const integerPart *, unsigned int) |
static unsigned int | tcMSB (const integerPart *parts, unsigned int n) |
static void | tcNegate (integerPart *, unsigned int) |
Negate a bignum in-place. | |
static integerPart | tcAdd (integerPart *, const integerPart *, integerPart carry, unsigned) |
DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag. | |
static integerPart | tcSubtract (integerPart *, const integerPart *, integerPart carry, unsigned) |
DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag. | |
static int | tcMultiplyPart (integerPart *dst, const integerPart *src, integerPart multiplier, integerPart carry, unsigned int srcParts, unsigned int dstParts, bool add) |
static int | tcMultiply (integerPart *, const integerPart *, const integerPart *, unsigned) |
static unsigned int | tcFullMultiply (integerPart *, const integerPart *, const integerPart *, unsigned, unsigned) |
static int | tcDivide (integerPart *lhs, const integerPart *rhs, integerPart *remainder, integerPart *scratch, unsigned int parts) |
static void | tcShiftLeft (integerPart *, unsigned int parts, unsigned int count) |
static void | tcShiftRight (integerPart *, unsigned int parts, unsigned int count) |
static void | tcAnd (integerPart *, const integerPart *, unsigned int) |
The obvious AND, OR and XOR and complement operations. | |
static void | tcOr (integerPart *, const integerPart *, unsigned int) |
static void | tcXor (integerPart *, const integerPart *, unsigned int) |
static void | tcComplement (integerPart *, unsigned int) |
static int | tcCompare (const integerPart *, const integerPart *, unsigned int) |
Comparison (unsigned) of two bignums. | |
static integerPart | tcIncrement (integerPart *, unsigned int) |
Increment a bignum in-place. Return the carry flag. | |
static integerPart | tcDecrement (integerPart *, unsigned int) |
Decrement a bignum in-place. Return the borrow flag. | |
static void | tcSetLeastSignificantBits (integerPart *, unsigned int, unsigned int bits) |
Set the least significant BITS and clear the rest. | |
Friends | |
hash_code | hash_value (const APInt &Arg) |
Overload to compute a hash_code for an APInt value. |
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.
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).
numBits | the bit width of the constructed APInt |
val | the initial value of the APInt |
isSigned | how to treat signedness of val |
Definition at line 236 of file APInt.h.
References VAL.
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.
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.
Definition at line 112 of file APInt.cpp.
References llvm::makeArrayRef().
Construct an APInt from a string representation.
This constructor interprets the string 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.
numBits | the bit width of the constructed APInt |
str | the string to be interpreted |
radix | the radix to use for the conversion |
llvm::APInt::APInt | ( | APInt && | that | ) | [inline] |
llvm::APInt::~APInt | ( | ) | [inline] |
llvm::APInt::APInt | ( | ) | [inline, explicit] |
Default constructor that creates an uninitialized APInt.
This is useful for object deserialization (pair this with the static method Read).
Definition at line 302 of file APInt.h.
Referenced by And(), ashr(), byteSwap(), ceilLogBase2(), getAllOnesValue(), getHighBitsSet(), getLowBitsSet(), getNullValue(), getSignedMinValue(), lshr(), multiplicativeInverse(), operator*(), operator+(), operator-(), operator<<(), llvm::APSInt::operator==(), sext(), sge(), sgt(), sle(), sqrt(), trunc(), udiv(), udivrem(), uge(), ugt(), ule(), urem(), and zext().
APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::abs | ( | ) | const [inline] |
Get the absolute value;.
If *this is < 0 then return -(*this), otherwise *this;
Definition at line 1533 of file APInt.h.
Referenced by computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), findGCD(), gcd(), magic(), SimplifyICmpInst(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitMul().
APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::And | ( | const APInt & | RHS | ) | const [inline] |
Definition at line 763 of file APInt.h.
References APInt(), getBitWidth(), and VAL.
APInt APInt::ashr | ( | unsigned | shiftAmt | ) | const |
Arithmetic right-shift function.
Arithmetic right-shift this APInt by shiftAmt.
Definition at line 1039 of file APInt.cpp.
References APInt(), getNumWords(), and isNegative().
Referenced by ashr(), llvm::APIntOps::ashr(), llvm::ConstantFoldBinaryInstruction(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldICmpShrCst(), llvm::SelectionDAG::getNode(), llvm::APSInt::operator>>(), SimplifyICmpInst(), and llvm::Interpreter::visitAShr().
APInt APInt::ashr | ( | const APInt & | shiftAmt | ) | const |
Arithmetic right-shift function.
Arithmetic right-shift this APInt by shiftAmt.
Definition at line 1033 of file APInt.cpp.
References ashr(), and getLimitedValue().
double llvm::APInt::bitsToDouble | ( | ) | const [inline] |
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.
Definition at line 1431 of file APInt.h.
Referenced by llvm::APFloat::convertToDouble(), and llvm::ExecutionEngine::getConstantValue().
float llvm::APInt::bitsToFloat | ( | ) | const [inline] |
Converts APInt bits to a double.
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.
Definition at line 1445 of file APInt.h.
References I, pVal, T, and VAL.
Referenced by llvm::APFloat::convertToFloat(), and llvm::ExecutionEngine::getConstantValue().
APInt APInt::byteSwap | ( | ) | const |
Definition at line 778 of file APInt.cpp.
References APInt(), llvm::ByteSwap_16(), llvm::ByteSwap_32(), llvm::ByteSwap_64(), getNumWords(), I, lshrNear(), N, and pVal.
Referenced by llvm::APIntOps::byteSwap(), llvm::SelectionDAG::getNode(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
unsigned llvm::APInt::ceilLogBase2 | ( | ) | const [inline] |
void llvm::APInt::clearAllBits | ( | ) | [inline] |
Set every bit to 0.
Definition at line 1207 of file APInt.h.
References getNumWords(), pVal, and UINT64_MAX.
Referenced by computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromAssume(), computeKnownBitsMul(), getUsefulBitsFromOrWithShiftedReg(), and operator*=().
void APInt::clearBit | ( | unsigned | bitPosition | ) |
Set a given bit to 0.
Set the given bit to 0 whose position is given as "bitPosition".
Definition at line 593 of file APInt.cpp.
References pVal.
Referenced by checkRippleForAdd(), ComputeSignedMinMaxValuesFromKnownBits(), and flipBit().
unsigned APInt::countLeadingOnes | ( | ) | const |
Count the number of leading one bits.
This function is an APInt version of the countLeadingOnes_{32,64} functions in MathExtras.h. It counts the number of ones from the most significant bit to the first zero bit.
Definition at line 710 of file APInt.cpp.
References llvm::CountLeadingOnes_64(), getNumWords(), and pVal.
Referenced by computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsMul(), getZExtValue(), isU24(), SimplifyICmpInst(), and sshl_ov().
unsigned llvm::APInt::countLeadingZeros | ( | ) | const [inline] |
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.
Definition at line 1327 of file APInt.h.
Referenced by areUsedBitsDense(), checkRippleForAdd(), ComputeNumSignBits(), llvm::SelectionDAG::ComputeNumSignBits(), llvm::SelectionDAG::getNode(), isBitfieldInsertOpFromOr(), nearestLogBase2(), ProcessUMulZExtIdiom(), llvm::TargetLowering::TargetLoweringOpt::ShrinkDemandedOp(), SimplifyICmpInst(), sshl_ov(), and llvm::InstCombiner::visitAnd().
unsigned llvm::APInt::countPopulation | ( | ) | const [inline] |
Count the number of bits set.
This function is an APInt version of the countPopulation_{32,64} functions in MathExtras.h. It counts the number of 1 bits in the APInt value.
Definition at line 1381 of file APInt.h.
References llvm::CountTrailingOnes_64(), and VAL.
Referenced by checkRippleForAdd(), llvm::SelectionDAG::getNode(), isMaxSignedValue(), and ValueHasExactlyOneBitSet().
unsigned llvm::APInt::countTrailingOnes | ( | ) | const [inline] |
Count the number of trailing one bits.
This function is an APInt version of the countTrailingOnes_{32,64} functions in MathExtras.h. It counts the number of ones from the least significant bit to the first zero bit.
Definition at line 1369 of file APInt.h.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsMul(), DemandedBitsLHSMask(), and isWordAligned().
unsigned APInt::countTrailingZeros | ( | ) | const |
Count the number of trailing zero bits.
This function is an APInt version of the countTrailingZeros_{32,64} functions in MathExtras.h. It counts the number of zeros from the least significant bit to the first set bit.
Definition at line 737 of file APInt.cpp.
References llvm::countTrailingZeros(), getNumWords(), and pVal.
Referenced by areUsedBitsDense(), BinomialCoefficient(), llvm::TargetLowering::BuildUDIV(), checkForNegativeOperand(), DemandedBitsLHSMask(), llvm::SelectionDAG::getNode(), isBitfieldInsertOpFromOr(), ProcessUGT_ADDCST_ADD(), SimplifyICmpInst(), llvm::TargetLowering::SimplifySetCC(), SolveLinEquationWithOverflow(), llvm::APFloat::toString(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
static APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::doubleToBits | ( | double | V | ) | [inline, static] |
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.
Definition at line 1458 of file APInt.h.
Referenced by llvm::APFloat::APFloat(), and llvm::ExecutionEngine::getConstantValue().
void APInt::dump | ( | ) | const |
debug method
Definition at line 2254 of file APInt.cpp.
References llvm::dbgs(), llvm::SmallString< InternalLen >::str(), toStringSigned(), and toStringUnsigned().
bool llvm::APInt::eq | ( | const APInt & | RHS | ) | const [inline] |
Equality comparison.
Compares this APInt with RHS for the validity of the equality relationship.
Definition at line 981 of file APInt.h.
References VAL.
Referenced by llvm::APSInt::operator==(), ProcessUMulZExtIdiom(), sgt(), sle(), ugt(), and ule().
int32_t llvm::APInt::exactLogBase2 | ( | ) | const [inline] |
Definition at line 1521 of file APInt.h.
References getBoolValue(), and VAL.
Referenced by llvm::TargetLowering::SimplifyDemandedBits().
void llvm::APInt::flipAllBits | ( | ) | [inline] |
Toggle every bit to its opposite value.
Definition at line 1220 of file APInt.h.
Referenced by getUsefulBits(), getUsefulBitsFromOrWithShiftedReg(), operator~(), slt(), and toString().
void APInt::flipBit | ( | unsigned | bitPosition | ) |
Toggles a given bit to its opposite value.
Toggle every bit to its opposite value.
Toggle a given bit to its opposite value whose position is given as "bitPosition".
Toggle a given bit to its opposite value whose position is given as "bitPosition". Toggles a given bit to its opposite value.
Definition at line 605 of file APInt.cpp.
References clearBit(), and setBit().
static APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::floatToBits | ( | float | V | ) | [inline, static] |
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.
Definition at line 1471 of file APInt.h.
Referenced by llvm::APFloat::APFloat(), llvm::ExecutionEngine::getConstantValue(), and llvm::SIInstrInfo::isInlineConstant().
unsigned llvm::APInt::getActiveBits | ( | ) | const [inline] |
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.
Definition at line 1263 of file APInt.h.
References getNumWords().
Referenced by areUsedBitsDense(), getLimitedValue(), getMinSignedBits(), getSExtValue(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::ScalarEvolution::getSmallConstantTripMultiple(), getZExtValue(), isDereferenceablePointer(), llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing(), isIndexInRangeOfSequentialType(), isIntN(), isRunOfOnes(), operator*=(), roundToDouble(), sqrt(), udiv(), udivrem(), llvm::ConstantInt::uge(), ult(), urem(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
unsigned llvm::APInt::getActiveWords | ( | ) | const [inline] |
static APInt llvm::APInt::getAllOnesValue | ( | unsigned | numBits | ) | [inline, static] |
Get the all-ones value.
Definition at line 444 of file APInt.h.
References APInt(), and UINT64_MAX.
Referenced by computeKnownBits(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), DemandedBitsLHSMask(), llvm::APFloat::getAllOnesValue(), getHighBitsSet(), llvm::SelectionDAG::getLogicalNOT(), llvm::IntegerType::getMask(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNOT(), isConditionalZeroOrAllOnes(), magicu(), llvm::PPCTargetLowering::PerformDAGCombine(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifyICmpInst(), llvm::TargetLowering::SimplifySetCC(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitInsertElementInst(), llvm::InstCombiner::visitSelectInst(), and llvm::InstCombiner::visitShuffleVectorInst().
unsigned APInt::getBitsNeeded | ( | StringRef | str, |
uint8_t | radix | ||
) | [static] |
Get bits required for string value.
This method determines how many bits are required to hold the APInt equivalent of the string given by str
.
Definition at line 611 of file APInt.cpp.
References llvm::StringRef::begin(), llvm::StringRef::empty(), isNegative(), llvm::LibFunc::log, logBase2(), and llvm::StringRef::size().
static APInt llvm::APInt::getBitsSet | ( | unsigned | numBits, |
unsigned | loBit, | ||
unsigned | hiBit | ||
) | [inline, static] |
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. If hiBit is less than loBit then the set bits "wrap". For example, with parameters (32, 28, 4), you would get 0xF000000F.
numBits | the intended bit width of the result |
loBit | the index of the lowest bit set. |
hiBit | the index of the highest bit set. |
Definition at line 489 of file APInt.h.
References getHighBitsSet(), getLowBitsSet(), and shl().
Referenced by llvm::SelectionDAG::computeKnownBits(), isBitfieldInsertOpFromOr(), llvm::BuildVectorSDNode::isConstantSplat(), llvm::SITargetLowering::PerformDAGCombine(), llvm::AMDGPUTargetLowering::PerformDAGCombine(), llvm::TargetLowering::SimplifyDemandedBits(), and llvm::InstCombiner::visitCallInst().
unsigned llvm::APInt::getBitWidth | ( | ) | const [inline] |
Return the number of bits in the APInt.
Definition at line 1239 of file APInt.h.
References getNumWords(), pVal, and UINT64_MAX.
Referenced by llvm::GEPOperator::accumulateConstantOffset(), llvm::DwarfUnit::addConstantFPValue(), llvm::DwarfUnit::addConstantValue(), And(), APIntToHexString(), llvm::TargetLowering::BuildUDIV(), checkRippleForAdd(), llvm::InstCombiner::commonIDivTransforms(), computeKnownBits(), computeKnownBitsAddSub(), llvm::SparcTargetLowering::computeKnownBitsForTargetNode(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), llvm::AArch64TargetLowering::computeKnownBitsForTargetNode(), llvm::ARMTargetLowering::computeKnownBitsForTargetNode(), llvm::PPCTargetLowering::computeKnownBitsForTargetNode(), llvm::TargetLowering::computeKnownBitsForTargetNode(), computeKnownBitsFromAssume(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsMul(), llvm::ComputeMultiple(), ComputeNumSignBits(), llvm::SelectionDAG::ComputeNumSignBits(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), ComputeRange(), ComputeSignedMinMaxValuesFromKnownBits(), ComputeUnsignedMinMaxValuesFromKnownBits(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantRange::ConstantRange(), llvm::APFloat::convertToInteger(), llvm::MDBuilder::createRange(), emitGlobalConstantFP(), llvm::InstCombiner::FoldICmpShrCst(), gcd(), llvm::ConstantInt::get(), getAdjustedPtr(), llvm::StringRef::getAsInteger(), llvm::ConstantRange::getBitWidth(), llvm::ConstantInt::getBitWidth(), llvm::ExecutionEngine::getConstantValue(), GetLinearExpression(), llvm::FunctionLoweringInfo::GetLiveOutRegInfo(), getNaturalGEPRecursively(), getNaturalGEPWithOffset(), llvm::SelectionDAG::getNode(), getShiftAmount(), getStrideFromPointer(), getUsefulBits(), getUsefulBitsFromAndWithImmediate(), getUsefulBitsFromBFM(), getUsefulBitsFromBitfieldMoveOpd(), IncorporateWeight(), isBitfieldInsertOpFromOr(), llvm::isBytewiseValue(), isLikelyComplexAddressComputation(), llvm::APIntOps::isMask(), IsMultiple(), llvm::APSInt::isSameValue(), isStridedPtr(), LoadIntFromMemory(), magic(), magicu(), llvm::ICmpInst::makeConstantRange(), MaskedValueIsZero(), performORCombine(), PerformORCombine(), ProcessUMulZExtIdiom(), llvm::Interpreter::run(), sdiv(), sge(), sgt(), ShrinkDemandedConstant(), llvm::TargetLowering::SimplifyDemandedBits(), llvm::TargetLowering::SimplifySetCC(), sle(), SolveLinEquationWithOverflow(), srem(), sshl_ov(), StoreIntToMemory(), llvm::Value::stripAndAccumulateInBoundsConstantOffsets(), llvm::ConstantRange::subtract(), llvm::APFloat::toString(), toString(), udivrem(), uge(), ugt(), ule(), llvm::InstCombiner::visitAnd(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::WriteConstantInternal().
bool llvm::APInt::getBoolValue | ( | ) | const [inline] |
Convert APInt to a boolean value.
This converts the APInt to a boolean value as a test against zero.
Definition at line 400 of file APInt.h.
Referenced by llvm::SelectionDAG::computeKnownBits(), exactLogBase2(), isKnownToBeAPowerOfTwo(), and llvm::PPCTargetLowering::SelectAddressRegReg().
APInt APInt::getHiBits | ( | unsigned | numBits | ) | const |
Compute an APInt containing numBits highbits from this APInt.
HiBits - This function returns the high "numBits" bits of 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.
Definition at line 672 of file APInt.cpp.
References lshr().
Referenced by llvm::TargetLowering::SimplifyDemandedBits().
static APInt llvm::APInt::getHighBitsSet | ( | unsigned | numBits, |
unsigned | hiBitsSet | ||
) | [inline, static] |
Get a value with high bits set.
Constructs an APInt value that has the top hiBitsSet bits set.
numBits | the bitwidth of the result |
hiBitsSet | the number of high-order bits set in the result. |
Definition at line 504 of file APInt.h.
References APInt(), getAllOnesValue(), and shl().
Referenced by CanEvaluateShifted(), CanEvaluateTruncated(), CanEvaluateZExtd(), computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsAddSub(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), llvm::AArch64TargetLowering::computeKnownBitsForTargetNode(), llvm::ARMTargetLowering::computeKnownBitsForTargetNode(), computeKnownBitsFromAssume(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsMul(), llvm::TargetLowering::expandMUL(), llvm::InstCombiner::FoldICmpShrCst(), FoldMaskAndShiftToScale(), llvm::InstCombiner::FoldShiftByConstant(), getBitsSet(), GetShiftedValue(), PerformShiftCombine(), llvm::ConstantRange::signExtend(), llvm::TargetLowering::SimplifyDemandedBits(), llvm::TargetLowering::SimplifySetCC(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitShl(), and llvm::InstCombiner::visitZExt().
uint64_t llvm::APInt::getLimitedValue | ( | uint64_t | Limit = ~0ULL | ) | const [inline] |
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.
Definition at line 404 of file APInt.h.
References getActiveBits(), and getZExtValue().
Referenced by APIntToHexString(), ashr(), llvm::InstCombiner::commonIDivTransforms(), llvm::ComputeMultiple(), llvm::ConstantInt::getLimitedValue(), GetLinearExpression(), lshr(), rotl(), rotr(), shl(), and SwitchToLookupTable().
APInt APInt::getLoBits | ( | unsigned | numBits | ) | const |
Compute an APInt containing numBits lowbits from this APInt.
LoBits - This function returns the low "numBits" bits of this APInt.
Get an APInt with the same BitWidth as this APInt, just zero mask the high bits.
Definition at line 677 of file APInt.cpp.
References lshr(), and llvm::APIntOps::shl().
Referenced by getTargetShuffleMask(), matchRotateSub(), and llvm::TargetLowering::SimplifyDemandedBits().
static APInt llvm::APInt::getLowBitsSet | ( | unsigned | numBits, |
unsigned | loBitsSet | ||
) | [inline, static] |
Get a value with low bits set.
Constructs an APInt value that has the bottom loBitsSet bits set.
numBits | the bitwidth of the result |
loBitsSet | the number of low-order bits set in the result. |
Definition at line 522 of file APInt.h.
References APInt(), and UINT64_MAX.
Referenced by CanEvaluateShifted(), computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsMul(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldInstOperands(), DemandedBitsLHSMask(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldShiftByConstant(), getBitsSet(), GetShiftedValue(), llvm::SelectionDAG::getZeroExtendInReg(), llvm::APIntOps::isMask(), MultiplyOverflows(), ProcessUGT_ADDCST_ADD(), llvm::ConstantRange::signExtend(), llvm::TargetLowering::SimplifyDemandedBits(), simplifyI24(), llvm::TargetLowering::SimplifySetCC(), llvm::InstCombiner::visitAnd(), llvm::InstCombiner::visitAShr(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitLShr(), and llvm::InstCombiner::visitZExt().
static APInt llvm::APInt::getMaxValue | ( | unsigned | numBits | ) | [inline, static] |
Gets maximum unsigned value of APInt for specific bit width.
Definition at line 412 of file APInt.h.
Referenced by llvm::ConstantRange::ConstantRange(), llvm::InstCombiner::FoldFCmp_IntToFP_Cst(), llvm::APSInt::getMaxValue(), llvm::ConstantRange::getUnsignedMax(), llvm::ScalarEvolution::getUnsignedRange(), llvm::ScalarEvolution::getZeroExtendExpr(), ProcessUMulZExtIdiom(), llvm::TargetLowering::SimplifySetCC(), and llvm::ConstantRange::truncate().
unsigned llvm::APInt::getMinSignedBits | ( | ) | const [inline] |
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.
Definition at line 1282 of file APInt.h.
References getActiveBits().
Referenced by canFoldIVIncExpr(), and isSignedIntN().
static APInt llvm::APInt::getMinValue | ( | unsigned | numBits | ) | [inline, static] |
Gets minimum unsigned value of APInt for a specific bit width.
Definition at line 424 of file APInt.h.
Referenced by llvm::ConstantRange::ConstantRange(), llvm::InstCombiner::FoldFCmp_IntToFP_Cst(), llvm::APSInt::getMinValue(), llvm::ConstantRange::getUnsignedMin(), llvm::ScalarEvolution::getUnsignedRange(), llvm::ScalarEvolution::getZeroExtendExpr(), llvm::ICmpInst::makeConstantRange(), llvm::ConstantRange::makeICmpRegion(), and llvm::TargetLowering::SimplifySetCC().
static APInt llvm::APInt::getNullValue | ( | unsigned | numBits | ) | [inline, static] |
Get the '0' value.
Definition at line 451 of file APInt.h.
References APInt().
Referenced by llvm::ConstantRange::binaryAnd(), llvm::ConstantRange::binaryOr(), llvm::ObjectSizeOffsetVisitor::compute(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), llvm::ConstantFoldCastInstruction(), llvm::SelectionDAG::getNode(), llvm::Constant::getNullValue(), llvm::ConstantRange::makeICmpRegion(), and stripAndComputeConstantOffsets().
unsigned llvm::APInt::getNumSignBits | ( | ) | const [inline] |
Computes the number of leading bits of this APInt that are equal to its sign bit.
Definition at line 1347 of file APInt.h.
Referenced by llvm::SelectionDAG::ComputeNumSignBits(), and llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo().
unsigned llvm::APInt::getNumWords | ( | ) | const [inline] |
Get the number of words.
Here one word's bitwidth equals to that of uint64_t.
Definition at line 1246 of file APInt.h.
Referenced by ashr(), byteSwap(), clearAllBits(), llvm::APFloat::convertFromAPInt(), llvm::APFloat::convertToInteger(), countLeadingOnes(), countTrailingZeros(), emitGlobalConstantFP(), getActiveBits(), getBitWidth(), llvm::hash_value(), lshr(), operator!(), operator&=(), operator*=(), operator+(), operator++(), operator+=(), operator-(), operator--(), operator-=(), operator=(), operator^=(), operator|=(), Profile(), sext(), toString(), trunc(), and zext().
static unsigned llvm::APInt::getNumWords | ( | unsigned | BitWidth | ) | [inline, static] |
static APInt llvm::APInt::getOneBitSet | ( | unsigned | numBits, |
unsigned | BitNo | ||
) | [inline, static] |
Return an APInt with exactly one bit set in the result.
Definition at line 470 of file APInt.h.
Referenced by BinomialCoefficient(), llvm::InstCombiner::commonIDivTransforms(), llvm::InstCombiner::FoldICmpShrCst(), IncorporateWeight(), ProcessUMulZExtIdiom(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::ConstantRange::zeroExtend().
const uint64_t* llvm::APInt::getRawData | ( | ) | const [inline] |
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.
Definition at line 564 of file APInt.h.
Referenced by llvm::DwarfUnit::addConstantFPValue(), llvm::DwarfUnit::addConstantValue(), llvm::APFloat::convertFromAPInt(), llvm::APFloat::convertFromZeroExtendedInteger(), emitGlobalConstantFP(), llvm::HexagonLowerToMC(), LoadIntFromMemory(), sext(), StoreIntToMemory(), llvm::ExecutionEngine::StoreValueToMemory(), toString(), trunc(), llvm::WriteConstantInternal(), WriteConstants(), and zext().
int64_t llvm::APInt::getSExtValue | ( | ) | const [inline] |
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.
Definition at line 1305 of file APInt.h.
References getActiveBits(), pVal, and VAL.
Referenced by llvm::DwarfUnit::addConstantValue(), llvm::InstCombiner::commonPointerCastTransforms(), DecomposeGEPExpression(), llvm::AArch64_AM::getFP32Imm(), llvm::ARM_AM::getFP32Imm(), llvm::AArch64_AM::getFP64Imm(), llvm::ARM_AM::getFP64Imm(), llvm::GetPointerBaseWithConstantOffset(), llvm::ConstantInt::getSExtValue(), getStrideFromPointer(), getVShiftImm(), llvm::SIInstrInfo::isInlineConstant(), isLikelyComplexAddressComputation(), isStridedPtr(), LLVMGenericValueToInt(), llvm::TargetLowering::LowerAsmOperandForConstraint(), lowerConstant(), llvm::AArch64TargetLowering::shouldConvertConstantLoadToIntImm(), llvm::TargetLowering::SimplifySetCC(), toString(), tryCombineShiftImm(), and llvm::InstCombiner::visitGetElementPtrInst().
static APInt llvm::APInt::getSignBit | ( | unsigned | BitWidth | ) | [inline, static] |
Get the SignBit for a specific bit width.
This is just a wrapper function of getSignedMinValue(), and it helps code readability when we want to get a SignBit.
Definition at line 437 of file APInt.h.
References getSignedMinValue().
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsAddSub(), computeKnownBitsFromAssume(), decomposeBitTestICmp(), DemandedBitsLHSMask(), llvm::TargetLowering::expandFP_TO_SINT(), llvm::SelectionDAG::SignBitIsZero(), llvm::TargetLowering::SimplifyDemandedBits(), llvm::InstCombiner::visitAShr(), llvm::InstCombiner::visitSDiv(), and llvm::InstCombiner::visitSRem().
static APInt llvm::APInt::getSignedMaxValue | ( | unsigned | numBits | ) | [inline, static] |
Gets maximum signed value of APInt for a specific bit width.
Definition at line 417 of file APInt.h.
Referenced by llvm::InstCombiner::FoldFCmp_IntToFP_Cst(), llvm::InstCombiner::FoldICmpAddOpCst(), llvm::APSInt::getMaxValue(), getOverflowLimitForStep(), llvm::ConstantRange::getSignedMax(), llvm::ScalarEvolution::getSignedRange(), isKnownNonZero(), llvm::ConstantRange::isSignWrappedSet(), magicu(), MultiplyOverflows(), SimplifyICmpInst(), and llvm::TargetLowering::SimplifySetCC().
static APInt llvm::APInt::getSignedMinValue | ( | unsigned | numBits | ) | [inline, static] |
Gets minimum signed value of APInt for a specific bit width.
Definition at line 427 of file APInt.h.
References APInt().
Referenced by BinomialCoefficient(), llvm::InstCombiner::FoldFCmp_IntToFP_Cst(), llvm::APSInt::getMinValue(), getOverflowLimitForStep(), getSignBit(), llvm::ConstantRange::getSignedMin(), llvm::ScalarEvolution::getSignedRange(), llvm::ConstantRange::isSignWrappedSet(), magic(), magicu(), llvm::ICmpInst::makeConstantRange(), llvm::ConstantRange::makeICmpRegion(), MultiplyOverflows(), SimplifyICmpInst(), and llvm::TargetLowering::SimplifySetCC().
static APInt llvm::APInt::getSplat | ( | unsigned | NewLen, |
const APInt & | V | ||
) | [inline, static] |
Return a value containing V broadcasted over NewLen bits.
Definition at line 536 of file APInt.h.
Referenced by getMemsetValue().
uint64_t llvm::APInt::getZExtValue | ( | ) | const [inline] |
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.
Definition at line 1293 of file APInt.h.
References countLeadingOnes(), getActiveBits(), and isNegative().
Referenced by llvm::DwarfUnit::addConstantValue(), ComputeNumSignBits(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldTerminator(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), llvm::Interpreter::exitCalled(), ExtractBranchMetadata(), foldImmediates(), FoldOperand(), FoldReinterpretLoadFromConstPtr(), GetBranchWeights(), llvm::ExecutionEngine::getConstantValue(), llvm::AArch64_AM::getFP32Imm(), llvm::ARM_AM::getFP32Imm(), llvm::AArch64_AM::getFP64Imm(), llvm::ARM_AM::getFP64Imm(), llvm::AsmToken::getIntVal(), getLimitedValue(), getNaturalGEPRecursively(), llvm::SelectionDAG::getNode(), getTargetShuffleMask(), llvm::ConstantInt::getZExtValue(), IncorporateWeight(), isEXTMask(), LLVMGenericValueToInt(), LowerShift(), PerformANDCombine(), performDSPShiftCombine(), PerformINTRINSIC_WO_CHAINCombine(), PerformORCombine(), llvm::NVPTXFloatMCExpr::PrintImpl(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::PPCTargetLowering::SelectAddressRegImm(), SymbolicallyEvaluateGEP(), llvm::APFloat::toString(), toString(), tryToFoldExtendOfConstant(), llvm::ConstantInt::uge(), llvm::Interpreter::visitAShr(), llvm::Interpreter::visitLShr(), llvm::Interpreter::visitShl(), and llvm::WriteConstantInternal().
bool llvm::APInt::intersects | ( | const APInt & | RHS | ) | const [inline] |
This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are both set.
Definition at line 1137 of file APInt.h.
References slt().
Referenced by llvm::SelectionDAGISel::CheckAndMask(), llvm::SelectionDAGISel::CheckOrMask(), llvm::TargetLowering::TargetLoweringOpt::ShrinkDemandedConstant(), and llvm::TargetLowering::SimplifyDemandedBits().
bool llvm::APInt::isAllOnesValue | ( | ) | const [inline] |
Determine if all bits are set.
This checks to see if the value has all bits of the APInt are set or not.
Definition at line 336 of file APInt.h.
References VAL.
Referenced by areUsedBitsDense(), llvm::ConstantRange::binaryAnd(), computeKnownBitsFromAssume(), llvm::ConstantFoldBinaryInstruction(), createAndInstr(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldOrWithConstants(), llvm::InstCombiner::FoldXorWithConstants(), getExactSDiv(), isMaxValue(), llvm::ConstantInt::isMinusOne(), llvm::PatternMatch::is_all_ones::isValue(), isVectorAllOnes(), performORCombine(), sdiv_ov(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifyICmpInst(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
bool llvm::APInt::isIntN | ( | unsigned | N | ) | const [inline] |
Check if this APInt has an N-bits unsigned integer value.
Definition at line 372 of file APInt.h.
References getActiveBits().
Referenced by AreMulWideOperandsDemotable(), llvm::ScalarEvolution::getUDivExactExpr(), intToken(), and llvm::APIntOps::isIntN().
bool llvm::APInt::isMaxSignedValue | ( | ) | const [inline] |
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.
Definition at line 352 of file APInt.h.
References countPopulation(), isNegative(), and VAL.
Referenced by llvm::ConstantInt::isMaxValue(), and llvm::ScalarEvolution::SimplifyICmpOperands().
bool llvm::APInt::isMaxValue | ( | ) | const [inline] |
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.
Definition at line 346 of file APInt.h.
References isAllOnesValue().
Referenced by llvm::ConstantRange::ConstantRange(), llvm::ConstantRange::isFullSet(), llvm::ConstantInt::isMaxValue(), and llvm::ScalarEvolution::SimplifyICmpOperands().
bool llvm::APInt::isMinSignedValue | ( | ) | const [inline] |
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.
Definition at line 367 of file APInt.h.
References isNegative(), isPowerOf2(), and VAL.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::ScalarEvolution::getSignedRange(), llvm::ConstantInt::isMinValue(), isSignBit(), sdiv_ov(), llvm::ConstantRange::signExtend(), and llvm::ScalarEvolution::SimplifyICmpOperands().
bool llvm::APInt::isMinValue | ( | ) | const [inline] |
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.
Definition at line 361 of file APInt.h.
Referenced by llvm::ConstantRange::binaryOr(), llvm::ConstantRange::ConstantRange(), llvm::ScalarEvolution::getUnsignedRange(), IncorporateWeight(), llvm::ConstantRange::isEmptySet(), llvm::ConstantInt::isMinValue(), LinearizeExprTree(), llvm::ScalarEvolution::SimplifyICmpOperands(), SolveQuadraticEquation(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
bool llvm::APInt::isNegative | ( | ) | const [inline] |
Determine sign of this APInt.
This tests the high bit of this APInt to determine if it is set.
Definition at line 318 of file APInt.h.
Referenced by ashr(), llvm::TargetLowering::BuildSDIV(), computeKnownBitsAddSub(), computeKnownBitsFromAssume(), computeKnownBitsMul(), ComputeNumSignBits(), llvm::SelectionDAG::ComputeNumSignBits(), computePointerICmp(), llvm::APFloat::convertFromAPInt(), llvm::InstCombiner::FoldICmpCstShrCst(), FoldReinterpretLoadFromConstPtr(), getBitsNeeded(), getZExtValue(), llvm::ScalarEvolution::isKnownNegative(), llvm::ScalarEvolution::isKnownNonNegative(), isMaxSignedValue(), isMinSignedValue(), llvm::ConstantInt::isNegative(), llvm::SCEV::isNonConstantNegative(), isNonNegative(), llvm::APSInt::isSameValue(), magic(), multiplicativeInverse(), sdiv(), sdivrem(), ShrinkDemandedConstant(), slt(), srem(), toString(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitMul().
bool llvm::APInt::isNonNegative | ( | ) | const [inline] |
Determine if this APInt Value is non-negative (>= 0)
This tests the high bit of the APInt to determine if it is unset.
Definition at line 323 of file APInt.h.
References isNegative().
Referenced by computeKnownBits(), isStrictlyPositive(), performMulCombine(), sadd_ov(), sshl_ov(), ssub_ov(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
bool llvm::APInt::isPowerOf2 | ( | ) | const [inline] |
Check if this APInt's value is a power of two greater than zero.
Definition at line 386 of file APInt.h.
References llvm::isPowerOf2_64(), and VAL.
Referenced by computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), decomposeBitTestICmp(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldOrOfICmps(), foldSelectICmpAnd(), GatherConstantCompares(), getLogBase2Vector(), llvm::ScalarEvolution::getSignExtendExpr(), getTypeOfMaskedICmp(), isMinSignedValue(), llvm::PatternMatch::is_power2::isValue(), performMulCombine(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), SimplifyICmpInst(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitMul().
bool llvm::APInt::isSignBit | ( | ) | const [inline] |
Check if the APInt's value is returned by getSignBit.
Definition at line 395 of file APInt.h.
References isMinSignedValue().
Referenced by isSignBitCheck(), llvm::PatternMatch::is_sign_bit::isValue(), SimplifyICmpInst(), llvm::InstCombiner::visitAdd(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
bool llvm::APInt::isSignedIntN | ( | unsigned | N | ) | const [inline] |
Check if this APInt has an N-bits signed integer value.
Definition at line 378 of file APInt.h.
References getMinSignedBits().
Referenced by AreMulWideOperandsDemotable(), and llvm::APIntOps::isSignedIntN().
bool llvm::APInt::isStrictlyPositive | ( | ) | const [inline] |
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.
Definition at line 331 of file APInt.h.
References isNonNegative().
Referenced by llvm::TargetLowering::BuildSDIV(), llvm::InstCombiner::FoldICmpDivCst(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::isKnownNonPositive(), and llvm::ScalarEvolution::isKnownPositive().
unsigned llvm::APInt::logBase2 | ( | ) | const [inline] |
Definition at line 1483 of file APInt.h.
Referenced by llvm::InstCombiner::FoldICmpCstShrCst(), foldSelectICmpAnd(), foldSelectICmpAndOr(), foldUDivPow2Cst(), foldUDivShl(), getBitsNeeded(), getLogBase2Vector(), isEXTMask(), llvm::APIntOps::logBase2(), performMulCombine(), ProcessUMulZExtIdiom(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitMul().
APInt APInt::lshr | ( | unsigned | shiftAmt | ) | const |
Logical right-shift function.
Logical right-shift this APInt by shiftAmt.
Definition at line 1128 of file APInt.cpp.
References APInt(), getNumWords(), and lshrNear().
Referenced by areUsedBitsDense(), BinomialCoefficient(), llvm::TargetLowering::BuildUDIV(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromAssume(), llvm::ConstantFoldBinaryInstruction(), ExtractConstantBytes(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldICmpShrCst(), llvm::InstCombiner::FoldShiftByConstant(), llvm::SelectionDAG::getConstant(), llvm::AArch64_AM::getFP32Imm(), llvm::ARM_AM::getFP32Imm(), llvm::AArch64_AM::getFP64Imm(), llvm::ARM_AM::getFP64Imm(), getHiBits(), getLoBits(), getTargetShuffleMask(), getUsefulBitsFromBitfieldMoveOpd(), getUsefulBitsFromOrWithShiftedReg(), llvm::isBytewiseValue(), llvm::BuildVectorSDNode::isConstantSplat(), lowerMSABinaryBitImmIntr(), llvm::ConstantRange::lshr(), lshr(), llvm::APIntOps::lshr(), magic(), magicu(), llvm::APSInt::operator>>(), rotl(), rotr(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifyICmpInst(), llvm::TargetLowering::SimplifySetCC(), SolveLinEquationWithOverflow(), llvm::APFloat::toString(), toString(), llvm::Interpreter::visitLShr(), and llvm::InstCombiner::visitXor().
APInt APInt::lshr | ( | const APInt & | shiftAmt | ) | const |
Logical right-shift function.
Logical right-shift this APInt by shiftAmt.
Definition at line 1122 of file APInt.cpp.
References getLimitedValue(), and lshr().
APInt::ms APInt::magic | ( | ) | const |
Calculate the magic numbers required to implement a signed integer division by a constant as a sequence of multiplies, adds and shifts. Requires that the divisor not be 0, 1, or -1. Taken from "Hacker's Delight", Henry S. Warren, Jr., chapter 10.
Definition at line 1396 of file APInt.cpp.
References abs(), getBitWidth(), getSignedMinValue(), isNegative(), lshr(), llvm::APInt::ms::m, llvm::APInt::ms::s, udiv(), uge(), ult(), and urem().
Referenced by llvm::TargetLowering::BuildSDIV().
APInt::mu APInt::magicu | ( | unsigned | LeadingZeros = 0 | ) | const |
Calculate the magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts. Requires that the divisor not be 0. Taken from "Hacker's Delight", Henry S. Warren, Jr., chapter 10. LeadingZeros can be used to simplify the calculation if the upper bits of the divided value are known zero.
Definition at line 1440 of file APInt.cpp.
References llvm::APInt::mu::a, allOnes(), getAllOnesValue(), getBitWidth(), getSignedMaxValue(), getSignedMinValue(), lshr(), llvm::APInt::mu::m, llvm::APInt::mu::s, udiv(), uge(), ult(), and urem().
Referenced by llvm::TargetLowering::BuildUDIV().
APInt APInt::multiplicativeInverse | ( | const APInt & | modulo | ) | const |
Computes the multiplicative inverse of this APInt for a given modulo. The iterative extended Euclidean algorithm is used to solve for this value, however we simplify it to speed up calculating only the inverse, and take advantage of div+rem calculations. We also use some tricks to avoid copying (potentially large) APInts around.
Definition at line 1353 of file APInt.cpp.
References APInt(), isNegative(), udivrem(), and ult().
Referenced by BinomialCoefficient(), and SolveLinEquationWithOverflow().
bool llvm::APInt::ne | ( | const APInt & | RHS | ) | const [inline] |
unsigned llvm::APInt::nearestLogBase2 | ( | ) | const [inline] |
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.
Definition at line 1499 of file APInt.h.
References countLeadingZeros().
bool llvm::APInt::needsCleanup | ( | ) | const [inline] |
bool llvm::APInt::operator! | ( | ) | const [inline] |
bool llvm::APInt::operator!= | ( | const APInt & | RHS | ) | const [inline] |
bool llvm::APInt::operator!= | ( | uint64_t | Val | ) | const [inline] |
Multiplication assignment operator.
Multiplies this APInt by RHS and assigns the result to *this.
Definition at line 356 of file APInt.cpp.
References clearAllBits(), getActiveBits(), getMemory(), getNumWords(), llvm::LibFunc::memcpy, mul(), pVal, and VAL.
Postfix increment operator.
Reimplemented in llvm::APSInt.
APInt & APInt::operator++ | ( | ) |
Prefix increment operator.
Prefix increment operator. Increments the APInt by one.
Reimplemented in llvm::APSInt.
Definition at line 197 of file APInt.cpp.
References add_1(), getNumWords(), pVal, and VAL.
APInt llvm::APInt::operator- | ( | ) | const [inline] |
Unary negation operator.
Negates *this using two's complement logic.
Reimplemented in llvm::APSInt.
Definition at line 616 of file APInt.h.
References APInt().
Postfix decrement operator.
Reimplemented in llvm::APSInt.
APInt & APInt::operator-- | ( | ) |
Prefix decrement operator.
Prefix decrement operator. Decrements the APInt by one.
Reimplemented in llvm::APSInt.
Definition at line 226 of file APInt.cpp.
References getNumWords(), pVal, sub_1(), and VAL.
Left logical shift operator.
Shifts this APInt left by Bits
and returns the result.
Reimplemented in llvm::APSInt.
Left-shift assignment function.
Shifts *this left by shiftAmt and assigns the result to *this.
Reimplemented in llvm::APSInt.
APInt & APInt::operator= | ( | uint64_t | RHS | ) |
Assignment operator.
The RHS value is assigned to *this. If the significant bits in RHS exceed the bit width, the excess bits are truncated. If the bit width is larger than 64, the value is zero filled in the unspecified high order bits.
Reimplemented in llvm::APSInt.
Definition at line 155 of file APInt.cpp.
References getNumWords(), llvm::LibFunc::memset, and pVal.
bool llvm::APInt::operator== | ( | uint64_t | Val | ) | const [inline] |
Bitwise XOR operator.
Performs a bitwise XOR operation on *this and RHS.
Definition at line 794 of file APInt.h.
References operator|().
Bitwise OR operator.
Performs a bitwise OR operation on *this and RHS.
Definition at line 772 of file APInt.h.
Referenced by operator^().
APInt& llvm::APInt::operator|= | ( | uint64_t | RHS | ) | [inline] |
APInt llvm::APInt::operator~ | ( | ) | const [inline] |
Unary bitwise complement operator.
Performs a bitwise complement operation on this APInt.
Reimplemented in llvm::APSInt.
Definition at line 605 of file APInt.h.
References flipAllBits().
APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::Or | ( | const APInt & | RHS | ) | const [inline] |
void APInt::print | ( | raw_ostream & | OS, |
bool | isSigned | ||
) | const |
Definition at line 2262 of file APInt.cpp.
References llvm::SmallString< InternalLen >::str(), and toString().
Referenced by emitDebugValueComment(), and llvm::operator<<().
void APInt::Profile | ( | FoldingSetNodeID & | id | ) | const |
Profile - This method 'profiles' an APInt for use with FoldingSet.
Used to insert APInt objects, or objects that contain APInt objects, into FoldingSets.
Reimplemented in llvm::APSInt.
Definition at line 166 of file APInt.cpp.
References llvm::FoldingSetNodeID::AddInteger(), getNumWords(), and pVal.
APInt APInt::rotl | ( | unsigned | rotateAmt | ) | const |
APInt APInt::rotl | ( | const APInt & | rotateAmt | ) | const |
Rotate left by rotateAmt.
Definition at line 1241 of file APInt.cpp.
References getLimitedValue(), and rotl().
APInt APInt::rotr | ( | unsigned | rotateAmt | ) | const |
APInt APInt::rotr | ( | const APInt & | rotateAmt | ) | const |
Rotate right by rotateAmt.
Definition at line 1252 of file APInt.cpp.
References getLimitedValue(), and rotr().
double APInt::roundToDouble | ( | bool | isSigned | ) | const |
Converts this APInt to a double value.
RoundToDouble - This function converts this APInt to a double. The layout for double is as following (IEEE Standard 754): -------------------------------------- | Sign Exponent Fraction Bias | |-------------------------------------- | | 1[63] 11[62-52] 52[51-00] 1023 | --------------------------------------
Definition at line 859 of file APInt.cpp.
References llvm::LibFunc::exp, getActiveBits(), I, pVal, sext(), and T.
Referenced by llvm::ExecutionEngine::getConstantValue(), and llvm::APIntOps::RoundAPIntToDouble().
double llvm::APInt::roundToDouble | ( | ) | const [inline] |
APInt APInt::sadd_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 1997 of file APInt.cpp.
References isNonNegative().
Referenced by ConstantFoldScalarCall(), and MaintainNoSignedWrap().
APInt APInt::sdiv | ( | const APInt & | RHS | ) | const |
Signed division function for APInt.
Signed divide this APInt by APInt RHS.
Definition at line 1880 of file APInt.cpp.
References isNegative(), and udiv().
Referenced by llvm::ConstantFoldBinaryInstruction(), findGCD(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::ExecutionEngine::getConstantValue(), getExactSDiv(), getNaturalGEPRecursively(), getNaturalGEPWithOffset(), llvm::APSInt::operator/(), llvm::APSInt::operator/=(), llvm::APIntOps::sdiv(), sdiv_ov(), SimplifyICmpInst(), smul_ov(), SolveQuadraticEquation(), and llvm::Interpreter::visitBinaryOperator().
APInt APInt::sdiv_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 2023 of file APInt.cpp.
References isAllOnesValue(), isMinSignedValue(), and sdiv().
void APInt::sdivrem | ( | const APInt & | LHS, |
const APInt & | RHS, | ||
APInt & | Quotient, | ||
APInt & | Remainder | ||
) | [static] |
Definition at line 1979 of file APInt.cpp.
References isNegative(), and udivrem().
Referenced by ceilingOfQuotient(), findGCD(), floorOfQuotient(), and IsMultiple().
void llvm::APInt::setAllBits | ( | ) | [inline] |
Set every bit to 1.
Definition at line 1189 of file APInt.h.
Referenced by computeKnownBits(), and computeKnownBitsFromAssume().
void APInt::setBit | ( | unsigned | bitPosition | ) |
Set a given bit to 1.
Set the given bit to 1 whose position is given as "bitPosition".
Definition at line 584 of file APInt.cpp.
References pVal.
Referenced by computeKnownBits(), computeKnownBitsAddSub(), computeKnownBitsMul(), llvm::ComputeMultiple(), ComputeSignedMinMaxValuesFromKnownBits(), flipBit(), llvm::ConstantRange::getSetSize(), SolveLinEquationWithOverflow(), llvm::ConstantRange::truncate(), and llvm::InstCombiner::visitExtractElementInst().
APInt APInt::sext | ( | unsigned | width | ) | const |
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 or equal to the current width.
Definition at line 943 of file APInt.cpp.
References APInt(), getMemory(), getNumWords(), getRawData(), and pVal.
Referenced by ComputeRange(), llvm::APSInt::extend(), llvm::ExecutionEngine::getConstantValue(), MultiplyOverflows(), roundToDouble(), sdiv(), sextOrSelf(), sextOrTrunc(), llvm::ConstantRange::signExtend(), and srem().
APInt APInt::sextOrSelf | ( | unsigned | width | ) | const |
APInt APInt::sextOrTrunc | ( | unsigned | width | ) | const |
Sign extend or truncate to width.
Make this APInt have the bit width given by width
. The value is sign extended, truncated, or left alone to make it that width.
Definition at line 1011 of file APInt.cpp.
References sext(), and trunc().
Referenced by llvm::GEPOperator::accumulateConstantOffset(), llvm::APSInt::extOrTrunc(), and llvm::SelectionDAG::getNode().
bool llvm::APInt::sge | ( | const APInt & | RHS | ) | const [inline] |
Signed greather or equal comparison.
Regards both *this and RHS as signed quantities and compares them for validity of the greater-or-equal relationship.
Definition at line 1125 of file APInt.h.
References APInt(), getBitWidth(), and uge().
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::APSInt::operator>=(), and TryMULWIDECombine().
bool llvm::APInt::sge | ( | uint64_t | RHS | ) | const [inline] |
bool llvm::APInt::sgt | ( | const APInt & | RHS | ) | const [inline] |
Signed greather than comparison.
Regards both *this and RHS as signed quantities and compares them for the validity of the greater-than relationship.
Definition at line 1093 of file APInt.h.
References APInt(), getBitWidth(), and ugt().
Referenced by ceilingOfQuotient(), llvm::ConstantFoldCompareInstruction(), floorOfQuotient(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldOrOfICmps(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), HasAddOverflow(), HasSubOverflow(), maxAPInt(), MultiplyOverflows(), llvm::APSInt::operator>(), SimplifyICmpInst(), llvm::APIntOps::smax(), SwitchToLookupTable(), uge(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
bool llvm::APInt::sgt | ( | uint64_t | RHS | ) | const [inline] |
APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::shl | ( | unsigned | shiftAmt | ) | const [inline] |
Left-shift function.
Left-shift this APInt by shiftAmt.
Definition at line 851 of file APInt.h.
Referenced by llvm::ConstantFoldBinaryInstruction(), getBitsSet(), getHighBitsSet(), getUsefulBitsFromBFM(), getUsefulBitsFromBitfieldMoveOpd(), getUsefulBitsFromOrWithShiftedReg(), LowerShift(), PerformSHLCombine(), rotl(), rotr(), llvm::APIntOps::RoundDoubleToAPInt(), llvm::ConstantRange::shl(), shl(), llvm::APIntOps::shl(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifyICmpInst(), sqrt(), and llvm::Interpreter::visitShl().
APInt APInt::shl | ( | const APInt & | shiftAmt | ) | const |
Left-shift function.
Left-shift this APInt by shiftAmt.
Definition at line 1186 of file APInt.cpp.
References getLimitedValue(), and shl().
double llvm::APInt::signedRoundToDouble | ( | ) | const [inline] |
Converts this signed APInt to a double value.
Definition at line 1424 of file APInt.h.
Referenced by llvm::ExecutionEngine::getConstantValue(), llvm::APIntOps::RoundSignedAPIntToDouble(), and llvm::APIntOps::RoundSignedAPIntToFloat().
bool llvm::APInt::sle | ( | const APInt & | RHS | ) | const [inline] |
Signed less or equal comparison.
Regards both *this and RHS as signed quantities and compares them for validity of the less-or-equal relationship.
Definition at line 1061 of file APInt.h.
References APInt(), getBitWidth(), and ule().
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), llvm::APSInt::operator<=(), ugt(), and llvm::InstCombiner::visitICmpInst().
bool llvm::APInt::sle | ( | uint64_t | RHS | ) | const [inline] |
bool APInt::slt | ( | const APInt & | RHS | ) | const |
Signed less than comparison.
Regards both *this and RHS as signed quantities and compares them for validity of the less-than relationship.
Definition at line 548 of file APInt.cpp.
References flipAllBits(), isNegative(), ugt(), ult(), and VAL.
Referenced by ceilingOfQuotient(), llvm::ConstantFoldCompareInstruction(), findGCD(), floorOfQuotient(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), llvm::MDNode::getMostGenericRange(), HasAddOverflow(), HasSubOverflow(), intersects(), minAPInt(), MultiplyOverflows(), llvm::APSInt::operator<(), sgt(), sle(), llvm::APIntOps::smin(), SwitchToLookupTable(), TryMULWIDECombine(), ule(), and llvm::InstCombiner::visitICmpInst().
bool llvm::APInt::slt | ( | uint64_t | RHS | ) | const [inline] |
APInt APInt::smul_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 2029 of file APInt.cpp.
References sdiv().
Referenced by ConstantFoldScalarCall().
APInt APInt::sqrt | ( | ) | const |
Compute the square root.
Definition at line 1270 of file APInt.cpp.
References APInt(), getActiveBits(), llvm::LibFunc::round, shl(), udiv(), ule(), and ult().
APInt APInt::srem | ( | const APInt & | RHS | ) | const |
Function for signed remainder operation.
Signed remainder operation on APInt.
Definition at line 1928 of file APInt.cpp.
References isNegative(), and urem().
Referenced by llvm::ConstantFoldBinaryInstruction(), findGCD(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::ExecutionEngine::getConstantValue(), getExactSDiv(), isRemainderZero(), llvm::APSInt::operator%(), llvm::APSInt::operator%=(), llvm::APIntOps::srem(), and llvm::Interpreter::visitBinaryOperator().
APInt APInt::sshl_ov | ( | unsigned | Amt, |
bool & | Overflow | ||
) | const |
Definition at line 2049 of file APInt.cpp.
References countLeadingOnes(), countLeadingZeros(), getBitWidth(), and isNonNegative().
APInt APInt::ssub_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 2010 of file APInt.cpp.
References isNonNegative().
Referenced by ConstantFoldScalarCall(), and MaintainNoSignedWrap().
integerPart APInt::tcAdd | ( | integerPart * | , |
const integerPart * | , | ||
integerPart | carry, | ||
unsigned | |||
) | [static] |
void APInt::tcAnd | ( | integerPart * | dst, |
const integerPart * | rhs, | ||
unsigned int | parts | ||
) | [static] |
void APInt::tcAssign | ( | integerPart * | dst, |
const integerPart * | src, | ||
unsigned int | parts | ||
) | [static] |
Assign one bignum to another.
Definition at line 2336 of file APInt.cpp.
Referenced by llvm::APFloat::convert(), llvm::APFloat::convertFromSignExtendedInteger(), powerOf5(), tcDivide(), and tcExtract().
void APInt::tcClearBit | ( | integerPart * | parts, |
unsigned int | bit | ||
) | [static] |
Clear the given bit of a bignum. Zero-based.
Definition at line 2374 of file APInt.cpp.
References llvm::integerPartWidth.
int APInt::tcCompare | ( | const integerPart * | lhs, |
const integerPart * | rhs, | ||
unsigned int | parts | ||
) | [static] |
Comparison (unsigned) of two bignums.
Definition at line 2828 of file APInt.cpp.
Referenced by tcDivide().
void APInt::tcComplement | ( | integerPart * | dst, |
unsigned int | parts | ||
) | [static] |
Definition at line 2818 of file APInt.cpp.
Referenced by tcNegate().
integerPart APInt::tcDecrement | ( | integerPart * | dst, |
unsigned int | parts | ||
) | [static] |
Decrement a bignum in-place. Return the borrow flag.
Definition at line 2860 of file APInt.cpp.
Referenced by llvm::APFloat::next().
int APInt::tcDivide | ( | integerPart * | lhs, |
const integerPart * | rhs, | ||
integerPart * | remainder, | ||
integerPart * | scratch, | ||
unsigned int | parts | ||
) | [static] |
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.
Definition at line 2675 of file APInt.cpp.
References llvm::ScaledNumbers::compare(), llvm::integerPartWidth, tcAssign(), tcCompare(), tcMSB(), tcSet(), tcShiftLeft(), tcShiftRight(), and tcSubtract().
void APInt::tcExtract | ( | integerPart * | dst, |
unsigned int | dstCount, | ||
const integerPart * | src, | ||
unsigned int | srcBits, | ||
unsigned int | srcLSB | ||
) | [static] |
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.
Definition at line 2423 of file APInt.cpp.
References llvm::integerPartWidth, tcAssign(), and tcShiftRight().
int APInt::tcExtractBit | ( | const integerPart * | parts, |
unsigned int | bit | ||
) | [static] |
Extract the given bit of a bignum; returns 0 or 1. Zero-based.
Definition at line 2359 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by llvm::APFloat::convertFromSignExtendedInteger(), llvm::APFloat::convertFromZeroExtendedInteger(), llvm::APFloat::isDenormal(), llvm::APFloat::isSignaling(), and lostFractionThroughTruncation().
unsigned int APInt::tcFullMultiply | ( | integerPart * | , |
const integerPart * | , | ||
const integerPart * | , | ||
unsigned | , | ||
unsigned | |||
) | [static] |
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. Returns the number of parts required to hold the result.
Definition at line 2641 of file APInt.cpp.
References tcMultiplyPart(), and tcSet().
Referenced by powerOf5().
integerPart APInt::tcIncrement | ( | integerPart * | dst, |
unsigned int | parts | ||
) | [static] |
Increment a bignum in-place. Return the carry flag.
Definition at line 2847 of file APInt.cpp.
Referenced by tcNegate().
bool APInt::tcIsZero | ( | const integerPart * | src, |
unsigned int | parts | ||
) | [static] |
unsigned int APInt::tcLSB | ( | const integerPart * | parts, |
unsigned int | n | ||
) | [static] |
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.
Definition at line 2383 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by lostFractionThroughTruncation().
unsigned int APInt::tcMSB | ( | const integerPart * | parts, |
unsigned int | n | ||
) | [static] |
Definition at line 2401 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by tcDivide().
int APInt::tcMultiply | ( | integerPart * | , |
const integerPart * | , | ||
const integerPart * | , | ||
unsigned | |||
) | [static] |
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.
Definition at line 2618 of file APInt.cpp.
References tcMultiplyPart(), and tcSet().
int APInt::tcMultiplyPart | ( | integerPart * | dst, |
const integerPart * | src, | ||
integerPart | multiplier, | ||
integerPart | carry, | ||
unsigned int | srcParts, | ||
unsigned int | dstParts, | ||
bool | add | ||
) | [static] |
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.
Definition at line 2525 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by tcFullMultiply(), and tcMultiply().
void APInt::tcNegate | ( | integerPart * | dst, |
unsigned int | parts | ||
) | [static] |
Negate a bignum in-place.
Definition at line 2507 of file APInt.cpp.
References tcComplement(), and tcIncrement().
Referenced by llvm::APFloat::convertFromSignExtendedInteger().
void APInt::tcOr | ( | integerPart * | dst, |
const integerPart * | rhs, | ||
unsigned int | parts | ||
) | [static] |
void APInt::tcSet | ( | integerPart * | dst, |
integerPart | part, | ||
unsigned int | parts | ||
) | [static] |
Sets the least significant part of a bignum to the input value, and zeroes out higher parts.
Definition at line 2323 of file APInt.cpp.
Referenced by llvm::APFloat::convert(), llvm::APFloat::next(), tcDivide(), tcFullMultiply(), and tcMultiply().
void APInt::tcSetBit | ( | integerPart * | parts, |
unsigned int | bit | ||
) | [static] |
Set the given bit of a bignum. Zero-based.
Definition at line 2367 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by llvm::APFloat::convert(), and llvm::APFloat::next().
void APInt::tcSetLeastSignificantBits | ( | integerPart * | dst, |
unsigned int | parts, | ||
unsigned int | bits | ||
) | [static] |
Set the least significant BITS and clear the rest.
Definition at line 2875 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by llvm::APFloat::convertToInteger().
void APInt::tcShiftLeft | ( | integerPart * | dst, |
unsigned int | parts, | ||
unsigned int | count | ||
) | [static] |
Shift a bignum left COUNT bits. Shifted in bits are zero. There are no restrictions on COUNT.
Definition at line 2722 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by llvm::APFloat::convert(), llvm::APFloat::convertToInteger(), and tcDivide().
void APInt::tcShiftRight | ( | integerPart * | dst, |
unsigned int | parts, | ||
unsigned int | count | ||
) | [static] |
Shift a bignum right COUNT bits. Shifted in bits are zero. There are no restrictions on COUNT.
Definition at line 2756 of file APInt.cpp.
References llvm::integerPartWidth.
Referenced by shiftRight(), tcDivide(), and tcExtract().
integerPart APInt::tcSubtract | ( | integerPart * | , |
const integerPart * | , | ||
integerPart | carry, | ||
unsigned | |||
) | [static] |
DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag.
Definition at line 2482 of file APInt.cpp.
Referenced by tcDivide().
void APInt::tcXor | ( | integerPart * | dst, |
const integerPart * | rhs, | ||
unsigned int | parts | ||
) | [static] |
void APInt::toString | ( | SmallVectorImpl< char > & | Str, |
unsigned | Radix, | ||
bool | Signed, | ||
bool | formatAsCLiteral = false |
||
) | const |
Converts an APInt to a string and append it to Str. Str is commonly a SmallString.
Definition at line 2125 of file APInt.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), flipAllBits(), getBitWidth(), getNumWords(), getRawData(), getSExtValue(), getZExtValue(), I, isNegative(), llvm_unreachable, lshr(), N, llvm::cl::Prefix, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by print(), and toString().
std::string APInt::toString | ( | unsigned | Radix = 10 , |
bool | Signed = true |
||
) | const |
Return the APInt as a std::string.
Note that this is an inefficient method. It is better to pass in a SmallVector/SmallString to the methods above to avoid thrashing the heap for the string.
toString - This returns the APInt as a std::string. Note that this is an inefficient method. It is better to pass in a SmallVector/SmallString to the methods above.
Definition at line 2247 of file APInt.cpp.
References Signed, llvm::SmallString< InternalLen >::str(), and toString().
void llvm::APInt::toStringSigned | ( | SmallVectorImpl< char > & | Str, |
unsigned | Radix = 10 |
||
) | const [inline] |
void llvm::APInt::toStringUnsigned | ( | SmallVectorImpl< char > & | Str, |
unsigned | Radix = 10 |
||
) | const [inline] |
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.
Definition at line 1397 of file APInt.h.
References llvm::CountPopulation_64(), and VAL.
Referenced by dump(), and llvm::Interpreter::run().
APInt APInt::trunc | ( | unsigned | width | ) | const |
Truncate to new width.
Truncate the APInt to a specified width. It is an error to specify a width that is greater than or equal to the current width.
Definition at line 920 of file APInt.cpp.
References APInt(), getMemory(), getNumWords(), getRawData(), and pVal.
Referenced by areUsedBitsDense(), BinomialCoefficient(), computeKnownBits(), ExtractConstantBytes(), llvm::SelectionDAG::getConstant(), llvm::ExecutionEngine::getConstantValue(), GetLinearExpression(), llvm::SelectionDAG::getNode(), llvm::isBytewiseValue(), llvm::BuildVectorSDNode::isConstantSplat(), lowerMSABinaryBitImmIntr(), performShiftToAllZeros(), ProcessUMulZExtIdiom(), sextOrTrunc(), llvm::TargetLowering::SimplifyDemandedBits(), SolveLinEquationWithOverflow(), llvm::APSInt::trunc(), llvm::ConstantRange::truncate(), and zextOrTrunc().
APInt APInt::uadd_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 2004 of file APInt.cpp.
References ult().
Referenced by ConstantFoldScalarCall().
APInt APInt::udiv | ( | const APInt & | RHS | ) | const |
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.
Definition at line 1843 of file APInt.cpp.
References APInt(), getActiveBits(), pVal, ult(), and VAL.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::ExecutionEngine::getConstantValue(), magic(), magicu(), llvm::APSInt::operator/(), llvm::APSInt::operator/=(), sdiv(), SimplifyICmpInst(), sqrt(), SymbolicallyEvaluateGEP(), llvm::ConstantRange::udiv(), llvm::APIntOps::udiv(), umul_ov(), and llvm::Interpreter::visitBinaryOperator().
void APInt::udivrem | ( | const APInt & | LHS, |
const APInt & | RHS, | ||
APInt & | Quotient, | ||
APInt & | Remainder | ||
) | [static] |
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.
Definition at line 1939 of file APInt.cpp.
References APInt(), getActiveBits(), getBitWidth(), pVal, ult(), and VAL.
Referenced by IsMultiple(), multiplicativeInverse(), sdivrem(), llvm::APFloat::toString(), and llvm::ConstantRange::truncate().
bool llvm::APInt::uge | ( | const APInt & | RHS | ) | const [inline] |
Unsigned greater or equal comparison.
Regards both *this and RHS as unsigned quantities and compares them for validity of the greater-or-equal relationship.
Definition at line 1109 of file APInt.h.
References APInt(), getBitWidth(), and sgt().
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), getNaturalGEPRecursively(), magic(), magicu(), llvm::APSInt::operator>=(), performShiftToAllZeros(), sge(), SymbolicallyEvaluateGEP(), llvm::ConstantRange::truncate(), llvm::ConstantRange::unionWith(), and llvm::InstCombiner::visitICmpInst().
bool llvm::APInt::uge | ( | uint64_t | RHS | ) | const [inline] |
bool llvm::APInt::ugt | ( | const APInt & | RHS | ) | const [inline] |
Unsigned greather than comparison.
Regards both *this and RHS as unsigned quantities and compares them for the validity of the greater-than relationship.
Definition at line 1077 of file APInt.h.
References APInt(), getBitWidth(), and sle().
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::InstCombiner::FoldAndOfICmps(), llvm::InstCombiner::FoldICmpCstShrCst(), llvm::InstCombiner::FoldOrOfICmps(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), GatherConstantCompares(), llvm::ScalarEvolution::getSignExtendExpr(), HasSubOverflow(), llvm::ConstantRange::isWrappedSet(), MultiplyOverflows(), llvm::APSInt::operator>(), sgt(), llvm::ConstantRange::shl(), slt(), llvm::APIntOps::umax(), llvm::ConstantRange::unionWith(), usub_ov(), and llvm::ObjectSizeOffsetVisitor::visitCallSite().
bool llvm::APInt::ugt | ( | uint64_t | RHS | ) | const [inline] |
bool llvm::APInt::ule | ( | const APInt & | RHS | ) | const [inline] |
Unsigned less or equal comparison.
Regards both *this and RHS as unsigned quantities and compares them for validity of the less-or-equal relationship.
Definition at line 1045 of file APInt.h.
References APInt(), getBitWidth(), and slt().
Referenced by llvm::ConstantFoldCompareInstruction(), llvm::ConstantRange::contains(), llvm::InstCombiner::FoldOrOfICmps(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), llvm::ConstantRange::intersectWith(), llvm::APSInt::operator<=(), sle(), sqrt(), llvm::ConstantRange::truncate(), llvm::ConstantRange::unionWith(), and llvm::InstCombiner::visitICmpInst().
bool llvm::APInt::ule | ( | uint64_t | RHS | ) | const [inline] |
bool APInt::ult | ( | const APInt & | RHS | ) | const |
Unsigned less than comparison.
Regards both *this and RHS as unsigned quantities and compares them for the validity of the less-than relationship.
Definition at line 516 of file APInt.cpp.
References getActiveBits(), pVal, and VAL.
Referenced by llvm::ConstantRange::add(), CanEvaluateShifted(), computePointerICmp(), llvm::ConstantFoldCompareInstruction(), ConstantIntSortPredicate(), llvm::ConstantRange::contains(), llvm::InstCombiner::FoldOrOfICmps(), llvm::SelectionDAG::FoldSetCC(), llvm::InstCombiner::FoldSPFofSPF(), llvm::getObjectSize(), HasAddOverflow(), IncorporateWeight(), llvm::ConstantRange::intersectWith(), magic(), magicu(), multiplicativeInverse(), llvm::APSInt::operator<(), SimplifyICmpInst(), slt(), sqrt(), llvm::ConstantRange::sub(), llvm::ConstantRange::truncate(), uadd_ov(), udiv(), udivrem(), uge(), ugt(), ule(), llvm::APIntOps::umin(), llvm::ConstantRange::unionWith(), urem(), and llvm::InstCombiner::visitICmpInst().
bool llvm::APInt::ult | ( | uint64_t | RHS | ) | const [inline] |
APInt APInt::umul_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 2039 of file APInt.cpp.
References udiv().
Referenced by ConstantFoldScalarCall(), and llvm::InstCombiner::visitCallInst().
APInt APInt::urem | ( | const APInt & | RHS | ) | const |
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.
Definition at line 1891 of file APInt.cpp.
References APInt(), getActiveBits(), pVal, ult(), and VAL.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::ExecutionEngine::getConstantValue(), llvm::ScalarEvolution::getUDivExpr(), magic(), magicu(), llvm::APSInt::operator%(), llvm::APSInt::operator%=(), srem(), llvm::APIntOps::urem(), and llvm::Interpreter::visitBinaryOperator().
APInt APInt::usub_ov | ( | const APInt & | RHS, |
bool & | Overflow | ||
) | const |
Definition at line 2017 of file APInt.cpp.
References ugt().
Referenced by ConstantFoldScalarCall().
APInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APInt::Xor | ( | const APInt & | RHS | ) | const [inline] |
APInt APInt::zext | ( | unsigned | width | ) | const |
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 or equal to the current width.
Definition at line 984 of file APInt.cpp.
References APInt(), getMemory(), getNumWords(), getRawData(), llvm::LibFunc::memset, and pVal.
Referenced by BinomialCoefficient(), computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), llvm::APSInt::extend(), llvm::InstCombiner::FoldAndOfICmps(), gcd(), llvm::StringRef::getAsInteger(), llvm::SelectionDAG::getConstant(), llvm::ExecutionEngine::getConstantValue(), GetLinearExpression(), llvm::ConstantRange::getSetSize(), insertInteger(), llvm::ConstantRange::multiply(), MultiplyOverflows(), llvm::PPCTargetLowering::PerformDAGCombine(), ProcessUMulZExtIdiom(), llvm::ConstantRange::signExtend(), llvm::TargetLowering::SimplifyDemandedBits(), SolveLinEquationWithOverflow(), llvm::APFloat::toString(), llvm::ConstantRange::truncate(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), WidenMaskArithmetic(), llvm::ConstantRange::zeroExtend(), zextOrSelf(), and zextOrTrunc().
APInt APInt::zextOrSelf | ( | unsigned | width | ) | const |
Zero extend or truncate to width.
Make this APInt have the bit width given by width
. The value is zero extended, or left alone to make it that width.
Definition at line 1019 of file APInt.cpp.
References zext().
Referenced by llvm::ObjectSizeOffsetVisitor::visitCallSite().
APInt APInt::zextOrTrunc | ( | unsigned | width | ) | const |
Zero extend or truncate to width.
Make this APInt have the bit width given by width
. The value is zero extended, truncated, or left alone to make it that width.
Definition at line 1003 of file APInt.cpp.
References trunc(), and zext().
Referenced by computeKnownBits(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), llvm::Interpreter::exitCalled(), llvm::APSInt::extOrTrunc(), llvm::ExecutionEngine::getConstantValue(), llvm::FunctionLoweringInfo::GetLiveOutRegInfo(), llvm::SelectionDAG::getNode(), isBitfieldDstMask(), llvm::BuildVectorSDNode::isConstantSplat(), resolveBuildVector(), ShrinkDemandedConstant(), SymbolicallyEvaluateBinop(), and SymbolicallyEvaluateGEP().
hash_code hash_value | ( | const APInt & | Arg | ) | [friend] |
uint64_t* llvm::APInt::pVal |
Used to store the >64 bits integer value.
Definition at line 82 of file APInt.h.
Referenced by bitsToFloat(), byteSwap(), clearAllBits(), clearBit(), countLeadingOnes(), countTrailingZeros(), getBitWidth(), getRawData(), getSExtValue(), llvm::hash_value(), operator!(), operator&=(), operator*=(), operator+(), operator++(), operator+=(), operator-(), operator--(), operator-=(), operator=(), operator^=(), operator|=(), Profile(), roundToDouble(), setBit(), sext(), trunc(), udiv(), udivrem(), ult(), urem(), zext(), and ~APInt().
uint64_t llvm::APInt::VAL |
Used to store the <= 64 bits integer value.
Definition at line 81 of file APInt.h.
Referenced by And(), APInt(), bitsToFloat(), countPopulation(), eq(), exactLogBase2(), getRawData(), getSExtValue(), llvm::hash_value(), isAllOnesValue(), isMaxSignedValue(), isMinSignedValue(), isPowerOf2(), operator!(), operator&=(), operator*(), operator*=(), operator+(), operator++(), operator+=(), operator-(), operator--(), operator-=(), operator=(), operator^=(), operator|=(), slt(), toStringUnsigned(), udiv(), udivrem(), ult(), and urem().