15#ifndef LLVM_SUPPORT_TYPESIZE_H
16#define LLVM_SUPPORT_TYPESIZE_H
45 return {
Fixed, Scalable};
56 return {
Fixed +
RHS.Fixed, Scalable +
RHS.Scalable};
59 return {
Fixed -
RHS.Fixed, Scalable -
RHS.Scalable};
63 Scalable +=
RHS.Scalable;
68 Scalable -=
RHS.Scalable;
75 return Fixed ==
RHS.Fixed && Scalable ==
RHS.Scalable;
78 return Fixed !=
RHS.Fixed || Scalable !=
RHS.Scalable;
82 explicit operator bool()
const {
return Fixed != 0 || Scalable != 0; }
102 LHS.Scalable ==
RHS.Scalable) &&
103 "Incompatible types");
104 LHS.Quantity +=
RHS.Quantity;
106 LHS.Scalable =
RHS.Scalable;
112 LHS.Scalable ==
RHS.Scalable) &&
113 "Incompatible types");
114 LHS.Quantity -=
RHS.Quantity;
116 LHS.Scalable =
RHS.Scalable;
140 template <
typename U = ScalarTy>
141 friend constexpr std::enable_if_t<std::is_signed_v<U>, LeafTy>
204 "Request for a fixed element count on a scalable object");
220 if (!
LHS.isScalable() ||
RHS.isScalable())
221 return LHS.getKnownMinValue() <
RHS.getKnownMinValue();
227 if (
LHS.isScalable() || !
RHS.isScalable())
228 return LHS.getKnownMinValue() >
RHS.getKnownMinValue();
234 if (!
LHS.isScalable() ||
RHS.isScalable())
235 return LHS.getKnownMinValue() <=
RHS.getKnownMinValue();
241 if (
LHS.isScalable() || !
RHS.isScalable())
242 return LHS.getKnownMinValue() >=
RHS.getKnownMinValue();
305 const FixedOrScalableQuantity<ElementCount, unsigned> &V)
335 TypeSize(
const FixedOrScalableQuantity<TypeSize, uint64_t> &V)
420template <
typename LeafTy,
typename ScalarTy>
438 return (HashVal - 1U);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
constexpr bool isVector() const
One or more elements.
static constexpr ElementCount getScalable(ScalarTy MinVal)
static constexpr ElementCount getFixed(ScalarTy MinVal)
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
constexpr bool isScalar() const
Exactly one element.
StackOffset holds a fixed and a scalable offset in bytes.
int64_t getFixed() const
Returns the fixed component of the stack.
StackOffset operator+(const StackOffset &RHS) const
int64_t getScalable() const
Returns the scalable component of the stack.
StackOffset operator-() const
bool operator!=(const StackOffset &RHS) const
StackOffset operator-(const StackOffset &RHS) const
bool operator==(const StackOffset &RHS) const
StackOffset & operator-=(const StackOffset &RHS)
static StackOffset get(int64_t Fixed, int64_t Scalable)
static StackOffset getScalable(int64_t Scalable)
static StackOffset getFixed(int64_t Fixed)
StackOffset & operator+=(const StackOffset &RHS)
static constexpr TypeSize getFixed(ScalarTy ExactSize)
constexpr TypeSize(ScalarTy Quantity, bool Scalable)
static constexpr TypeSize getZero()
friend constexpr TypeSize operator*(const TypeSize &LHS, const unsigned RHS)
friend constexpr TypeSize operator*(const TypeSize &LHS, const int64_t RHS)
friend constexpr TypeSize operator*(const uint64_t LHS, const TypeSize &RHS)
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
static constexpr TypeSize get(ScalarTy Quantity, bool Scalable)
friend constexpr TypeSize operator*(const TypeSize &LHS, const int RHS)
friend constexpr TypeSize operator*(const int64_t LHS, const TypeSize &RHS)
friend constexpr TypeSize operator*(const unsigned LHS, const TypeSize &RHS)
friend constexpr TypeSize operator*(const int LHS, const TypeSize &RHS)
constexpr bool isKnownMultipleOf(ScalarTy RHS) const
This function tells the caller whether the element count is known at compile time to be a multiple of...
constexpr bool hasKnownScalarFactor(const FixedOrScalableQuantity &RHS) const
Returns true if there exists a value X where RHS.multiplyCoefficientBy(X) will result in a value whos...
friend constexpr LeafTy & operator*=(LeafTy &LHS, ScalarTy RHS)
friend constexpr LeafTy operator+(const LeafTy &LHS, const LeafTy &RHS)
constexpr bool operator!=(const FixedOrScalableQuantity &RHS) const
friend constexpr LeafTy & operator-=(LeafTy &LHS, const LeafTy &RHS)
constexpr ScalarTy getFixedValue() const
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
constexpr FixedOrScalableQuantity()=default
friend constexpr LeafTy & operator+=(LeafTy &LHS, const LeafTy &RHS)
constexpr bool isNonZero() const
friend constexpr std::enable_if_t< std::is_signed_v< U >, LeafTy > operator-(const LeafTy &LHS)
void print(raw_ostream &OS) const
Printing function.
constexpr LeafTy coefficientNextPowerOf2() const
constexpr LeafTy getWithIncrement(ScalarTy RHS) const
Add RHS to the underlying quantity.
constexpr ScalarTy getKnownScalarFactor(const FixedOrScalableQuantity &RHS) const
Returns a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches ou...
constexpr FixedOrScalableQuantity(ScalarTy Quantity, bool Scalable)
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
friend constexpr LeafTy operator-(const LeafTy &LHS, const LeafTy &RHS)
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr LeafTy multiplyCoefficientBy(ScalarTy RHS) const
constexpr bool isKnownEven() const
A return value of true indicates we know at compile time that the number of elements (vscale * Min) i...
constexpr bool isFixed() const
Returns true if the quantity is not scaled by vscale.
friend constexpr LeafTy operator*(const LeafTy &LHS, ScalarTy RHS)
constexpr bool operator==(const FixedOrScalableQuantity &RHS) const
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
constexpr bool isKnownMultipleOf(const FixedOrScalableQuantity &RHS) const
Returns whether or not the callee is known to be a multiple of RHS.
constexpr bool isZero() const
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
constexpr LeafTy divideCoefficientBy(ScalarTy RHS) const
We do not provide the '/' operator here because division for polynomial types does not work in the sa...
static constexpr bool isKnownGE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
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.
void reportInvalidSizeRequest(const char *Msg)
Reports a diagnostic message to indicate an invalid size request has been done on a scalable vector.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
constexpr uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static ElementCount getEmptyKey()
static unsigned getHashValue(const ElementCount &EltCnt)
static bool isEqual(const ElementCount &LHS, const ElementCount &RHS)
static ElementCount getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...