Assembly Constructs And Macros; Assembly Constructs And Flow Control - 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

Assembly Constructs and Macros

One way to use
look like functions. For example, the following shows macros that contain
constructs. This code defines a macro,
asm()
inline
instruction to perform an assembly-language
asm()
variable
, putting the result in
x_var
#define abs_macro(result,x) \
asm("%0=abs %1;":"=c" (result):"c"(x))
/* (pseudo code) result = abs x */
main(){
int result_var=0;
int x_var=10;
abs_macro(result_var, 10);
/* or */
abs_macro(result_var, x_var);
}

Assembly Constructs and Flow Control

It is inadvisable to place flow control operations within an
that "leaves" the
ing a jump, to another piece of code that is not within the
itself. Such operations are invisible to the compiler and may violate
assumptions made by the compiler.
For example, the compiler is careful to adhere to the calling conventions
for preserved registers when making a procedure call. If an
calls a procedure, the
tions are obeyed, or the called procedure may corrupt the state used by the
function containing the
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
constructs is to encapsulate them in macros that
asm()
construct, such as calling a procedure or perform-
asm()
construct must also ensure that all conven-
asm()
construct.
asm()
abs_macro()
:
result_var
Compiler
, which uses the
operation of
abs
construct
asm()
construct
asm()
construct
asm()
1-77

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

Subscribe to Our Youtube Channel

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents