A register is an electronic device that holds bit patterns. A general purpose register is a register that is visible to assembly language. The floating point registers, although visible to assembly language, are not regarded as general purpose registers.
Although the registers are called "general purpose", it is conventional in software to use specific registers for specific purposes. This is not required by hardware. It is just a way for programmers to avoid confusion by establishing conventions. The extended assembler uses mnemonic names for registers that show how they are used.
For example, registers
$15 are conventionally used to
hold temporary values.
Mnemonic names for these registers are
|Conventional Use||Register |
|$0||$zero||Permanently 0||$24, $25||$t8, $t9||Temporary|
|$1||$at||Assembler Temporary||$26, $27||$k0, $k1||Kernel|
|$2, $3||$v0, $v1||Value returned by a subroutine||$28||$gp||Global Pointer|
|$4-$7||$a0-$a3||Subroutine Arguments||$29||$sp||Stack Pointer|
|$16-$23||$s0-$s7||Saved registers||$31||$ra||Return Address|
far as hardware is concerned,
are different from the rest
$0 is always full of zeros and
$31 is automatically used
by some subroutine linkage instructions to hold the return address).
The remaining registers are electronically identical.
It is a software convention to use different sets
of registers for different purposes.
Are programs written in extended assembly code executed on the same MIPS processor we have been looking at?