LLVM  3.7.0
Public Member Functions | Static Public Member Functions | List of all members
llvm::APSInt Class Reference

#include <APSInt.h>

Inheritance diagram for llvm::APSInt:
[legend]
Collaboration diagram for llvm::APSInt:
[legend]

Public Member Functions

 APSInt ()
 Default constructor that creates an uninitialized APInt. More...
 
 APSInt (uint32_t BitWidth, bool isUnsigned=true)
 APSInt ctor - Create an APSInt with the specified width, default to unsigned. More...
 
 APSInt (APInt I, bool isUnsigned=true)
 
 APSInt (StringRef Str)
 Construct an APSInt from a string representation. More...
 
APSIntoperator= (APInt RHS)
 
APSIntoperator= (uint64_t RHS)
 
bool isSigned () const
 
bool isUnsigned () const
 
void setIsUnsigned (bool Val)
 
void setIsSigned (bool Val)
 
void toString (SmallVectorImpl< char > &Str, unsigned Radix=10) const
 toString - Append this APSInt to the specified SmallString. More...
 
std::string toString (unsigned Radix) const
 toString - Converts an APInt to a std::string. More...
 
int64_t getExtValue () const
 Get the correctly-extended int64_t value. More...
 
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc (uint32_t width) const
 
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT extend (uint32_t width) const
 
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT extOrTrunc (uint32_t width) const
 
const APSIntoperator%= (const APSInt &RHS)
 
const APSIntoperator/= (const APSInt &RHS)
 
APSInt operator% (const APSInt &RHS) const
 
APSInt operator/ (const APSInt &RHS) const
 
APSInt operator>> (unsigned Amt) const
 
APSIntoperator>>= (unsigned Amt)
 
bool operator< (const APSInt &RHS) const
 
bool operator> (const APSInt &RHS) const
 
bool operator<= (const APSInt &RHS) const
 
bool operator>= (const APSInt &RHS) const
 
bool operator== (const APSInt &RHS) const
 
bool operator!= (const APSInt &RHS) const
 
bool operator== (int64_t RHS) const
 
bool operator!= (int64_t RHS) const
 
bool operator<= (int64_t RHS) const
 
bool operator>= (int64_t RHS) const
 
bool operator< (int64_t RHS) const
 
bool operator> (int64_t RHS) const
 
APSInt operator<< (unsigned Bits) const
 
APSIntoperator<<= (unsigned Amt)
 
APSIntoperator++ ()
 
APSIntoperator-- ()
 
APSInt operator++ (int)
 
APSInt operator-- (int)
 
APSInt operator- () const
 
APSIntoperator+= (const APSInt &RHS)
 
APSIntoperator-= (const APSInt &RHS)
 
APSIntoperator*= (const APSInt &RHS)
 
APSIntoperator&= (const APSInt &RHS)
 
APSIntoperator|= (const APSInt &RHS)
 
APSIntoperator^= (const APSInt &RHS)
 
APSInt operator& (const APSInt &RHS) const
 
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT And (const APSInt &RHS) const
 
APSInt operator| (const APSInt &RHS) const
 
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT Or (const APSInt &RHS) const
 
APSInt operator^ (const APSInt &RHS) const
 
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT Xor (const APSInt &RHS) const
 
APSInt operator* (const APSInt &RHS) const
 
APSInt operator+ (const APSInt &RHS) const
 
APSInt operator- (const APSInt &RHS) const
 
APSInt operator~ () const
 
void Profile (FoldingSetNodeID &ID) const
 Profile - Used to insert APSInt objects, or objects that contain APSInt objects, into FoldingSets. More...
 
- Public Member Functions inherited from llvm::APInt
 APInt (unsigned numBits, uint64_t val, bool isSigned=false)
 Create a new APInt of numBits width, initialized as val. More...
 
 APInt (unsigned numBits, ArrayRef< uint64_t > bigVal)
 Construct an APInt of numBits width, initialized as bigVal[]. More...
 
 APInt (unsigned numBits, unsigned numWords, const uint64_t bigVal[])
 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. More...
 
 APInt (unsigned numBits, StringRef str, uint8_t radix)
 Construct an APInt from a string representation. More...
 
 APInt (const APInt &that)
 Simply makes *this a copy of that. More...
 
 APInt (APInt &&that)
 Move Constructor. More...
 
 ~APInt ()
 Destructor. More...
 
 APInt ()
 Default constructor that creates an uninitialized APInt. More...
 
