The
regs_clobbered
or a declaration preceding a definition, when it acts as a command to the
compiler to generate register saves and restores on entry and exit from the
function to ensure it only modifies the registers in string. For example,
#pragma regs_clobbered "ar m7"
int g(int a) {
return a+3;
}
The
regs_clobbered
#pragma interrupt
regs_clobbered
To obtain best results with the pragma, it is best to restrict the clobbered
set to be a subset of the default scratch registers. The compiler is likely to
produce more efficient code this way than if the scratch set is changed to
use the same number of registers but which does not make a subset of the
default volatile set usually scratch.
When considering when to apply the
useful to look at the output of the compiler to see how many scratch regis-
ters were used. Restricting the volatile set to these registers will produce no
impact on the code produced for the function but may free up registers for
the caller to allocate across the call site.
String Syntax
A
regs_clobbered
register sets that are clobbered. The list is separated by spaces, commas, or
semicolons.
A register is a single register name, which is the same as that which may be
used in an assembly file.
A register range consists of
same register class, separated by a hyphen. All registers between the two
(inclusive) are clobbered.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
pragma may also be used with a function definition,
pragma may not be used in conjunction with
. If both are specified, a warning is issued and the
pragma is ignored.
string consists of a list of registers, register ranges, or
and
start
pragma, it may be
regs_clobbered
registers which both reside in the
end
Compiler
1-131
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?