Index: include/clang/AST/ASTContext.h =================================================================== --- include/clang/AST/ASTContext.h +++ include/clang/AST/ASTContext.h @@ -1022,6 +1022,10 @@ CanQualType OCLSamplerTy, OCLEventTy, OCLClkEventTy; CanQualType OCLQueueTy, OCLReserveIDTy; CanQualType OMPArraySectionTy; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + CanQualType AArch64SVEInt8Ty, AArch64SVEInt16Ty; // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand. mutable QualType AutoDeductTy; // Deduction against 'auto'. Index: include/clang/AST/BuiltinTypes.def =================================================================== --- include/clang/AST/BuiltinTypes.def +++ include/clang/AST/BuiltinTypes.def @@ -178,6 +178,12 @@ // OpenCL reserve_id_t. BUILTIN_TYPE(OCLReserveID, OCLReserveIDTy) +// NOT intended for commit, just a crutch to provide some sizeless types. +// The real SVE support will include a way of defining target-specific +// types like these. +BUILTIN_TYPE(AArch64SVEInt8, AArch64SVEInt8Ty) +BUILTIN_TYPE(AArch64SVEInt16, AArch64SVEInt16Ty) + // This represents the type of an expression whose type is // totally unknown, e.g. 'T::foo'. It is permitted for this to // appear in situations where the structure of the type is Index: include/clang/AST/CanonicalType.h =================================================================== --- include/clang/AST/CanonicalType.h +++ include/clang/AST/CanonicalType.h @@ -265,6 +265,8 @@ // Type predicates LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjectType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteType) + LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSizelessType) + LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSizelessBuiltinType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteOrObjectType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariablyModifiedType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegerType) Index: include/clang/AST/Type.h =================================================================== --- include/clang/AST/Type.h +++ include/clang/AST/Type.h @@ -1713,6 +1713,15 @@ /// or QualType::getSingleStepDesugaredType(const ASTContext&). QualType getLocallyUnqualifiedSingleStepDesugaredType() const; + /// As an extension, we classify types as one of "sized" or "sizeless"; + /// every type is one or the other. Standard types are all sized; + /// sizeless types are purely an extension. + /// + /// Sizeless types contain data with no specified size, alignment, + /// or layout. They are always incomplete. + bool isSizelessType() const; + bool isSizelessBuiltinType() const; + /// Types are partitioned into 3 broad categories (C99 6.2.5p1): /// object types, function types, and incomplete types. Index: include/clang/Serialization/ASTBitCodes.h =================================================================== --- include/clang/Serialization/ASTBitCodes.h +++ include/clang/Serialization/ASTBitCodes.h @@ -943,6 +943,12 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ PREDEF_TYPE_##Id##_ID, #include "clang/Basic/OpenCLImageTypes.def" + + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + PREDEF_TYPE_AARCH64_SVE_INT8 = 98, + PREDEF_TYPE_AARCH64_SVE_INT16 = 99 }; /// \brief The number of predefined type IDs that are reserved for Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -1242,6 +1242,12 @@ // Builtin type used to help define __builtin_va_list. VaListTagDecl = nullptr; + + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + InitBuiltinType(AArch64SVEInt8Ty, BuiltinType::AArch64SVEInt8); + InitBuiltinType(AArch64SVEInt16Ty, BuiltinType::AArch64SVEInt16); } DiagnosticsEngine &ASTContext::getDiagnostics() const { @@ -6258,6 +6264,11 @@ #define PLACEHOLDER_TYPE(KIND, ID) \ case BuiltinType::KIND: #include "clang/AST/BuiltinTypes.def" + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: llvm_unreachable("invalid builtin type for @encode"); } llvm_unreachable("invalid BuiltinType::Kind value"); Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -7341,6 +7341,11 @@ case BuiltinType::OCLQueue: case BuiltinType::OCLReserveID: case BuiltinType::Dependent: + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type"); }; break; Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2614,6 +2614,12 @@ case BuiltinType::OCLReserveID: Out << "13ocl_reserveid"; break; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: + llvm_unreachable("Mangling of SVE types not supported yet"); } } Index: lib/AST/MicrosoftMangle.cpp =================================================================== --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -1923,6 +1923,11 @@ mangleArtificalTagType(TTK_Struct, "_Float16", {"__clang"}); break; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: case BuiltinType::Float128: case BuiltinType::Half: { DiagnosticsEngine &Diags = Context.getDiags(); Index: lib/AST/NSAPI.cpp =================================================================== --- lib/AST/NSAPI.cpp +++ lib/AST/NSAPI.cpp @@ -465,6 +465,11 @@ case BuiltinType::PseudoObject: case BuiltinType::BuiltinFn: case BuiltinType::OMPArraySection: + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: break; } Index: lib/AST/Type.cpp =================================================================== --- lib/AST/Type.cpp +++ lib/AST/Type.cpp @@ -2060,6 +2060,23 @@ } } +bool Type::isSizelessBuiltinType() const { + if (const BuiltinType *BT = getAs()) { + switch (BT->getKind()) { + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: + return true; + default: + return false; + } + } + return false; +} + +bool Type::isSizelessType() const { + return isSizelessBuiltinType(); +} + bool QualType::isPODType(const ASTContext &Context) const { // C++11 has a more relaxed definition of POD. if (Context.getLangOpts().CPlusPlus11) @@ -2707,6 +2724,13 @@ return "reserve_id_t"; case OMPArraySection: return ""; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case AArch64SVEInt8: + return "__SVInt8_t"; + case AArch64SVEInt16: + return "__SVInt16_t"; } llvm_unreachable("Invalid builtin type."); @@ -3728,6 +3752,11 @@ case BuiltinType::BuiltinFn: case BuiltinType::NullPtr: case BuiltinType::OMPArraySection: + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: return false; } llvm_unreachable("unknown builtin type"); Index: lib/AST/TypeLoc.cpp =================================================================== --- lib/AST/TypeLoc.cpp +++ lib/AST/TypeLoc.cpp @@ -344,6 +344,11 @@ case BuiltinType::LongDouble: case BuiltinType::Float16: case BuiltinType::Float128: + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: llvm_unreachable("Builtin type needs extra local data!"); // Fall through, if the impossible happens. Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -702,6 +702,12 @@ // floating point types of the same size. Encoding = llvm::dwarf::DW_ATE_float; break; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: + llvm_unreachable("codegen of SVE types not supported yet"); } switch (BT->getKind()) { Index: lib/CodeGen/CodeGenTypes.cpp =================================================================== --- lib/CodeGen/CodeGenTypes.cpp +++ lib/CodeGen/CodeGenTypes.cpp @@ -493,6 +493,13 @@ case BuiltinType::Id: #include "clang/AST/BuiltinTypes.def" llvm_unreachable("Unexpected placeholder builtin type!"); + + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: + llvm_unreachable("No LLVM equivalent of SVE types yet"); } break; } Index: lib/CodeGen/ItaniumCXXABI.cpp =================================================================== --- lib/CodeGen/ItaniumCXXABI.cpp +++ lib/CodeGen/ItaniumCXXABI.cpp @@ -2721,6 +2721,11 @@ case BuiltinType::OCLClkEvent: case BuiltinType::OCLQueue: case BuiltinType::OCLReserveID: + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: return false; case BuiltinType::Dependent: Index: lib/Index/USRGeneration.cpp =================================================================== --- lib/Index/USRGeneration.cpp +++ lib/Index/USRGeneration.cpp @@ -717,6 +717,12 @@ c = 'O'; break; case BuiltinType::ObjCSel: c = 'e'; break; + // NOT intended for commit, just a crutch to provide some + // sizeless types. The real SVE support will include a way of + // defining target-specific types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: + llvm_unreachable("USR not supported for SVE types"); } Out << c; return; Index: lib/Sema/Sema.cpp =================================================================== --- lib/Sema/Sema.cpp +++ lib/Sema/Sema.cpp @@ -250,6 +250,12 @@ addImplicitTypedef("size_t", Context.getSizeType()); } + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + addImplicitTypedef("__SVInt8_t", Context.AArch64SVEInt8Ty); + addImplicitTypedef("__SVInt16_t", Context.AArch64SVEInt16Ty); + // Initialize predefined OpenCL types and supported extensions and (optional) // core features. if (getLangOpts().OpenCL) { Index: lib/Serialization/ASTCommon.cpp =================================================================== --- lib/Serialization/ASTCommon.cpp +++ lib/Serialization/ASTCommon.cpp @@ -162,6 +162,15 @@ case BuiltinType::OMPArraySection: ID = PREDEF_TYPE_OMP_ARRAY_SECTION; break; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + ID = PREDEF_TYPE_AARCH64_SVE_INT8; + break; + case BuiltinType::AArch64SVEInt16: + ID = PREDEF_TYPE_AARCH64_SVE_INT16; + break; } return TypeIdx(ID); Index: lib/Serialization/ASTReader.cpp =================================================================== --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -6894,6 +6894,15 @@ case PREDEF_TYPE_OMP_ARRAY_SECTION: T = Context.OMPArraySectionTy; break; + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case PREDEF_TYPE_AARCH64_SVE_INT8: + T = Context.AArch64SVEInt8Ty; + break; + case PREDEF_TYPE_AARCH64_SVE_INT16: + T = Context.AArch64SVEInt16Ty; + break; } assert(!T.isNull() && "Unknown predefined type"); Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1529,6 +1529,11 @@ #define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id: #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: #include "clang/AST/BuiltinTypes.def" + // NOT intended for commit, just a crutch to provide some sizeless types. + // The real SVE support will include a way of defining target-specific + // types like these. + case BuiltinType::AArch64SVEInt8: + case BuiltinType::AArch64SVEInt16: break; case BuiltinType::ObjCId: