Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include SME attributes in the name mangling of types #290

Closed
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions aapcs64/aapcs64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ changes to the content of the document for that release.
| | September 2024 | - Add soft-float PCS variant. |
| | | - Add the __arm_get_current_vg SME support routine. |
| | | - Clarify use of `it` when preserving z and p registers. |
| | | - Update C++ mangling to include SME attributes in type names |
+------------+--------------------+------------------------------------------------------------------+

References
Expand Down Expand Up @@ -3111,6 +3112,34 @@ instead.
The SVE tuple types are mangled using their ``arm_sve.h`` names
(``svBASExN_t``).

Types which have an SME streaming or ZA interface should include an additional suffix as described in the table below:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding suffixes like this would conflict with the existing mangling scheme for types. E.g. sm would normally indicate an extra short argument followed by an extra unsigned long argument (spec):

$ c++filt
_Z1fPFu10__SVInt8_tsmE
f(__SVInt8_t (*)(short, unsigned long))

I wondered whether we could use a vendor-specific qualifier (U…), but function argument types are understandably mangled without a qualifier. (For example, there is no difference between f(const int) and f(int).)

For __attribute__((arm_sve_vector_bits(N))), we used a fake template type __SVE_VLS<…, N> to attach the vector length N to the underlying standard SVE vector type. Perhaps we could do the same sort of thing here: have a fake template type that wraps the unadorned function type and adds information about the streaming mode and shared state? This would probably mean encoding that information as C++ expressions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I hopelessly confused myself while writing and rewriting the comment above, so gave the wrong reason. The problem isn't that function argument types have no qualifiers, but that function types themselves have only cv-qualifiers. The spec hard-codes markup for transactional safety (Tx), but AFAIK there's no general mechanism for adding vendor extensions at the function type level.

The conclusion is the same though :-)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to qualify functions; we don't support defining both a streaming and non-streaming function with the same signature. We only need to qualify function pointers (which, as pointers, do support qualifiers).


+-------------------------+-----------------------------+
| Type of interface | Suffix |
+=========================+=============================+
| Non-streaming (default) | None |
+-------------------------+-----------------------------+
| Streaming | sm |
+-------------------------+-----------------------------+
| Streaming-compatible | sc |
+-------------------------+-----------------------------+
| Private-ZA (default) | None |
+-------------------------+-----------------------------+
| Shared-ZA | sz |
+-------------------------+-----------------------------+

A streaming interface suffix should precede any ZA interface suffix. For example:

.. code:: c

void f(svint8_t (*fn)() __arm_inout("za") __arm_streaming) { fn(); }

is mangled as

.. code:: c

_Z1fPFu10__SVInt8_tsmszvE

.. raw:: pdf

PageBreak
Expand Down