Datasheet
C and C++ Compilers
2-24 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
2.3.9 Controlling code generation
Use the options described in this section to control aspects of the code generated by the
compiler such as optimization. See Pragmas on page 3-2 for information on additional
code generation options that are controlled using pragmas.
This section describes:
• Defining optimization criteria
• Setting the default type of unqualified floating-point constants on page 2-27
• Controlling code and data sections on page 2-28
• Setting byte order on page 2-29
• Setting alignment options on page 2-29
• Controlling implementation details on page 2-30.
Defining optimization criteria
The following options control aspects of how the compilers optimize generated code.
-O, number
This option specifies the level of optimization to be used. The
optimization levels are:
-O0
Turns off all optimization, except some simple source
transformations. This is the default optimization level if debug
tables are generated with
-g
. It gives the best possible debug
view and the lowest level of optimization.
-O1
Turns off optimizations that seriously degrade the debug view.
If used with
-g
, this option gives a satisfactory debug view
with good code density.
-O2
Generates fully optimized code. If used with
-g
, the debug
view might be less satisfactory because the mapping of object
code to source code is not always clear. This is the default
optimization level if debug tables are not generated.
See Pragmas on page 3-2 for information on controlling optimization
with pragmas.
-Ospace
This option optimizes to reduce image size at the expense of a possible
increase in execution time. For example, large structure copies are done
by out-of-line function calls instead of inline code. Use this option if code
size is more critical than performance. This is the default.
-Otime
This option optimizes to reduce execution time at the possible expense of
a larger image. Use this option if execution time is more critical than code
size. For example, it compiles: