OSDN Git Service

Unify handling of runtime support functions.
[pf3gnuchains/gcc-fork.git] / gcc / sched-ebb.c
index f487560..6bb223b 100644 (file)
@@ -1,6 +1,6 @@
 /* Instruction scheduling pass.
-   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
    and currently maintained by, Jim Wilson (wilson@cygnus.com)
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
 #include "rtl.h"
 #include "tm_p.h"
 #include "hard-reg-set.h"
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "insn-config.h"
 #include "insn-attr.h"
 #include "except.h"
-#include "toplev.h"
 #include "recog.h"
 #include "cfglayout.h"
 #include "params.h"
@@ -60,7 +59,7 @@ static basic_block last_bb;
 
 /* Implementations of the sched_info functions for region scheduling.  */
 static void init_ready_list (void);
-static void begin_schedule_ready (rtx, rtx);
+static void begin_schedule_ready (rtx);
 static int schedule_more_p (void);
 static const char *ebb_print_insn (const_rtx, int);
 static int rank (rtx, rtx);
@@ -126,10 +125,15 @@ init_ready_list (void)
 
 /* INSN is being scheduled after LAST.  Update counters.  */
 static void
-begin_schedule_ready (rtx insn, rtx last)
+begin_schedule_ready (rtx insn ATTRIBUTE_UNUSED)
 {
   sched_rgn_n_insns++;
+}
 
+/* INSN is being moved to its place in the schedule, after LAST.  */
+static void
+begin_move_insn (rtx insn, rtx last)
+{
   if (BLOCK_FOR_INSN (insn) == last_bb
       /* INSN is a jump in the last block, ...  */
       && control_flow_insn_p (insn)
@@ -137,7 +141,6 @@ begin_schedule_ready (rtx insn, rtx last)
       && last != PREV_INSN (insn))
     {
       edge e;
-      edge_iterator ei;
       basic_block bb;
 
       /* An obscure special case, where we do have partially dead
@@ -145,28 +148,24 @@ begin_schedule_ready (rtx insn, rtx last)
         In this case we can create new basic block.  It is
         always exactly one basic block last in the sequence.  */
 
-      FOR_EACH_EDGE (e, ei, last_bb->succs)
-       if (e->flags & EDGE_FALLTHRU)
-         break;
+      e = find_fallthru_edge (last_bb->succs);
 
-#ifdef ENABLE_CHECKING
-      gcc_assert (!e || !(e->flags & EDGE_COMPLEX));
+      gcc_checking_assert (!e || !(e->flags & EDGE_COMPLEX));
 
-      gcc_assert (BLOCK_FOR_INSN (insn) == last_bb
-                 && !IS_SPECULATION_CHECK_P (insn)
-                 && BB_HEAD (last_bb) != insn
-                 && BB_END (last_bb) == insn);
+      gcc_checking_assert (BLOCK_FOR_INSN (insn) == last_bb
+                          && !IS_SPECULATION_CHECK_P (insn)
+                          && BB_HEAD (last_bb) != insn
+                          && BB_END (last_bb) == insn);
 
       {
        rtx x;
 
        x = NEXT_INSN (insn);
        if (e)
-         gcc_assert (NOTE_P (x) || LABEL_P (x));
+         gcc_checking_assert (NOTE_P (x) || LABEL_P (x));
        else
-         gcc_assert (BARRIER_P (x));
+         gcc_checking_assert (BARRIER_P (x));
       }
-#endif
 
       if (e)
        {
@@ -294,6 +293,7 @@ static struct haifa_sched_info ebb_sched_info =
 
   ebb_add_remove_insn,
   begin_schedule_ready,
+  begin_move_insn,
   advance_target_bb,
   SCHED_EBB
   /* We can create new blocks in begin_schedule_ready ().  */
@@ -463,7 +463,7 @@ static basic_block
 schedule_ebb (rtx head, rtx tail)
 {
   basic_block first_bb, target_bb;
-  struct deps tmp_deps;
+  struct deps_desc tmp_deps;
 
   first_bb = BLOCK_FOR_INSN (head);
   last_bb = BLOCK_FOR_INSN (tail);
@@ -585,21 +585,23 @@ schedule_ebbs (void)
     {
       rtx head = BB_HEAD (bb);
 
+      if (bb->flags & BB_DISABLE_SCHEDULE)
+       continue;
+
       for (;;)
        {
          edge e;
-         edge_iterator ei;
          tail = BB_END (bb);
          if (bb->next_bb == EXIT_BLOCK_PTR
              || LABEL_P (BB_HEAD (bb->next_bb)))
            break;
-         FOR_EACH_EDGE (e, ei, bb->succs)
-           if ((e->flags & EDGE_FALLTHRU) != 0)
-             break;
+         e = find_fallthru_edge (bb->succs);
          if (! e)
            break;
          if (e->probability <= probability_cutoff)
            break;
+         if (e->dest->flags & BB_DISABLE_SCHEDULE)
+           break;
          bb = bb->next_bb;
        }
 
@@ -607,9 +609,9 @@ schedule_ebbs (void)
         a note or two.  */
       while (head != tail)
        {
-         if (NOTE_P (head) || BOUNDARY_DEBUG_INSN_P (head))
+         if (NOTE_P (head) || DEBUG_INSN_P (head))
            head = NEXT_INSN (head);
-         else if (NOTE_P (tail) || BOUNDARY_DEBUG_INSN_P (tail))
+         else if (NOTE_P (tail) || DEBUG_INSN_P (tail))
            tail = PREV_INSN (tail);
          else if (LABEL_P (head))
            head = NEXT_INSN (head);