This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: AVR peephole2 fixes
- To: Denis Chertykov <denisc at overta dot ru>
- Subject: Re: AVR peephole2 fixes
- From: Marek Michalkiewicz <marekm at linux dot org dot pl>
- Date: Thu, 4 Jan 2001 19:40:42 +0100 (CET)
- CC: Marek Michalkiewicz <marekm at linux dot org dot pl>, gcc-patches at gcc dot gnu dot org
> int
> avr_peep2_scratch_safe (reg_rtx)
> rtx reg_rtx;
> {
> if (interrupt_function_p (current_function_decl) ||
> signal_function_p (current_function_decl))
> {
> int regno = true_regnum (reg_rtx);
> int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg_rtx));
> int reg;
>
> for (reg = regno; reg < endregno; ++reg)
> {
> if (regs_ever_live[reg]
> || (!leaf_function_p () && call_used_regs[reg]))
> continue;
> return 0;
> }
> }
> return 1;
> }
Looks fine to me, should have exactly the same effect, because of the
checks already done in peep2_find_free_register (the condition
(regs_ever_live[reg] || call_used_regs[reg]) should always be true).
My version is different simply because I didn't get your mail (the ISP
was down for 5 days), and I was looking at it only for a while in the
gcc-patches list archive on the web. So I got the basic idea, and
implemented it myself. (Note that there is an error in that patch -
a few places should use operands[2] not [3].)
The fact that you can FAIL a peephole2 should probably be documented
somewhere - I thought it was only allowed for define_expand.
Marek