#pragma no_alias
Use the
#pragma no_alias
or stores that conflict due to references to the same location through dif-
ferent pointers, known as "aliases". In this example,
void vadd(int *a, int *b, int *out, int n) {
int i;
#pragma no_alias
for (i=0; i < n; i++)
out[i] = a[i] + b[i];
}
the use of
#pragma no_alias
that the pointers
or
will be using the same address as any store to
a
is never an alias for
b[i]
Using the
no_alias
loads and stores to be reordered and any number of iterations to be per-
formed concurrently, thus providing better software pipelining by the
optimizer.
General Optimization Pragmas
There are three pragmas which can change the optimization level while a
given module is being compiled. These pragmas must be used at global
scope, immediately prior to a function definition. The pragmas do not
just apply to the immediately-following function; they remain in effect
until the end of the compilation, or until superceded by a following
pragma.
optimize_
The pragmas are:
• #pragma optimize_off
This pragma turns off the optimizer, if it was enabled. This
pragma has no effect if IPA is enabled.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
to tell the compiler the following has no loads
just before the loop informs the compiler
,
and
point to different arrays, so no load from
a
b
out
.
out[i]
pragma can lead to better code because it allows the
Compiler
. Therefore,
out
a[i]
1-125
b
or
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers