reload.c (find_reloads): Swap operand_loc pointers for find_dummy_reload if we have...
authorDaniel Jacobowitz <dan@debian.org>
Fri, 3 Sep 2004 19:34:15 +0000 (19:34 +0000)
committerDaniel Jacobowitz <drow@gcc.gnu.org>
Fri, 3 Sep 2004 19:34:15 +0000 (19:34 +0000)
* reload.c (find_reloads): Swap operand_loc pointers for
find_dummy_reload if we have swapped two operands.

From-SVN: r87049

gcc/ChangeLog
gcc/reload.c

index 9c4561fa2faacdbaa8bd15d42273e6d5ed07854d..c20d4a9b5d3456bc1dd74d00d55090f47a1efc9e 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-03  Daniel Jacobowitz  <dan@debian.org>
+
+       * reload.c (find_reloads): Swap operand_loc pointers for
+       find_dummy_reload if we have swapped two operands.
+
 2004-09-03  Hans-Peter Nilsson  <hp@axis.com>
 
        * config/cris/cris.h (ASM_OUTPUT_CASE_END): Use prev_nonnote_insn
index 260e4b7a3aaa7a94b9f25e3196fa7356082103ca..950d6fd30880371c52dcb3b1773362b6e148e001 100644 (file)
@@ -3079,6 +3079,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                  {
                    /* Operands don't match.  */
                    rtx value;
+                   int loc1, loc2;
                    /* Retroactively mark the operand we had to match
                       as a loser, if it wasn't already.  */
                    if (this_alternative_win[m])
@@ -3087,12 +3088,26 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                    if (this_alternative[m] == (int) NO_REGS)
                      bad = 1;
                    /* But count the pair only once in the total badness of
-                      this alternative, if the pair can be a dummy reload.  */
+                      this alternative, if the pair can be a dummy reload.
+                      The pointers in operand_loc are not swapped; swap
+                      them by hand if necessary.  */
+                   if (swapped && i == commutative)
+                     loc1 = commutative + 1;
+                   else if (swapped && i == commutative + 1)
+                     loc1 = commutative;
+                   else
+                     loc1 = i;
+                   if (swapped && m == commutative)
+                     loc2 = commutative + 1;
+                   else if (swapped && m == commutative + 1)
+                     loc2 = commutative;
+                   else
+                     loc2 = m;
                    value
                      = find_dummy_reload (recog_data.operand[i],
                                           recog_data.operand[m],
-                                          recog_data.operand_loc[i],
-                                          recog_data.operand_loc[m],
+                                          recog_data.operand_loc[loc1],
+                                          recog_data.operand_loc[loc2],
                                           operand_mode[i], operand_mode[m],
                                           this_alternative[m], -1,
                                           this_alternative_earlyclobber[m]);