[doc] Small clarification on define_subst

Message ID 8CA03051-8D69-4429-8B47-A1A29DB82035@comcast.net
State New
Headers show
Series
  • [doc] Small clarification on define_subst
Related show

Commit Message

Paul Koning July 9, 2018, 12:03 a.m.
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.

Comments

Jeff Law July 11, 2018, 4:12 p.m. | #1
On 07/08/2018 06:03 PM, Paul Koning wrote:
> 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.
OK.
jeff

Patch

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