Sujet : Re: Calling conventions (particularly 32-bit ARM)
De : monnier (at) *nospam* iro.umontreal.ca (Stefan Monnier)
Groupes : comp.archDate : 09. Jan 2025, 00:20:43
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <jwvr05cq4tx.fsf-monnier+comp.arch@gnu.org>
References : 1 2 3 4
User-Agent : Gnus/5.13 (Gnus v5.13)
ABI calling conventions tend to be designed to support at least C,
including varargs and often also tolerant of differences between the
number of arguments in the caller and callee.
I can agree that it's important to support those use-cases (varargs
obviously, mismatched arg numbers less so), but I think the focus of
optimization of the ABI should be calls to functions known to take the
exact same number of arguments (after all, even in C we normally know
the prototype of the called function; only sloppy ancient C calls
functions without proper declarations), even if it comes at the cost of
using different calling conventions for the two cases.
But in any case, I suspect there are also diminishing returns at some
point: how much faster is it in practice to pass/return 13 values in
registers instead of 8 of them in registers and the remaining 5 on
the stack? I expect a 13-arg function to perform an amount
of work that will dwarf the extra work of going through the stack.
I certainly have a use for as many arguments as the ABI provides,
Ah, yes, machine-generated code can always defy intuitions about what
is "typical". 🙂
Stefan