Should optimizing compilers automatically assign registers?

Guy Harris guy at auspex.auspex.com
Mon May 7 05:21:19 AEST 1990


The answer to the question "why doesn't -O assign things to register
automatically" is "-O means different things on different systems".

Prior to SunOS 4.0, Sun didn't have an optimizing compiler for C on the
68K that would assign variables to registers for you; 4.0 has such a
compiler, but you have to say "-O2" or higher to get that level of
optimization; "-O" is equivalent to "-O1".  The SPARC compiler gives you
"-O2" when you say "-O".  (In SunOS 4.1, "-O" means "-O2" on both 68K
and SPARC.)

Presumably, for the other machines where "p" wasn't put into a register
automatically, either the compiler won't do that for you, or you have to
ask for it with more than just "-O".



More information about the Comp.unix.wizards mailing list