* Re: peephole2 question
@ 2002-04-23 15:36 Peter Barada
2002-04-23 15:48 ` Richard Henderson
2002-04-23 16:05 ` Alan Lehotsky
0 siblings, 2 replies; 3+ messages in thread
From: Peter Barada @ 2002-04-23 15:36 UTC (permalink / raw)
To: gcc
I've got a peephole2 that uses match_operator to select both PLUS and
MULT. How to I specify in the new-insn-pattern the result of the
match_operator? In the following, what do I put in place of 'xxx'
that means the operator that I think is in operands[3]:
(define_peephole2
[(set (match_operand:DF 0 "m68k_freg_operand" "")
(mem:DF (match_operand:SI 1 "m68k_areg_operand" "")))
(set (match_operand:DF 2 "m68k_freg_operand" "")
(match_operator:DF 3 "plus_or_mult_operator"
[(match_dup 2)
(match_dup 0)]))]
"0 && TARGET_CFV4E
&& peep2_reg_dead_p (2, operands[0])
&& REGNO (operands[0]) != REGNO (operands[2])"
[(set (match_dup 2)
(xxx:DF (match_dup 2)
(mem:DF (match_dup 1))))]
"")
I know that I could create more patterns, one for each type, but that
makes the recognizer bigger.
Any ideas?
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: peephole2 question
2002-04-23 15:36 peephole2 question Peter Barada
@ 2002-04-23 15:48 ` Richard Henderson
2002-04-23 16:05 ` Alan Lehotsky
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2002-04-23 15:48 UTC (permalink / raw)
To: Peter Barada; +Cc: gcc
On Tue, Apr 23, 2002 at 06:10:43PM -0400, Peter Barada wrote:
> In the following, what do I put in place of 'xxx'
> that means the operator that I think is in operands[3]:
match_op_dup.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: peephole2 question
2002-04-23 15:36 peephole2 question Peter Barada
2002-04-23 15:48 ` Richard Henderson
@ 2002-04-23 16:05 ` Alan Lehotsky
1 sibling, 0 replies; 3+ messages in thread
From: Alan Lehotsky @ 2002-04-23 16:05 UTC (permalink / raw)
To: Peter Barada; +Cc: gcc
You use a "match_dup" in the peephole result and an action statement that
does something like
(define_peephole2
[(set (match_operand:DF 0 "m68k_freg_operand" "")
(mem:DF (match_operand:SI 1 "m68k_areg_operand" "")))
(set (match_operand:DF 2 "m68k_freg_operand" "")
(match_operator:DF 3 "plus_or_mult_operator"
[(match_dup 2)
(match_dup 0)]))]
"0 && TARGET_CFV4E
&& peep2_reg_dead_p (2, operands[0])
&& REGNO (operands[0]) != REGNO (operands[2])"
[(set (match_dup 2)
(match_dup 3)
)]
"
operands[3] = gen_rtx (..... operands[2], operands[1])
")
You might want to make your "plus_or_mult_operator()" function leave the
right code somewhere global so that you don't have to grovel thru the pattern
to find if it's PLUS or MULT....
At 6:10 PM -0400 4/23/02, Peter Barada wrote:
>I've got a peephole2 that uses match_operator to select both PLUS and
>MULT. How to I specify in the new-insn-pattern the result of the
>match_operator? In the following, what do I put in place of 'xxx'
>that means the operator that I think is in operands[3]:
>
--
Quality Software Management
http://home.earthlink.net/~qsmgmt
apl@alum.mit.edu
(978)287-0435 Voice
(978)808-6836 Cell
Software Process Improvement / Management Consulting
Language Design / Compiler Implementation
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-23 22:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23 15:36 peephole2 question Peter Barada
2002-04-23 15:48 ` Richard Henderson
2002-04-23 16:05 ` Alan Lehotsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).