A stack register is a computer central processor register whose purpose is to keep track of a call stack. On an accumulator-based architecture machine, this may be a dedicated register such as SP on an Intel x86 machine. On a general register machine, it may be a register which is reserved by convention, such as on the PDP-11 or RISC machines. Some designs such as the Data General Eclipse had no dedicated register, but used a reserved hardware memory address for this function.
Machines before the late 1960s—such as the PDP-8 and HP 2100—did not have compilers which supported recursion. Their subroutine instructions typically would save the current location in the jump address, and then set the program counter to the next address. While this is simpler than maintaining a stack, since there is only one return location per subroutine code section, there cannot be recursion without considerable effort on the part of the programmer.
- David Salomon (February 1993). Assemblers and Loaders. Ellis Horwood Ltd. ISBN 0-13-052564-2. Retrieved 2008-10-01. "Most computers save the return address in either the stack, in one of the registers, or in the ﬁrst word of the procedure (in which case the ﬁrst executable instruction of the procedure should be stored in the second word). If the latter method is used, a return from the procedure is a jump to the memory location whose address is contained in the ﬁrst word of the procedure."
|This computer hardware article is a stub. You can help Wikipedia by expanding it.|
|This computer science article is a stub. You can help Wikipedia by expanding it.|