[PATCH] D131058: [AArch64] Add an error if SVE scalable vector types are used in a context without sve

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 02:06:32 PDT 2022


dmgreen created this revision.
dmgreen added reviewers: sdesmalen, simon_tatham, stuij, efriedma.
Herald added subscribers: ctetreau, kristof.beyls, tschuett.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a subscriber: alextsao1999.

This adds an error message if the isVLSTBuiltinTypes like `__SVFloat32_t` / `__SVInt64_t` / etc, which provide the backing for the `svfloat32_t` / `svint64_t` / etc ACLE types, are used in a function without SVE. The alternative is a crash in the backend, which is not capable of handling scalable vector types.

When SVE is available, either through a `-march=..+sve` option or via a `target("sve")` attribute, nothing should change. Without the sve feature, this patch gives an error for any function arguments, return values and variable declarations involving the scalable types. Struct/class members and global variables already give an error. (Let me know if there is anything else that should give an error. This might not be all cases, but should rule out the most obvious.) As this can be based on the current function target attributes, the error sometimes needs to be handled later than would otherwise if it was just based on the global target.

This also adds a basic initFeatureMap method for AArch64 to include a few transient sve target dependencies. This should ideally be based on the existing map of features already present in the backend, not reproduced in the target parser.


https://reviews.llvm.org/D131058

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/arm-sve-target.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131058.449595.patch
Type: text/x-patch
Size: 5235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220803/2dde19cb/attachment.bin>


More information about the llvm-commits mailing list