[clang] [llvm] [LLVMABI] Add support for SVE types in the LLVM ABI library (PR #221375)

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 10:57:35 PDT 2026


================
@@ -209,23 +209,73 @@ class ArrayType : public Type {
   static bool classof(const Type *T) { return T->getKind() == TypeKind::Array; }
 };
 
+/// Distinguishes the vector flavors that ABIs have to treat differently.
+/// Scalability is not part of the kind. It is tracked by the vector's
+/// ElementCount, because some flavors have both a scalable and a
+/// fixed-length spelling.
+enum class VectorKind {
+  /// A plain vector, such as a Neon vector or a GCC vector_size vector.
+  Generic,
+
+  /// An AArch64 SVE data vector, such as svint32_t or svfloat64x2_t. Data
+  /// vectors are passed in Z registers.
+  SVEData,
+
+  /// An AArch64 SVE predicate vector, such as svbool_t or svboolx4_t.
+  /// Predicate vectors have one-bit elements and are passed in P registers.
+  SVEPredicate,
+
+  /// The AArch64 __SVCount_t type. It is opaque rather than a real vector,
+  /// but it occupies a predicate register, so it is given the same shape as
+  /// svbool_t.
+  SVECount,
+};
+
 class VectorType : public Type {
 private:
   const Type *ElementType;
   ElementCount NumElements;
+  VectorKind VecKind;
+  unsigned NumVectors;
----------------
andykaylor wrote:

Good question. I think maybe having an explicit TupleType would be better.

https://github.com/llvm/llvm-project/pull/221375


More information about the llvm-commits mailing list