Liste des Groupes | Revenir à c arch |
On 06/01/2025 21:19, MitchAlsup1 wrote:My 66000 ABI passes structs up to 8 doublewords in size as------------------------Both C and C++ provide perfectly good ways to pass data around by
address when that's what you want to do. My problem is that the calling
convention won't let me pass around data in registers when I want to do
that.
>
I don't care what the compiler does when not optimising heavily - or for
compilers that can't optimise heavily. When I am looking for efficient
code, I use optimisation - caring about inefficiencies in the calling
convention without heavy optimisation is like caring about how fast your
car goes when you keep it in first gear.
>>>Struct returns were (and AFAIK still are, many decades after>
they were added to C) a relatively rarely used feature, so Johnson
(PCC's author) probably did not want to waste a lot of effort on
making it more efficient.
In addition, the programmer has the choice of changing into pointer
form (&struct) from value form (struct) which is what we learned
was better style way back then.
>
I already know when it is best to pass a struct via a pointer, and when
it is best to pass it as a struct value. (The 32-bit ARM calling
convention happily uses registers to pass structs by value, using up to
4 registers. It's the return via registers that is missing.) I also
know when it is best for a struct return to be via an address or in
registers - but C has no way to let me choose that.
Les messages affichés proviennent d'usenet.