Overview - Link register (R14/LR)
What is it?
The Link Register (LR), also known as R14 in ARM architecture, is a special-purpose register that stores the return address when a function or subroutine is called. It holds the address to which the program should return after completing the called function. This register helps manage the flow of execution in programs by keeping track of where to continue after a function finishes.
Why it matters
Without the Link Register, the processor would not know where to return after a function call, making it impossible to execute programs with reusable code blocks or subroutines efficiently. This would lead to complex and error-prone code, as programmers would have to manually manage return addresses. The LR simplifies function calls and returns, enabling structured and maintainable programming.
Where it fits
Before understanding the Link Register, learners should know basic ARM registers and how function calls work in assembly language. After this, learners can explore stack usage for saving registers, exception handling, and advanced function call optimizations like tail calls and interrupt handling.
