This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions about peephole2
- From: Richard Henderson <rth at redhat dot com>
- To: Peter Barada <pbarada at mail dot wm dot sps dot mot dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 17 Apr 2002 17:16:38 -0700
- Subject: Re: Questions about peephole2
- References: <200204172022.g3HKM8802492@hyper.wm.sps.mot.com>
On Wed, Apr 17, 2002 at 04:22:08PM -0400, Peter Barada wrote:
> fmove.d (%a1),%fp1 | 36 movdf_v4e/1
> fadd.d %fp1,%fp0 | 20 adddf3_v4e
[..]
> Insn 36 could be folded into insn 20 if it is known that %fp1 dies at
> the end of instruction 20, producing the code:
If adddf3_v4e ought to match here, I encourage you *not* to add random
peepholes here to work around a failing in the register allocator.
Instead, help with the new register allocator implementation on
new-regalloc-branch.
> (define_peephole2
> [(set (match_operand:DF 0 "register_operand" "")
> (mem:DF (match_operand:SI 1 "register_operand" "")))
> (set (match_operand:DF 2 "register_operand" "")
> (plus:DF (match_dup 2)
> (match_dup 0)))]
> "find_regno_note (insn, REG_DEAD, REGNO (operands[0]))
peep2_reg_dead_p (2, operands[0])
> && (REGNO (operands[0]) >= 16 && REGNO (operands[0]) < 24)
> && (REGNO (operands[1]) >= 8 && REGNO (operands[1]) < 16)
> && (REGNO (operands[2]) >= 16 && REGNO (operands[2]) < 24)"
I encourage you to use predicates above such as
m68k_address_register_operand
etc. It's much much clearer.
r~