On Sat, 27 Jun 1998, Andrea Arcangeli wrote:
>To be more precise is _only_ a GCC issue. GCC i386 doesn' t use registers
>for passing argument to functions only for historical reasons and because
>other i386 compilers uses stack (so if GCC would do different things
>object and libs couldn' t be sharded between compilers).
GCC passes parameters in registers with __attribute__((regparm(x)))
in function prototype.
* Why it doesn't do this by default?
"Historical reasons": you mean that if we'd change GCC to use registers
all libs compiled with older GCC would break. True...
"other i386 compilers uses stack": what other compilers are used in
Linux except GCC? EGCS and P(entium)GCC are both free compilers
which could be modified as well as GCC.
I think that there are other (commercial) compilers too? From
Portland maybe?
* Why not change all header files and insert "__attribute__((regparm(x)))"
in each function prototype?
- Because all binaries would need to be recompiled. But they have
to be recompiled anyway while moving from aout->elf or libc5->glibc.
This would be just another transition.
- Because some compilers might not support this GCC extension,
and having non-ANSI C extensions in header files would be ugly anyway.
* Would it be possible at all to start generally using register
parameter passing convention in Linux?
Definitely it would be possible.
Does anyone know how much this would actually give speedup on x86?
I don't think very much, because accessing cached stack is as fast
as registers, unless doing arithmetic there (with Pentium, that is).
It would be possible, but would it be worth the trouble?
It bothers me as I can use easily register passing with Watcom
but not in Linux ... =)
--
| Tuukka Toivonen <[EMAIL PROTECTED]> [PGP public key
| Homepage: http://www.ee.oulu.fi/~tuukkat/ available]
| Try also finger -l [EMAIL PROTECTED]
| Studying information engineering at the University of Oulu
+-----------------------------------------------------------