MIPS IV Argument Registers
MIPS ISA IV runs in 64-bit mode. MIPS ISA III and up, running in 64-bit mode, assigns argument registers as follows, in precedence order:
- Double precision floating point and 64-bit integer arguments to any argument registers available, as the registers are 64 bits wide. This corresponds to always being 8-byte aligned when allocating memory on the stack for a 64-bit argument.
- Arguments prototyped with an ellipsis to corresponding general-purpose registers if any corresponding general-purpose registers remain. For example, if the second argument prototype is an ellipsis, then the second argument begins using argument registers $5 through $7.
- If the first argument is floating-point and floating-point hardware is present, a 4-byte float first argument uses float register $f12 and an 8-byte float first argument also uses the float register $f12.
- If the second argument is floating-point, floating-point hardware is present, and the first argument is floating point, a 4-byte second argument uses float register $f13 and an 8-byte second argument also uses the float register $f13.
- If the second argument is an 8-byte float or integer (signed or unsigned), floating-point hardware is not present, then the 8-byte second argument uses the general register $5.
- Otherwise, allocation of argument registers is done using general registers $4 through $7.
The following examples in below illustrate MIPS ISA III passes arguments in registers. The meaning of the symbols used is as follows.
- D followed by a number is used for a double precision floating-point argument.
- s followed by a number is used to represent a single precision floating point argument.
- n followed by a number represents a 4-byte non-floating point argument
- j followed by a number is used for an 8-byte non-floating point argument, for example, a _int64 argument.
Some entries have two register assignment sequences. The first represents the convention used with floating-point emulation, the second, if there is a difference, is the convention with floating-point hardware.
Argument List | Register Assignment |
---|---|
n1, n2, n3, n4 | n1 — > $4, n2 —> $5, n3 —> $6, n4 —> $7 |
s1, s2, s3, s4 | s1 —> $4, s2 —> $5, s3 —> $6, s4 —> $7
s1 —> $f12, s2 —> $f13, s3 —> $f14, s4 —> $f15 |
d1, d2 | d1 —> $4, d2 —> $5
d1 —> $f12, d2 —> $f13 |
s1, s2 | s1 —> $4, s2 —> $5
s1 —> $f12, s2 —> $f13 |
d1, s2 | d1 —> $4, s2 —> $5
d1 —> $f12, s2 —> $f13 |
s1, d2 | s1 —> $4, d2 —> $5
s1 —> $f12, d2 —> $f13 |
s1, s2, d3 | s1 —> $4, s2 —> $5, d3 —> $6
s1 —> $f12, s2 —> $f13, d3 —> $f14 |
d1, s2, d3 | d1 —> $4, s2 —> $5, d3 —> $6
d1 —> $f12, s2 —> $f13, d3 —> $f14 |
d1, s2, s3, s4, s5 | d1 —> $4, s2 —> $5, s3 —> $6, s4 —> $7, s5 —> stack
d1 —> $f12, s2 —> $f13, s3 —> $f14, s4 —> $f15, s5 —> stack |
n1, d2 | n1 —> $4, d2 —> $5
n1 —> $4, d2 —> $f13 |
n1, s1, d2 | n1 —> $4, s1 —> $5, d2 —> $6
n1 —> $4, s1 —> $f13, d2 —> $f14 |
j1, d2 | j1 —> $4, d2 —> $5
j1 —> $4, d2 —> $f13 |
j1, s2 | j1 —> $4, s2 —> $5
j1 —> $4, s2 —> $f13 |
The following table illustrates what happens when an ellipsis appears in the second argument position. Notice that in all cases for all arguments matching the ellipsis and beyond only general purpose registers are used even if floating-point hardware is available.
Argument List | Register Assignment |
---|---|
n1, d2 | n1 —> $4, d2 —> $5 |
s1, d2 | s1 —> $4, d2 —> $5
s1 —> $f12, d2 —> $5 |
d1, s2 | d1 —> $4, s2 —> $5
d1 —> $f12, s2 —> $5 |
d1, n1, d2 | d1 —> $4, n1 —> $5, d2 —> $6
d1 —> $f12, n1 —> $5, d2 —> $6 |
j1, d2 | j1 —> $4, d2 —> $5 |
See Also
MIPS Stack Frame and Argument Registers | MIPS I, II Argument Registers | MIPS Frame and Stack Pointers | MIPS Leaf Routines
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.