MIPS Registers (Windows Embedded CE 6.0)

1/5/2010

The MIPS microprocessor has 32 general-purpose registers.

  • Registers are 32 bits for MIPS I instruction set architecture (ISA) and II ISA.
  • MIPS III and later ISAs have 32-bit registers when running in 32-bit mode, and 64-bit registers when running in 64-bit mode.
  • Registers $1, $26, $27, $29 are reserved for special purposes by the assembler, compiler and operating system.
  • Register $0 is hard wired to the value zero, and $31 is the link register for jump and link instructions but can be used with other instructions with caution.

The following table summarizes the usage convention for these registers.

Register Name Common Name Description

$0

zero

Always has the value 0. Any writes to this register are ignored.

$1

at

Assembler temporary.

$2-$3

v0-v1

Function result registers.

Functions return integer results in v0, and 64-bit integer results in v0 and v1 when using 32-bit registers.

In cases where floating-point hardware is not present, or when compiler options enable floating-point emulation, functions return single precision floating-point results in v0 and double precision floating-point results in v0 and v1 when using 32-bit registers.

v0 and v1 can be temporary registers.

Not preserved across function calls.

$4-$7

a0-a3

Function argument registers that hold the first four words of integer type arguments.

Functions use these registers to hold floating-point arguments.

When floating-point hardware is not present, or compiler options enable floating-point emulation, functions use a0 to hold the first single precision floating-point argument and a1 to hold the second single precision floating-point argument.

Functions use a0-a1 for the first double precision floating-point argument, and a2-a3 to hold the second double precision floating-point argument.

Not preserved across function calls.

$8-$15,

$24-$25

t0-t9

Temporary registers you can use as you want. Not preserved across function calls.

$16-$23, $30

s0-s8

Saved registers to use freely.

Preserved across function calls. These registers must be saved before use by the called function.

$26-$27

k0-k1

Reserved for use by the operating system kernel and for exception return.

$28

gp

Global pointer.

Not used in Windows Embedded CE and may be used as save register for called functions.

$29

sp

Stack pointer.

$31

ra

Return address register, saved by the calling function. Available for use after saving.

$f0

n/a

Function return register used to return float and double values from function calls.

($f12, $f13)

and

($f14, $f15)

n/a

Two pairs of registers used to pass float and double valued parameters to functions.

Pairs of registers are parenthesized because they have to pass double values.

To pass float values, only $f12 and $f14 are used.

The following list contains additional information on floating-point registers:

  • In MIPS ISAs I, II, and in MIPS III and later ISAs running in 32-bit mode, only $f4, $f6, $f8, $f10, $f16, and $f18 temporary registers are available.
    When manipulating these registers with double precision instructions, the high-order 32-bits are in the implied odd register. The odd registers are not directly accessible.
  • Permanent registers $f20, $f22, $f24, $f26, $f28, and $f30 are registers where values are preserved across function calls.
  • In MIPS architectures III and later running in 64-bit mode, the following registers are also available as temporary registers: $f1, $f3, $f5, $f7, $f9, $f11, $f17, $f19, $f21, $f23, $f25, $f27, $f29, $f31.

See Also

Reference

MIPS Stack Frame Layout

Other Resources

MIPS Calling Sequence Specification