home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / gcc-2.5.8-bin.lha / info / gcc.info-3 (.txt) < prev    next >
GNU Info File  |  1994-02-21  |  46KB  |  877 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 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', only variables declared `register' are allocated in
  37.      registers.  The resulting compiled code is a little worse than
  38.      produced by PCC without `-O'.
  39.      With `-O', the compiler tries to reduce code size and execution
  40.      time.
  41.      When `-O' is specified, the two options `-fthread-jumps' and
  42.      `-fdelayed-branch' are turned on.  On some machines other flags may
  43.      also be turned on.
  44. `-O2'
  45.      Optimize even more.  Nearly all supported optimizations that do not
  46.      involve a space-speed tradeoff are performed.  As compared to `-O',
  47.      this option increases both compilation time and the performance of
  48.      the generated code.
  49.      `-O2' turns on all optional optimizations except for loop unrolling
  50.      and frame pointer elimination.
  51. `-O0'
  52.      Do not optimize.
  53.      If you use multiple `-O' options, with or without level numbers,
  54.      the last such option is the one that is effective.
  55.    Options of the form `-fFLAG' specify machine-independent flags.
  56. Most flags have both positive and negative forms; the negative form of
  57. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  58. is listed--the one which is not the default.  You can figure out the
  59. other form by either removing `no-' or adding it.
  60. `-ffloat-store'
  61.      Do not store floating point variables in registers, and inhibit
  62.      other options that might change whether a floating point value is
  63.      taken from a register or memory.
  64.      This option prevents undesirable excess precision on machines such
  65.      as the 68000 where the floating registers (of the 68881) keep more
  66.      precision than a `double' is supposed to have.  For most programs,
  67.      the excess precision does only good, but a few programs rely on the
  68.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  69.      such programs.
  70. `-fno-default-inline'
  71.      Do not make member functions inline by default merely because they
  72.      are defined inside the class scope (C++ only).  Otherwise, when
  73.      you specify `-O', member functions defined inside class scope are
  74.      compiled inline by default; i.e., you don't need to add `inline'
  75.      in front of the member function name.
  76. `-fno-defer-pop'
  77.      Always pop the arguments to each function call as soon as that
  78.      function returns.  For machines which must pop arguments after a
  79.      function call, the compiler normally lets arguments accumulate on
  80.      the stack for several function calls and pops them all at once.
  81. `-fforce-mem'
  82.      Force memory operands to be copied into registers before doing
  83.      arithmetic on them.  This may produce better code by making all
  84.      memory references potential common subexpressions.  When they are
  85.      not common subexpressions, instruction combination should
  86.      eliminate the separate register-load.  I am interested in hearing
  87.      about the difference this makes.
  88. `-fforce-addr'
  89.      Force memory address constants to be copied into registers before
  90.      doing arithmetic on them.  This may produce better code just as
  91.      `-fforce-mem' may.  I am interested in hearing about the
  92.      difference this makes.
  93. `-fomit-frame-pointer'
  94.      Don't keep the frame pointer in a register for functions that
  95.      don't need one.  This avoids the instructions to save, set up and
  96.      restore frame pointers; it also makes an extra register available
  97.      in many functions.  *It also makes debugging impossible on some
  98.      machines.*
  99.      On some machines, such as the Vax, this flag has no effect, because
  100.      the standard calling sequence automatically handles the frame
  101.      pointer and nothing is saved by pretending it doesn't exist.  The
  102.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  103.      whether a target machine supports this flag.  *Note Registers::.
  104. `-fno-inline'
  105.      Don't pay attention to the `inline' keyword.  Normally this option
  106.      is used to keep the compiler from expanding any functions inline.
  107.      Note that if you are not optimizing, no functions can be expanded
  108.      inline.
  109. `-finline-functions'
  110.      Integrate all simple functions into their callers.  The compiler
  111.      heuristically decides which functions are simple enough to be worth
  112.      integrating in this way.
  113.      If all calls to a given function are integrated, and the function
  114.      is declared `static', then the function is normally not output as
  115.      assembler code in its own right.
  116. `-fkeep-inline-functions'
  117.      Even if all calls to a given function are integrated, and the
  118.      function is declared `static', nevertheless output a separate
  119.      run-time callable version of the function.
  120. `-fno-function-cse'
  121.      Do not put function addresses in registers; make each instruction
  122.      that calls a constant function contain the function's address
  123.      explicitly.
  124.      This option results in less efficient code, but some strange hacks
  125.      that alter the assembler output may be confused by the
  126.      optimizations performed when this option is not used.
  127. `-ffast-math'
  128.      This option allows GCC to violate some ANSI or IEEE rules and/or
  129.      specifications in the interest of optimizing code for speed.  For
  130.      example, it allows the compiler to assume arguments to the `sqrt'
  131.      function are non-negative numbers.
  132.      This option should never be turned on by any `-O' option since it
  133.      can result in incorrect output for programs which depend on an
  134.      exact implementation of IEEE or ANSI rules/specifications for math
  135.      functions.
  136.    The following options control specific optimizations.  The `-O2'
  137. option turns on all of these optimizations except `-funroll-loops' and
  138. `-funroll-all-loops'.  On most machines, the `-O' option turns on the
  139. `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
  140. may handle it differently.
  141.    You can use the following flags in the rare cases when "fine-tuning"
  142. of optimizations to be performed is desired.
  143. `-fstrength-reduce'
  144.      Perform the optimizations of loop strength reduction and
  145.      elimination of iteration variables.
  146. `-fthread-jumps'
  147.      Perform optimizations where we check to see if a jump branches to a
  148.      locati