This link has been bookmarked by 18 people . It was first bookmarked on 01 Aug 2006, by Heiko J Schick.
-
04 Jan 15
-
25 Mar 14
-
17 Dec 13
-
08 Oct 13
-
31 Dec 12
-
19 Oct 12
-
13 Oct 12
-
3.10 Options That Control Optimization
These options control various sorts of optimizations.
Without any optimization option, 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 expect from the source code.
Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program.
The compiler performs optimization based on the knowledge it has of the program. Compiling multiple files at once to a single output file mode allows the compiler to use information gained from all of the files when compiling each of them.
Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed in this section.
Most optimizations are only enabled if an -O level is set on the command line. Otherwise they are disabled, even if individual optimization flags are specified.
Depending on the target and how GCC was configured, a slightly different set of optimizations may be enabled at each -O level than those listed here. You can invoke GCC with -Q --help=optimizers to find out the exact set of optimizations that are enabled at each level. See Overall Options, for examples.
-
-
20 Jul 12
-
21 Apr 12
-
debug the program
-
at the expense of compilation time
-
-O level
-
at each -O level
-
reduce code size
-
execution time
-
performance
-
do not involve a space-speed tradeoff
-
both compilation time
-
Optimize for size
-
-
15 Mar 10
-
13 Jul 09
-
29 May 08
-
01 Aug 06
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.