(reload): Move test for failure to find any group to after the loop over i.
authorRichard Stallman <rms@gnu.org>
Sat, 3 Oct 1992 00:38:02 +0000 (00:38 +0000)
committerRichard Stallman <rms@gnu.org>
Sat, 3 Oct 1992 00:38:02 +0000 (00:38 +0000)
(reload): Move test for failure to find any group
to after the loop over i.  Also check that all the regnos fit
below FIRST_PSEUDO_REGISTER.

From-SVN: r2306

gcc/reload1.c

index 31b1dfa6b900355672728b41bc3c89ed4a06616c..4374d1f633840dbb4b8ca92576391d9ff108de3d 100644 (file)
@@ -1651,7 +1651,8 @@ reload (first, global, dumpfile)
                    {
                      int j = potential_reload_regs[i];
                      int k;
-                     if (j >= 0 && j + 1 < FIRST_PSEUDO_REGISTER
+                     if (j >= 0
+                         && j + group_size[class] <= FIRST_PSEUDO_REGISTER
                          && HARD_REGNO_MODE_OK (j, group_mode[class]))
                        {
                          /* Check each reg in the sequence.  */
@@ -1671,18 +1672,10 @@ reload (first, global, dumpfile)
                                  for (idx = 0; idx < FIRST_PSEUDO_REGISTER; idx++)
                                    if (potential_reload_regs[idx] == j + k)
                                      break;
-                                   if (i >= FIRST_PSEUDO_REGISTER)
-                                     {
-                                       /* There are no groups left.  */
-                                       spill_failure (max_groups_insn[class]);
-                                       failure = 1;
-                                       goto failed;
-                                     }
-                                   else
-                                     something_changed
-                                       |= new_spill_reg (idx, class,
-                                                         max_needs, NULL_PTR,
-                                                         global, dumpfile);
+                                 something_changed
+                                   |= new_spill_reg (idx, class,
+                                                     max_needs, NULL_PTR,
+                                                     global, dumpfile);
                                }
 
                              /* We have found one that will complete a group,
@@ -1697,9 +1690,14 @@ reload (first, global, dumpfile)
                        }
                    }
                  /* We couldn't find any registers for this reload.
-                    Abort to avoid going into an infinite loop.  */
-                 if (i == FIRST_PSEUDO_REGISTER)
-                   abort ();
+                    Avoid going into an infinite loop.  */
+                 if (i >= FIRST_PSEUDO_REGISTER)
+                   {
+                     /* There are no groups left.  */
+                     spill_failure (max_groups_insn[class]);
+                     failure = 1;
+                     goto failed;
+                   }
                }
            }