[PATCH] D75570: [AST][SVE] Add new Type queries for sizeless types
Richard Sandiford via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 15:00:33 PST 2020
rsandifo-arm created this revision.
rsandifo-arm added reviewers: sdesmalen, efriedma, rovka, rjmccall.
Herald added subscribers: cfe-commits, psnobl, rkruppe, kristof.beyls, tschuett, mgorny.
Herald added a reviewer: rengolin.
Herald added a project: clang.
rsandifo-arm added a comment.
rsandifo-arm added a child revision: D75572: [Sema][SVE] Reject sizeof and alignof for sizeless types.
At the moment the queries just return true for SVE types, so an obvious alternative would be to check specifically for SVE types. The sizeless type concept is more general than that though. E.g. my understanding from:
https://gcc.gnu.org/ml/gcc/2019-11/msg00092.html
is that the RVV folks intend to use this too (both for clang and gcc).
One of the defining features of the SVE ACLE types is that they
are "sizeless"; see the SVE ACLE spec:
https://developer.arm.com/docs/100987/0000/arm-c-language-extensions-for-sve
or the email message:
http://lists.llvm.org/pipermail/cfe-dev/2019-June/062523.html
for a fuller definition of what that means.
This patch adds two associated type queries:
- isSizelessBuiltinType asks specifically about types that are built into clang. It is effectively an enum range check.
- isSizelessType instead tests for any type that has the "sizeless" type property. At the moment it only returns true for the built-in types, but it seems better not to hard-code that assumption throughout the codebase. (E.g. we could in principle support some form of user-defined sizeless types in future. Even if that seems unlikely and never actually happens, the possibility at least exists.)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75570
Files:
clang/include/clang/AST/CanonicalType.h
clang/include/clang/AST/Type.h
clang/lib/AST/Type.cpp
clang/unittests/AST/CMakeLists.txt
clang/unittests/AST/SizelessTypesTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75570.248038.patch
Type: text/x-patch
Size: 6309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200303/0ad47252/attachment-0001.bin>
More information about the cfe-commits
mailing list