public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Help with an ABI peculiarity
@ 2022-01-07 21:06 Iain Sandoe
  2022-01-07 21:55 ` Paul Koning
  2022-01-10 10:46 ` Richard Sandiford
  0 siblings, 2 replies; 13+ messages in thread
From: Iain Sandoe @ 2022-01-07 21:06 UTC (permalink / raw)
  To: GCC Development

Hi Folks,

In the aarch64 Darwin ABI we have an unusual (OK, several unusual) feature of the calling convention.

When an argument is passed *in a register* and it is integral and less than SI it is promoted (with appropriate signedness) to SI.  This applies when the function parm is named only.

When the same argument would be placed on the stack (i.e. we ran out of registers) - it occupies its natural size, and is naturally aligned (so, for instance, 3 QI values could be passed as 3 registers - promoted to SI .. or packed into three adjacent bytes on the stack)..

The key is that we need to know that the argument will be placed in a register before we decide whether to promote it.
(similarly, the promotion is not done in the callee for the in-register case).

I am trying to figure out where to implement this.

* the code that (in regular cases) decides on such promotions is called _before_ we call target’s function_arg.

* OVERRIDE_ABI_FORMAT seems to be called too early (we don’t have enough information on the function - to decide to set the PARM passed-as type).

I’ve experimented with various schemes - specifically that  tm.function_arg can alter the mode of the register in the appropriate cases, and then calls.c can act on the case that the mode has been changed by that callback.

It seems probable that this approach can be made non-invasive - but...
... if someone can point me at a better solution - I’m interested.

thanks
Iain


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-01-21 12:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 21:06 Help with an ABI peculiarity Iain Sandoe
2022-01-07 21:55 ` Paul Koning
2022-01-08 16:35   ` Jeff Law
2022-01-10  8:38     ` Florian Weimer
2022-01-10 13:27       ` Iain Sandoe
2022-01-10 13:46         ` Florian Weimer
2022-01-11 12:53         ` Eric Gallager
2022-01-11 11:57       ` Richard Earnshaw
2022-01-10 10:46 ` Richard Sandiford
2022-01-10 13:06   ` Iain Sandoe
2022-01-20 22:32     ` Richard Sandiford
2022-01-21 11:19       ` Iain Sandoe
2022-01-21 12:22         ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).