rsandifo-arm created this revision.
Herald added subscribers: cfe-commits, rengolin.
[ Not intended for commit. I'm just posting it to back up an
RFC on cfe-dev. ]
This patch is a hack to add two new "sizeless builtin" types __SVInt8_t
and __SVInt16_t. The real SVE implementation looks nothing like this;
the patch is just the most direct way of adding two distinct sizeless
types to the type system, so that a follow-on patch can add and test
support for sizeless types in a meaningful way.
Repository:
rC Clang
https://reviews.llvm.org/D46307
Files:
include/clang/AST/ASTContext.h
include/clang/AST/BuiltinTypes.def
include/clang/AST/CanonicalType.h
include/clang/AST/Type.h
include/clang/Serialization/ASTBitCodes.h
lib/AST/ASTContext.cpp
lib/AST/ExprConstant.cpp
lib/AST/ItaniumMangle.cpp
lib/AST/MicrosoftMangle.cpp
lib/AST/NSAPI.cpp
lib/AST/Type.cpp
lib/AST/TypeLoc.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CodeGenTypes.cpp
lib/CodeGen/ItaniumCXXABI.cpp
lib/Index/USRGeneration.cpp
lib/Sema/Sema.cpp
lib/Serialization/ASTCommon.cpp
lib/Serialization/ASTReader.cpp
tools/libclang/CIndex.cpp
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:
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: 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/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/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/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 t