Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: comp.arch Subject: Re: Calling conventions (particularly 32-bit ARM) Date: Wed, 08 Jan 2025 18:20:43 -0500 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <4903307dfcce354508c9fc016a4c1ea1@www.novabbs.org> <2025Jan8.230846@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 09 Jan 2025 00:20:43 +0100 (CET) Injection-Info: dont-email.me; posting-host="692fcd5b3935c3b76ebd704fafa92356"; logging-data="3155425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4GFoxs9bwmaUeApyxt1GxMQMCqQbAqZQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:lP78Vnf3GlMR2iupTI53PgYf0vI= sha1:QHf7aAdkrDLu7A6e/DCEKcNyotM= Bytes: 2341 > 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