public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] doc: Document order of define_peephole2 scanning
@ 2023-04-18 17:55 Hans-Peter Nilsson
  2023-04-18 18:32 ` Paul Koning
  0 siblings, 1 reply; 11+ messages in thread
From: Hans-Peter Nilsson @ 2023-04-18 17:55 UTC (permalink / raw)
  To: gcc-patches

Generated pdf inspected.  Ok to commit?

Thoughts on fixing the IMHO wart to also expose all
replacements to all define_peephole2?  Looks feasible
(famous last words), but then again I haven't checked the
history yet.

-- >8 --
I was a bit surprised when my define_peephole2 didn't match,
but it was because it was expected to partially match the
generated output of a previous define_peephole2.  I had
assumed that the algorithm exposed newly created opportunities
to all define_peephole2's.  While things can change in that
direction, let's start with documenting the current state.

	* doc/md.texi (define_peephole2): Document order of scanning.
---
 gcc/doc/md.texi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 07bf8bdebffb..0f9e32d2c648 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -9362,6 +9362,14 @@ If the preparation falls through (invokes neither @code{DONE} nor
 @code{FAIL}), then the @code{define_peephole2} uses the replacement
 template.
 
+Insns are scanned in forward order from beginning to end for each basic
+block, but the basic blocks are scanned in reverse order of appearance
+in a function.  After a successful replacement, scanning for further
+opportunities for @code{define_peephole2} matches, resumes at the last
+generated insn.  I.e. for the example above, the first insn that can be
+matched by another @code{define_peephole2}, is @code{(set (match_dup 3)
+(match_dup 4))}.
+
 @end ifset
 @ifset INTERNALS
 @node Insn Attributes
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-04  9:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 17:55 [PATCH] doc: Document order of define_peephole2 scanning Hans-Peter Nilsson
2023-04-18 18:32 ` Paul Koning
2023-04-18 18:44   ` Hans-Peter Nilsson
2023-04-19  3:15     ` [PATCH v2] " Hans-Peter Nilsson
2023-04-19  4:06       ` Hans-Peter Nilsson
2023-04-19 16:59         ` [PATCH v3] " Hans-Peter Nilsson
     [not found]           ` <4E63CF4D-C355-4053-8EA4-5700C1B938E3@gmail.com>
2023-04-19 20:16             ` Bernhard Reutner-Fischer
2023-04-20  2:57               ` Hans-Peter Nilsson
2023-04-26 23:55           ` Ping: " Hans-Peter Nilsson
2023-05-04  0:09             ` 2nd " Hans-Peter Nilsson
2023-05-04  9:45               ` Richard Biener

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).