Achieving Optimal Performance from C/C++ Source Code
The pointer style introduces additional variables that compete with the
surrounding code for resources during the compiler optimizer's analysis.
Array accesses, on the other hand, must be transformed to pointers by the
compiler and sometimes it does not do the job as well as you could do by
hand.
The best strategy is to start with array notation. If the generated code
looks unsatisfactory, try using pointers. Outside the critical loops, use the
indexed style, since it is easier to understand.
Function Inlining
The function inlining may be used in two ways
• By annotating functions in the source code with the
word. In this case, function inlining is only performed when
optimization is enabled.
• By turning on automatic inlining with the
(on page
Tip: Inline small, frequently executed functions.
You can use the compiler's
should have code generated inline at the point of call. Doing this avoids
various costs such as program flow latencies, function entry and exit
instructions and parameter passing overheads. Using an
also has the advantage that the compiler can optimize through the inline
code and does not have to assume that scratch registers and condition
states are modified by the call. Prime candidates for inlining are small, fre-
quently used functions because they will cause the least code-size increase
while giving most performance benefit.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
1-37). This switch automatically enables optimization.
inline
-Oa
keyword to indicate that functions
key-
inline
switch
function
inline
2-13
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers