Add SVE opaque built-in types
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 9 Aug 2019 08:52:54 +0000 (08:52 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 9 Aug 2019 08:52:54 +0000 (08:52 +0000)
commiteb485fbc712861e37813ff93d2711c631d162f68
treea4d98d5f98b6ca91562dba8b5c2a3819546eb688
parent9693d28da8758de36adcf95614447f8ee3943ab1
Add SVE opaque built-in types

This patch adds the SVE built-in types defined by the Procedure Call
Standard for the Arm Architecture:

   https://developer.arm.com/docs/100986/0000

It handles the types in all relevant places that deal with built-in types.
At the moment, some of these places bail out with an error, including:

   (1) trying to generate LLVM IR for the types
   (2) trying to generate debug info for the types
   (3) trying to mangle the types using the Microsoft C++ ABI
   (4) trying to @encode the types in Objective C

(1) and (2) are fixed by follow-on patches but (unlike this patch)
they deal mostly with target-specific LLVM details, so seemed like
a logically separate change.  There is currently no spec for (3) and
(4), so reporting an error seems like the correct behaviour for now.

The intention is that the types will become sizeless types:

   http://lists.llvm.org/pipermail/cfe-dev/2019-June/062523.html

The main purpose of the sizeless type extension is to diagnose
impossible or dangerous uses of the types, such as any that would
require sizeof to have a meaningful defined value.

Until then, the patch sets the alignments of the types to the values
specified in the link above.  It also sets the sizes of the types to
zero, which is chosen to be consistently wrong and shouldn't affect
correctly-written code (i.e. code that would compile even with the
sizeless type extension).

The patch adds the common subset of functionality needed to test the
sizeless type extension on the one hand and to provide SVE intrinsic
functions on the other.  After this patch, the two pieces of work are
essentially independent.

The patch is based on one by Graham Hunter:

   https://reviews.llvm.org/D59245

Differential Revision: https://reviews.llvm.org/D62960

llvm-svn: 368413
35 files changed:
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/AArch64SVEACLETypes.def [new file with mode: 0644]
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Serialization/ASTBitCodes.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/AST/ItaniumMangle.cpp
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/AST/NSAPI.cpp
clang/lib/AST/PrintfFormatString.cpp
clang/lib/AST/Type.cpp
clang/lib/AST/TypeLoc.cpp
clang/lib/Basic/TargetInfo.cpp
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CodeGenTypes.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/Index/USRGeneration.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Serialization/ASTCommon.cpp
clang/lib/Serialization/ASTReader.cpp
clang/test/AST/ast-dump-aarch64-sve-types.c [new file with mode: 0644]
clang/test/CodeGen/aarch64-sve.c [new file with mode: 0644]
clang/test/CodeGenCXX/aarch64-mangle-sve-vectors-msvc.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/aarch64-mangle-sve-vectors.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/aarch64-sve-typeinfo.cpp [new file with mode: 0644]
clang/test/CodeGenObjC/aarch64-sve-types.m [new file with mode: 0644]
clang/test/PCH/aarch64-sve-types.c [new file with mode: 0644]
clang/test/Sema/aarch64-sve-types.c [new file with mode: 0644]
clang/test/SemaObjC/aarch64-sve-types.m [new file with mode: 0644]
clang/tools/libclang/CIndex.cpp
clang/unittests/AST/ASTImporterTest.cpp