Pragmas; Function Pragmas; Pragma Const - 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

Pragmas

Pragmas can assist optimization by allowing the programmer to make
assertions or suggestions to the compiler. This section looks at how they
can be used to finely tune source code. Refer to
for full details of how each pragma works; the emphasis here will be in
considering under what circumstances they are useful during the optimi-
zation process.
In most cases, the pragmas serve to give the compiler information which it
is unable to deduce for itself. It must be emphasized that the programmer
is responsible for making sure that the information given by the pragma is
valid in the context in which it is used. Use of a pragma to assert that a
function or loop has a quality that it does not in fact have is likely to result
in incorrect code and hence a malfunctioning application.
An advantage of the use of pragmas is that they allow code to remain por-
table, since they will normally be ignored by a compiler that does not
recognize them.

Function Pragmas

Function pragmas include
#pragma result_alignment
#pragma optimize_{off|for_speed|for_space|as_cmd_line}

#pragma const

The
pragma const
have any side effects (such as modifying global variables or data buffers),
and the result returned is only a function of the parameter values. The
pragma may be applied to a function prototype or definition. It helps the
compiler since two calls to the function with identical parameters will
always yield the same result. This way, calls to
may be hoisted out of loops if their parameters are loop independent.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
#pragma const
,
#pragma regs_clobbered
pragma asserts to the compiler that a function does not
"Pragmas" on page 1-119
,
,
#pragma pure
#pragma alloc
, and
#pragma const
,
.
functions
2-31

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