egcs-1.1 status
Jeffrey A Law
law@cygnus.com
Sat Aug 22 22:04:00 GMT 1998
In message < 19980823032940.A4165@kali.lrz-muenchen.de >you write:
> How about something like
>
> register void *arga asm("eax");
> register void *argb asm("ebx");
>
> void switch_to(void)
> {
> /* use arga and argb */
> }
>
> Could this work?
The important issue is argument setup on the caller side, not the
callee side.
Presumably yould do something like
arga = something;
argb = something;
switch_to ();
Right?
Probably not. Or more correctly, I suspect the semantics of global
register variables will be unacceptable for your purposes. In particular:
Defining a global register variable in a certain register reserves that
register entirely for this use, at least within the current compilation.
The register will not be allocated for any other purpose in the functions
in the current compilation. The register will not be saved and restored by
these functions. Stores into this register are never deleted even if they
would appear to be dead, but references may be deleted or moved or
simplified.
Using eax like this would probably crash the compiler since the compiler
needs to use it as the return value register. And taking away regs
from the register allocator may cause the compiler to run out of
registers.
jeff
>
>
> > I would *love* for someone to start revamping reload since the benefits
> > both in terms of efficiency of the generated code and the user interface
> > issues with the "asm" which use too many regs are significant.
>
> This is a real problem. I encountered it while porting some MMX code
> from Visual C to gcc. The optimized inline assembler parts were using
> lots of registers, and gcc/egcs complained about register shortage in
> most cases. I ended up with having to move them into a separate assembler
> file and take the cost of the "call".
>
> -Andi
More information about the Gcc
mailing list