Performing Program-Level Optimization (
−
pm and
−
o3 Options)
3-6
3.3 Performing Program-Level Optimization (
−
pm and
−
o3 Options)
You can specify program-level optimization by using the
−
pm option with the
−
o3 option. With program-level optimization, all of your source files are
compiled into one intermediate file called a
module
. The module moves to the
optimization and code generation passes of the compiler. Because the com-
piler can see the entire program, it performs several optimizations that are
rarely applied during file-level optimization:
-
If a particular argument in a function always has the same value, the com-
piler replaces the argument with the value and passes the value instead
of the argument.
-
If a return value of a function is never used, the compiler deletes the return
code in the function.
-
If a function is not called, directly or indirectly, the compiler removes the
function.
To see which program-level optimizations the compiler is applying, use the
−
on2 option to generate an information file. See section 3.2.2,
Creating an Op-
timization Information File (
−
on
n
Option)
,
on page 3-5 for more information.
3.3.1 Controlling Program-Level Optimization (
−
op
n
Option)
You can control program-level optimization, which you invoke with
−
pm
−
o3,
by using the
−
op option. Specifically, the
−
op option indicates if functions in
other modules can call a module’s external functions or modify a module’s ex-
ternal variables. The number following
−
op indicates the level you set for the
module that you are allowing to be called or modified. The
−
o3 option com-
bines this information with its own file-level analysis to decide whether to treat
this module’s external function and variable declarations as if they had been
declared static. Use Table 3
4 to select the appropriate level to append to the
−
op option.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...