On 01/14/2016 05:33 PM, Andreas Krebbel wrote:
When processing substitutions the operands are renumbered.  To find a
free operand number the array used_operands_numbers is used to record
the operand numbers already in use.  Currently this array is used to
assign new numbers *before* all the RTXes in the vector have been
processed.

        * gensupport.c (process_substs_on_one_elem): Split loop to
        complete mark_operands_used_in_match_dup on all expressions in the
        vector first.
        (adjust_operands_numbers): Inline into process_substs_on_one_elem
        and remove function.

Mostly ok, I think. As an aside, all the define_subst stuff in gensupport looks rather suspiciously clunky and the comments are in broken English. We should fix this stuff at some point.

@@ -1976,6 +1986,14 @@ find_first_unused_number_of_operand ()
     It visits all expressions in PATTERN and assigns not-occupied
     operand indexes to MATCH_OPERANDs and MATCH_OPERATORs of this
     PATTERN.  */
+/* If output pattern of define_subst contains MATCH_DUP, then this
+   expression would be replaced with the pattern, matched with
+   MATCH_OPERAND from input pattern.  This pattern could contain any
+   number of MATCH_OPERANDs, MATCH_OPERATORs etc., so it's possible
+   that a MATCH_OPERAND from output_pattern (if any) would have the
+   same number, as MATCH_OPERAND from copied pattern.  To avoid such
+   indexes overlapping, we assign new indexes to MATCH_OPERANDs,
+   laying in the output pattern outside of MATCH_DUPs.  */
  static void
  renumerate_operands_in_pattern (rtx pattern)
  {

If you want to keep this comment, you might want to move it inside the function (or into the caller). Ok with or without any such change - this looks a bit weird but I don't know what's best.


Bernd

Reply via email to