OSDN Git Service

PR c/10175
[pf3gnuchains/gcc-fork.git] / gcc / graph.c
index c6af98a..e56ef93 100644 (file)
@@ -2,25 +2,27 @@
    Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
-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 FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+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 Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+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.  */
 
 #include <config.h>
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 
 #include "rtl.h"
 #include "flags.h"
@@ -31,7 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "graph.h"
 
-static const char *graph_ext[] =
+static const char *const graph_ext[] =
 {
   /* no_graph */ "",
   /* vcg */      ".vcg",
@@ -236,7 +238,7 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
      const char *suffix;
      rtx rtx_first;
 {
-  register rtx tmp_rtx;
+  rtx tmp_rtx;
   size_t namelen = strlen (base);
   size_t suffixlen = strlen (suffix);
   size_t extlen = strlen (graph_ext[graph_dump_format]) + 1;
@@ -258,7 +260,6 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
     fprintf (fp, "(nil)\n");
   else
     {
-      int i;
       enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
       int max_uid = get_max_uid ();
       int *start = (int *) xmalloc (max_uid * sizeof (int));
@@ -266,6 +267,7 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
       enum bb_state *in_bb_p = (enum bb_state *)
        xmalloc (max_uid * sizeof (enum bb_state));
       basic_block bb;
+      int i;
 
       for (i = 0; i < max_uid; ++i)
        {
@@ -273,12 +275,11 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
          in_bb_p[i] = NOT_IN_BB;
        }
 
-      for (i = n_basic_blocks - 1; i >= 0; --i)
+      FOR_EACH_BB_REVERSE (bb)
        {
          rtx x;
-         bb = BASIC_BLOCK (i);
-         start[INSN_UID (bb->head)] = i;
-         end[INSN_UID (bb->end)] = i;
+         start[INSN_UID (bb->head)] = bb->index;
+         end[INSN_UID (bb->end)] = bb->index;
          for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x))
            {
              in_bb_p[INSN_UID (x)]