On Sun, 5 Jul 1998, Glynn Clements wrote:

>If the function performs a multiply, or calls another function, you're
>just going to have to save eax in memory anyhow, so it may as well
>start off there.

Yes but in a lot of cases you would need to load something from the stack
to make some operation on it. If you have just the value in eax (even if
you will have to move eax in ebx) you will not access memory. What I would
to tell is that it can be not an advantage, but it can' t see a
disavantage having a parameter just in eax.

>What is the difference if you use `-O3' (which enables the
>`-finline-functions' option)?

This make no sense at all. I just tried it. If the function are inlined
the stack is not accessed and `call' is not recalled. Did you compile all
your software with -O3? Maybe you have more memory and HD space then me
;-). The issue was the calling convention and with -O3 there aren' t
calls.

>Trivial functions would typically benefit most from a register-based
>calling convention. But in practice, a function as trivial as `return
>++t' wouldn't be a separate function. And the simple functions that do
>exist in a real world program would often be inlined. So this example

Right.

>doesn't really tell us how much difference a register-based calling
>convention would make to real world programs.

This is true. The program show the best case (I just said this). The fact
is that I can' t see the regparm(1) worst case to perform worse than
regparm(0). I see regparm(1) only as an improvement that in the best case
can help much and in the worse case will simply will not help. So why not
go fast in the best case?

Is there a case where regparm(1) hurt more than regparm(0)? Note that
there should be no differences in pushing eax on the stack inside the
callee (is this the right spelling? ;-) or inside the caller.

Andrea[s] Arcangeli

Reply via email to