bool needsCleanup () const
 Returns whether this instance allocated memory. More...
 
void Profile (FoldingSetNodeID &id) const
 Used to insert APInt objects, or objects that contain APInt objects, into FoldingSets. More...
 
bool isNegative () const
 Determine sign of this APInt. More...
 
bool isNonNegative () const
 Determine if this APInt Value is non-negative (>= 0) More...
 
bool isStrictlyPositive () const
 Determine if this APInt Value is positive. More...
 
bool isAllOnesValue () const
 Determine if all bits are set. More...
 
bool isMaxValue () const
 Determine if this is the largest unsigned value. More...
 
bool isMaxSignedValue () const
 Determine if this is the largest signed value. More...
 
bool isMinValue () const
 Determine if this is the smallest unsigned value. More...
 
bool isMinSignedValue () const
 Determine if this is the smallest signed value. More...
 
bool isIntN (unsigned N) const
 Check if this APInt has an N-bits unsigned integer value. More...
 
bool isSignedIntN (unsigned N) const
 Check if this APInt has an N-bits signed integer value. More...
 
bool isPowerOf2 () const
 Check if this APInt's value is a power of two greater than zero. More...
 
bool isSignBit () const
 Check if the APInt's value is returned by getSignBit. More...
 
bool getBoolValue () const
 Convert APInt to a boolean value. More...
 
uint64_t getLimitedValue (uint64_t Limit=~0ULL) const
 If this value is smaller than the specified limit, return it, otherwise return the limit value. More...
 
bool isSplat (unsigned SplatSizeInBits) const
 Check if the APInt consists of a repeated bit pattern. More...
 
const APInt operator++ (int)
 Postfix increment operator. More...
 
APIntoperator++ ()
 Prefix increment operator. More...
 
const APInt operator-- (int)
 Postfix decrement operator. More...
 
APIntoperator-- ()
 Prefix decrement operator. More...
 
APInt operator~ () const
 Unary bitwise complement operator. More...
 
APInt operator- () const
 Unary negation operator. More...
 
bool operator! () const
 Logical negation operator. More...
 
APIntoperator= (const APInt &RHS)
 Copy assignment operator. More...
 
APIntoperator= (APInt &&that)
 Move assignment operator. More...
 
APIntoperator= (uint64_t RHS)
 Assignment operator. More...
 
APIntoperator&= (const APInt &RHS)
 Bitwise AND assignment operator. More...
 
APIntoperator|= (const APInt &RHS)
 Bitwise OR assignment operator. More...
 
APIntoperator|= (uint64_t RHS)
 Bitwise OR assignment operator. More...
 
APIntoperator^= (const APInt &RHS)
 Bitwise XOR assignment operator. More...
 
APIntoperator*= (const APInt &RHS)
 Multiplication assignment operator. More...
 
APIntoperator+= (const APInt &RHS)
 Addition assignment operator. More...
 
APIntoperator-= (const APInt &RHS)
 Subtraction assignment operator. More...
 
APIntoperator<<= (unsigned shiftAmt)
 Left-shift assignment function. More...
 
bool operator== (const APInt &RHS) const
 Equality operator. More...
 
bool operator== (uint64_t Val) const
 Equality operator. More...
 
bool eq (const APInt &RHS) const
 Equality comparison. More...
 
bool operator!= (const APInt &RHS) const
 Inequality operator. More...
 
bool operator!= (uint64_t Val) const
 Inequality operator. More...
 
bool ne (const APInt &RHS) const
 Inequality comparison. More...
 
bool ult (const APInt &RHS) const
 Unsigned less than comparison. More...
 
bool ult (uint64_t RHS) const
 Unsigned less than comparison. More...
 
bool slt (const APInt &RHS) const
 Signed less than comparison. More...
 
bool slt (int64_t RHS) const
 Signed less than comparison. More...
 
bool ule (const APInt &RHS) const
 Unsigned less or equal comparison. More...
 
bool ule (uint64_t RHS) const
 Unsigned less or equal comparison. More...
 
bool sle (const APInt &RHS) const
 Signed less or equal comparison. More...
 
bool sle (uint64_t RHS) const
 Signed less or equal comparison. More...
 
bool ugt (const APInt &RHS) const
 Unsigned greather than comparison. More...
 
bool ugt (uint64_t RHS) const
 Unsigned greater than comparison. More...
 
bool sgt (const APInt &RHS) const
 Signed greather than comparison. More...
 
bool sgt (int64_t RHS) const
 Signed greater than comparison. More...
 
bool uge (const APInt &RHS) const
 Unsigned greater or equal comparison. More...
 
bool uge (uint64_t RHS) const
 Unsigned greater or equal comparison. More...
 
bool sge (const APInt &RHS) const
 Signed greather or equal comparison. More...
 
bool sge (int64_t RHS) const
 Signed greater or equal comparison. More...
 
bool intersects (const APInt &RHS) const
 This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are both set. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc (unsigned width) const
 Truncate to new width. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sext (unsigned width) const
 Sign extend to a new width. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext (unsigned width) const
 Zero extend to a new width. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sextOrTrunc (unsigned width) const
 Sign extend or truncate to width. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrTrunc (unsigned width) const
 Zero extend or truncate to width. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sextOrSelf (unsigned width) const
 Sign extend or truncate to width. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrSelf (unsigned width) const
 Zero extend or truncate to width. More...
 
void setAllBits ()
 Set every bit to 1. More...
 
void setBit (unsigned bitPosition)
 Set a given bit to 1. More...
 
void clearAllBits ()
 Set every bit to 0. More...
 
void clearBit (unsigned bitPosition)
 Set a given bit to 0. More...
 
void flipAllBits ()
 Toggle every bit to its opposite value. More...
 
void flipBit (unsigned bitPosition)
 Toggles a given bit to its opposite value. More...
 
unsigned logBase2 () const
 
unsigned ceilLogBase2 () const
 
unsigned nearestLogBase2 () const
 
int32_t exactLogBase2 () const
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sqrt () const
 Compute the square root. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT abs () const
 Get the absolute value;. More...
 
APInt multiplicativeInverse (const APInt &modulo) const
 Computes the multiplicative inverse of this APInt for a given modulo. More...
 
ms magic () const
 Calculate the magic numbers required to implement a signed integer division by a constant as a sequence of multiplies, adds and shifts. More...
 
mu 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. More...
 
APInt getHiBits (unsigned numBits) const
 Compute an APInt containing numBits highbits from this APInt. More...
 
APInt getLoBits (unsigned numBits) const
 Compute an APInt containing numBits lowbits from this APInt. More...
 
const uint64_t * getRawData () const
 This function returns a pointer to the internal storage of the APInt. More...
 
APInt operator& (const APInt &RHS) const
 Bitwise AND operator. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT And (const APInt &RHS) const
 
APInt operator| (const APInt &RHS) const
 Bitwise OR operator. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT Or (const APInt &RHS) const
 Bitwise OR function. More...
 
APInt operator^ (const APInt &RHS) const
 Bitwise XOR operator. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT Xor (const APInt &RHS) const
 Bitwise XOR function. More...
 
APInt operator* (const APInt &RHS) const
 Multiplication operator. More...
 
APInt operator+ (const APInt &RHS) const
 Addition operator. More...
 
APInt operator+ (uint64_t RHS) const
 
APInt operator- (const APInt &RHS) const
 Subtraction operator. More...
 
APInt operator- (uint64_t RHS) const
 
APInt operator<< (unsigned Bits) const
 Left logical shift operator. More...
 
APInt operator<< (const APInt &Bits) const
 Left logical shift operator. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT ashr (unsigned shiftAmt) const
 Arithmetic right-shift function. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT lshr (unsigned shiftAmt) const
 Logical right-shift function. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT shl (unsigned shiftAmt) const
 Left-shift function. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT rotl (unsigned rotateAmt) const
 Rotate left by rotateAmt. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT rotr (unsigned rotateAmt) const
 Rotate right by rotateAmt. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT ashr (const APInt &shiftAmt) const
 Arithmetic right-shift function. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT lshr (const APInt &shiftAmt) const
 Logical right-shift function. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT shl (const APInt &shiftAmt) const
 Left-shift function. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT rotl (const APInt &rotateAmt) const
 Rotate left by rotateAmt. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT rotr (const APInt &rotateAmt) const
 Rotate right by rotateAmt. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT udiv (const APInt &RHS) const
 Unsigned division operation. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sdiv (const APInt &RHS) const
 Signed division function for APInt. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT urem (const APInt &RHS) const
 Unsigned remainder operation. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT srem (const APInt &RHS) const
 Function for signed remainder operation. More...
 
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 (const APInt &Amt, bool &Overflow) const
 
APInt ushl_ov (const APInt &Amt, bool &Overflow) const
 
bool operator[] (unsigned bitPosition) const
 Array-indexing support. More...
 
unsigned getBitWidth () const
 Return the number of bits in the APInt. More...
 
unsigned getNumWords () const
 Get the number of words. More...
 
unsigned getActiveBits () const
 Compute the number of active bits in the value. More...
 
unsigned getActiveWords () const
 Compute the number of active words in the value of this APInt. More...
 
unsigned getMinSignedBits () const
 Get the minimum bit size for this signed APInt. More...
 
uint64_t getZExtValue () const
 Get zero extended value. More...
 
int64_t getSExtValue () const
 Get sign extended value. More...
 
unsigned countLeadingZeros () const
 The APInt version of the countLeadingZeros functions in MathExtras.h. More...
 
unsigned countLeadingOnes () const
 Count the number of leading one bits. More...
 
unsigned getNumSignBits () const
 Computes the number of leading bits of this APInt that are equal to its sign bit. More...
 
unsigned countTrailingZeros () const
 Count the number of trailing zero bits. More...
 
unsigned countTrailingOnes () const
 Count the number of trailing one bits. More...
 
unsigned countPopulation () const
 Count the number of bits set. More...
 
void print (raw_ostream &OS, bool isSigned) const
 
void toString (SmallVectorImpl< char > &Str, unsigned Radix, bool Signed, bool formatAsCLiteral=false) const
 Converts an APInt to a string and append it to Str. More...
 
void toStringUnsigned (SmallVectorImpl< char > &Str, unsigned Radix=10) const
 Considers the APInt to be unsigned and converts it into a string in the radix given. More...
 
void toStringSigned (SmallVectorImpl< char > &Str, unsigned Radix=10) const
 Considers the APInt to be signed and converts it into a string in the radix given. More...
 
std::string toString (unsigned Radix, bool Signed) const
 Return the APInt as a std::string. More...
 
APInt LLVM_ATTRIBUTE_UNUSED_RESULT byteSwap () const
 
double roundToDouble (bool isSigned) const
 Converts this APInt to a double value. More...
 
double roundToDouble () const
 Converts this unsigned APInt to a double value. More...
 
double signedRoundToDouble () const
 Converts this signed APInt to a double value. More...
 
double bitsToDouble () const
 Converts APInt bits to a double. More...
 
float bitsToFloat () const
 Converts APInt bits to a double. More...
 
void dump () const
 debug method More...
 

Static Public Member Functions

static APSInt getMaxValue (uint32_t numBits, bool Unsigned)
 getMaxValue - Return the APSInt representing the maximum integer value with the given bit width and signedness. More...
 
static APSInt getMinValue (uint32_t numBits, bool Unsigned)
 getMinValue - Return the APSInt representing the minimum integer value with the given bit width and signedness. More...
 
static bool isSameValue (const APSInt &I1, const APSInt &I2)
 Determine if two APSInts have the same value, zero- or sign-extending as needed. More...
 
static int compareValues (const APSInt &I1, const APSInt &I2)
 Compare underlying values of two numbers. More...
 
static APSInt get (int64_t X)
 
static APSInt getUnsigned (uint64_t X)
 
- Static Public Member Functions inherited from llvm::APInt
static APInt getMaxValue (unsigned numBits)
 Gets maximum unsigned value of APInt for specific bit width. More...
 
static APInt getSignedMaxValue (unsigned numBits)
 Gets maximum signed value of APInt for a specific bit width. More...
 
static APInt getMinValue (unsigned numBits)
 Gets minimum unsigned value of APInt for a specific bit width. More...
 
static APInt getSignedMinValue (unsigned numBits)
 Gets minimum signed value of APInt for a specific bit width. More...
 
static APInt getSignBit (unsigned BitWidth)
 Get the SignBit for a specific bit width. More...
 
static APInt getAllOnesValue (unsigned numBits)
 Get the all-ones value. More...
 
static APInt getNullValue (unsigned numBits)
 Get the '0' value. More...
 
static APInt getOneBitSet (unsigned numBits, unsigned BitNo)
 Return an APInt with exactly one bit set in the result. More...
 
static APInt getBitsSet (unsigned numBits, unsigned loBit, unsigned hiBit)
 Get a value with a block of bits set. More...
 
static APInt getHighBitsSet (unsigned numBits, unsigned hiBitsSet)
 Get a value with high bits set. More...
 
static APInt getLowBitsSet (unsigned numBits, unsigned loBitsSet)
 Get a value with low bits set. More...
 
static APInt getSplat (unsigned NewLen, const APInt &V)
 Return a value containing V broadcasted over NewLen bits. More...
 
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. More...
 
static void udivrem (const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder)
 Dual division/remainder interface. More...
 
static void sdivrem (const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder)
 
static unsigned getNumWords (unsigned BitWidth)
 Get the number of words. More...
 
static unsigned getBitsNeeded (StringRef str, uint8_t radix)
 Get bits required for string value. More...
 
static APInt
LLVM_ATTRIBUTE_UNUSED_RESULT 
doubleToBits (double V)
 Converts a double to APInt bits. More...
 
static APInt
LLVM_ATTRIBUTE_UNUSED_RESULT 
floatToBits (float V)
 Converts a float to APInt bits. More...
 
static void tcSet (integerPart *, integerPart, unsigned int)
 Sets the least significant part of a bignum to the input value, and zeroes out higher parts. More...
 
static void tcAssign (integerPart *, const integerPart *, unsigned int)
 Assign one bignum to another. More...
 
static bool tcIsZero (const integerPart *, unsigned int)
 Returns true if a bignum is zero, false otherwise. More...
 
static int tcExtractBit (const integerPart *, unsigned int bit)
 Extract the given bit of a bignum; returns 0 or 1. Zero-based. More...
 
static void tcExtract (integerPart *, unsigned int dstCount, const integerPart *, unsigned int srcBits, unsigned int srcLSB)
 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. More...
 
static void tcSetBit (integerPart *, unsigned int bit)
 Set the given bit of a bignum. Zero-based. More...
 
static void tcClearBit (integerPart *, unsigned int bit)
 Clear the given bit of a bignum. Zero-based. More...
 
static unsigned int tcLSB (const integerPart *, unsigned int)
 Returns the bit number of the least or most significant set bit of a number. More...
 
static unsigned int tcMSB (const integerPart *parts, unsigned int n)
 
static void tcNegate (integerPart *, unsigned int)
 Negate a bignum in-place. More...
 
static integerPart tcAdd (integerPart *, const integerPart *, integerPart carry, unsigned)
 DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag. More...
 
static integerPart tcSubtract (integerPart *, const integerPart *, integerPart carry, unsigned)
 DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag. More...
 
static int tcMultiplyPart (integerPart *dst, const integerPart *src, integerPart multiplier, integerPart carry, unsigned int srcParts, unsigned int dstParts, bool add)
 DST += SRC * MULTIPLIER + PART if add is true DST = SRC * MULTIPLIER + PART if add is false. More...
 
static int tcMultiply (integerPart *, const integerPart *, const integerPart *, unsigned)
 DST = LHS * RHS, where DST has the same width as the operands and is filled with the least significant parts of the result. More...
 
static unsigned int tcFullMultiply (integerPart *, const integerPart *, const integerPart *, unsigned, unsigned)
 DST = LHS * RHS, where DST has width the sum of the widths of the operands. More...
 
static int tcDivide (integerPart *lhs, const integerPart *rhs, integerPart *remainder, integerPart *scratch, unsigned int parts)
 If RHS is zero LHS and REMAINDER are left unchanged, return one. More...
 
