OSDN Git Service

* g++.old-deja/g++.pt/static11.C: Add xtensa-*-elf* to the
[pf3gnuchains/gcc-fork.git] / gcc / sched-ebb.c
index 56d9661..43bf9ab 100644 (file)
@@ -1,24 +1,24 @@
 /* Instruction scheduling pass.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
    and currently maintained by, Jim Wilson (wilson@cygnus.com)
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-GNU CC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to the Free
-the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+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.  */
 \f
 #include "config.h"
@@ -36,6 +36,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "except.h"
 #include "toplev.h"
 #include "recog.h"
+#include "cfglayout.h"
 #include "sched-int.h"
 \f
 /* The number of insns to be scheduled in total.  */
@@ -48,7 +49,7 @@ static void init_ready_list PARAMS ((struct ready_list *));
 static int can_schedule_ready_p PARAMS ((rtx));
 static int new_ready PARAMS ((rtx));
 static int schedule_more_p PARAMS ((void));
-static const char *print_insn PARAMS ((rtx, int));
+static const char *ebb_print_insn PARAMS ((rtx, int));
 static int rank PARAMS ((rtx, rtx));
 static int contributes_to_priority PARAMS ((rtx, rtx));
 static void compute_jump_reg_dependencies PARAMS ((rtx, regset));
@@ -127,7 +128,7 @@ new_ready (next)
    to be formatted so that multiple output lines will line up nicely.  */
 
 static const char *
-print_insn (insn, aligned)
+ebb_print_insn (insn, aligned)
      rtx insn;
      int aligned ATTRIBUTE_UNUSED;
 {
@@ -187,13 +188,13 @@ static struct sched_info ebb_sched_info =
   schedule_more_p,
   new_ready,
   rank,
-  print_insn,
+  ebb_print_insn,
   contributes_to_priority,
   compute_jump_reg_dependencies,
 
   NULL, NULL,
   NULL, NULL,
-  0
+  0, 1
 };
 \f
 /* Schedule a single extended basic block, defined by the boundaries HEAD
@@ -236,10 +237,7 @@ schedule_ebb (head, tail)
      or after the last real insn of the block.  So if the first insn
      has a REG_SAVE_NOTE which would otherwise be emitted before the
      insn, it is redundant with the note before the start of the
-     block, and so we have to take it out.
-
-     FIXME: Probably the same thing should be done with REG_SAVE_NOTEs
-     referencing NOTE_INSN_SETJMP at the end of the block.  */
+     block, and so we have to take it out.  */
   if (INSN_P (head))
     {
       rtx note;
@@ -247,14 +245,9 @@ schedule_ebb (head, tail)
       for (note = REG_NOTES (head); note; note = XEXP (note, 1))
        if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
          {
-           if (INTVAL (XEXP (note, 0)) != NOTE_INSN_SETJMP)
-             {
-               remove_note (head, note);
-               note = XEXP (note, 1);
-               remove_note (head, note);
-             }
-           else
-             note = XEXP (note, 1);
+           remove_note (head, note);
+           note = XEXP (note, 1);
+           remove_note (head, note);
          }
     }
 
@@ -286,7 +279,7 @@ void
 schedule_ebbs (dump_file)
      FILE *dump_file;
 {
-  int i;
+  basic_block bb;
 
   /* Taking care of this degenerate case makes the rest of
      this code simpler.  */
@@ -298,23 +291,22 @@ schedule_ebbs (dump_file)
   current_sched_info = &ebb_sched_info;
 
   allocate_reg_life_data ();
-  compute_bb_for_insn (get_max_uid ());
+  compute_bb_for_insn ();
 
   /* Schedule every region in the subroutine.  */
-  for (i = 0; i < n_basic_blocks; i++)
-    { 
-      rtx head = BASIC_BLOCK (i)->head;
+  FOR_EACH_BB (bb)
+    {
+      rtx head = bb->head;
       rtx tail;
 
       for (;;)
        {
-         basic_block b = BASIC_BLOCK (i);
          edge e;
-         tail = b->end;
-         if (i + 1 == n_basic_blocks
-             || GET_CODE (BLOCK_HEAD (i + 1)) == CODE_LABEL)
+         tail = bb->end;
+         if (bb->next_bb == EXIT_BLOCK_PTR
+             || GET_CODE (bb->next_bb->head) == CODE_LABEL)
            break;
-         for (e = b->succ; e; e = e->succ_next)
+         for (e = bb->succ; e; e = e->succ_next)
            if ((e->flags & EDGE_FALLTHRU) != 0)
              break;
          if (! e)
@@ -330,7 +322,7 @@ schedule_ebbs (dump_file)
                }
            }
 
-         i++;
+         bb = bb->next_bb;
        }
 
       /* Blah.  We should fix the rest of the code not to get confused by