Help with an ABI peculiarity
Jeff Law
jeffreyalaw@gmail.com
Sat Jan 8 16:35:52 GMT 2022
On 1/7/2022 2:55 PM, Paul Koning via Gcc wrote:
>
>> On Jan 7, 2022, at 4:06 PM, Iain Sandoe <iain@sandoe.co.uk> wrote:
>>
>> 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.
> I don't remember the MIPS machinery well enough, but is that a similar case? It too has register arguments (4 or 8 of them) along with stack arguments (for the rest).
Most targets these days use registers for parameter passing and
obviously we can run out of registers on all of them. The key property
is the size/alignment of the argument differs depending on if it's pass
in a register (get promoted) or passed in memory (not promoted). I'm
not immediately aware of another ABI with that feature. Though I
haven't really gone looking.
jeff
More information about the Gcc
mailing list