(reload): Print the needs to the dump file.
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 21 Sep 1992 12:26:33 +0000 (08:26 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 21 Sep 1992 12:26:33 +0000 (08:26 -0400)
(reload): If we can't get a register that we know won't interfere with groups,
get one that might instead of giving up.

From-SVN: r2201

gcc/reload1.c

index 77387a0d6378792f602f0556f617658781adbcbb..1b322bbee0d65dd8006208acb8d1e96a71bf8b13 100644 (file)
@@ -802,6 +802,7 @@ reload (first, global, dumpfile)
       rtx max_nongroups_insn[N_REG_CLASSES];
       rtx x;
       int starting_frame_size = get_frame_size ();
+      static char *reg_class_names[] = REG_CLASS_NAMES;
 
       something_changed = 0;
       bzero (max_needs, sizeof max_needs);
@@ -1323,6 +1324,27 @@ reload (first, global, dumpfile)
       if (starting_frame_size != get_frame_size ())
        something_changed = 1;
 
+      if (dumpfile)
+       for (i = 0; i < N_REG_CLASSES; i++)
+         {
+           if (max_needs[i] > 0)
+             fprintf (dumpfile,
+                        ";; Need %d reg%s of class %s (for insn %d).\n",
+                      max_needs[i], max_needs[i] == 1 ? "" : "s",
+                      reg_class_names[i], INSN_UID (max_needs_insn[i]));
+           if (max_nongroups[i] > 0)
+             fprintf (dumpfile,
+                      ";; Need %d nongroup reg%s of class %s (for insn %d).\n",
+                      max_nongroups[i], max_nongroups[i] == 1 ? "" : "s",
+                      reg_class_names[i], INSN_UID (max_nongroups_insn[i]));
+           if (max_groups[i] > 0)
+             fprintf (dumpfile,
+                      ";; Need %d group%s (%smode) of class %s (for insn %d).\n",
+                      max_groups[i], max_groups[i] == 1 ? "" : "s",
+                      mode_name[(int) group_mode[i]],
+                      reg_class_names[i], INSN_UID (max_groups_insn[i]));
+         }
+                        
       /* If we have caller-saves, set up the save areas and see if caller-save
         will need a spill register.  */
 
@@ -1703,6 +1725,23 @@ reload (first, global, dumpfile)
                        || possible_group_p (potential_reload_regs[i], max_groups)))
                  break;
 
+             /* If we couldn't get a register, try to get one even if we
+                might foreclose possible groups.  This may cause problems
+                later, but that's better than aborting now, since it is
+                possible that we will, in fact, be able to form the needed
+                group even with this allocation.  */
+
+             if (i >= FIRST_PSEUDO_REGISTER
+                 && (asm_noperands (max_needs[class] > 0
+                                    ? max_needs_insn[class]
+                                    : max_nongroups_insn[class])
+                     < 0))
+               for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+                 if (potential_reload_regs[i] >= 0
+                     && TEST_HARD_REG_BIT (reg_class_contents[class],
+                                           potential_reload_regs[i]))
+                   break;
+
              /* I should be the index in potential_reload_regs
                 of the new reload reg we have found.  */