11/08/2010

IAR C/C++ Development Guide Compiling and linking

http://www.cadfamily.com/downinfo/302081.html

The compiler performs many transformations on your application to generate the best
possible code. Examples of such transformations are storing values in registers instead
of memory, removing superfluous code, reordering computations in a more efficient
order, and replacing arithmetic operations by cheaper operations.
The linker should also be considered an integral part of the compilation system, because
some optimizations are performed by the linker. For instance, all unused functions and
variables are removed and not included in the final output.
SCOPE FOR PERFORMED OPTIMIZATIONS
You can decide whether optimizations should be performed on your whole application
or on individual files. By default, the same types of optimizations are used for an entire
project, but you should consider using different optimization settings for individual files.
For example, put code that must execute very quickly into a separate file and compile it
for minimal execution time, and the rest of the code for minimal code size. This will give
a small program, which is still fast enough where it matters.
You can also exclude individual functions from the performed optimizations. The
#pragma optimize directive allows you to either lower the optimization level, or
specify another type of optimization to be performed. Refer to optimize, page 252, for
information about the pragma directive.

No comments: