Indirect branch
|
An indirect branch (also known as a computed jump) is a type of program control instruction present in some machine language instruction sets. Rather than specifying the address of the next instruction to execute, as in a direct branch, the argument specifies where the address is located. Thus an example could be to 'jump indirect on the r1 register' would mean that the next instruction to be executed would be at the address who's value is in register r1. The address to be jumped to is not known until the instruct is executed.
This instruction can be useful to make a conditional branch, especially a multi-way branch. For instance, based on input a value could be looked up in a table of what routine to run, this value could be stored in a register and an indirect jump made based on that register; efficiently implementing response to the input.
Examples:
SPARC: jmpl %o7
Template:Compu-stub
MIPS: jmpl %ra
X86: j %eax
IA64: br.ret.sptk.few rp