OSDN Git Service

* config/ia64/ia64.c (ia64_expand_vcondu_v2si): Generate proper
[pf3gnuchains/gcc-fork.git] / gcc / reorg.c
index dbe075a..b6f60c7 100644 (file)
@@ -1,6 +1,6 @@
 /* Perform instruction reorganizations for delay slot filling.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
    Hacked by Michael Tiemann (tiemann@cygnus.com).
 
@@ -18,8 +18,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 /* Instruction reorganization pass.
 
@@ -253,7 +253,7 @@ stop_search_p (rtx insn, int labels_p)
              || asm_noperands (PATTERN (insn)) >= 0);
 
     default:
-      abort ();
+      gcc_unreachable ();
     }
 }
 \f
@@ -384,7 +384,7 @@ find_end_label (void)
       /* If the basic block reorder pass moves the return insn to
         some other place try to locate it again and put our
         end_of_function_label there.  */
-      while (insn && ! (GET_CODE (insn) == JUMP_INSN
+      while (insn && ! (JUMP_P (insn)
                        && (GET_CODE (PATTERN (insn)) == RETURN)))
        insn = PREV_INSN (insn);
       if (insn)
@@ -420,7 +420,12 @@ find_end_label (void)
             if needed.  */
          emit_label (end_of_function_label);
 #ifdef HAVE_return
-         if (HAVE_return)
+         /* We don't bother trying to create a return insn if the
+            epilogue has filled delay-slots; we would have to try and
+            move the delay-slot fillers to the delay-slots for the new
+            return insn or in front of the new return insn.  */
+         if (current_function_epilogue_delay_list == NULL
+             && HAVE_return)
            {
              /* The return we make may have delay slots too.  */
              rtx insn = gen_return ();
@@ -564,8 +569,7 @@ emit_delay_sequence (rtx insn, rtx list, int length)
   if (had_barrier)
     emit_barrier_after (seq_insn);
 
-  if (i != length + 1)
-    abort ();
+  gcc_assert (i == length + 1);
 
   return seq_insn;
 }
@@ -887,7 +891,7 @@ get_jump_flags (rtx insn, rtx label)
          break;
 
        default:
-         abort ();
+         gcc_unreachable ();
        }
     }
   else
@@ -999,16 +1003,6 @@ mostly_true_jump (rtx jump_insn, rtx condition)
           insn = PREV_INSN (insn))
        if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
          return 2;
-
-      /* If this is a jump to the test of a loop, it is likely true.  We scan
-        forwards from the target label.  If we find a NOTE_INSN_LOOP_VTOP
-        before the next real insn, we assume the branch is to the loop branch
-        test.  */
-      for (insn = NEXT_INSN (target_label);
-          insn && NOTE_P (insn);
-          insn = PREV_INSN (insn))
-       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_VTOP)
-         return 1;
     }
 
   /* Look at the relative rarities of the fallthrough and destination.  If
@@ -2559,9 +2553,8 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
   int flags;
 
   /* Validate our arguments.  */
-  if ((condition == const_true_rtx && ! thread_if_true)
-      || (! own_thread && ! thread_if_true))
-    abort ();
+  gcc_assert(condition != const_true_rtx || thread_if_true);
+  gcc_assert(own_thread || thread_if_true);
 
   flags = get_jump_flags (insn, JUMP_LABEL (insn));
 
@@ -2931,8 +2924,7 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
     {
       rtx label;
 
-      if (! thread_if_true)
-       abort ();
+      gcc_assert (thread_if_true);
 
       if (new_thread && JUMP_P (new_thread)
          && (simplejump_p (new_thread)
@@ -3238,8 +3230,7 @@ relax_delay_slots (rtx first)
 
          trial = PREV_INSN (insn);
          delete_related_insns (insn);
-         if (GET_CODE (pat) != SEQUENCE)
-           abort ();
+         gcc_assert (GET_CODE (pat) == SEQUENCE);
          after = trial;
          for (i = 0; i < XVECLEN (pat, 0); i++)
            {
@@ -3357,8 +3348,7 @@ relax_delay_slots (rtx first)
 
          trial = PREV_INSN (insn);
          delete_related_insns (insn);
-         if (GET_CODE (pat) != SEQUENCE)
-           abort ();
+         gcc_assert (GET_CODE (pat) == SEQUENCE);
          after = trial;
          for (i = 0; i < XVECLEN (pat, 0); i++)
            {
@@ -3389,6 +3379,7 @@ relax_delay_slots (rtx first)
         annulled jumps, though.  Again, don't convert a jump to a RETURN
         here.  */
       if (! INSN_ANNULLED_BRANCH_P (delay_insn)
+         && any_condjump_p (delay_insn)
          && next && JUMP_P (next)
          && (simplejump_p (next) || GET_CODE (PATTERN (next)) == RETURN)
          && next_active_insn (target_label) == next_active_insn (next)
@@ -3591,17 +3582,6 @@ dbr_schedule (rtx first, FILE *file)
 {
   rtx insn, next, epilogue_insn = 0;
   int i;
-#if 0
-  int old_flag_no_peephole = flag_no_peephole;
-
-  /* Execute `final' once in prescan mode to delete any insns that won't be
-     used.  Don't let final try to do any peephole optimization--it will
-     ruin dataflow information for this pass.  */
-
-  flag_no_peephole = 1;
-  final (first, 0, NO_DEBUG, 1, 1);
-  flag_no_peephole = old_flag_no_peephole;
-#endif
 
   /* If the current function has no insns other than the prologue and
      epilogue, then do not try to fill any delay slots.  */