home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.5.8-bin.lha / GNU / info / gcc.info-3 (.txt) < prev    next >
GNU Info File  |  1994-09-02  |  48KB  |  925 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  23. Options That Control Optimization
  24. =================================
  25.    These options control various sorts of optimizations:
  26. `-O1'
  27.      Optimize.  Optimizing compilation takes somewhat more time, and a
  28.      lot more memory for a large function.
  29.      Without `-O', the compiler's goal is to reduce the cost of
  30.      compilation and to make debugging produce the expected results.
  31.      Statements are independent: if you stop the program with a
  32.      breakpoint between statements, you can then assign a new value to
  33.      any variable or change the program counter to any other statement
  34.      in the function and get exactly the results you would expect from
  35.      the source code.
  36.      Without `-O', the compiler only allocates variables declared
  37.      `register' in registers.  The resulting compiled code is a little
  38.      worse than produced by PCC without `-O'.
  39.      With `-O', the compiler tries to reduce code size and execution
  40.      time.
  41.      When you specify `-O', the compiler turns on `-fthread-jumps' and
  42.      `-fdefer-pop' on all machines.  The compiler turns on
  43.      `-fdelayed-branch' on machines that have delay slots, and
  44.      `-fomit-frame-pointer' on machines that can support debugging even
  45.      without a frame pointer.  On some machines the compiler also turns
  46.      on other flags.
  47. `-O2'
  48.      Optimize even more.  GNU CC performs nearly all supported
  49.      optimizations that do not involve a space-speed tradeoff.  The
  50.      compiler does not perform loop unrolling or function inlining when
  51.      you specify `-O2'.  As compared to `-O', this option increases
  52.      both compilation time and the performance of the generated code.
  53.      `-O2' turns on all optional optimizations except for loop
  54.      unrolling, function inlining, and, on machines where it interfers
  55.      with debugging, frame pointer elimination.
  56. `-O3'
  57.      Optimize yet more.  `-O3' turns on all optimizations specified by
  58.      `-O2' and also turns on the `inline-functions' option.
  59. `-O0'
  60.      Do not optimize.
  61.      If you use multiple `-O' options, with or without level numbers,
  62.      the last such option is the one that is effective.
  63.    Options of the form `-fFLAG' specify machine-independent flags.
  64. Most flags have both positive and negative forms; the negative form of
  65. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  66. is listed--the one which is not the default.  You can figure out the
  67. other form by either removing `no-' or adding it.
  68. `-ffloat-store'
  69.      Do not store floating point variables in registers, and inhibit
  70.      other options that might change whether a floating point value is
  71.      taken from a register or memory.
  72.      This option prevents undesirable excess precision on machines such
  73.      as the 68000 where the floating registers (of the 68881) keep more
  74.      precision than a `double' is supposed to have.  For most programs,
  75.      the excess precision does only good, but a few programs rely on the
  76.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  77.      such programs.
  78. `-fno-default-inline'
  79.      Do not make member functions inline by default merely because they
  80.      are defined inside the class scope (C++ only).  Otherwise, when
  81.      you specify `-O', member functions defined inside class scope are
  82.      compiled inline by default; i.e., you don't need to add `inline'
  83.      in front of the member function name.
  84. `-fno-defer-pop'
  85.      Always pop the arguments to each function call as soon as that
  86.      function returns.  For machines which must pop arguments after a
  87.      function call, the compiler normally lets arguments accumulate on
  88.      the stack for several function calls and pops them all at once.
  89. `-fforce-mem'
  90.      Force memory operands to be copied into registers before doing
  91.      arithmetic on them.  This may produce better code by making all
  92.      memory references potential common subexpressions.  When they are
  93.      not common subexpressions, instruction combination should
  94.      eliminate the separate register-load.  I am interested in hearing
  95.      about the difference this makes.
  96. `-fforce-addr'
  97.      Force memory address constants to be copied into registers before
  98.      doing arithmetic on them.  This may produce better code just as
  99.      `-fforce-mem' may.  I am interested in hearing about the
  100.      difference this makes.
  101. `-fomit-frame-pointer'
  102.      Don't keep the frame pointer in a register for functions that
  103.      don't need one.  This avoids the instructions to save, set up and
  104.      restore frame pointers; it also makes an extra register available
  105.      in many functions.  *It also makes debugging impossible on some
  106.      machines.*
  107.      On some machines, such as the Vax, this flag has no effect, because
  108.      the standard calling sequence automatically handles the frame
  109.      pointer and nothing is saved by pretending it doesn't exist.  The
  110.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  111.      whether a target machine supports this flag.  *Note Registers::.
  112. `-fno-inline'
  113.      Don't pay attention to the `inline' keyword.  Normally this option
  114.      is used to keep the compiler from expanding any functions inline.
  115.      Note that if you are not optimizing, no functions can be expanded
  116.      inline.
  117. `-finline-functions'
  118.      Integrate all simple functions into their callers.  The compiler
  119.      heuristically decides which functions are simple enough to be worth
  120.      integrating in this way.
  121.      If all calls to a given function are integrated, and the function
  122.      is declared `static', then the function is normally not output as
  123.      assembler code in its own right.
  124. `-fkeep-inline-functions'
  125.      Even if all calls to a given function are integrated, and the
  126.      function is declared `static', nevertheless output a separate
  127.      run-time callable version of the function.
  128. `-fno-function-cse'
  129.      Do not put function addresses in registers; make each instruction
  130.      that calls a constant function contain the function's address
  131.      explicitly.
  132.      This option results in less efficient code, but some strange hacks
  133.      that alter the assembler output may be confused by the
  134.      optimizations performed when this option is not used.
  135. `-ffast-math'
  136.      This option allows GCC to violate some ANSI or IEEE rules and/or
  137.      specifications in the interest of optimizing code for speed.  For
  138.      example, it allows the compiler to assume arguments to the `sqrt'
  139.      function are non-negative numbers and that no floating-point values
  140.      are NaNs.
  141.      This option should never be turned on by any `-O' option since it
  142.      can result in incorrect output for programs which depend on an
  143.      exact implementation of IEEE or ANSI rules/specifications for math
  144.      functions.
  145.    The following options control specific optimizations.  The `-O2'
  146. option turns on all