summaryrefslogtreecommitdiff
path: root/gcc/gensupport.c
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2016-03-01 14:51:17 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2016-03-01 14:51:17 +0000
commit39834c3406ef6acc1bd012b3368640aa3982d55a (patch)
treecad87364a453573f8ffdfea88b7274509c48ea6e /gcc/gensupport.c
parentd99a947c8839a97f1b26c883c99fa965713d5bf3 (diff)
downloadgcc-39834c3406ef6acc1bd012b3368640aa3982d55a.tar.gz
Revert recent gensupport change.
2016-03-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com> Revert 2016-03-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233853 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gensupport.c')
-rw-r--r--gcc/gensupport.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index de295795a96..8c5a1ab8602 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -126,10 +126,7 @@ 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 void mark_operands_used_in_match_dup (rtx);
-static void renumerate_operands_in_pattern (rtx);
-
+static rtx adjust_operands_numbers (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
@@ -1847,18 +1844,7 @@ process_substs_on_one_elem (struct queue_elem *elem,
subst_pattern = alter_constraints (subst_pattern, alternatives,
duplicate_each_alternative);
- 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);
-
- /* The number of MATCH_OPERANDs in the output pattern might
- change. This routine assigns new numbers to the
- MATCH_OPERAND expressions to avoid collisions. */
- renumerate_operands_in_pattern (subst_pattern);
+ subst_pattern = adjust_operands_numbers (subst_pattern);
/* Substitute match_dup and match_op_dup in the new pattern and
duplicate constraints. */
@@ -1871,6 +1857,7 @@ 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;
@@ -1940,7 +1927,7 @@ mark_operands_from_match_dup (rtx pattern)
}
}
-/* This is a subroutine of process_substs_on_one_elem.
+/* This is a subroutine of adjust_operands_numbers.
It goes through all expressions in PATTERN and when MATCH_DUP is
met, all MATCH_OPERANDs inside it is marked as occupied. The
process of marking is done by routin mark_operands_from_match_dup. */
@@ -1986,9 +1973,10 @@ find_first_unused_number_of_operand ()
return MAX_OPERANDS;
}
-/* This is a subroutine of process_substs_on_one_elem. It visits all
- expressions in PATTERN and assigns not-occupied operand indexes to
- MATCH_OPERANDs and MATCH_OPERATORs of this PATTERN. */
+/* This is subroutine of adjust_operands_numbers.
+ It visits all expressions in PATTERN and assigns not-occupied
+ operand indexes to MATCH_OPERANDs and MATCH_OPERATORs of this
+ PATTERN. */
static void
renumerate_operands_in_pattern (rtx pattern)
{
@@ -2023,6 +2011,23 @@ 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)