Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part1. Using the compiler
Efficient coding for embedded applications
123
Both compiler options and pragma directives are available for specifying the preferred 
type and level of optimization. The chapteCompiler options contains reference 
information about the command line options used for specifying optimization type and 
level. Refer to the AVR® IAR Embedded Workbench™ IDE User Guide for information 
about the compiler options available in IAR Embedded Workbench. Refer to #pragma 
optimize
, page 221, fo
r information about the pragma directives that can be used for 
specifying optimization type and level.
FINE-TUNING ENABLED TRANSFORMATIONS
At each optimization level you can disable some of the transformations individually. To 
disable a transformation, use either the appropriate option, for instance the command 
line option 
--no_inline
, alternatively its equivalent in the IAR Embedded Workbench 
IDE Function inlining, or the 
#pragma optimize
 directive. The following 
transformations can be disabled: 
Common subexpression elimination
Function inlining
Code motion
Type-based alias analysis
Static clustering
Cross call
Common subexpression elimination   
Redundant re-evaluation of common subexpressions is by default eliminated at 
optimization levels Medium and High. This optimization normally reduces both code 
size and execution time. However, the resulting code might be difficult to debug.
Note: This option has no effect at optimization levels Low and None.
To read more about the command line option, see --no_cse, page 190.
Function inlining
 
Function inlining means that a simple function, whose definition is known at compile 
time, is integrated into the body of its caller to eliminate the overhead of the call. This 
optimization, which is performed at optimization level High, normally reduces 
execution time, but increases code size. The resulting code might also be difficult to 
debug.
The compiler decides which functions to inline. Different heuristics are used when 
optimizing for speed and size.
Note: This option has no effect at optimization levels NoneLow, and Medium.
To read more about the command line option, see --no_inline, page 190.