[PATCH] D157269: [Clang][AArch64] Diagnostics for SME attributes when target doesn't have 'sme'

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 10:56:09 PDT 2023


rsandifo-arm added inline comments.


================
Comment at: clang/test/Sema/aarch64-sme-func-attrs-without-target-feature.cpp:20
+
+// No code is generated for declarations, so it should be fine to declare using the attribute.
+void streaming_compatible_decl() __arm_streaming_compatible; // OK
----------------
aaron.ballman wrote:
> Is this a requirement of the specification? I guess I was surprised we're going to these lengths rather than diagnosing the attribute in SemaDeclAttr.cpp when sme is not enabled.
Yeah.  The problem is that it's possible (and reasonable!) to enable SME for only part of a translation unit.  E.g. an ifunc might have SME and non-SME implementations, with those implementations being in the same translation unit.  Things like the `target` and `target_version` attributes exist to allow this.

A function that's compiled with SME enabled might want to call streaming functions.  There therefore needs to be a way of declaring streaming functions without assuming that the whole TU is SME.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157269/new/

https://reviews.llvm.org/D157269



More information about the cfe-commits mailing list