16#ifndef LLVM_ADT_DYNAMICAPINT_H
17#define LLVM_ADT_DYNAMICAPINT_H
54 ValLarge.detail::SlowDynamicAPInt::~SlowDynamicAPInt();
59 initLarge(
const detail::SlowDynamicAPInt &O) {
66 new (&
ValLarge) detail::SlowDynamicAPInt(O);
76 const detail::SlowDynamicAPInt &Val)
88 "getSmall should only be called when the value stored is small!");
93 "getSmall should only be called when the value stored is small!");
99 "getLarge should only be called when the value stored is large!");
104 "getLarge should only be called when the value stored is large!");
107 explicit operator detail::SlowDynamicAPInt()
const {
109 return detail::SlowDynamicAPInt(getSmall());
121 ValLarge.detail::SlowDynamicAPInt::~SlowDynamicAPInt();
127 initLarge(O.ValLarge);
131 initSmall(O.ValSmall);
134 initLarge(O.ValLarge);
144 return static_cast<int64_t
>(getLarge());
244 const DynamicAPInt &
RHS);
254 return getSmall() == O.getSmall();
260 return getSmall() != O.getSmall();
266 return getSmall() > O.getSmall();
272 return getSmall() < O.getSmall();
278 return getSmall() <= O.getSmall();
284 return getSmall() >= O.getSmall();
296 bool Overflow =
AddOverflow(getSmall(), O.getSmall(), Result.getSmall());
309 bool Overflow =
SubOverflow(getSmall(), O.getSmall(), Result.getSmall());
322 bool Overflow =
MulOverflow(getSmall(), O.getSmall(), Result.getSmall());
392 assert(
A >= 0 &&
B >= 0 &&
"operands must be non-negative!");
418 if (
LLVM_LIKELY(getSmall() != std::numeric_limits<int64_t>::min()))
431 int64_t Result = getSmall();
432 bool Overflow =
AddOverflow(getSmall(), O.getSmall(), Result);
448 int64_t Result = getSmall();
449 bool Overflow =
SubOverflow(getSmall(), O.getSmall(), Result);
465 int64_t Result = getSmall();
466 bool Overflow =
MulOverflow(getSmall(), O.getSmall(), Result);
484 return *
this = -*
this;
485 getSmall() /= O.getSmall();
497 getSmall() /= O.getSmall();
506 return *
this = *
this % O;
583 return A.getSmall() ==
B;
584 return A.getLarge() ==
B;
588 return A.getSmall() !=
B;
589 return A.getLarge() !=
B;
593 return A.getSmall() >
B;
594 return A.getLarge() >
B;
598 return A.getSmall() <
B;
599 return A.getLarge() <
B;
603 return A.getSmall() <=
B;
604 return A.getLarge() <=
B;
608 return A.getSmall() >=
B;
609 return A.getLarge() >=
B;
613 return A ==
B.getSmall();
614 return A ==
B.getLarge();
618 return A !=
B.getSmall();
619 return A !=
B.getLarge();
623 return A >
B.getSmall();
624 return A >
B.getLarge();
628 return A <
B.getSmall();
629 return A <
B.getLarge();
633 return A <=
B.getSmall();
634 return A <=
B.getLarge();
638 return A >=
B.getSmall();
639 return A >=
B.getLarge();
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_UNLIKELY(EXPR)
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
#define LLVM_LIKELY(EXPR)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class provides support for dynamic arbitrary-precision arithmetic.
friend DynamicAPInt & operator%=(DynamicAPInt &A, int64_t B)
raw_ostream & print(raw_ostream &OS) const
friend bool operator>=(const DynamicAPInt &A, int64_t B)
friend bool operator>(const DynamicAPInt &A, int64_t B)
friend DynamicAPInt ceilDiv(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
friend bool operator!=(const DynamicAPInt &A, int64_t B)
DynamicAPInt & operator--()
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator=(const DynamicAPInt &O)
friend DynamicAPInt abs(const DynamicAPInt &X)
friend DynamicAPInt gcd(const DynamicAPInt &A, const DynamicAPInt &B)
friend DynamicAPInt lcm(const DynamicAPInt &A, const DynamicAPInt &B)
Returns the least common multiple of A and B.
friend DynamicAPInt operator+(const DynamicAPInt &A, int64_t B)
friend DynamicAPInt & operator+=(DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt()
friend DynamicAPInt operator/(const DynamicAPInt &A, int64_t B)
friend DynamicAPInt & operator*=(DynamicAPInt &A, int64_t B)
friend DynamicAPInt operator%(const DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator=(int X)
detail::SlowDynamicAPInt ValLarge
friend bool operator<(const DynamicAPInt &A, int64_t B)
void static_assert_layout()
DynamicAPInt divByPositive(const DynamicAPInt &O) const
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt(const DynamicAPInt &O)
friend DynamicAPInt & operator/=(DynamicAPInt &A, int64_t B)
DynamicAPInt operator-() const
LLVM_DUMP_METHOD void dump() const
friend hash_code hash_value(const DynamicAPInt &x)
Redeclarations of friend declaration above to make it discoverable by lookups.
DynamicAPInt & operator++()
friend bool operator<=(const DynamicAPInt &A, int64_t B)
friend DynamicAPInt mod(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
is always non-negative.
friend bool operator==(const DynamicAPInt &A, int64_t B)
We provide special implementations of the comparison operators rather than calling through as above,...
LLVM_ATTRIBUTE_ALWAYS_INLINE ~DynamicAPInt()
friend DynamicAPInt floorDiv(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
friend DynamicAPInt operator*(const DynamicAPInt &A, int64_t B)
friend DynamicAPInt & operator-=(DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt(int64_t Val)
DynamicAPInt & divByPositiveInPlace(const DynamicAPInt &O)
A simple class providing dynamic arbitrary-precision arithmetic.
An opaque object representing a hash code.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
bool operator<(int64_t V1, const APSInt &V2)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt gcd(const DynamicAPInt &A, const DynamicAPInt &B)
std::enable_if_t< std::is_signed_v< T >, T > MulOverflow(T X, T Y, T &Result)
Multiply two signed integers, computing the two's complement truncated result, returning true if an o...
constexpr bool divideSignedWouldOverflow(U Numerator, V Denominator)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt mod(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
is always non-negative.
hash_code hash_value(const FixedPointSemantics &Val)
APInt operator*(APInt a, uint64_t RHS)
APFloat abs(APFloat X)
Returns the absolute value of the argument.
constexpr T divideFloorSigned(U Numerator, V Denominator)
Returns the integer floor(Numerator / Denominator).
bool operator!=(uint64_t V1, const APInt &V2)
bool operator>=(int64_t V1, const APSInt &V2)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator+=(DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator-=(DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt floorDiv(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt operator%(const DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator*=(DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator/=(DynamicAPInt &A, int64_t B)
bool operator>(int64_t V1, const APSInt &V2)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt ceilDiv(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
static int64_t int64fromDynamicAPInt(const DynamicAPInt &X)
This just calls through to the operator int64_t, but it's useful when a function pointer is required.
constexpr T divideCeilSigned(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt lcm(const DynamicAPInt &A, const DynamicAPInt &B)
Returns the least common multiple of A and B.
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt dynamicAPIntFromInt64(int64_t X)
std::enable_if_t< std::is_signed_v< T >, T > AddOverflow(T X, T Y, T &Result)
Add two signed integers, computing the two's complement truncated result, returning true if overflow ...
APInt operator+(APInt a, const APInt &b)
std::enable_if_t< std::is_signed_v< T >, T > SubOverflow(T X, T Y, T &Result)
Subtract two signed integers, computing the two's complement truncated result, returning true if an o...
bool operator<=(int64_t V1, const APSInt &V2)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator%=(DynamicAPInt &A, int64_t B)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt operator/(const DynamicAPInt &A, int64_t B)