Using Recursive and Nested Macros
5.9 Using Recursive and Nested Macros
Example 5–15. Using Nested Macros
5-22
The macro language supports recursive and nested macro calls. This means
that you can call other macros in a macro definition. You can nest macros up
to 32 levels deep. When you use recursive macros, you call a macro from its
own definition (the macro calls itself).
When you create recursive or nested macros, you should pay close attention
to the arguments that you pass to macro parameters, because the assembler
uses dynamic scoping for parameters. This means that the called macro uses
the environment of the macro from which it was called.
Example 5–15 shows nested macros. Note that the y in the in_block macro
hides the y in the out_block macro. The x and z from the out_block macro,
however, are accessible to the in_block macro.
in_block
.macro y,a
.
.
.endm
out_block .macro x,y,z
.
.
in_block x,y ; macro call with x and y as
.
.
.endm
out_block
; visible parameters are y,a and
;
x,z from the calling macro
; visible parameters are x,y,z
;
arguments
; macro call
Need help?
Do you have a question about the TMS320C54x and is the answer not in the manual?