16#ifndef LLVM_ADT_DYNAMICAPINT_H 
   17#define LLVM_ADT_DYNAMICAPINT_H 
   56      ValLarge.detail::SlowDynamicAPInt::~SlowDynamicAPInt();
 
   61  initLarge(
const detail::SlowDynamicAPInt &O) {
 
   68      new (&
ValLarge) detail::SlowDynamicAPInt(O);
 
   78      const detail::SlowDynamicAPInt &Val)
 
   90           "getSmall should only be called when the value stored is small!");
 
   95           "getSmall should only be called when the value stored is small!");
 
  101           "getLarge should only be called when the value stored is large!");
 
  106           "getLarge should only be called when the value stored is large!");
 
  109  explicit operator detail::SlowDynamicAPInt()
 const {
 
  111      return detail::SlowDynamicAPInt(getSmall());
 
  131      ValLarge.detail::SlowDynamicAPInt::~SlowDynamicAPInt();
 
 
  137      initLarge(O.ValLarge);
 
 
  141      initSmall(O.ValSmall);
 
  144    initLarge(O.ValLarge);
 
 
  154    return static_cast<int64_t
>(getLarge());
 
 
  230#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 
 
  257                                              const DynamicAPInt &
RHS);
 
  267    return getSmall() == O.getSmall();
 
 
  273    return getSmall() != O.getSmall();
 
 
  279    return getSmall() > O.getSmall();
 
 
  285    return getSmall() < O.getSmall();
 
 
  291    return getSmall() <= O.getSmall();
 
 
  297    return getSmall() >= O.getSmall();
 
 
  309    bool Overflow = 
AddOverflow(getSmall(), O.getSmall(), Result.getSmall());
 
 
  322    bool Overflow = 
SubOverflow(getSmall(), O.getSmall(), Result.getSmall());
 
 
  335    bool Overflow = 
MulOverflow(getSmall(), O.getSmall(), Result.getSmall());
 
 
  368  return DynamicAPInt(
X >= 0 ? 
X : -
X);
 
 
  372                                                  const DynamicAPInt &
