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: Puzzle about macro MIPS_PROLOGUE_TEMP_REGNUM


"Amker.Cheng" <amker.cheng@gmail.com> writes:
> Hi :
>    I found the temp register used for saving registers when expanding
> prologue is defined by
> macro MIPS_PROLOGUE_TEMP_REGNUM on mips target, like:
>
> #define MIPS_PROLOGUE_TEMP_REGNUM \
>   (cfun->machine->interrupt_handler_p ? K0_REG_NUM : GP_REG_FIRST + 3)
>
> I don't understand why using registers starting from $3?

It's not "starting from $3".  It's $3 and nothing else ;-)  It's not
intended to be used as (MIPS_PROLOGUE_TEMP_REGNUM + N).

$3 was chosen because it's a MIPS16 register, and can therefore
be used for both MIPS16 and normal-mode code.  $2 used to be the
static chain register, which left $3 as the only free call-clobbered
MIPS16 register.  I changed the static chain register to $15 to avoid
a clash with the MIPS16 gp-load sequence:

    http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00622.html

so $2 is probably free now too.

Richard


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