General Guidelines
•
"Indexed Arrays vs. Pointers" on page 2-12
•
"Function Inlining" on page 2-13
•
"Using Inline asm Statements" on page 2-14
•
"Memory Usage" on page 2-15
How the Compiler Can Help
The compiler provides many facilities designed to help the programmer.
Using the Compiler Optimizer
There is a vast difference in performance between code compiled opti-
mized and code compiled non-optimized. In some cases optimized code
can run ten or twenty times faster. Optimization should always be used
when measuring performance or shipping code as product.
The optimizer in the C/C++ compiler is designed to generate efficient
code from source that has been written in a straightforward manner. The
basic strategy for tuning a program is to present the algorithm in a way
that gives the optimizer excellent visibility of the operations and data, and
hence the greatest freedom to safely manipulate the code. Future releases
of the compiler will continue to enhance the optimizer, and expressing
algorithms simply will provide the best chance of benefiting from such
enhancements.
Note that the default setting (or "debug" mode within the VisualDSP++
IDDE) is for non-optimized compilation in order to assist programmers
in diagnosing problems with their initial coding. The optimizer is enabled
in VisualDSP++ by checking the Enable optimization checkbox under the
Project Options ->Compile tab. This adds the
switch
(on page
within VisualDSP++ will automatically enable optimization.
2-4
1-37) to the compiler invocation. A "release" build from
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
(enable optimization)
-O
for ADSP-219x DSPs
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?