@@ -126,7 +126,10 @@ static const char * duplicate_each_alternative (const char * str, int n_dup);
typedef const char * (*constraints_handler_t) (const char *, int);
static rtx alter_constraints (rtx, int, constraints_handler_t);
-static rtx adjust_operands_numbers (rtx);
+
+static void mark_operands_used_in_match_dup (rtx);
+static void renumerate_operands_in_pattern (rtx);
+
static rtx replace_duplicating_operands_in_pattern (rtx);
/* Make a version of gen_rtx_CONST_INT so that GEN_INT can be used in
@@ -1843,7 +1846,15 @@ process_substs_on_one_elem (struct queue_elem *elem,
subst_pattern = alter_constraints (subst_pattern, alternatives,
duplicate_each_alternative);
- subst_pattern = adjust_operands_numbers (subst_pattern);
+ mark_operands_used_in_match_dup (subst_pattern);
+ RTVEC_ELT (subst_pattern_vec, j) = subst_pattern;
+ }
+
+ for (j = 0; j < XVECLEN (subst_elem->data, 3); j++)
+ {
+ subst_pattern = RTVEC_ELT (subst_pattern_vec, j);
+
+ renumerate_operands_in_pattern (subst_pattern);
/* Substitute match_dup and match_op_dup in the new pattern and
duplicate constraints. */
@@ -1856,7 +1867,6 @@ process_substs_on_one_elem (struct queue_elem *elem,
if (GET_CODE (elem->data) == DEFINE_EXPAND)
remove_constraints (subst_pattern);
- RTVEC_ELT (subst_pattern_vec, j) = subst_pattern;
}
XVEC (elem->data, 1) = subst_pattern_vec;
@@ -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)
{
@@ -2010,23 +2028,6 @@ renumerate_operands_in_pattern (rtx 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 rtx
-adjust_operands_numbers (rtx pattern)
-{
- mark_operands_used_in_match_dup (pattern);
-
- renumerate_operands_in_pattern (pattern);
-
- return pattern;
-}
/* Generate RTL expression
(match_dup OPNO)