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: Mike Stump <mikestump at comcast dot net>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: Robert Suchanek <Robert dot Suchanek at imgtec dot com>, "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: Sat, 15 Aug 2015 16:11:28 -0700
- 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> <87k2szc6b9 dot fsf at googlemail dot com> <4438A5B8-6266-4E4F-A43C-8BA503A08900 at comcast dot net> <B5E67142681B53468FAF6B7C31356562441B05D2 at hhmail02 dot hh dot imgtec dot org> <878u9ckfkh dot fsf at googlemail dot com> <25005AA9-2F88-48E3-9776-2257FC513ED4 at comcast dot net> <87y4hccyn4 dot fsf at googlemail dot com>
On Aug 15, 2015, at 9:19 AM, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> Mike Stump <mikestump@comcast.net> writes:
>> On Aug 15, 2015, at 3:32 AM, Richard Sandiford
>> <rdsandiford@googlemail.com> wrote:
>>>
>>> The port is only buggy if they have define_peephole2s with match_scratches
>>> and those match_scratches require a register that would be saved by
>>> an interrupt function. In other cases defining T_H_R_S_O would have
>>> no effect (but still be a good idea for future proofing -- obviously
>>> someone who adds a new define_peephole2 is unlikely to be thinking
>>> about inerrupt functions).
>>
>> Yeah, that was my reading of the code after I posted as well. My port
>> was buggy. :-( I think all the other ports like likely buggy or
>> suboptimal.
>
> Suboptimal how?
Inability to use some registers. Hum, maybe that can’t happen for other reasons.
> I don't see how that helps.
Maybe I’m envisioning something you aren’t proposing. Anyway, a nice fix for this has code like:
/* If this is a CALL_INSN, all call used registers are stored with
unknown values. */
if (CALL_P (insn))
{
for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
{
if (call_used_regs[i])
/* Reset the information about this register. */
reg_mode[i] = VOIDmode;
}
}
being updated so that at least for some calls to an interrupt function, the mode of the reg isn’t set to VOIDmode. I didn’t choose this for any specific reason, I just grabbed a random use of call_used_regs that likely is wrong or less than optimal. In the type of fix I envision, it would/could address this.
> The third in my list is still there unless you disable -fipa-ra.
Maybe I was railing against something you’re not proposing. Anyway, safe to defer til we have more detail.