Achieving Optimal Performance from C/C++ Source Code
If
above were called in two places with global arrays as arguments, then
fn
IPA would have the results shown below:
fn(glob1, glob2, N);
fn(glob1, glob2, N);
Good: sets for
fn(glob1, glob2, N);
fn(glob3, glob4, N);
Good: sets for
fn(glob1, glob2, N);
fn(glob3, glob1, N);
Bad: sets intersect - both
aliases.
The third case arises because IPA considers the union of all calls at once,
rather than considering each call individually, when determining whether
there is a risk of aliasing. If each call were considered individually, IPA
would have to take flow control into account and the number of permuta-
tions would make compilation time impracticably long.
The lack of control flow analysis can also create problems when a single
pointer is used in multiple contexts. For example, it is better to write:
int *p = a;
int *q = b;
// some use of p
// some use of q
Good:
and
p
than
int *p = a;
// some use of p
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
and
do not intersect:
a
b
and
do not intersect:
a
b
and
a
do not alias.
q
and
are not aliases.
a
b
and
are not aliases.
a
b
may access
b
glob1
;
and
may be
a
b
2-11
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?