static void tcShiftLeft (integerPart *, unsigned int parts, unsigned int count)
 Shift a bignum left COUNT bits. More...
 
static void tcShiftRight (integerPart *, unsigned int parts, unsigned int count)
 Shift a bignum right COUNT bits. More...
 
static void tcAnd (integerPart *, const integerPart *, unsigned int)
 The obvious AND, OR and XOR and complement operations. More...
 
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. More...
 
static integerPart tcIncrement (integerPart *, unsigned int)
 Increment a bignum in-place. Return the carry flag. More...
 
static integerPart tcDecrement (integerPart *, unsigned int)
 Decrement a bignum in-place. Return the borrow flag. More...
 
static void tcSetLeastSignificantBits (integerPart *, unsigned int, unsigned int bits)
 Set the least significant BITS and clear the rest. More...
 

Detailed Description

Definition at line 22 of file APSInt.h.

Constructor & Destructor Documentation

llvm::APSInt::APSInt ( )
inlineexplicit
llvm::APSInt::APSInt ( uint32_t  BitWidth,
bool  isUnsigned = true 
)
inlineexplicit

APSInt ctor - Create an APSInt with the specified width, default to unsigned.

Definition at line 30 of file APSInt.h.

llvm::APSInt::APSInt ( APInt  I,
bool  isUnsigned = true 
)
inlineexplicit

Definition at line 33 of file APSInt.h.

APSInt::APSInt ( StringRef  Str)
explicit

Construct an APSInt from a string representation.

This constructor interprets the string Str using the radix of 10. The interpretation stops at the end of the string. The bit width of the constructed APSInt is determined automatically.

Parameters
Strthe string to be interpreted.

Definition at line 20 of file APSInt.cpp.

References APSInt(), llvm::StringRef::empty(), llvm::APInt::getActiveBits(), llvm::APInt::getMinSignedBits(), llvm::StringRef::size(), and llvm::APInt::trunc().

Member Function Documentation

APSInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APSInt::And ( const APSInt RHS) const
inline

Definition at line 237 of file APSInt.h.

References operator&().

static int llvm::APSInt::compareValues ( const APSInt I1,
const APSInt I2 
)
inlinestatic

Compare underlying values of two numbers.

Definition at line 295 of file APSInt.h.

References llvm::APInt::eq(), extend(), llvm::APInt::getBitWidth(), llvm::APInt::isNegative(), isSigned(), and llvm::APInt::ugt().

Referenced by isSameValue(), operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

APSInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APSInt::extend ( uint32_t  width) const
inline

Definition at line 84 of file APSInt.h.

References APSInt(), llvm::APInt::sext(), and llvm::APInt::zext().

Referenced by compareValues().

APSInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APSInt::extOrTrunc ( uint32_t  width) const
inline

Definition at line 91 of file APSInt.h.

References APSInt(), llvm::APInt::sextOrTrunc(), and llvm::APInt::zextOrTrunc().

static APSInt llvm::APSInt::get ( int64_t  X)
inlinestatic

Definition at line 320 of file APSInt.h.

References llvm::APInt::APInt(), APSInt(), and X.

int64_t llvm::APSInt::getExtValue ( ) const
inline

Get the correctly-extended int64_t value.

Definition at line 75 of file APSInt.h.

References llvm::APInt::getMinSignedBits(), llvm::APInt::getSExtValue(), llvm::APInt::getZExtValue(), and isSigned().

static APSInt llvm::APSInt::getMaxValue ( uint32_t  numBits,
bool  Unsigned 
)
inlinestatic

getMaxValue - Return the APSInt representing the maximum integer value with the given bit width and signedness.

Definition at line 276 of file APSInt.h.

References APSInt(), llvm::APInt::getMaxValue(), and llvm::APInt::getSignedMaxValue().

static APSInt llvm::APSInt::getMinValue ( uint32_t  numBits,
bool  Unsigned 
)
inlinestatic

getMinValue - Return the APSInt representing the minimum integer value with the given bit width and signedness.

Definition at line 283 of file APSInt.h.

References APSInt(), llvm::APInt::getMinValue(), and llvm::APInt::getSignedMinValue().

