Skip to content

Commit 5b452bd

Browse files
committed
add isScalar and isFixedVector
1 parent 90e4215 commit 5b452bd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/include/llvm/CodeGenTypes/LowLevelType.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ class LLT {
146146
constexpr bool isScalar() const { return IsScalar; }
147147
constexpr bool isToken() const { return IsScalar && RawData == 0; };
148148
constexpr bool isVector() const { return isValid() && IsVector; }
149+
constexpr bool isScalar(unsigned Size) const {
150+
return isScalar() && getScalarSizeInBits() == Size;
151+
}
149152
constexpr bool isPointer() const {
150153
return isValid() && IsPointer && !IsVector;
151154
}
@@ -176,6 +179,12 @@ class LLT {
176179
/// if the LLT is not a vector type.
177180
constexpr bool isFixedVector() const { return isVector() && !isScalable(); }
178181

182+
constexpr bool isFixedVector(unsigned NumElements,
183+
unsigned ScalarSize) const {
184+
return isFixedVector() && getNumElements() == NumElements &&
185+
getScalarSizeInBits() == ScalarSize;
186+
}
187+
179188
/// Returns true if the LLT is a scalable vector. Returns false otherwise,
180189
/// even if the LLT is not a vector type.
181190
constexpr bool isScalableVector() const { return isVector() && isScalable(); }

0 commit comments

Comments
 (0)