This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: fixed registers in mips
- From: Ian Lance Taylor <ian at airs dot com>
- To: Eric Fisher <joefoxreal at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 26 Sep 2005 20:36:46 -0700
- Subject: Re: fixed registers in mips
- References: <d6afecde05092619344678fc60@mail.gmail.com>
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