OSDN Git Service

* gcc.c-torture/execute/20000412-1.c: Reduce some more.
[pf3gnuchains/gcc-fork.git] / gcc / graph.c
index 9514944..f4dde01 100644 (file)
@@ -1,5 +1,5 @@
 /* Output routines for graphical representation.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
    This file is part of GNU CC.
 #include "rtl.h"
 #include "flags.h"
 #include "output.h"
+#include "function.h"
 #include "hard-reg-set.h"
 #include "basic-block.h"
 #include "toplev.h"
+#include "graph.h"
 
 static const char *graph_ext[] =
 {
@@ -35,6 +37,13 @@ static const char *graph_ext[] =
   /* vcg */      ".vcg",
 };
 
+static void start_fct PARAMS ((FILE *));
+static void start_bb PARAMS ((FILE *, int));
+static void node_data PARAMS ((FILE *, rtx));
+static void draw_edge PARAMS ((FILE *, int, int, int, int));
+static void end_fct PARAMS ((FILE *));
+static void end_bb PARAMS ((FILE *));
+
 /* Output text for new basic block.  */
 static void
 start_fct (fp)
@@ -94,12 +103,11 @@ label: \"basic block %d",
     }
 }
 
-static int
+static void
 node_data (fp, tmp_rtx)
      FILE *fp;
      rtx tmp_rtx;
 {
-  int result;
 
   if (PREV_INSN (tmp_rtx) == 0)
     {
@@ -168,9 +176,9 @@ darkgrey\n  shape: ellipse" : "white",
               XINT (tmp_rtx, 4) < 0 ? note_names[-XINT (tmp_rtx, 4)] : "");
     }
   else if (GET_RTX_CLASS (GET_CODE (tmp_rtx)) == 'i')
-    result = print_rtl_single (fp, PATTERN (tmp_rtx));
+    print_rtl_single (fp, PATTERN (tmp_rtx));
   else
-    result = print_rtl_single (fp, tmp_rtx);
+    print_rtl_single (fp, tmp_rtx);
 
   switch (graph_dump_format)
     {
@@ -180,8 +188,6 @@ darkgrey\n  shape: ellipse" : "white",
     case no_graph:
       break;
     }
-
-  return result;
 }
 
 static void
@@ -192,7 +198,7 @@ draw_edge (fp, from, to, bb_edge, class)
      int bb_edge;
      int class;
 {
-  char * color;
+  const char * color;
   switch (graph_dump_format)
     {
     case vcg:
@@ -217,9 +223,8 @@ draw_edge (fp, from, to, bb_edge, class)
 }
 
 static void
-end_bb (fp, bb)
+end_bb (fp)
      FILE *fp;
-     int bb ATTRIBUTE_UNUSED;
 {
   switch (graph_dump_format)
     {
@@ -279,10 +284,10 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
       int i;
       enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
       int max_uid = get_max_uid ();
-      int *start = (int *) alloca (max_uid * sizeof (int));
-      int *end = (int *) alloca (max_uid * sizeof (int));
+      int *start = (int *) xmalloc (max_uid * sizeof (int));
+      int *end = (int *) xmalloc (max_uid * sizeof (int));
       enum bb_state *in_bb_p = (enum bb_state *)
-       alloca (max_uid * sizeof (enum bb_state));
+       xmalloc (max_uid * sizeof (enum bb_state));
       basic_block bb;
 
       for (i = 0; i < max_uid; ++i)
@@ -316,7 +321,6 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
       for (tmp_rtx = NEXT_INSN (rtx_first); NULL != tmp_rtx;
           tmp_rtx = NEXT_INSN (tmp_rtx))
        {
-         int did_output;
          int edge_printed = 0;
          rtx next_insn;
 
@@ -339,7 +343,7 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
            }
 
          /* Print the data for this node.  */
-         did_output = node_data (fp, tmp_rtx);
+         node_data (fp, tmp_rtx);
          next_insn = next_nonnote_insn (tmp_rtx);
 
          if ((i = end[INSN_UID (tmp_rtx)]) >= 0)
@@ -349,7 +353,7 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
              bb = BASIC_BLOCK (i);
 
              /* End of the basic block.  */
-             end_bb (fp, bb);
+             end_bb (fp);
 
              /* Now specify the edges to all the successors of this
                 basic block.  */
@@ -406,6 +410,11 @@ print_rtl_graph_with_bb (base, suffix, rtx_first)
       dump_for_graph = 0;
 
       end_fct (fp);
+
+      /* Clean up.  */
+      free (start);
+      free (end);
+      free (in_bb_p);
     }
 
   fclose (fp);