Analog Devices ADSP-BF53x Blackfin Reference page 148

Table of Contents

Advertisement

Branches
[--SP] = (R7:7, P5:5);
P5.H = HI(myregister);
P5.L = LO(myregister);
R7 = [P5];
R0 = R0 + R7;
(R7:7, P5:5) = [SP++];
RTS;
/* return from subroutine */
myfunction.end:
Due to the syntax of the multiple-push, multiple-pop instructions, often
the upper R- and P-registers are used for local purposes, while lower regis-
ters pass the parameters. See the
more details on stack management.
The
instruction not only redirects the program flow to the myfunc-
CALL
tion routine, it also writes the return address into the
register holds the address where program execution resumes after the
RETS
instruction executes. In the example this is the location that holds the
RTS
instruction.
[P0]=R0;
The return address is not passed to any stack in the background. Rather,
the
register functions as single-entry hardware stack. This scheme
RETS
enables "leaf functions" (subroutines that do not contain further
instructions) to execute with less possible overhead, as no bus transfers
need to be performed.
If a subroutine calls other functions, it must temporarily save the content
of the
register explicitly. Most likely this is performed by stack oper-
RETS
ations as shown below.
/* parent function */
CALL function_a;
/* continue here after the call */
JUMP somewhereelse;
function_a:
[--SP] = (R7:7, P5:5);
4-14
ADSP-BF53x/BF56x Blackfin Processor Programming Reference
/* multiple push instruction */
/* P5 used locally */
/* R7 used locally */
/* R0 user for parameter passing */
/* multiple pop instruction */
/* closing subroutine label */
"Address Arithmetic Unit"
/* subroutine label */
/* optional multiple push instruction */
chapter for
register. The
RETS
CALL

Advertisement

Table of Contents
loading

This manual is also suitable for:

Adsp-bf56x blackfin

Table of Contents