bl
Branch and Link
Branches to a target address and saves the return address (CIA + 4) in the Link Register (LR). Used for function calls.
Details
The bl instruction is a branch and link instruction that unconditionally branches to the target address specified by the target_addr field. It sets the link register (LR) to the address of the next instruction, allowing for return to the original location after the branch.
Pseudocode Operation
LR <- CIA + 4; NIA <- CIA + EXTS(LI || 00)
Programming Note
The bl instruction is commonly used for function calls where a return to the caller is required. Ensure that the target address is correctly calculated and aligned, as misalignment can lead to exceptions. The link register (LR) must be preserved if nested subroutine calls are made to maintain correct return paths.
Example
Encoding
Operands
-
LI
24-bit Signed Immediate