OSDN Git Service

2006-08-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / graph.c
index 62c35d7..5e1627d 100644 (file)
@@ -17,19 +17,19 @@ 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.  */
 
 #include <config.h>
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-
 #include "rtl.h"
 #include "flags.h"
 #include "output.h"
 #include "function.h"
 #include "hard-reg-set.h"
+#include "obstack.h"
 #include "basic-block.h"
 #include "toplev.h"
 #include "graph.h"
@@ -66,6 +66,10 @@ graph: { title: \"%s\"\nfolding: 1\nhidden: 2\nnode: { title: \"%s.0\" }\n",
 static void
 start_bb (FILE *fp, int bb)
 {
+#if 0
+  reg_set_iterator rsi;
+#endif
+
   switch (graph_dump_format)
     {
     case vcg:
@@ -83,13 +87,12 @@ label: \"basic block %d",
 
   /* Print the live-at-start register list.  */
   fputc ('\n', fp);
-  EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i,
-                            {
-                              fprintf (fp, " %d", i);
-                              if (i < FIRST_PSEUDO_REGISTER)
-                                fprintf (fp, " [%s]",
-                                         reg_names[i]);
-                            });
+  EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i, rsi)
+    {
+      fprintf (fp, " %d", i);
+      if (i < FIRST_PSEUDO_REGISTER)
+       fprintf (fp, " [%s]", reg_names[i]);
+    }
 #endif
 
   switch (graph_dump_format)
@@ -244,9 +247,9 @@ print_rtl_graph_with_bb (const char *base, rtx rtx_first)
     {
       enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
       int max_uid = get_max_uid ();
-      int *start = xmalloc (max_uid * sizeof (int));
-      int *end = xmalloc (max_uid * sizeof (int));
-      enum bb_state *in_bb_p = xmalloc (max_uid * sizeof (enum bb_state));
+      int *start = XNEWVEC (int, max_uid);
+      int *end = XNEWVEC (int, max_uid);
+      enum bb_state *in_bb_p = XNEWVEC (enum bb_state, max_uid);
       basic_block bb;
       int i;
 
@@ -308,6 +311,7 @@ print_rtl_graph_with_bb (const char *base, rtx rtx_first)
          if ((i = end[INSN_UID (tmp_rtx)]) >= 0)
            {
              edge e;
+             edge_iterator ei;
 
              bb = BASIC_BLOCK (i);
 
@@ -316,7 +320,7 @@ print_rtl_graph_with_bb (const char *base, rtx rtx_first)
 
              /* Now specify the edges to all the successors of this
                 basic block.  */
-             for (e = bb->succ; e ; e = e->succ_next)
+             FOR_EACH_EDGE (e, ei, bb->succs)
                {
                  if (e->dest != EXIT_BLOCK_PTR)
                    {
@@ -398,14 +402,8 @@ clean_graph_dump_file (const char *base)
   if (fp == NULL)
     fatal_error ("can't open %s: %m", buf);
 
-  switch (graph_dump_format)
-    {
-    case vcg:
-      fputs ("graph: {\nport_sharing: no\n", fp);
-      break;
-    case no_graph:
-      abort ();
-    }
+  gcc_assert (graph_dump_format == vcg);
+  fputs ("graph: {\nport_sharing: no\n", fp);
 
   fclose (fp);
 }
@@ -426,15 +424,8 @@ finish_graph_dump_file (const char *base)
   fp = fopen (buf, "a");
   if (fp != NULL)
     {
-      switch (graph_dump_format)
-       {
-       case vcg:
-         fputs ("}\n", fp);
-         break;
-       case no_graph:
-         abort ();
-       }
-
+      gcc_assert (graph_dump_format == vcg);
+      fputs ("}\n", fp);
       fclose (fp);
     }
 }