Optimization Levels
Optimization Tips Summary
Summary: Optimization Tips
Summary: Optimization Tips
Within C functions :
Within C functions :
Use const with variables for parameter constants
Use const with variables for parameter constants
Minimize mixing signed & unsigned ops
Minimize mixing signed & unsigned ops
Keep frames <= 64 (locals + parameters + PC)
Keep frames <= 64 (locals + parameters + PC)
Use structures <= 8 words
Use structures <= 8 words
Declare longs first, then declare
Declare longs first, then declare
ints
ints
Avoid: long = (
Avoid: long = (
int
int
*
*
int
int
)
)
Optimizing : Use
Optimizing : Use
-
-
o0,
o0,
-
-
o1,
o1,
-
-
o2,
o2,
-
-
o3 when compiling
o3 when compiling
Inline short/key functions
Inline short/key functions
Pass
Pass
inlines
inlines
between files : static
between files : static
inlines
inlines
in header files
in header files
Invoke automatic
Invoke automatic
inlining
inlining
:
:
-
-
o3
o3
-
-
oi
oi
Give compiler project visibility : use
Give compiler project visibility : use
-
-
pm and
pm and
-
-
o3
o3
Tune memory map via linker command file
Tune memory map via linker command file
Re
Re
-
-
write key code segments to use intrinsics or in assembly
write key code segments to use intrinsics or in assembly
App notes
App notes
3rd Parties
3rd Parties
: SXM changes
: SXM changes
: *
: *
-
-
SP[6bit]
SP[6bit]
: use 3 bit index mode
: use 3 bit index mode
: minimize stack holes
: minimize stack holes
: yields unpredictable results
: yields unpredictable results
The list above documents the steps that can be taken to achieve increasingly higher coding effi-
ciency. It is recommended that users first get their code to work with no optimization, and then
add optimizations until the required performance is obtained.
C28x – C Programming D - 13