static APSInt llvm::APSInt::getUnsigned ( uint64_t  X)
inlinestatic

Definition at line 321 of file APSInt.h.

References llvm::APInt::APInt(), and APSInt().

static bool llvm::APSInt::isSameValue ( const APSInt I1,
const APSInt I2 
)
inlinestatic

Determine if two APSInts have the same value, zero- or sign-extending as needed.

Definition at line 290 of file APSInt.h.

References compareValues().

bool llvm::APSInt::isSigned ( ) const
inline
bool llvm::APSInt::isUnsigned ( ) const
inline

Definition at line 59 of file APSInt.h.

bool llvm::APSInt::operator!= ( const APSInt RHS) const
inline

Definition at line 151 of file APSInt.h.

bool llvm::APSInt::operator!= ( int64_t  RHS) const
inline

Definition at line 158 of file APSInt.h.

References compareValues().

APSInt llvm::APSInt::operator% ( const APSInt RHS) const
inline

Definition at line 114 of file APSInt.h.

References APSInt(), llvm::APInt::srem(), and llvm::APInt::urem().

const APSInt& llvm::APSInt::operator%= ( const APSInt RHS)
inline

Definition at line 98 of file APSInt.h.

References llvm::APInt::srem(), and llvm::APInt::urem().

APSInt llvm::APSInt::operator& ( const APSInt RHS) const
inline

Definition at line 233 of file APSInt.h.

References APSInt().

Referenced by And().

APSInt& llvm::APSInt::operator&= ( const APSInt RHS)
inline

Definition at line 217 of file APSInt.h.

APSInt llvm::APSInt::operator* ( const APSInt RHS) const
inline

Definition at line 258 of file APSInt.h.

References APSInt().

APSInt& llvm::APSInt::operator*= ( const APSInt RHS)
inline

Definition at line 212 of file APSInt.h.

APSInt llvm::APSInt::operator+ ( const APSInt RHS) const
inline

Definition at line 262 of file APSInt.h.

References APSInt().

APSInt& llvm::APSInt::operator++ ( )
inline

Definition at line 185 of file APSInt.h.

APSInt llvm::APSInt::operator++ ( int  )
inline

Definition at line 193 of file APSInt.h.

References APSInt().

APSInt& llvm::APSInt::operator+= ( const APSInt RHS)
inline

Definition at line 202 of file APSInt.h.

APSInt llvm::APSInt::operator- ( ) const
inline

Definition at line 199 of file APSInt.h.

References APSInt().

APSInt llvm::APSInt::operator- ( const APSInt RHS) const
inline

Definition at line 266 of file APSInt.h.

References APSInt().

APSInt& llvm::APSInt::operator-- ( )
inline

Definition at line 189 of file APSInt.h.

APSInt llvm::APSInt::operator-- ( int  )
inline

Definition at line 196 of file APSInt.h.

References APSInt().

APSInt& llvm::APSInt::operator-= ( const APSInt RHS)
inline

Definition at line 207 of file APSInt.h.

APSInt llvm::APSInt::operator/ ( const APSInt RHS) const
inline

Definition at line 118 of file APSInt.h.

References APSInt(), llvm::APInt::sdiv(), and llvm::APInt::udiv().

const APSInt& llvm::APSInt::operator/= ( const APSInt RHS)
inline

Definition at line 106 of file APSInt.h.

References llvm::APInt::sdiv(), and llvm::APInt::udiv().

bool llvm::APSInt::operator< ( const APSInt RHS) const
inline

Definition at line 131 of file APSInt.h.

References llvm::APInt::slt(), and llvm::APInt::ult().

bool llvm::APSInt::operator< ( int64_t  RHS) const
inline

Definition at line 167 of file APSInt.h.

References compareValues().

APSInt llvm::APSInt::operator<< ( unsigned  Bits) const
inline

Definition at line 177 of file APSInt.h.

References APSInt().

APSInt& llvm::APSInt::operator<<= ( unsigned  Amt)
inline

Definition at line 180 of file APSInt.h.

bool llvm::APSInt::operator<= ( const APSInt RHS) const
inline

Definition at line 139 of file APSInt.h.

References llvm::APInt::sle(), and llvm::APInt::ule().

bool llvm::APSInt::operator<= ( int64_t  RHS) const
inline

Definition at line 161 of file APSInt.h.

References compareValues().

APSInt& llvm::APSInt::operator= ( APInt  RHS)
inline

Definition at line 45 of file APSInt.h.

References llvm::APInt::operator=().

APSInt& llvm::APSInt::operator= ( uint64_t  RHS)
inline

Definition at line 51 of file APSInt.h.

References llvm::APInt::operator=().

bool llvm::APSInt::operator== ( const APSInt RHS) const
inline

Definition at line 147 of file APSInt.h.

References llvm::APInt::eq().

bool llvm::APSInt::operator== ( int64_t  RHS) const
inline

Definition at line 155 of file APSInt.h.

References compareValues().

bool llvm::APSInt::operator> ( const APSInt RHS) const
inline

Definition at line 135 of file APSInt.h.

References llvm::APInt::sgt(), and llvm::APInt::ugt().

bool llvm::APSInt::operator> ( int64_t  RHS) const
inline

Definition at line 170 of file APSInt.h.

References compareValues().

bool llvm::APSInt::operator>= ( const APSInt RHS) const
inline

Definition at line 143 of file APSInt.h.

References llvm::APInt::sge(), and llvm::APInt::uge().

bool llvm::APSInt::operator>= ( int64_t  RHS) const
inline

Definition at line 164 of file APSInt.h.

References compareValues().

APSInt llvm::APSInt::operator>> ( unsigned  Amt) const
inline

Definition at line 123 of file APSInt.h.

References APSInt(), llvm::APInt::ashr(), and llvm::APInt::lshr().

APSInt& llvm::APSInt::operator>>= ( unsigned  Amt)
inline

Definition at line 126 of file APSInt.h.

APSInt llvm::APSInt::operator^ ( const APSInt RHS) const
inline

Definition at line 250 of file APSInt.h.

References APSInt().

Referenced by Xor().

APSInt& llvm::APSInt::operator^= ( const APSInt RHS)
inline

Definition at line 227 of file APSInt.h.

APSInt llvm::APSInt::operator| ( const APSInt RHS) const
inline

Definition at line 241 of file APSInt.h.

References APSInt().

Referenced by Or().

APSInt& llvm::APSInt::operator|= ( const APSInt RHS)
inline

Definition at line 222 of file APSInt.h.

APSInt llvm::APSInt::operator~ ( ) const
inline

Definition at line 270 of file APSInt.h.

References APSInt().

APSInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APSInt::Or ( const APSInt RHS) const
inline

Definition at line 245 of file APSInt.h.

References operator|().

void APSInt::Profile ( FoldingSetNodeID ID) const

Profile - Used to insert APSInt objects, or objects that contain APSInt objects, into FoldingSets.

Definition at line 39 of file APSInt.cpp.

References llvm::FoldingSetNodeID::AddInteger(), and llvm::APInt::Profile().

void llvm::APSInt::setIsSigned ( bool  Val)
inline

Definition at line 61 of file APSInt.h.

void llvm::APSInt::setIsUnsigned ( bool  Val)
inline

Definition at line 60 of file APSInt.h.

void llvm::APSInt::toString ( SmallVectorImpl< char > &  Str,
unsigned  Radix = 10 
) const
inline

toString - Append this APSInt to the specified SmallString.

Definition at line 64 of file APSInt.h.

References isSigned(), and llvm::APInt::toString().

std::string llvm::APSInt::toString ( unsigned  Radix) const
inline

toString - Converts an APInt to a std::string.

This is an inefficient method; you should prefer passing in a SmallString instead.

Definition at line 69 of file APSInt.h.

References isSigned(), and llvm::APInt::toString().

APSInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APSInt::trunc ( uint32_t  width) const
inline

Definition at line 80 of file APSInt.h.

References APSInt(), and llvm::APInt::trunc().

APSInt LLVM_ATTRIBUTE_UNUSED_RESULT llvm::APSInt::Xor ( const APSInt RHS) const
inline

Definition at line 254 of file APSInt.h.

References operator^().


The documentation for this class was generated from the following files: