MLIR  16.0.0git
Classes | Functions
mlir::presburger::detail Namespace Reference

Classes

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

Functions

LLVM_ATTRIBUTE_ALWAYS_INLINE bool addOverflow (int64_t x, int64_t y, int64_t &result)
 If builtin intrinsics for overflow-checked arithmetic are available, use them. More...
 
LLVM_ATTRIBUTE_ALWAYS_INLINE bool subOverflow (int64_t x, int64_t y, int64_t &result)
 
LLVM_ATTRIBUTE_ALWAYS_INLINE bool mulOverflow (int64_t x, int64_t y, int64_t &result)
 
LLVM_ATTRIBUTE_ALWAYS_INLINE bool divWouldOverflow (int64_t x, int64_t y)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const SlowMPInt &x)
 
SlowMPInt mod (const SlowMPInt &lhs, const SlowMPInt &rhs)
 Returns the remainder of dividing LHS by RHS. More...
 
SlowMPInt lcm (const SlowMPInt &a, const SlowMPInt &b)
 Returns the least common multiple of 'a' and 'b'. More...
 
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)
 
llvm::hash_code hash_value (const SlowMPInt &x)
 
SlowMPIntoperator+= (SlowMPInt &a, int64_t b)
 

Convenience operator overloads for int64_t. More...

 
SlowMPIntoperator-= (SlowMPInt &a, int64_t b)
 
SlowMPIntoperator*= (SlowMPInt &a, int64_t b)
 
SlowMPIntoperator/= (SlowMPInt &a, int64_t b)
 
SlowMPIntoperator%= (SlowMPInt &a, int64_t b)
 
bool operator== (const SlowMPInt &a, int64_t b)
 
bool operator!= (const SlowMPInt &a, int64_t b)
 
bool operator> (const SlowMPInt &a, int64_t b)
 
bool operator< (const SlowMPInt &a, int64_t b)
 
bool operator<= (const SlowMPInt &a, int64_t b)
 
bool operator>= (const SlowMPInt &a, int64_t b)
 
SlowMPInt operator+ (const SlowMPInt &a, int64_t b)
 
SlowMPInt operator- (const SlowMPInt &a, int64_t b)
 
SlowMPInt operator* (const SlowMPInt &a, int64_t b)
 
SlowMPInt operator/ (const SlowMPInt &a, int64_t b)
 
SlowMPInt operator% (const SlowMPInt &a, int64_t b)
 
bool operator== (int64_t a, const SlowMPInt &b)
 
bool operator!= (int64_t a, const SlowMPInt &b)
 
bool operator> (int64_t a, const SlowMPInt &b)
 
bool operator< (int64_t a, const SlowMPInt &b)
 
bool operator<= (int64_t a, const SlowMPInt &b)
 
bool operator>= (int64_t a, const SlowMPInt &b)
 
SlowMPInt operator+ (int64_t a, const SlowMPInt &b)
 
SlowMPInt operator- (int64_t a, const SlowMPInt &b)
 
SlowMPInt operator* (int64_t a, const SlowMPInt &b)
 
SlowMPInt operator/ (int64_t a, const SlowMPInt &b)
 
SlowMPInt operator% (int64_t a, const SlowMPInt &b)
 

Function Documentation

◆ abs()

SlowMPInt mlir::detail::abs ( const SlowMPInt x)

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

Definition at line 200 of file SlowMPInt.cpp.

Referenced by mlir::presburger::lcm(), and mlir::presburger::MPInt::operator int64_t().

◆ addOverflow()

LLVM_ATTRIBUTE_ALWAYS_INLINE bool mlir::presburger::detail::addOverflow ( int64_t  x,
int64_t  y,
int64_t &  result 
)

If builtin intrinsics for overflow-checked arithmetic are available, use them.

Otherwise, call through to LLVM's overflow-checked arithmetic functionality. Those functions also have such macro-gated uses of intrinsics but they are not always_inlined, which is important for us to achieve high-performance; calling the functions directly would result in a slowdown of 1.15x.

Definition at line 44 of file MPInt.h.

Referenced by mlir::presburger::MPInt::operator+(), and mlir::presburger::MPInt::operator+=().

◆ ceilDiv()

SlowMPInt mlir::detail::ceilDiv ( const SlowMPInt lhs,
const SlowMPInt rhs 
)

◆ divWouldOverflow()

LLVM_ATTRIBUTE_ALWAYS_INLINE bool mlir::presburger::detail::divWouldOverflow ( int64_t  x,
int64_t  y 
)

◆ floorDiv()

SlowMPInt mlir::detail::floorDiv ( const SlowMPInt lhs,
const SlowMPInt rhs 
)

Definition at line 208 of file SlowMPInt.cpp.

Referenced by mlir::presburger::floorDiv().

◆ gcd()

SlowMPInt mlir::detail::gcd ( const SlowMPInt a,
const SlowMPInt b 
)

◆ hash_value()

llvm::hash_code mlir::detail::hash_value ( const SlowMPInt x)

◆ lcm()

SlowMPInt mlir::detail::lcm ( const SlowMPInt a,
const SlowMPInt b 
)

