15#ifndef LLVM_SUPPORT_TYPESIZE_H
16#define LLVM_SUPPORT_TYPESIZE_H
36 :
Fixed(Fixed), Scalable(Scalable) {}
40 static StackOffset
getFixed(int64_t Fixed) {
return {Fixed, 0}; }
41 static StackOffset
getScalable(int64_t Scalable) {
return {0, Scalable}; }
42 static StackOffset
get(int64_t Fixed, int64_t Scalable) {
43 return {Fixed, Scalable};
54 return {Fixed +
RHS.Fixed, Scalable +
RHS.Scalable};
57 return {Fixed -
RHS.Fixed, Scalable -
RHS.Scalable};
61 Scalable +=
RHS.Scalable;
66 Scalable -=
RHS.Scalable;
69 StackOffset
operator-()
const {
return {-Fixed, -Scalable}; }
73 return Fixed ==
RHS.Fixed && Scalable ==
RHS.Scalable;
76 return Fixed !=
RHS.Fixed || Scalable !=
RHS.Scalable;
80 explicit operator bool()
const {
return Fixed != 0 || Scalable != 0; }
100 LHS.Scalable ==
RHS.Scalable) &&
101 "Incompatible types");
102 LHS.Quantity +=
RHS.Quantity;
104 LHS.Scalable =
RHS.Scalable;
110 LHS.Scalable ==
RHS.Scalable) &&
111 "Incompatible types");
112 LHS.Quantity -=
RHS.Quantity;
114 LHS.Scalable =
RHS.Scalable;
138 template <
typename U = ScalarTy>
139 friend constexpr std::enable_if_t<std::is_signed_v<U>, LeafTy>
202 "Request for a fixed element count on a scalable object");
218 if (!
LHS.isScalable() ||
RHS.isScalable())
219 return LHS.getKnownMinValue() <
RHS.getKnownMinValue();
225 if (
LHS.isScalable() || !
RHS.isScalable())
226 return LHS.getKnownMinValue() >
RHS.getKnownMinValue();
232 if (!
LHS.isScalable() ||
RHS.isScalable())
233 return LHS.getKnownMinValue() <=
RHS.getKnownMinValue();
239 if (
LHS.isScalable() || !
RHS.isScalable())
240 return LHS.getKnownMinValue() >=
RHS.getKnownMinValue();
344 return TypeSize(ExactSize,
false);
347 return TypeSize(MinimumSize,
true);
349 static constexpr TypeSize
getZero() {
return TypeSize(0,
false); }
378 "Cannot implicitly convert a scalable size to a fixed-width size in "
379 "`TypeSize::operator ScalarTy()`");
425template <
typename LeafTy,
typename ScalarTy>
443 return (HashVal - 1U);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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.
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.
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
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...