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

Madhur Amilkanthwar via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 00:28:45 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;
----------------
madhur13490 wrote:

Design question before this sets: putting NumVectors on VectorType means getSizeInBits() and getNumElements() stop lining up for tuples (size counts all vectors, element count is per-vector), and a fair amount of target code reads those two together. Since IRTypeMapper already lowers a tuple to a struct of N vectors, did you consider modeling a tuple as an aggregate of single-vector types instead of a special vector? Not blocking — just want it to be a deliberate call.

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


More information about the cfe-commits mailing list