This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, doc] Small clarification on define_subst
- From: Paul Koning <paulkoning at comcast dot net>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 8 Jul 2018 20:03:51 -0400
- Subject: [PATCH, doc] Small clarification on define_subst
In doing CCmode work I was confused how define_subst handles cases where the same argument appears more than once. The attached clarifies this.
Ok for trunk?
paul
ChangeLog:
2018-07-08 Paul Koning <ni1d@arrl.net>
* doc/md.texi (define_subst): Document how multiple occurrences of
the same argument in the replacement pattern are handled.
Index: doc/md.texi
===================================================================
--- doc/md.texi (revision 262505)
+++ doc/md.texi (working copy)
@@ -10263,7 +10263,11 @@ the expression from the original pattern, which ma
@code{match_operand N} from the input pattern. As a consequence,
@code{match_dup} cannot be used to point to @code{match_operand}s from
the output pattern, it should always refer to a @code{match_operand}
-from the input pattern.
+from the input pattern. If a @code{match_dup N} occurs more than once
+in the output template, its first occurrence is replaced with the
+expression from the original pattern, and the subsequent expressions
+are replaced with @code{match_dup N}, i.e., a reference to the first
+expression.
In the output template one can refer to the expressions from the
original pattern and create new ones. For instance, some operands could