APPENDIX C. MIPS APPENDIX C. MIPS
Appendix C
MIPS
C.1 Registers.
( O32 calling convention )
C.1.1 General purpose registersGPR
Number Pseudoname Description
$0 $ZERO Always zero. Writing to this register is effectively an idle instruction (NOP).
$1 $AT Used as a temporary register for assembly macros and pseudoinstructions.
$2 ...$3 $V0 ...$V1 Function result is returned here.
$4 ...$7 $A0 ...$A3 Function arguments.
$8 ...$15 $T0 ...$T7 Used for temporary data.
$16 ...$23 $S0 ...$S7 Used for temporary data∗.
$24 ...$25 $T8 ...$T9 Used for temporary data.
$26 ...$27 $K0 ...$K1 Reserved forOSkernel.
$28 $GP Global Pointer∗∗.
$29 $SP SP∗.
$30 $FP FP∗.
$31 $RA RA.
n/a PC PC.
n/a HI high 32 bit of multiplication or division remainder∗∗∗.
n/a LO low 32 bit of multiplication and division remainder∗∗∗.
C.1.2 Floating-point registers
Name Description
$F0..$F1 Function result returned here.
$F2..$F3 Not used.
$F4..$F11 Used for temporary data.
$F12..$F15 First two function arguments.
$F16..$F19 Used for temporary data.
$F20..$F31 Used for temporary data∗.
∗—Calleemust preserve the value.
∗∗—Calleemust preserve the value ( except inPICcode).
∗∗∗—accessible using theMFHIandMFLOinstructions.
C.2 Instructions
There are 3 kinds of instructions:
- R-type: those which have 3 registers. R-instruction usually have the following form: