MLIR  19.0.0git
Public Member Functions | Friends | List of all members
mlir::presburger::detail::SlowMPInt Class Reference

A simple class providing multi-precision arithmetic. More...

#include "mlir/Analysis/Presburger/SlowMPInt.h"

Public Member Functions

 SlowMPInt (int64_t val)
 
 SlowMPInt ()
 
 SlowMPInt (const llvm::APInt &val)
 
SlowMPIntoperator= (int64_t val)
 
 operator int64_t () const
 
SlowMPInt operator- () const
 
bool operator== (const SlowMPInt &o) const
 
bool operator!= (const SlowMPInt &o) const
 
bool operator> (const SlowMPInt &o) const
 
bool operator< (const SlowMPInt &o) const
 
bool operator<= (const SlowMPInt &o) const
 
bool operator>= (const SlowMPInt &o) const
 
SlowMPInt operator+ (const SlowMPInt &o) const
 
SlowMPInt operator- (const SlowMPInt &o) const
 
SlowMPInt operator* (const SlowMPInt &o) const
 
SlowMPInt operator/ (const SlowMPInt &o) const
 
SlowMPInt operator% (const SlowMPInt &o) const
 This operation cannot overflow. More...
 
SlowMPIntoperator+= (const SlowMPInt &o)
 
SlowMPIntoperator-= (const SlowMPInt &o)
 
SlowMPIntoperator*= (const SlowMPInt &o)
 
SlowMPIntoperator/= (const SlowMPInt &o)
 
SlowMPIntoperator%= (const SlowMPInt &o)
 
SlowMPIntoperator++ ()
 
SlowMPIntoperator-- ()
 
void print (llvm::raw_ostream &os) const
 
void dump () const
 
unsigned getBitWidth () const
 

Friends

SlowMPInt abs (const SlowMPInt &x)
 Redeclarations of friend declarations above to make it discoverable by lookups. More...
 
SlowMPInt ceilDiv (const SlowMPInt &lhs, const SlowMPInt &rhs)
 
SlowMPInt floorDiv (const SlowMPInt &lhs, const SlowMPInt &rhs)
 
SlowMPInt gcd (const SlowMPInt &a, const SlowMPInt &b)
 The operands must be non-negative for gcd. More...
 
llvm::hash_code hash_value (const SlowMPInt &x)
 Overload to compute a hash_code for a SlowMPInt value. More...
 

Detailed Description

A simple class providing multi-precision arithmetic.

Internally, it stores an APInt, whose width is doubled whenever an overflow occurs at a certain width. The default constructor sets the initial width to 64. SlowMPInt is primarily intended to be used as a slow fallback path for the upcoming MPInt class.

Definition at line 35 of file SlowMPInt.h.

Constructor & Destructor Documentation

◆ SlowMPInt() [1/3]

SlowMPInt::SlowMPInt ( int64_t  val)
explicit

Definition at line 24 of file SlowMPInt.cpp.

◆ SlowMPInt() [2/3]

SlowMPInt::SlowMPInt ( )

Definition at line 25 of file SlowMPInt.cpp.

Referenced by operator%(), operator*(), operator+(), operator-(), operator/(), and operator=().

◆ SlowMPInt() [3/3]

SlowMPInt::SlowMPInt ( const llvm::APInt &  val)
explicit

Definition at line 26 of file SlowMPInt.cpp.

Member Function Documentation

◆ dump()

void SlowMPInt::dump ( ) const

Definition at line 39 of file SlowMPInt.cpp.

References print().

◆ getBitWidth()

unsigned mlir::presburger::detail::SlowMPInt::getBitWidth ( ) const
inline

Definition at line 78 of file SlowMPInt.h.

◆ operator int64_t()

SlowMPInt::operator int64_t ( ) const
explicit

Definition at line 28 of file SlowMPInt.cpp.

◆ operator!=()

bool SlowMPInt::operator!= ( const SlowMPInt o) const

Definition at line 147 of file SlowMPInt.cpp.

References getMaxWidth().

◆ operator%()

SlowMPInt SlowMPInt::operator% ( const SlowMPInt o) const

This operation cannot overflow.

Definition at line 245 of file SlowMPInt.cpp.

References max(), and SlowMPInt().

◆ operator%=()

