fixed registers in mips
Ian Lance Taylor
ian@airs.com
Tue Sep 27 03:37:00 GMT 2005
Eric Fisher <joefoxreal@gmail.com> writes:
> I'd like to know why mips doesn't define $30 and $31 as fix registers?
> And when should they be defined true?
Neither register has a use which is fixed by either the hardware or
the ABI.
$30 is generally the frame pointer, but gcc will only use a frame
pointer which it is required to. When a function does not need a
frame pointer, $30 is available as a caller-saved register.
$31 is used by hardware in a jal instruction, and the ABI requires its
used in a jalr instruction. However, in code that does not make a
function call, it is perfectly reasonable for gcc to use $31 as a
general caller-saved register, assuming of course that gcc has saved
the address to which the function should return.
Ian
More information about the Gcc
mailing list