From: Craig Burley (burley@churchy.gnu.ai.mit.edu)
Date: 05/25/92


From: burley@churchy.gnu.ai.mit.edu (Craig Burley)
Subject: Re: GCC -O flag (was Re: Porting perl to Linux)
Date: 26 May 1992 02:02:23 GMT

In article <3546@inca.comlab.ox.ac.uk> pgr@ecs.ox.ac.uk (Partially Grown Rhododendron) writes:

   I am puzzled as to why these big -O numbers keep being suggested...
   future expansion? psychological impact?

Future expansion. In fact, the forthcoming version 3 release of GCC and
related software will provide as many as 42 optimization levels. I think
42 is chosen because of its relationship to tHHGttG, especially since there
is a 43rd level that is designated as if it were an enhancement to level 42 --
the enhancement is called "No Allowances", referring to the complete
disallowance of anything other than full global optimization no matter
what the code indicates (e.g. even without "inline", _everything_ is
inlined). So what is really level 43 is called level 42NA.

Global (inter-procedural) optimization kicks in at optimization level 22,
and at that point compiling a file doesn't really generate assembly code
per se, but a new kind of file the GNU people call an RTL Format File, or
RFF. It contains all the RTL and related info for each file. It replaces
the object (.o) file normally output via compilation at optimization levels
below 22.

The GNU ld utility has a -O option to handle the new RFF file, because only
by running GNU ld is the global optimization actually achieved. The new
option specifies that global optimization is to be performed across all RFF
files (otherwise GNU ld just optimizes each files separately).

So, to get full global optimization for a program consisting of three C
source files, one would combine compile-time optimization level 42 No
Allowances (42NA) with link-time optimization global-RFF (-ORFF), as in
the following example, which also illustrates the psychological impact
suggested by the posting to which I am responding:

    cc -O42NA -c foo.c bar.c bletch.c
    ld -ORFF -o foo foo.rff bar.rff bletch.rff

I expect this sort of thing will be an Omen of the inevitable Glory to come
in the world of free software!