15 #ifndef LLVM_ADT_APSINT_H
16 #define LLVM_ADT_APSINT_H
38 IsUnsigned = RHS.IsUnsigned;
90 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
98 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
106 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
110 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
118 *
this = *
this >> Amt;
123 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
124 return IsUnsigned ?
ult(RHS) :
slt(RHS);
127 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
128 return IsUnsigned ?
ugt(RHS) :
sgt(RHS);
131 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
132 return IsUnsigned ?
ule(RHS) :
sle(RHS);
135 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
136 return IsUnsigned ?
uge(RHS) :
sge(RHS);
139 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
146 return !((*this) == RHS);
149 return !((*this) == RHS);
156 return APSInt(static_cast<const APInt&>(*
this) << Bits, IsUnsigned);
159 *
this = *
this << Amt;
164 ++(
static_cast<APInt&
>(*this));
168 --(
static_cast<APInt&
>(*this));
172 return APSInt(++static_cast<APInt&>(*
this), IsUnsigned);
175 return APSInt(--static_cast<APInt&>(*
this), IsUnsigned);
178 return APSInt(-static_cast<const APInt&>(*
this), IsUnsigned);
181 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
182 static_cast<APInt&
>(*this) += RHS;
186 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
187 static_cast<APInt&
>(*this) -= RHS;
191 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
192 static_cast<APInt&
>(*this) *= RHS;
196 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
197 static_cast<APInt&
>(*this) &= RHS;
201 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
202 static_cast<APInt&
>(*this) |= RHS;
206 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
207 static_cast<APInt&
>(*this) ^= RHS;
212 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
213 return APSInt(static_cast<const APInt&>(*
this) & RHS, IsUnsigned);
220 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
221 return APSInt(static_cast<const APInt&>(*
this) | RHS, IsUnsigned);
229 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
230 return APSInt(static_cast<const APInt&>(*
this) ^ RHS, IsUnsigned);
237 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
238 return APSInt(static_cast<const APInt&>(*
this) * RHS, IsUnsigned);
241 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
242 return APSInt(static_cast<const APInt&>(*
this) + RHS, IsUnsigned);
245 assert(IsUnsigned == RHS.IsUnsigned &&
"Signedness mismatch!");
246 return APSInt(static_cast<const APInt&>(*
this) - RHS, IsUnsigned);
249 return APSInt(~static_cast<const APInt&>(*
this), IsUnsigned);
284 return APSInt(I1,
true) == I2;
290 return I1 ==
APSInt(I2,
true);
APSInt operator-(const APSInt &RHS) const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT ashr(unsigned shiftAmt) const
Arithmetic right-shift function.
const APSInt & operator/=(const APSInt &RHS)
#define LLVM_ATTRIBUTE_UNUSED_RESULT
APSInt & operator-=(const APSInt &RHS)
void print(raw_ostream &OS, bool isSigned) const
APSInt()
Default constructor that creates an uninitialized APInt.
APSInt(uint32_t BitWidth, bool isUnsigned=true)
APSInt operator>>(unsigned Amt) const
void setIsSigned(bool Val)
APSInt(const APInt &I, bool isUnsigned=true)
APSInt & operator^=(const APSInt &RHS)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
void setIsUnsigned(bool Val)
APSInt operator&(const APSInt &RHS) const
bool isNegative() const
Determine sign of this APInt.
APSInt operator<<(unsigned Bits) const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT urem(const APInt &RHS) const
Unsigned remainder operation.
APSInt & operator=(const APInt &RHS)
bool operator>=(const APSInt &RHS) const
bool operator<=(const APSInt &RHS) const
APInt()
Default constructor that creates an uninitialized APInt.
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT extend(uint32_t width) const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT lshr(unsigned shiftAmt) const
Logical right-shift function.
ID
LLVM Calling Convention Representation.
This file implements a class to represent arbitrary precision integral constant values and operations...
APSInt & operator<<=(unsigned Amt)
bool operator!=(int64_t RHS) const
APSInt & operator*=(const APSInt &RHS)
APSInt operator|(const APSInt &RHS) const
bool sgt(const APInt &RHS) const
Signed greather than comparison.
APSInt operator/(const APSInt &RHS) const
bool operator==(const APSInt &RHS) const
bool ult(const APInt &RHS) const
Unsigned less than comparison.
bool operator>(const APSInt &RHS) const
static bool isSameValue(const APSInt &I1, const APSInt &I2)
Determine if two APSInts have the same value, zero- or sign-extending as needed.
void toString(SmallVectorImpl< char > &Str, unsigned Radix, bool Signed, bool formatAsCLiteral=false) const
bool eq(const APInt &RHS) const
Equality comparison.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc(unsigned width) const
Truncate to new width.
bool sge(const APInt &RHS) const
Signed greather or equal comparison.
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT Xor(const APSInt &RHS) const
APInt & operator=(const APInt &RHS)
Copy assignment operator.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sext(unsigned width) const
Sign extend to a new width.
bool sle(const APInt &RHS) const
Signed less or equal comparison.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sdiv(const APInt &RHS) const
Signed division function for APInt.
APSInt & operator=(uint64_t RHS)
bool operator!=(const APSInt &RHS) const
void toString(SmallVectorImpl< char > &Str, unsigned Radix=10) const
toString - Append this APSInt to the specified SmallString.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT srem(const APInt &RHS) const
Function for signed remainder operation.
APSInt & operator&=(const APSInt &RHS)
bool ugt(const APInt &RHS) const
Unsigned greather than comparison.
static APSInt getMaxValue(uint32_t numBits, bool Unsigned)
bool slt(const APInt &RHS) const
Signed less than comparison.
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT extOrTrunc(uint32_t width) const
static APSInt getMinValue(uint32_t numBits, bool Unsigned)
APSInt & operator|=(const APSInt &RHS)
void Profile(FoldingSetNodeID &ID) const
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc(uint32_t width) const
Class for arbitrary precision integers.
APSInt operator%(const APSInt &RHS) const
bool operator<(const APSInt &RHS) const
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
const APSInt & operator%=(const APSInt &RHS)
bool operator!=(uint64_t V1, const APInt &V2)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT udiv(const APInt &RHS) const
Unsigned division operation.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
APSInt & operator+=(const APSInt &RHS)
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
APSInt & operator=(const APSInt &RHS)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT Or(const APSInt &RHS) const
APSInt & operator>>=(unsigned Amt)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext(unsigned width) const
Zero extend to a new width.
bool operator==(uint64_t V1, const APInt &V2)
APSInt operator*(const APSInt &RHS) const
APSInt LLVM_ATTRIBUTE_UNUSED_RESULT And(const APSInt &RHS) const
bool operator==(int64_t RHS) const
APSInt operator+(const APSInt &RHS) const
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
std::string toString(unsigned Radix) const
APSInt operator^(const APSInt &RHS) const