
74 CHAPTER 2 Instruction Sets
to return. To properly return, we must save the PC value when the procedure/
function is called and, when the procedure is finished, set the PC to the address of
the instruction just after the call to the procedure. (You don’t want to endlessly
execute the procedure,after all.) The branch-and-link instruction is used in theARM
for procedure calls. For instance,
BL foo
will perform a branch and link to the code starting at location foo (using PC-relative
addressing,of course).The branch and link is much like a branch,except that before
branching it stores the current PC value in r14. Thus, to return from a procedure,
you