Returns the least common multiple of 'a' and 'b'.

Definition at line 230 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::abs, and mlir::presburger::detail::SlowMPInt::gcd.

◆ mod()

SlowMPInt mlir::detail::mod ( const SlowMPInt lhs,
const SlowMPInt rhs 
)

Returns the remainder of dividing LHS by RHS.

is always non-negative.

The RHS is always expected to be positive, and the result is always non-negative.

Definition at line 217 of file SlowMPInt.cpp.

Referenced by mlir::presburger::detail::SlowMPInt::getBitWidth(), mlir::presburger::mod(), and mlir::presburger::mpintFromInt64().

◆ mulOverflow()

LLVM_ATTRIBUTE_ALWAYS_INLINE bool mlir::presburger::detail::mulOverflow ( int64_t  x,
int64_t  y,
int64_t &  result 
)

◆ operator!=() [1/2]

bool mlir::detail::operator!= ( const SlowMPInt a,
int64_t  b 
)

◆ operator!=() [2/2]

bool mlir::detail::operator!= ( int64_t  a,
const SlowMPInt b 
)

Definition at line 95 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator%() [1/2]

SlowMPInt mlir::detail::operator% ( const SlowMPInt a,
int64_t  b 
)

◆ operator%() [2/2]

SlowMPInt mlir::detail::operator% ( int64_t  a,
const SlowMPInt b 
)

Definition at line 122 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator%=()

SlowMPInt & mlir::detail::operator%= ( SlowMPInt a,
int64_t  b 
)

◆ operator*() [1/2]

SlowMPInt mlir::detail::operator* ( const SlowMPInt a,
int64_t  b 
)

◆ operator*() [2/2]

SlowMPInt mlir::detail::operator* ( int64_t  a,
const SlowMPInt b 
)

Definition at line 116 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator*=()

SlowMPInt & mlir::detail::operator*= ( SlowMPInt a,
int64_t  b 
)

◆ operator+() [1/2]

SlowMPInt mlir::detail::operator+ ( const SlowMPInt a,
int64_t  b 
)

◆ operator+() [2/2]

SlowMPInt mlir::detail::operator+ ( int64_t  a,
const SlowMPInt b 
)

Definition at line 110 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator+=()

SlowMPInt & mlir::detail::operator+= ( SlowMPInt a,
int64_t  b 
)


Convenience operator overloads for int64_t.


Definition at line 42 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

Referenced by mlir::presburger::MPInt::operator int64_t().

◆ operator-() [1/2]

SlowMPInt mlir::detail::operator- ( const SlowMPInt a,
int64_t  b 
)

◆ operator-() [2/2]

SlowMPInt mlir::detail::operator- ( int64_t  a,
const SlowMPInt b 
)

Definition at line 113 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator-=()

SlowMPInt & mlir::detail::operator-= ( SlowMPInt a,
int64_t  b 
)

◆ operator/() [1/2]

SlowMPInt mlir::detail::operator/ ( const SlowMPInt a,
int64_t  b 
)

◆ operator/() [2/2]

SlowMPInt mlir::detail::operator/ ( int64_t  a,
const SlowMPInt b 
)

Definition at line 119 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator/=()

SlowMPInt & mlir::detail::operator/= ( SlowMPInt a,
int64_t  b 
)

◆ operator<() [1/2]

bool mlir::detail::operator< ( const SlowMPInt a,
int64_t  b 
)

◆ operator<() [2/2]

bool mlir::detail::operator< ( int64_t  a,
const SlowMPInt b 
)

Definition at line 101 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator<<()

llvm::raw_ostream & mlir::detail::operator<< ( llvm::raw_ostream &  os,
const SlowMPInt x 
)

◆ operator<=() [1/2]

bool mlir::detail::operator<= ( const SlowMPInt a,
int64_t  b 
)

◆ operator<=() [2/2]

bool mlir::detail::operator<= ( int64_t  a,
const SlowMPInt b 
)

Definition at line 104 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator==() [1/2]

bool mlir::detail::operator== ( const SlowMPInt a,
int64_t  b 
)

◆ operator==() [2/2]

bool mlir::detail::operator== ( int64_t  a,
const SlowMPInt b 
)

Definition at line 92 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator>() [1/2]

bool mlir::detail::operator> ( const SlowMPInt a,
int64_t  b 
)

◆ operator>() [2/2]

bool mlir::detail::operator> ( int64_t  a,
const SlowMPInt b 
)

Definition at line 98 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ operator>=() [1/2]

bool mlir::detail::operator>= ( const SlowMPInt a,
int64_t  b 
)

◆ operator>=() [2/2]

bool mlir::detail::operator>= ( int64_t  a,
const SlowMPInt b 
)

Definition at line 107 of file SlowMPInt.cpp.

References mlir::presburger::detail::SlowMPInt::SlowMPInt().

◆ subOverflow()

LLVM_ATTRIBUTE_ALWAYS_INLINE bool mlir::presburger::detail::subOverflow ( int64_t  x,
int64_t  y,
int64_t &  result 
)