PandA-2024.02
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
APInt Class Reference

#include <APInt.hpp>

Public Types

using backend = boost::multiprecision::backends::cpp_int_backend< 4096, 4096, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void >
 
using number = boost::multiprecision::number< backend >
 
using bw_t = uint16_t
 

Public Member Functions

 APInt ()
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
 APInt (T val)
 
 APInt (const number &v)
 
 APInt (const std::string &str)
 
 operator bool () const
 
APIntoperator+= (const APInt &rhs)
 
APIntoperator-= (const APInt &rhs)
 
APIntoperator*= (const APInt &rhs)
 
APIntoperator/= (const APInt &rhs)
 
APIntoperator%= (const APInt &rhs)
 
APIntoperator &= (const APInt &rhs)
 
APIntoperator|= (const APInt &rhs)
 
APIntoperator^= (const APInt &rhs)
 
APIntoperator<<= (const APInt &rhs)
 
APIntoperator>>= (const APInt &rhs)
 
APInt abs () const
 
APInt operator- () const
 
APInt operator~ () const
 
APInt operator++ (int)
 
APInt operator-- (int)
 
APIntoperator++ ()
 
APIntoperator-- ()
 
void bit_set (bw_t i)
 
void bit_clr (bw_t i)
 
bool bit_tst (bw_t i) const
 
bool sign () const
 
APIntextOrTrunc (bw_t bw, bool sign)
 
APInt extOrTrunc (bw_t bw, bool sign) const
 
bw_t trailingZeros (bw_t bw) const
 
bw_t trailingOnes (bw_t bw) const
 
bw_t leadingZeros (bw_t bw) const
 
bw_t leadingOnes (bw_t bw) const
 
bw_t minBitwidth (bool sign) const
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
 operator T () const
 

Static Public Member Functions

static APInt getMaxValue (bw_t bw)
 
static APInt getMinValue (bw_t bw)
 
static APInt getSignedMaxValue (bw_t bw)
 
static APInt getSignedMinValue (bw_t bw)
 

Private Attributes

number _data
 

Friends

bool operator< (const APInt &lhs, const APInt &rhs)
 
bool operator> (const APInt &lhs, const APInt &rhs)
 
bool operator<= (const APInt &lhs, const APInt &rhs)
 
bool operator>= (const APInt &lhs, const APInt &rhs)
 
bool operator== (const APInt &lhs, const APInt &rhs)
 
bool operator!= (const APInt &lhs, const APInt &rhs)
 
APInt operator+ (const APInt &lhs, const APInt &rhs)
 
APInt operator- (const APInt &lhs, const APInt &rhs)
 
APInt operator* (const APInt &lhs, const APInt &rhs)
 
APInt operator/ (const APInt &lhs, const APInt &rhs)
 
APInt operator% (const APInt &lhs, const APInt &rhs)
 
APInt operator & (const APInt &lhs, const APInt &rhs)
 
APInt operator| (const APInt &lhs, const APInt &rhs)
 
APInt operator^ (const APInt &lhs, const APInt &rhs)
 
APInt operator<< (const APInt &lhs, const APInt &rhs)
 
APInt operator>> (const APInt &lhs, const APInt &rhs)
 
std::ostream & operator<< (std::ostream &str, const APInt &v)
 
std::istream & operator>> (std::istream &str, APInt &v)
 

Detailed Description

Definition at line 53 of file APInt.hpp.

Member Typedef Documentation

◆ backend

using APInt::backend = boost::multiprecision::backends::cpp_int_backend<4096, 4096, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>

Definition at line 57 of file APInt.hpp.

◆ bw_t

using APInt::bw_t = uint16_t

Definition at line 59 of file APInt.hpp.

◆ number

using APInt::number = boost::multiprecision::number<backend>

Definition at line 58 of file APInt.hpp.

Constructor & Destructor Documentation

◆ APInt() [1/4]

APInt::APInt ( )

◆ APInt() [2/4]

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
APInt::APInt ( val)
inline

Definition at line 70 of file APInt.hpp.

◆ APInt() [3/4]

APInt::APInt ( const number v)
inline

Definition at line 74 of file APInt.hpp.

◆ APInt() [4/4]

APInt::APInt ( const std::string &  str)
inline

Member Function Documentation

◆ abs()

APInt APInt::abs ( ) const

Definition at line 210 of file APInt.cpp.

References _data, and abs.

Referenced by APInt().

Here is the caller graph for this function:

◆ bit_clr()

void APInt::bit_clr ( bw_t  i)

Definition at line 260 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ bit_set()

void APInt::bit_set ( bw_t  i)

Definition at line 255 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ bit_tst()

bool APInt::bit_tst ( bw_t  i) const

Definition at line 265 of file APInt.cpp.

References _data.

Referenced by APInt(), extOrTrunc(), leadingOnes(), trailingOnes(), and trailingZeros().

Here is the caller graph for this function:

◆ extOrTrunc() [1/2]

APInt & APInt::extOrTrunc ( bw_t  bw,
bool  sign 
)

Definition at line 285 of file APInt.cpp.

References _data, bit_tst(), THROW_ASSERT, and U.

Referenced by APInt(), Range::fromBitValues(), Range::getUnsignedMax(), Range::getUnsignedMin(), Range::normalizeRange(), and Range::shl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extOrTrunc() [2/2]

APInt APInt::extOrTrunc ( bw_t  bw,
bool  sign 
) const

Definition at line 297 of file APInt.cpp.

References _data, APInt(), bit_tst(), THROW_ASSERT, and U.

Here is the call graph for this function:

◆ getMaxValue()

APInt APInt::getMaxValue ( bw_t  bw)
static

Definition at line 419 of file APInt.cpp.

References APInt().

Referenced by Range::getSpan(), Range::getUnsignedMax(), Range::makeSatisfyingCmpRegion(), Range::normalizeRange(), operator T(), RealRange::toFloat32(), Range::truncate(), Range::usat_add(), Range::usat_sub(), and Range::zextOrTrunc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMinValue()

APInt APInt::getMinValue ( bw_t  bw)
static

Definition at line 424 of file APInt.cpp.

References APInt().

Referenced by Range::getUnsignedMin(), Range::makeSatisfyingCmpRegion(), and operator T().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSignedMaxValue()

APInt APInt::getSignedMaxValue ( bw_t  bw)
static

Definition at line 429 of file APInt.cpp.

References APInt().

Referenced by Range::abs(), Range::getSignedMax(), Range::getSpan(), Range::isFullSet(), Range::makeSatisfyingCmpRegion(), Range::normalizeRange(), operator T(), Range::sat_add(), Range::sat_sub(), SymbRange::solveFuture(), and Range::sub().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSignedMinValue()

APInt APInt::getSignedMinValue ( bw_t  bw)
static

Definition at line 434 of file APInt.cpp.

References APInt().

Referenced by Range::abs(), Range::getSignedMin(), Range::getSpan(), Range::isFullSet(), Range::makeSatisfyingCmpRegion(), Range::normalizeRange(), operator T(), Range::sat_add(), Range::sat_sub(), SymbRange::solveFuture(), and Range::sub().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leadingOnes()

bw_t APInt::leadingOnes ( bw_t  bw) const

Definition at line 382 of file APInt.cpp.

References bit_tst(), and U.

Referenced by APInt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leadingZeros()

bw_t APInt::leadingZeros ( bw_t  bw) const

Definition at line 335 of file APInt.cpp.

References _data, offset, THROW_ASSERT, and THROW_ERROR.

Referenced by APInt(), and minBitwidth().

Here is the caller graph for this function:

◆ minBitwidth()

APInt::bw_t APInt::minBitwidth ( bool  sign) const

Definition at line 395 of file APInt.cpp.

References _data, APInt(), leadingZeros(), sign(), and U.

Referenced by APInt(), Range::neededBits(), and tree_helper::Size().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator &=()

APInt& APInt::operator&= ( const APInt rhs)

Referenced by APInt(), and operator%=().

Here is the caller graph for this function:

◆ operator bool()

APInt::operator bool ( ) const
explicit

Definition at line 89 of file APInt.cpp.

References _data.

◆ operator T()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
APInt::operator T ( ) const
inlineexplicit

Definition at line 142 of file APInt.hpp.

References getMaxValue(), getMinValue(), getSignedMaxValue(), getSignedMinValue(), max, operator<<, operator>>, str, STR, test_panda::type, and U.

Here is the call graph for this function:

◆ operator%=()

APInt & APInt::operator%= ( const APInt rhs)

Definition at line 171 of file APInt.cpp.

References _data, and operator &=().

Referenced by APInt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*=()

APInt & APInt::operator*= ( const APInt rhs)

Definition at line 159 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator++() [1/2]

