home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
gnu
/
gcc-2.5.8-bin.lha
/
info
/
gcc.info-3
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-07-11
|
46KB
|
877 lines
This is Info file gcc.info, produced by Makeinfo-1.55 from the input
file gcc.texi.
This file documents the use and the internals of the GNU compiler.
Published by the Free Software Foundation 675 Massachusetts Avenue
Cambridge, MA 02139 USA
Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License" and "Protect
Your Freedom--Fight `Look And Feel'" are included exactly as in the
original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License" and "Protect Your Freedom--Fight `Look And Feel'", and this
permission notice, may be included in translations approved by the Free
Software Foundation instead of in the original English.
File: gcc.info, Node: Optimize Options, Next: Preprocessor Options, Prev: Debugging Options, Up: Invoking GCC
Options That Control Optimization
=================================
These options control various sorts of optimizations:
`-O1'
Optimize. Optimizing compilation takes somewhat more time, and a
lot more memory for a large function.
Without `-O', the compiler's goal is to reduce the cost of
compilation and to make debugging produce the expected results.
Statements are independent: if you stop the program with a
breakpoint between statements, you can then assign a new value to
any variable or change the program counter to any other statement
in the function and get exactly the results you would expect from
the source code.
Without `-O', only variables declared `register' are allocated in
registers. The resulting compiled code is a little worse than
produced by PCC without `-O'.
With `-O', the compiler tries to reduce code size and execution
time.
When `-O' is specified, the two options `-fthread-jumps' and
`-fdelayed-branch' are turned on. On some machines other flags may
also be turned on.
`-O2'
Optimize even more. Nearly all supported optimizations that do not
involve a space-speed tradeoff are performed. As compared to `-O',
this option increases both compilation time and the performance of
the generated code.
`-O2' turns on all optional optimizations except for loop unrolling
and frame pointer elimination.
`-O0'
Do not optimize.
If you use multiple `-O' options, with or without level numbers,
the last such option is the one that is effective.
Options of the form `-fFLAG' specify machine-independent flags.
Most flags have both positive and negative forms; the negative form of
`-ffoo' would be `-fno-foo'. In the table below, only one of the forms
is listed--the one which is not the default. You can figure out the
other form by either removing `no-' or adding it.
`-ffloat-store'
Do not store floating point variables in registers, and inhibit
other options that might change whether a floating point value is
taken from a register or memory.
This option prevents undesirable excess precision on machines such
as the 68000 where the floating registers (of the 68881) keep more
precision than a `double' is supposed to have. For most programs,
the excess precision does only good, but a few programs rely on the
precise definition of IEEE floating point. Use `-ffloat-store' for
such programs.
`-fno-default-inline'
Do not make member functions inline by default merely because they
are defined inside the class scope (C++ only). Otherwise, when
you specify `-O', member functions defined inside class scope are
compiled inline by default; i.e., you don't need to add `inline'
in front of the member function name.
`-fno-defer-pop'
Always pop the arguments to each function call as soon as that
function returns. For machines which must pop arguments after a
function call, the compiler normally lets arguments accumulate on
the stack for several function calls and pops them all at once.
`-fforce-mem'
Force memory operands to be copied into registers before doing
arithmetic on them. This may produce better code by making all
memory references potential common subexpressions. When they are
not common subexpressions, instruction combination should
eliminate the separate register-load. I am interested in hearing
about the difference this makes.
`-fforce-addr'
Force memory address constants to be copied into registers before
doing arithmetic on them. This may produce better code just as
`-fforce-mem' may. I am interested in hearing about the
difference this makes.
`-fomit-frame-pointer'
Don't keep the frame pointer in a register for functions that
don't need one. This avoids the instructions to save, set up and
restore frame pointers; it also makes an extra register available
in many functions. *It also makes debugging impossible on some
machines.*
On some machines, such as the Vax, this flag has no effect, because
the standard calling sequence automatically handles the frame
pointer and nothing is saved by pretending it doesn't exist. The
machine-description macro `FRAME_POINTER_REQUIRED' controls
whether a target machine supports this flag. *Note Registers::.
`-fno-inline'
Don't pay attention to the `inline' keyword. Normally this option
is used to keep the compiler from expanding any functions inline.
Note that if you are not optimizing, no functions can be expanded
inline.
`-finline-functions'
Integrate all simple functions into their callers. The compiler
heuristically decides which functions are simple enough to be worth
integrating in this way.
If all calls to a given function are integrated, and the function
is declared `static', then the function is normally not output as
assembler code in its own right.
`-fkeep-inline-functions'
Even if all calls to a given function are integrated, and the
function is declared `static', nevertheless output a separate
run-time callable version of the function.
`-fno-function-cse'
Do not put function addresses in registers; make each instruction
that calls a constant function contain the function's address
explicitly.
This option results in less efficient code, but some strange hacks
that alter the assembler output may be confused by the
optimizations performed when this option is not used.
`-ffast-math'
This option allows GCC to violate some ANSI or IEEE rules and/or
specifications in the interest of optimizing code for speed. For
example, it allows the compiler to assume arguments to the `sqrt'
function are non-negative numbers.
This option should never be turned on by any `-O' option since it
can result in incorrect output for programs which depend on an
exact implementation of IEEE or ANSI rules/specifications for math
functions.
The following options control specific optimizations. The `-O2'
option turns on all of these optimizations except `-funroll-loops' and
`-funroll-all-loops'. On most machines, the `-O' option turns on the
`-fthread-jumps' and `-fdelayed-branch' options, but specific machines
may handle it differently.
You can use the following flags in the rare cases when "fine-tuning"
of optimizations to be performed is desired.
`-fstrength-reduce'
Perform the optimizations of loop strength reduction and
elimination of iteration variables.
`-fthread-jumps'
Perform optimizations where we check to see if a jump branches to a
locati