https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110899

--- Comment #3 from Michael Matz <matz at gcc dot gnu.org> ---
Huh, since when does clang implement this?  See also 
  https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624004.html
where I asked for comments about a similar, but not same, mechanism.  I came
from
the angle of preserving a couple of SSE registers on x86-64.

For ABIs you generally want a good mix between caller- and callee-saved
registers. The x86-64 psABI didn't do that on the SSE regs for conscious, but
meanwhile irrelevant, reasons, so my approach above tried to rectify this.

The clang attributes seem to go against that general idea, they move all regs
(or all general regs) into being callee-saved (except, strangely for aarch64?).
It also makes argument registers be callee-saved, which is very unconventional.

Does the clang implementation take into account the various problematic cases
that arise when calling a normal function from a (say) preserve_all function
(hint: such call can't usually be done)?  Does exception handling,
setjmp/longjmp
and make/swapcontext interact with the clang attributes?

That said: the implementation itself (after a more detailed spec) can be
implemented in the same framework like the above patch.  (It's possible that
something more needs doing for the unusual situation that argument regs are
then
callee-saved).

Reply via email to