SlowMPInt & SlowMPInt::operator%= ( const SlowMPInt o)

Definition at line 278 of file SlowMPInt.cpp.

◆ operator*()

SlowMPInt SlowMPInt::operator* ( const SlowMPInt o) const

Definition at line 200 of file SlowMPInt.cpp.

References runOpWithExpandOnOverflow(), and SlowMPInt().

◆ operator*=()

SlowMPInt & SlowMPInt::operator*= ( const SlowMPInt o)

Definition at line 270 of file SlowMPInt.cpp.

◆ operator+()

SlowMPInt SlowMPInt::operator+ ( const SlowMPInt o) const

Definition at line 192 of file SlowMPInt.cpp.

References runOpWithExpandOnOverflow(), and SlowMPInt().

◆ operator++()

SlowMPInt & SlowMPInt::operator++ ( )

Definition at line 282 of file SlowMPInt.cpp.

◆ operator+=()

SlowMPInt & SlowMPInt::operator+= ( const SlowMPInt o)

Assignment operators, preincrement, predecrement.

Definition at line 262 of file SlowMPInt.cpp.

◆ operator-() [1/2]

SlowMPInt SlowMPInt::operator- ( ) const

Overflow only occurs when the value is the minimum possible value.

Definition at line 250 of file SlowMPInt.cpp.

References SlowMPInt().

◆ operator-() [2/2]

SlowMPInt SlowMPInt::operator- ( const SlowMPInt o) const

Definition at line 196 of file SlowMPInt.cpp.

References runOpWithExpandOnOverflow(), and SlowMPInt().

◆ operator--()

SlowMPInt & SlowMPInt::operator-- ( )

Definition at line 287 of file SlowMPInt.cpp.

◆ operator-=()

SlowMPInt & SlowMPInt::operator-= ( const SlowMPInt o)

Definition at line 266 of file SlowMPInt.cpp.

◆ operator/()

SlowMPInt SlowMPInt::operator/ ( const SlowMPInt o) const

Definition at line 204 of file SlowMPInt.cpp.

References runOpWithExpandOnOverflow(), and SlowMPInt().

◆ operator/=()

SlowMPInt & SlowMPInt::operator/= ( const SlowMPInt o)

Definition at line 274 of file SlowMPInt.cpp.

◆ operator<()

bool SlowMPInt::operator< ( const SlowMPInt o) const

Definition at line 155 of file SlowMPInt.cpp.

References getMaxWidth().

◆ operator<=()

bool SlowMPInt::operator<= ( const SlowMPInt o) const

Definition at line 159 of file SlowMPInt.cpp.

References getMaxWidth().

◆ operator=()

SlowMPInt & SlowMPInt::operator= ( int64_t  val)

Definition at line 27 of file SlowMPInt.cpp.

References SlowMPInt().

◆ operator==()

bool SlowMPInt::operator== ( const SlowMPInt o) const

Comparison operators.

Definition at line 143 of file SlowMPInt.cpp.

References getMaxWidth().

◆ operator>()

bool SlowMPInt::operator> ( const SlowMPInt o) const

Definition at line 151 of file SlowMPInt.cpp.

References getMaxWidth().

◆ operator>=()

bool SlowMPInt::operator>= ( const SlowMPInt o) const

Definition at line 163 of file SlowMPInt.cpp.

References getMaxWidth().

◆ print()

void SlowMPInt::print ( llvm::raw_ostream &  os) const

Printing.

Definition at line 37 of file SlowMPInt.cpp.

Referenced by dump().

Friends And Related Function Documentation

◆ abs

SlowMPInt abs ( const SlowMPInt x)
friend

Redeclarations of friend declarations above to make it discoverable by lookups.

◆ ceilDiv

SlowMPInt ceilDiv ( const SlowMPInt lhs,
const SlowMPInt rhs 
)
friend

◆ floorDiv

SlowMPInt floorDiv ( const SlowMPInt lhs,
const SlowMPInt rhs 
)
friend

◆ gcd

SlowMPInt gcd ( const SlowMPInt a,
const SlowMPInt b 
)
friend

The operands must be non-negative for gcd.

◆ hash_value

llvm::hash_code hash_value ( const SlowMPInt x)
friend

Overload to compute a hash_code for a SlowMPInt value.


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