@@ -322,13 +322,21 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
322
322
auto kind = T->getKind ();
323
323
324
324
#if CLANG_VERSION_MAJOR >= 10
325
- // Handle built-in vector types as if they're normal vector types
326
- if (kind >= BuiltinType::SveInt8 && kind <= BuiltinType::SveBool
325
+ // Recognize ARM vector types
326
+ const bool is_sve = kind >= BuiltinType::SveInt8 && kind <= BuiltinType::SveBool;
327
+ #else
328
+ const bool is_sve = false ;
329
+ #endif // CLANG_VERSION_MAJOR >= 10
330
+
327
331
#if CLANG_VERSION_MAJOR >= 13
328
- /* RISC-V vector types */
329
- || kind >= BuiltinType::RvvInt8mf8 && kind <= BuiltinType::RvvBool64
332
+ // Recognize RISC-V vector types
333
+ const bool is_rvv = kind >= BuiltinType::RvvInt8mf8 && kind <= BuiltinType::RvvBool64;
334
+ #else
335
+ const bool is_rvv = false ;
330
336
#endif // CLANG_VERSION_MAJOR >= 13
331
- ) {
337
+
338
+ // Handle built-in vector types as if they're normal vector types
339
+ if (is_sve || is_rvv) {
332
340
// Declare ElemType and ElemCount as needed by various Clang versions
333
341
#if CLANG_VERSION_MAJOR >= 11
334
342
auto Info = Context->getBuiltinVectorTypeInfo (T);
@@ -348,6 +356,7 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
348
356
auto ElemType = [&] {
349
357
switch (kind) {
350
358
default : llvm_unreachable (" Unknown builtin SVE type!" );
359
+ #if CLANG_VERSION_MAJOR >= 10
351
360
case BuiltinType::SveInt8: return Ctx.SignedCharTy ;
352
361
case BuiltinType::SveUint8: return Ctx.UnsignedCharTy ;
353
362
case BuiltinType::SveBool: return Ctx.UnsignedCharTy ;
@@ -360,6 +369,7 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
360
369
case BuiltinType::SveFloat16: return Ctx.Float16Ty ;
361
370
case BuiltinType::SveFloat32: return Ctx.FloatTy ;
362
371
case BuiltinType::SveFloat64: return Ctx.DoubleTy ;
372
+ #endif // CLANG_VERSION_MAJOR >= 10
363
373
}
364
374
}();
365
375
// All the SVE types present in Clang 10 are 128-bit vectors
@@ -377,7 +387,6 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
377
387
VisitQualType (ElemType);
378
388
return ;
379
389
}
380
- #endif // CLANG_VERSION_MAJOR >= 10
381
390
382
391
const TypeTag tag = [&] {
383
392
switch (kind) {
0 commit comments