OSDN Git Service

* dwarf2out.c (dwarf2out_frame_debug_expr): Consult the
[pf3gnuchains/gcc-fork.git] / gcc / reload1.c
index dada892..d0fec9b 100644 (file)
@@ -548,7 +548,7 @@ compute_use_by_pseudos (HARD_REG_SET *to, regset from)
       if (r < 0)
        {
          /* reload_combine uses the information from
-            DF_RA_LIVE_IN (BASIC_BLOCK), which might still
+            DF_LIVE_IN (BASIC_BLOCK), which might still
             contain registers that have not actually been allocated
             since they have an equivalence.  */
          gcc_assert (reload_completed);
@@ -702,7 +702,7 @@ int
 reload (rtx first, int global)
 {
   int i;
-  rtx insn, next;
+  rtx insn;
   struct elim_table *ep;
   basic_block bb;
 
@@ -743,9 +743,11 @@ reload (rtx first, int global)
   /* A function that has a nonlocal label that can reach the exit
      block via non-exceptional paths must save all call-saved
      registers.  */
-  if (current_function_calls_unwind_init
-      || (current_function_has_nonlocal_label
-         && has_nonexceptional_receiver ()))
+  if (current_function_has_nonlocal_label
+      && has_nonexceptional_receiver ())
+    current_function_saves_all_registers = 1;
+
+  if (current_function_saves_all_registers)
     for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
       if (! call_used_regs[i] && ! fixed_regs[i] && ! LOCAL_REGNO (i))
        df_set_regs_ever_live (i, true);
@@ -1156,10 +1158,7 @@ reload (rtx first, int global)
 
   if (! frame_pointer_needed)
     FOR_EACH_BB (bb)
-      {
-       bitmap_clear_bit (df_get_live_in (bb), HARD_FRAME_POINTER_REGNUM);
-       bitmap_clear_bit (df_get_live_top (bb), HARD_FRAME_POINTER_REGNUM);
-      }
+      bitmap_clear_bit (df_get_live_in (bb), HARD_FRAME_POINTER_REGNUM);
        
   /* Come here (with failure set nonzero) if we can't get enough spill
      regs.  */
@@ -1225,91 +1224,86 @@ reload (rtx first, int global)
      are no longer useful or accurate.  Strip and regenerate REG_INC notes
      that may have been moved around.  */
 
-  for (insn = first; insn; insn = next)
-    {
-      next = NEXT_INSN (insn);
-      if (INSN_P (insn))
-        {
-          rtx *pnote;
-
-          if (CALL_P (insn))
-            replace_pseudos_in (& CALL_INSN_FUNCTION_USAGE (insn),
-                                VOIDmode, CALL_INSN_FUNCTION_USAGE (insn));
-
-          if ((GET_CODE (PATTERN (insn)) == USE
-               /* We mark with QImode USEs introduced by reload itself.  */
-               && (GET_MODE (insn) == QImode
-                   || find_reg_note (insn, REG_EQUAL, NULL_RTX)))
-              || (GET_CODE (PATTERN (insn)) == CLOBBER
-                  && (!MEM_P (XEXP (PATTERN (insn), 0))
-                      || GET_MODE (XEXP (PATTERN (insn), 0)) != BLKmode
-                      || (GET_CODE (XEXP (XEXP (PATTERN (insn), 0), 0))
-                          != SCRATCH
-                          && XEXP (XEXP (PATTERN (insn), 0), 0)
-                          != stack_pointer_rtx))
-                  && (!REG_P (XEXP (PATTERN (insn), 0))
-                      || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
-            {
-              delete_insn (insn);
-              continue;
-            }
-
-          /* Some CLOBBERs may survive until here and still reference
-             unassigned pseudos with const equivalent, which may in turn cause
-             ICE in later passes if the reference remains in place.  */
-          if (GET_CODE (PATTERN (insn)) == CLOBBER)
-            replace_pseudos_in (& XEXP (PATTERN (insn), 0),
-                                VOIDmode, PATTERN (insn));
-
-          /* Discard obvious no-ops, even without -O.  This optimization
-             is fast and doesn't interfere with debugging.  */
-          if (NONJUMP_INSN_P (insn)
-              && GET_CODE (PATTERN (insn)) == SET
-              && REG_P (SET_SRC (PATTERN (insn)))
-              && REG_P (SET_DEST (PATTERN (insn)))
-              && (REGNO (SET_SRC (PATTERN (insn)))
-                  == REGNO (SET_DEST (PATTERN (insn)))))
-            {
-              delete_insn (insn);
-              continue;
-            }
-
-          pnote = &REG_NOTES (insn);
-          while (*pnote != 0)
-            {
-              if (REG_NOTE_KIND (*pnote) == REG_DEAD
-                  || REG_NOTE_KIND (*pnote) == REG_UNUSED
-                  || REG_NOTE_KIND (*pnote) == REG_INC
-                  || REG_NOTE_KIND (*pnote) == REG_RETVAL
-                  || REG_NOTE_KIND (*pnote) == REG_LIBCALL_ID
-                  || REG_NOTE_KIND (*pnote) == REG_LIBCALL)
-                *pnote = XEXP (*pnote, 1);
-              else
-                pnote = &XEXP (*pnote, 1);
-            }
+  for (insn = first; insn; insn = NEXT_INSN (insn))
+    if (INSN_P (insn))
+      {
+       rtx *pnote;
+
+       if (CALL_P (insn))
+         replace_pseudos_in (& CALL_INSN_FUNCTION_USAGE (insn),
+                             VOIDmode, CALL_INSN_FUNCTION_USAGE (insn));
+
+       if ((GET_CODE (PATTERN (insn)) == USE
+            /* We mark with QImode USEs introduced by reload itself.  */
+            && (GET_MODE (insn) == QImode
+                || find_reg_note (insn, REG_EQUAL, NULL_RTX)))
+           || (GET_CODE (PATTERN (insn)) == CLOBBER
+               && (!MEM_P (XEXP (PATTERN (insn), 0))
+                   || GET_MODE (XEXP (PATTERN (insn), 0)) != BLKmode
+                   || (GET_CODE (XEXP (XEXP (PATTERN (insn), 0), 0)) != SCRATCH
+                       && XEXP (XEXP (PATTERN (insn), 0), 0)
+                               != stack_pointer_rtx))
+               && (!REG_P (XEXP (PATTERN (insn), 0))
+                   || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
+         {
+           delete_insn (insn);
+           continue;
+         }
+
+       /* Some CLOBBERs may survive until here and still reference unassigned
+          pseudos with const equivalent, which may in turn cause ICE in later
+          passes if the reference remains in place.  */
+       if (GET_CODE (PATTERN (insn)) == CLOBBER)
+         replace_pseudos_in (& XEXP (PATTERN (insn), 0),
+                             VOIDmode, PATTERN (insn));
+
+       /* Discard obvious no-ops, even without -O.  This optimization
+          is fast and doesn't interfere with debugging.  */
+       if (NONJUMP_INSN_P (insn)
+           && GET_CODE (PATTERN (insn)) == SET
+           && REG_P (SET_SRC (PATTERN (insn)))
+           && REG_P (SET_DEST (PATTERN (insn)))
+           && (REGNO (SET_SRC (PATTERN (insn)))
+               == REGNO (SET_DEST (PATTERN (insn)))))
+         {
+           delete_insn (insn);
+           continue;
+         }
+
+       pnote = &REG_NOTES (insn);
+       while (*pnote != 0)
+         {
+           if (REG_NOTE_KIND (*pnote) == REG_DEAD
+               || REG_NOTE_KIND (*pnote) == REG_UNUSED
+               || REG_NOTE_KIND (*pnote) == REG_INC
+               || REG_NOTE_KIND (*pnote) == REG_RETVAL
+               || REG_NOTE_KIND (*pnote) == REG_LIBCALL)
+             *pnote = XEXP (*pnote, 1);
+           else
+             pnote = &XEXP (*pnote, 1);
+         }
 
 #ifdef AUTO_INC_DEC
-          add_auto_inc_notes (insn, PATTERN (insn));
+       add_auto_inc_notes (insn, PATTERN (insn));
 #endif
 
-          /* Simplify (subreg (reg)) if it appears as an operand.  */
-          cleanup_subreg_operands (insn);
-
-          /* Clean up invalid ASMs so that they don't confuse later passes.
-             See PR 21299.  */
-          if (asm_noperands (PATTERN (insn)) >= 0)
-            {
-              extract_insn (insn);
-              if (!constrain_operands (1))
-               {
-                  error_for_asm (insn,
-                                 "%<asm%> operand has impossible constraints");
-                  delete_insn (insn);
-                  continue;
-                }
-            }
-        }
-    }
+       /* Simplify (subreg (reg)) if it appears as an operand.  */
+       cleanup_subreg_operands (insn);
+
+       /* Clean up invalid ASMs so that they don't confuse later passes.
+          See PR 21299.  */
+       if (asm_noperands (PATTERN (insn)) >= 0)
+         {
+           extract_insn (insn);
+           if (!constrain_operands (1))
+             {
+               error_for_asm (insn,
+                              "%<asm%> operand has impossible constraints");
+               delete_insn (insn);
+               continue;
+             }
+         }
+      }
 
   /* If we are doing stack checking, give a warning if this function's
      frame size is larger than we expect.  */
@@ -1541,8 +1535,8 @@ calculate_needs_all_insns (int global)
       chain->need_operand_change = 0;
 
       /* If this is a label, a JUMP_INSN, or has REG_NOTES (which might
-        include REG_LABEL), we need to see what effects this has on the
-        known offsets at labels.  */
+        include REG_LABEL_OPERAND and REG_LABEL_TARGET), we need to see
+        what effects this has on the known offsets at labels.  */
 
       if (LABEL_P (insn) || JUMP_P (insn)
          || (INSN_P (insn) && REG_NOTES (insn) != 0))
@@ -2297,10 +2291,11 @@ set_label_offsets (rtx x, rtx insn, int initial_p)
 
     case INSN:
     case CALL_INSN:
-      /* Any labels mentioned in REG_LABEL notes can be branched to indirectly
-        and hence must have all eliminations at their initial offsets.  */
+      /* Any labels mentioned in REG_LABEL_OPERAND notes can be branched
+        to indirectly and hence must have all eliminations at their
+        initial offsets.  */
       for (tem = REG_NOTES (x); tem; tem = XEXP (tem, 1))
-       if (REG_NOTE_KIND (tem) == REG_LABEL)
+       if (REG_NOTE_KIND (tem) == REG_LABEL_OPERAND)
          set_label_offsets (XEXP (tem, 0), insn, 1);
       return;
 
@@ -4018,7 +4013,7 @@ fixup_eh_region_note (rtx insn, rtx prev, rtx next)
       trap_count = 0;
     }
 
-  for (i = NEXT_INSN (prev); i && (i != next); i = NEXT_INSN (i))
+  for (i = NEXT_INSN (prev); i != next; i = NEXT_INSN (i))
     if (INSN_P (i) && i != insn && may_trap_p (PATTERN (i)))
       {
        trap_count++;
@@ -8051,7 +8046,7 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type)
   else if (OBJECT_P (in) || GET_CODE (in) == SUBREG)
     {
       tem = emit_insn (gen_move_insn (out, in));
-      /* IN may contain a LABEL_REF, if so add a REG_LABEL note.  */
+      /* IN may contain a LABEL_REF, if so add a REG_LABEL_OPERAND note.  */
       mark_jump_label (in, tem, 0);
     }
 
@@ -8190,18 +8185,15 @@ delete_output_reload (rtx insn, int j, int last_reload_reg)
       && REG_BASIC_BLOCK (REGNO (reg)) >= NUM_FIXED_BLOCKS
       && find_regno_note (insn, REG_DEAD, REGNO (reg)))
     {
-      rtx i2, prev;
+      rtx i2;
 
       /* We know that it was used only between here and the beginning of
         the current basic block.  (We also know that the last use before
         INSN was the output reload we are thinking of deleting, but never
         mind that.)  Search that range; see if any ref remains.  */
-      for (i2 = PREV_INSN (insn); i2; i2 = prev)
+      for (i2 = PREV_INSN (insn); i2; i2 = PREV_INSN (i2))
        {
-          rtx set;
-
-          prev = PREV_INSN (i2);
-          set = single_set (i2);
+         rtx set = single_set (i2);
 
          /* Uses which just store in the pseudo don't count,
             since if they are the only uses, they are dead.  */
@@ -8223,11 +8215,9 @@ delete_output_reload (rtx insn, int j, int last_reload_reg)
 
       /* Delete the now-dead stores into this pseudo.  Note that this
         loop also takes care of deleting output_reload_insn.  */
-      for (i2 = PREV_INSN (insn); i2; i2 = prev)
+      for (i2 = PREV_INSN (insn); i2; i2 = PREV_INSN (i2))
        {
-          rtx set;
-          prev = PREV_INSN (i2);
-          set = single_set (i2);
+         rtx set = single_set (i2);
 
          if (set != 0 && SET_DEST (set) == reg)
            {