This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][MIPS] Fix register renaming in the interrupt handlers
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Robert Suchanek <Robert dot Suchanek at imgtec dot com>
- Cc: "Catherine_Moore\ at mentor dot com" <Catherine_Moore at mentor dot com>, Matthew Fortune <Matthew dot Fortune at imgtec dot com>, "gcc-patches\ at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Aug 2015 20:54:50 +0100
- Subject: Re: [PATCH][MIPS] Fix register renaming in the interrupt handlers
- Authentication-results: sourceware.org; auth=none
- References: <B5E67142681B53468FAF6B7C31356562441B01AD at hhmail02 dot hh dot imgtec dot org>
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