]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/reload1.c
Fix bug in reloads_conflict
[gcc.git] / gcc / reload1.c
index 98a246bc79e8153b22cd94f3605b8994c8f6b8aa..ac00812e8326523c4fbc4e4dbfc40a0d7fb26e17 100644 (file)
@@ -1106,13 +1106,12 @@ reload (first, global, dumpfile)
      which are only valid during and after reload.  */
   reload_completed = 1;
 
-  /* Make a pass over all the insns and delete all USEs which we
-     inserted only to tag a REG_EQUAL note on them.  Remove all
-     REG_DEAD and REG_UNUSED notes.  Delete all CLOBBER insns and
-     simplify (subreg (reg)) operands.  Also remove all REG_RETVAL and
-     REG_LIBCALL notes since they are no longer useful or accurate.
-     Strip and regenerate REG_INC notes that may have been moved
-     around.  */
+  /* Make a pass over all the insns and delete all USEs which we inserted
+     only to tag a REG_EQUAL note on them.  Remove all REG_DEAD and REG_UNUSED
+     notes.  Delete all CLOBBER insns that don't refer to the return value
+     and simplify (subreg (reg)) operands.  Also remove all REG_RETVAL and
+     REG_LIBCALL notes since they are no longer useful or accurate.  Strip
+     and regenerate REG_INC notes that may have been moved around.  */
 
   for (insn = first; insn; insn = NEXT_INSN (insn))
     if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
@@ -1121,7 +1120,9 @@ reload (first, global, dumpfile)
 
        if ((GET_CODE (PATTERN (insn)) == USE
             && find_reg_note (insn, REG_EQUAL, NULL_RTX))
-           || GET_CODE (PATTERN (insn)) == CLOBBER)
+           || (GET_CODE (PATTERN (insn)) == CLOBBER
+               && (GET_CODE (XEXP (PATTERN (insn), 0)) != REG
+                   || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
          {
            PUT_CODE (insn, NOTE);
            NOTE_SOURCE_FILE (insn) = 0;
@@ -3515,7 +3516,11 @@ eliminate_regs_in_insn (insn, replace)
         and one is inside RTL that has been copied while the other is not.  */
       new_body = old_body;
       if (! replace)
-       new_body = copy_insn (old_body);
+       {
+         new_body = copy_insn (old_body);
+         if (REG_NOTES (insn))
+           REG_NOTES (insn) = copy_insn_1 (REG_NOTES (insn));
+       }
       PATTERN (insn) = new_body;
 
       /* If we had a move insn but now we don't, rerecognize it.  This will
@@ -4304,9 +4309,8 @@ reload_as_needed (live_known)
 
   bzero ((char *) spill_reg_rtx, sizeof spill_reg_rtx);
   bzero ((char *) spill_reg_store, sizeof spill_reg_store);
-  reg_last_reload_reg = (rtx *) alloca (max_regno * sizeof (rtx));
-  bzero ((char *) reg_last_reload_reg, max_regno * sizeof (rtx));
-  reg_has_output_reload = (char *) alloca (max_regno);
+  reg_last_reload_reg = (rtx *) xcalloc (max_regno, sizeof (rtx));
+  reg_has_output_reload = (char *) xmalloc (max_regno);
   CLEAR_HARD_REG_SET (reg_reloaded_valid);
 
   set_initial_elim_offsets ();
@@ -4568,11 +4572,11 @@ reload_as_needed (live_known)
            && INSN_CLOBBERS_REGNO_P (insn, i))
          CLEAR_HARD_REG_BIT (reg_reloaded_valid, i);
 #endif
-
-#ifdef USE_C_ALLOCA
-      alloca (0);
-#endif
     }
+
+  /* Clean up.  */
+  free (reg_last_reload_reg);
+  free (reg_has_output_reload);
 }
 
 /* Discard all record of any value reloaded from X,
@@ -5228,7 +5232,7 @@ reloads_conflict (r1, r2)
       return (r2_type == RELOAD_FOR_INSN || r2_type == RELOAD_FOR_OUTPUT
              || ((r2_type == RELOAD_FOR_OUTPUT_ADDRESS
                   || r2_type == RELOAD_FOR_OUTADDR_ADDRESS)
-                 && r2_opnum >= r1_opnum));
+                 && r2_opnum <= r1_opnum));
 
     case RELOAD_FOR_INSN:
       return (r2_type == RELOAD_FOR_INPUT || r2_type == RELOAD_FOR_OUTPUT
@@ -5303,6 +5307,13 @@ reload_reg_free_for_value_p (regno, opnum, type, value, out, reloadnum,
   int i;
   int copy = 0;
 
+  /* ??? reload_reg_used is abused to hold the registers that are not
+     available as spill registers, including hard registers that are
+     earlyclobbered in asms.  As a temporary measure, reject anything
+     in reload_reg_used.  */
+  if (TEST_HARD_REG_BIT (reload_reg_used, regno))
+    return 0;
+
   if (out == const0_rtx)
     {
       copy = 1;
This page took 0.028336 seconds and 5 git commands to generate.