Performing Program-Level Optimization (
−
pm and
−
o3 Options)
3-9
Optimizing Your Code
Situation
Your application consists of C source code and assembly
source code. The assembly functions are interrupt service
routines that call C functions; the C functions that the assem-
bly functions call are never called from C. These C functions
act like main: they function as entry points into C.
Solution
Add the volatile keyword to the C variables that may be modi-
fied by the interrupts
.
Then, you can optimize your code in one
of these ways:
J
You achieve the best optimization by applying the
FUNC_EXT_CALLED pragma to all of the entry-point
functions called from the assembly language interrupts,
and then compiling with
−
pm
−
o3
−
op2.
Be sure that you
use the pragma with all of the entry-point functions.
If you
do not, the compiler removes the entry-point functions
that are not preceded by the FUNC_EXT_CALL pragma.
J
Compile with
−
pm
−
o3
−
op3. Because you do not use the
FUNC_EXT_CALL pragma, you must use the
−
op3 op-
tion, which is less aggressive than the
−
op2 option, and
your optimization may not be as effective.
Keep in mind that if you use
−
pm
−
o3 without additional op-
tions, the compiler removes the C functions that the assembly
functions call. Use the FUNC_EXT_CALLED pragma to keep
these functions.
Use the
−
on2 option to generate an information file to see which program-level
optimizations the compiler is applying. See section 3.2.2,
Creating an Optimi-
zaton Information File
, on page 3-5 for more information.
3.3.3 Naming the Program Compilation Output File (
−
px Option)
When you specify whole program compilation with the
−
pm option, you can
use the
−
px
filename
option to specify the name of the output file. If you specify
no assembly (
−
n shell option), the default file extension for the output file is
.asm. If you allow assembly (default shell behavior), the default file extension
for the output file is .obj. If you specify linking, you must name the output file
with the
−
o option after the
−
z option, or the name of the output file is the default
a.out.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...