RHS) {
 
 
  383                                                   const DynamicAPInt &
RHS) {
 
 
  396                                              const DynamicAPInt &
RHS) {
 
  398    return DynamicAPInt(
mod(
LHS.getSmall(), 
RHS.getSmall()));
 
 
  404                                              const DynamicAPInt &
B) {
 
  405  assert(
A >= 0 && 
B >= 0 && 
"operands must be non-negative!");
 
  407    return DynamicAPInt(std::gcd(
A.getSmall(), 
B.getSmall()));
 
 
  414                                              const DynamicAPInt &
B) {
 
  415  DynamicAPInt 
X = 
abs(
A);
 
  416  DynamicAPInt 
Y = 
abs(
B);
 
 
  431    if (
LLVM_LIKELY(getSmall() != std::numeric_limits<int64_t>::min()))
 
 
  444    int64_t Result = getSmall();
 
  445    bool Overflow = 
AddOverflow(getSmall(), O.getSmall(), Result);
 
 
  461    int64_t Result = getSmall();
 
  462    bool Overflow = 
SubOverflow(getSmall(), O.getSmall(), Result);
 
 
  478    int64_t Result = getSmall();
 
  479    bool Overflow = 
MulOverflow(getSmall(), O.getSmall(), Result);
 
 
  497      return *
this = -*
this;
 
  498    getSmall() /= O.getSmall();
 
 
  510    getSmall() /= O.getSmall();
 
 
  519  return *
this = *
this % O;
 
 
  553  return A + DynamicAPInt(
B);
 
 
  557  return A - DynamicAPInt(
B);
 
 
  561  return A * DynamicAPInt(
B);
 
 
  565  return A / DynamicAPInt(
B);
 
 
  569  return A % DynamicAPInt(
B);
 
 
  572                                                    const DynamicAPInt &
B) {
 
  573  return DynamicAPInt(
A) + 
B;
 
 
  576                                                    const DynamicAPInt &
B) {
 
  577  return DynamicAPInt(
A) - 
B;
 
 
  580                                                    const DynamicAPInt &
B) {
 
  581  return DynamicAPInt(
A) * 
B;
 
 
  584                                                    const DynamicAPInt &
B) {
 
  585  return DynamicAPInt(
A) / 
B;
 
 
  588                                                    const DynamicAPInt &
B) {
 
  589  return DynamicAPInt(
A) % 
B;
 
 
  596    return A.getSmall() == 
B;
 
  597  return A.getLarge() == 
B;
 
 
  601    return A.getSmall() != 
B;
 
  602  return A.getLarge() != 
B;
 
 
  606    return A.getSmall() > 
B;
 
  607  return A.getLarge() > 
B;
 
 
  611    return A.getSmall() < 
B;
 
  612  return A.getLarge() < 
B;
 
 
  616    return A.getSmall() <= 
B;
 
  617  return A.getLarge() <= 
B;
 
 
  621    return A.getSmall() >= 
B;
 
  622  return A.getLarge() >= 
B;
 
 
  626    return A == 
B.getSmall();
 
  627  return A == 
B.getLarge();
 
 
  631    return A != 
B.getSmall();
 
  632  return A != 
B.getLarge();
 
 
  636    return A > 
B.getSmall();
 
  637  return A > 
B.getLarge();
 
 
  641    return A < 
B.getSmall();
 
  642  return A < 
B.getLarge();
 
 
  646    return A <= 
B.getSmall();
 
  647  return A <= 
B.getLarge();
 
 
  651    return A >= 
B.getSmall();
 
  652  return A >= 
B.getLarge();
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#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 TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
Class for arbitrary precision integers.
unsigned getBitWidth() const
Return the number of bits in the APInt.
int64_t getSExtValue() const
Get sign extended value.
This class provides support for dynamic arbitrary-precision arithmetic.
LLVM_ABI raw_ostream & print(raw_ostream &OS) const
DynamicAPInt & operator%=(const DynamicAPInt &O)
friend DynamicAPInt ceilDiv(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
DynamicAPInt & operator--()
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator=(const DynamicAPInt &O)
friend DynamicAPInt abs(const DynamicAPInt &X)
DynamicAPInt & operator/=(const DynamicAPInt &O)
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.
DynamicAPInt operator/(const DynamicAPInt &O) const
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt()
DynamicAPInt operator%(const DynamicAPInt &O) const
This operation cannot overflow.
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator=(int X)
detail::SlowDynamicAPInt ValLarge
DynamicAPInt & operator*=(const DynamicAPInt &O)
bool operator==(const DynamicAPInt &O) const
We define the operations here in the header to facilitate inlining.
LLVM_ABI void static_assert_layout()
DynamicAPInt divByPositive(const DynamicAPInt &O) const
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt(const DynamicAPInt &O)
bool operator<=(const DynamicAPInt &O) const
LLVM_ABI friend hash_code hash_value(const DynamicAPInt &x)
Redeclarations of friend declaration above to make it discoverable by lookups.
DynamicAPInt operator-() const
bool operator<(const DynamicAPInt &O) const
bool operator>=(const DynamicAPInt &O) const
LLVM_DUMP_METHOD void dump() const
DynamicAPInt & operator+=(const DynamicAPInt &O)
DynamicAPInt operator+(const DynamicAPInt &O) const
DynamicAPInt & operator-=(const DynamicAPInt &O)
DynamicAPInt & operator++()
DynamicAPInt operator*(const DynamicAPInt &O) const
bool operator!=(const DynamicAPInt &O) const
friend DynamicAPInt mod(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
is always non-negative.
LLVM_ATTRIBUTE_ALWAYS_INLINE ~DynamicAPInt()
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt(const APInt &Val)
friend DynamicAPInt floorDiv(const DynamicAPInt &LHS, const DynamicAPInt &RHS)
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt(int64_t Val)
DynamicAPInt & divByPositiveInPlace(const DynamicAPInt &O)
bool operator>(const DynamicAPInt &O) const
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)