Процессоры архитектуры MIPS32

Register Names

MIPS labels registers in two different ways. Integer registers are labelled from $r0 to $r31.

However, for the purposes of writing functions, it's often easier to label registers with mnemonics.

In particular, MIPS uses the following alternate names.

All of the registers listed in the previous section correspond to some register labelled $r0 up to $r31.

Here's a chart. It's the same as the one on page 140 of Patterson and Hennessy.

Name Register Number Usage Preserved by callee
$zero 0 hardwired 0 N/A
$v0-$v1 2-3 return value and expression evaluation no
$a0-$a3 4-7 arguments no
$t0-$t7 8-15 temporary values no
$s0-$s7 16-23 saved values YES
$t8-$t9 24-25 more temporary values no
$gp 28 global pointer YES
$sp 29 stack pointer YES
$fp 30 frame pointer YES
$ra 31 return address YES

There are a few registers not listed. $at, which is register 1, is used by the assembler. $k0-$k1 which is registers 26-27 is used by the operating system.

It's easier to program using the mnemonics (i.e., names that suggest the purpose of the registers). An assembler should be able to handle either the $r0-$r31$ notation or the ones above.

While you should know the names of both sets of registers, you do not need to know how the correspond to one another. That is, it's more important to know there are temporary and saved registers and that an example is $t0 and $s0, but it's less important to know which register numbers they correspond to.

These alternate names make it easier to program because it's easier to remember what the registers are being used for by mnemonics.

telnet://devel8.cronyx.ru