unroll.c (initial_reg_note_copy): Use PUT_REG_NOTE_KIND and REG_NOTE_KIND, not PUT_MO...
authorMark Mitchell <mark@codesourcery.com>
Tue, 12 Jun 2001 04:42:46 +0000 (04:42 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 12 Jun 2001 04:42:46 +0000 (04:42 +0000)
* unroll.c (initial_reg_note_copy): Use PUT_REG_NOTE_KIND and
REG_NOTE_KIND, not PUT_MODE and GET_MODE.
(final_reg_note_copy): Remove REG_WAS_0 notes that are no longer
valid.

From-SVN: r43241

gcc/ChangeLog
gcc/unroll.c

index 272d38d97c2ed6d0ffb530f8a1bf0e970989be96..4d46908a35f2e8a8c061fdce914beada1469b1fe 100644 (file)
@@ -1,3 +1,10 @@
+2001-06-11  Mark Mitchell  <mark@codesourcery.com>
+
+       * unroll.c (initial_reg_note_copy): Use PUT_REG_NOTE_KIND and
+       REG_NOTE_KIND, not PUT_MODE and GET_MODE.
+       (final_reg_note_copy): Remove REG_WAS_0 notes that are no longer
+       valid.
+
 2001-06-11  Stan Shebs  <shebs@apple.com>
 
        * darwin.h (ASM_FILE_END): Remove decl of language_string.
index 71c96f68987916008be8a4b115e5add9fb60190d..94c58cd925cea78409f0977dec68dc25206da91d 100644 (file)
@@ -201,7 +201,7 @@ static int *splittable_regs_updates;
 static void init_reg_map PARAMS ((struct inline_remap *, int));
 static rtx calculate_giv_inc PARAMS ((rtx, rtx, unsigned int));
 static rtx initial_reg_note_copy PARAMS ((rtx, struct inline_remap *));
-static void final_reg_note_copy PARAMS ((rtx, struct inline_remap *));
+static void final_reg_note_copy PARAMS ((rtx *, struct inline_remap *));
 static void copy_loop_body PARAMS ((struct loop *, rtx, rtx,
                                    struct inline_remap *, rtx, int,
                                    enum unroll_types, rtx, rtx, rtx, rtx));
@@ -1666,7 +1666,7 @@ initial_reg_note_copy (notes, map)
     return 0;
 
   copy = rtx_alloc (GET_CODE (notes));
-  PUT_MODE (copy, GET_MODE (notes));
+  PUT_REG_NOTE_KIND (copy, REG_NOTE_KIND (notes));
 
   if (GET_CODE (notes) == EXPR_LIST)
     XEXP (copy, 0) = copy_rtx_and_substitute (XEXP (notes, 0), map, 0);
@@ -1684,15 +1684,38 @@ initial_reg_note_copy (notes, map)
 /* Fixup insn references in copied REG_NOTES.  */
 
 static void
-final_reg_note_copy (notes, map)
-     rtx notes;
+final_reg_note_copy (notesp, map)
+     rtx *notesp;
      struct inline_remap *map;
 {
-  rtx note;
+  while (*notesp)
+    {
+      rtx note = *notesp;
+      
+      if (GET_CODE (note) == INSN_LIST)
+       {
+         /* Sometimes, we have a REG_WAS_0 note that points to a
+            deleted instruction.  In that case, we can just delete the
+            note.  */
+         if (REG_NOTE_KIND (note) == REG_WAS_0)
+           {
+             *notesp = XEXP (note, 1);
+             continue;
+           }
+         else
+           {
+             rtx insn = map->insn_map[INSN_UID (XEXP (note, 0))];
+
+             /* If we failed to remap the note, something is awry.  */
+             if (!insn)
+               abort ();
+
+             XEXP (note, 0) = insn;
+           }
+       }
 
-  for (note = notes; note; note = XEXP (note, 1))
-    if (GET_CODE (note) == INSN_LIST)
-      XEXP (note, 0) = map->insn_map[INSN_UID (XEXP (note, 0))];
+      notesp = &XEXP (note, 1);
+    }
 }
 
 /* Copy each instruction in the loop, substituting from map as appropriate.
@@ -2219,7 +2242,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
       if ((GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
           || GET_CODE (insn) == CALL_INSN)
          && map->insn_map[INSN_UID (insn)])
-       final_reg_note_copy (REG_NOTES (map->insn_map[INSN_UID (insn)]), map);
+       final_reg_note_copy (&REG_NOTES (map->insn_map[INSN_UID (insn)]), map);
     }
   while (insn != copy_end);