This is the mail archive of the gcc-patches@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: [PATCH][MIPS] Fix register renaming in the interrupt handlers


Robert Suchanek <Robert.Suchanek@imgtec.com> writes:
> Hi,
>
> It was discovered that with the attached test case compiled with -O2
> -funroll-loops, the regrename pass renamed one of the registers ($2)
> to $8 that was not saved by the prologue.
>
> The attached patch fixes it by defining macro HARD_REGNO_RENAME_OK
> that returns zero iff the current function is an interrupt handler and
> a register was never live.
>
> Regression is still in progress. Ok to apply if it passes?
>
> Regards,
> Robert
>
> gcc/
> 	* config/mips/mips-protos.h (mips_hard_regno_rename_ok): New prototype.
> 	* config/mips/mips.c (mips_hard_regno_rename_ok): New function.
> 	* config/mips/mips.h (HARD_REGNO_RENAME_OK): New.
>
> gcc/testsuite/
> 	* gcc.target/mips/interrupt_handler-bug-1.c: New test.

You also need to do the same thing for TARGET_HARD_REGNO_SCRATCH_OK,
to stop peephole2 from using unsaved registers as scratch registers.

I should dig out my patches to clean up this interface.  It's just
too brittle to have two macros that say what registers can be used
after reload.

Thanks,
Richard


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