APInt APInt::operator++ ( int  )

Definition at line 231 of file APInt.cpp.

References _data.

◆ operator++() [2/2]

APInt & APInt::operator++ ( )

Definition at line 245 of file APInt.cpp.

References operator+=().

Referenced by APInt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator+=()

APInt & APInt::operator+= ( const APInt rhs)

Definition at line 147 of file APInt.cpp.

References _data.

Referenced by APInt(), and operator++().

Here is the caller graph for this function:

◆ operator-()

APInt APInt::operator- ( ) const

Definition at line 217 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator--() [1/2]

APInt APInt::operator-- ( int  )

Definition at line 238 of file APInt.cpp.

References _data.

◆ operator--() [2/2]

APInt & APInt::operator-- ( )

Definition at line 250 of file APInt.cpp.

References operator-=().

Referenced by APInt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator-=()

APInt & APInt::operator-= ( const APInt rhs)

Definition at line 153 of file APInt.cpp.

References _data.

Referenced by APInt(), and operator--().

Here is the caller graph for this function:

◆ operator/=()

APInt & APInt::operator/= ( const APInt rhs)

Definition at line 165 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator<<=()

APInt & APInt::operator<<= ( const APInt rhs)

Definition at line 195 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator>>=()

APInt & APInt::operator>>= ( const APInt rhs)

Definition at line 201 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator^=()

APInt & APInt::operator^= ( const APInt rhs)

Definition at line 189 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator|=()

APInt & APInt::operator|= ( const APInt rhs)

Definition at line 183 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ operator~()

APInt APInt::operator~ ( ) const

Definition at line 224 of file APInt.cpp.

References _data.

Referenced by APInt().

Here is the caller graph for this function:

◆ sign()

bool APInt::sign ( ) const

Definition at line 270 of file APInt.cpp.

References _data.

Referenced by APInt(), and minBitwidth().

Here is the caller graph for this function:

◆ trailingOnes()

bw_t APInt::trailingOnes ( bw_t  bw) const

Definition at line 322 of file APInt.cpp.

References bit_tst().

Referenced by APInt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trailingZeros()

bw_t APInt::trailingZeros ( bw_t  bw) const

Definition at line 309 of file APInt.cpp.

References bit_tst().

Referenced by APInt().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator &

APInt operator& ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 122 of file APInt.cpp.

Referenced by APInt().

◆ operator!=

bool operator!= ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 84 of file APInt.cpp.

Referenced by APInt().

◆ operator%

APInt operator% ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 117 of file APInt.cpp.

Referenced by APInt().

◆ operator*

APInt operator* ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 107 of file APInt.cpp.

Referenced by APInt().

◆ operator+

APInt operator+ ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 97 of file APInt.cpp.

Referenced by APInt().

◆ operator-

APInt operator- ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 102 of file APInt.cpp.

◆ operator/

APInt operator/ ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 112 of file APInt.cpp.

Referenced by APInt().

◆ operator<

bool operator< ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 59 of file APInt.cpp.

Referenced by APInt().

◆ operator<< [1/2]

APInt operator<< ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 137 of file APInt.cpp.

Referenced by APInt(), and operator T().

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  str,
const APInt v 
)
friend

Definition at line 439 of file APInt.cpp.

◆ operator<=

bool operator<= ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 69 of file APInt.cpp.

Referenced by APInt().

◆ operator==

bool operator== ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 79 of file APInt.cpp.

Referenced by APInt().

◆ operator>

bool operator> ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 64 of file APInt.cpp.

Referenced by APInt().

◆ operator>=

bool operator>= ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 74 of file APInt.cpp.

Referenced by APInt().

◆ operator>> [1/2]

APInt operator>> ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 142 of file APInt.cpp.

Referenced by APInt(), and operator T().

◆ operator>> [2/2]

std::istream& operator>> ( std::istream &  str,
APInt v 
)
friend

Definition at line 445 of file APInt.cpp.

◆ operator^

APInt operator^ ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 132 of file APInt.cpp.

Referenced by APInt().

◆ operator|

APInt operator| ( const APInt lhs,
const APInt rhs 
)
friend

Definition at line 127 of file APInt.cpp.

Referenced by APInt().

Field Documentation

◆ _data

number APInt::_data
private

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

Generated on Mon Feb 12 2024 13:03:43 for PandA-2024.02 by doxygen 1.8.13