Getting The Most From Ipa; Initializing Constants Statically - Analog Devices VISUALDSP++ 3.5 Manual

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

Achieving Optimal Performance from C/C++ Source Code

Getting the Most from IPA

Interprocedural analysis (IPA) is designed to try to propagate information
about the program to parts of the optimizer that can use it. This section
looks at what information is useful, and how to structure your code to
make this information easily accessible to the analysis.

Initializing Constants Statically

IPA will identify variables that have only one value and replace them with
constants, resulting in a host of benefits for the optimizer's analysis. For
this to happen a variable must have a single value throughout the pro-
gram. If the variable is statically initialized to zero, as all global variables
are by default, and is subsequently assigned some other value at another
point in the program, then the analysis sees two values and will not con-
sider the variable to have a constant value.
For example,
#include <stdio.h>
int val;
void init() {
val = 3;
}
void func() {
printf("val %d",val);
}
int main() {
init();
func();
}
Bad: IPA cannot see that
is better written as
#include <stdio.h>
const int val = 3;
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
// initialized to zero
// re-assigned
is a constant
val
// initialized once
2-9

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents