This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fixed registers in mips


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]