OSDN Git Service

* final.c (FIRST_INSN_ADDRESS): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / ra-debug.c
index fd8c8d4..26aac12 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "rtl.h"
 #include "insn-config.h"
 #include "recog.h"
 #include "df.h"
 #include "output.h"
 #include "ra.h"
+#include "tm_p.h"
 
 /* This file contains various dumping and debug functions for
    the graph coloring register allocator.  */
 
-static void ra_print_rtx_1op PARAMS ((FILE *, rtx));
-static void ra_print_rtx_2op PARAMS ((FILE *, rtx));
-static void ra_print_rtx_3op PARAMS ((FILE *, rtx));
-static void ra_print_rtx_object PARAMS ((FILE *, rtx));
+static void ra_print_rtx_1op (FILE *, rtx);
+static void ra_print_rtx_2op (FILE *, rtx);
+static void ra_print_rtx_3op (FILE *, rtx);
+static void ra_print_rtx_object (FILE *, rtx);
 
 /* The hardregs as names, for debugging.  */
 static const char *const reg_class_names[] = REG_CLASS_NAMES;
@@ -45,24 +48,14 @@ static const char *const reg_class_names[] = REG_CLASS_NAMES;
    have any bits in common.  */
 
 void
-ra_debug_msg VPARAMS ((unsigned int level, const char *format, ...))
+ra_debug_msg (unsigned int level, const char *format, ...)
 {
-#ifndef ANSI_PROTOTYPES
-  int level;
-  const char *format;
-#endif
   va_list ap;
+  
+  va_start (ap, format);
   if ((debug_new_regalloc & level) != 0 && rtl_dump_file != NULL)
-    {
-      VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-      format = va_arg (ap, const char *);
-#endif
-
-      vfprintf (rtl_dump_file, format, ap);
-      va_end (ap);
-    }
+    vfprintf (rtl_dump_file, format, ap);
+  va_end (ap);
 }
 
 
@@ -77,9 +70,7 @@ ra_debug_msg VPARAMS ((unsigned int level, const char *format, ...))
    "op(Y)" to FILE.  */
 
 static void
-ra_print_rtx_1op (file, x)
-     FILE *file;
-     rtx x;
+ra_print_rtx_1op (FILE *file, rtx x)
 {
   enum rtx_code code = GET_CODE (x);
   rtx op0 = XEXP (x, 0);
@@ -113,9 +104,7 @@ ra_print_rtx_1op (file, x)
    to FILE.  */
 
 static void
-ra_print_rtx_2op (file, x)
-     FILE *file;
-     rtx x;
+ra_print_rtx_2op (FILE *file, rtx x)
 {
   int infix = 1;
   const char *opname = "shitop";
@@ -178,9 +167,7 @@ ra_print_rtx_2op (file, x)
    I.e. X is either an IF_THEN_ELSE, or a bitmap operation.  */
 
 static void
-ra_print_rtx_3op (file, x)
-     FILE *file;
-     rtx x;
+ra_print_rtx_3op (FILE *file, rtx x)
 {
   enum rtx_code code = GET_CODE (x);
   rtx op0 = XEXP (x, 0);
@@ -215,9 +202,7 @@ ra_print_rtx_3op (file, x)
    is a hardreg, whose name is NULL, or empty.  */
 
 static void
-ra_print_rtx_object (file, x)
-     FILE *file;
-     rtx x;
+ra_print_rtx_object (FILE *file, rtx x)
 {
   enum rtx_code code = GET_CODE (x);
   enum machine_mode mode = GET_MODE (x);
@@ -351,10 +336,7 @@ ra_print_rtx_object (file, x)
    the preceding and following insn.  */
 
 void
-ra_print_rtx (file, x, with_pn)
-     FILE *file;
-     rtx x;
-     int with_pn;
+ra_print_rtx (FILE *file, rtx x, int with_pn)
 {
   enum rtx_code code;
   char class;
@@ -524,10 +506,7 @@ ra_print_rtx (file, x, with_pn)
 /* This only calls ra_print_rtx(), but emits a final newline.  */
 
 void
-ra_print_rtx_top (file, x, with_pn)
-     FILE *file;
-     rtx x;
-     int with_pn;
+ra_print_rtx_top (FILE *file, rtx x, int with_pn)
 {
   ra_print_rtx (file, x, with_pn);
   fprintf (file, "\n");
@@ -536,8 +515,7 @@ ra_print_rtx_top (file, x, with_pn)
 /* Callable from gdb.  This prints rtx X onto stderr.  */
 
 void
-ra_debug_rtx (x)
-     rtx x;
+ra_debug_rtx (rtx x)
 {
   ra_print_rtx_top (stderr, x, 1);
 }
@@ -546,16 +524,16 @@ ra_debug_rtx (x)
    The first and last insn are emitted with UIDs of prev and next insns.  */
 
 void
-ra_debug_bbi (bbi)
-     int bbi;
+ra_debug_bbi (int bbi)
 {
   basic_block bb = BASIC_BLOCK (bbi);
   rtx insn;
-  for (insn = bb->head; insn; insn = NEXT_INSN (insn))
+  for (insn = BB_HEAD (bb); insn; insn = NEXT_INSN (insn))
     {
-      ra_print_rtx_top (stderr, insn, (insn == bb->head || insn == bb->end));
+      ra_print_rtx_top (stderr, insn,
+                       (insn == BB_HEAD (bb) || insn == BB_END (bb)));
       fprintf (stderr, "\n");
-      if (insn == bb->end)
+      if (insn == BB_END (bb))
        break;
     }
 }
@@ -564,9 +542,7 @@ ra_debug_bbi (bbi)
    or emit a window of NUM insns around INSN, to stderr.  */
 
 void
-ra_debug_insns (insn, num)
-     rtx insn;
-     int num;
+ra_debug_insns (rtx insn, int num)
 {
   int i, count = (num == 0 ? 1 : num < 0 ? -num : num);
   if (num < 0)
@@ -585,9 +561,7 @@ ra_debug_insns (insn, num)
    some notes, if flag_ra_dump_notes is zero.  */
 
 void
-ra_print_rtl_with_bb (file, insn)
-     FILE *file;
-     rtx insn;
+ra_print_rtl_with_bb (FILE *file, rtx insn)
 {
   basic_block last_bb, bb;
   unsigned int num = 0;
@@ -635,7 +609,7 @@ ra_print_rtl_with_bb (file, insn)
    graph, and prints the findings.  */
 
 void
-dump_number_seen ()
+dump_number_seen (void)
 {
 #define N 17
   int num[N];
@@ -661,8 +635,7 @@ dump_number_seen ()
 /* Dump the interference graph, the move list and the webs.  */
 
 void
-dump_igraph (df)
-     struct df *df ATTRIBUTE_UNUSED;
+dump_igraph (struct df *df ATTRIBUTE_UNUSED)
 {
   struct move_list *ml;
   unsigned int def1, def2;
@@ -675,7 +648,8 @@ dump_igraph (df)
   for (def1 = 0; def1 < num_webs; def1++)
     {
       int num1 = num;
-      for (num2=0, def2 = 0; def2 < num_webs; def2++)
+      num2 = 0;
+      for (def2 = 0; def2 < num_webs; def2++)
         if (def1 != def2 && TEST_BIT (igraph, igraph_index (def1, def2)))
          {
            if (num1 == num)
@@ -721,9 +695,9 @@ dump_igraph (df)
          ra_debug_msg (DUMP_WEBS, " par %d", find_web_for_subweb (web)->id);
        }
       ra_debug_msg (DUMP_WEBS, " +%d (span %d, cost "
-                HOST_WIDE_INT_PRINT_DEC ") (%s)",
-                web->add_hardregs, web->span_deaths, web->spill_cost,
-                reg_class_names[web->regclass]);
+                   HOST_WIDE_INT_PRINT_DEC ") (%s)",
+                   web->add_hardregs, web->span_deaths, web->spill_cost,
+                   reg_class_names[web->regclass]);
       if (web->spill_temp == 1)
        ra_debug_msg (DUMP_WEBS, " (spilltemp)");
       else if (web->spill_temp == 2)
@@ -747,7 +721,7 @@ dump_igraph (df)
    to my custom graph colorizer.  */
 
 void
-dump_igraph_machine ()
+dump_igraph_machine (void)
 {
   unsigned int i;
 
@@ -807,7 +781,7 @@ dump_igraph_machine ()
    and emits information, if the resulting insns are strictly valid.  */
 
 void
-dump_constraints ()
+dump_constraints (void)
 {
   rtx insn;
   int i;
@@ -824,7 +798,7 @@ dump_constraints ()
        int uid = INSN_UID (insn);
        int o;
        /* Don't simply force rerecognition, as combine might left us
-          with some unrecongnizable ones, which later leads to aborts
+          with some unrecognizable ones, which later leads to aborts
           in regclass, if we now destroy the remembered INSN_CODE().  */
        /*INSN_CODE (insn) = -1;*/
        code = recog_memoized (insn);
@@ -860,13 +834,10 @@ dump_constraints ()
    preceded by a custom message MSG, with debug level LEVEL.  */
 
 void
-dump_graph_cost (level, msg)
-     unsigned int level;
-     const char *msg;
+dump_graph_cost (unsigned int level, const char *msg)
 {
   unsigned int i;
   unsigned HOST_WIDE_INT cost;
-#define LU HOST_WIDE_INT_PRINT_UNSIGNED
   if (!rtl_dump_file || (debug_new_regalloc & level) == 0)
     return;
 
@@ -877,16 +848,15 @@ dump_graph_cost (level, msg)
       if (alias (web)->type == SPILLED)
        cost += web->orig_spill_cost;
     }
-  ra_debug_msg (level, " spill cost of graph (%s) = " LU "\n",
-            msg ? msg : "", cost);
-#undef LU
+  ra_debug_msg (level, " spill cost of graph (%s) = "
+               HOST_WIDE_INT_PRINT_UNSIGNED "\n",
+               msg ? msg : "", cost);
 }
 
 /* Dump the color assignment per web, the coalesced and spilled webs.  */
 
 void
-dump_ra (df)
-     struct df *df ATTRIBUTE_UNUSED;
+dump_ra (struct df *df ATTRIBUTE_UNUSED)
 {
   struct web *web;
   struct dlist *d;
@@ -920,22 +890,20 @@ dump_ra (df)
    (loads, stores and copies).  */
 
 void
-dump_static_insn_cost (file, message, prefix)
-     FILE *file;
-     const char *message;
-     const char *prefix;
+dump_static_insn_cost (FILE *file, const char *message, const char *prefix)
 {
   struct cost
     {
       unsigned HOST_WIDE_INT cost;
       unsigned int count;
     };
-  struct cost load = {0, 0};
-  struct cost store = {0, 0};
-  struct cost regcopy = {0, 0};
-  struct cost selfcopy = {0, 0};
-  struct cost overall = {0, 0};
   basic_block bb;
+  struct cost load, store, regcopy, selfcopy, overall;
+  memset (&load, 0, sizeof(load));
+  memset (&store, 0, sizeof(store));
+  memset (&regcopy, 0, sizeof(regcopy));
+  memset (&selfcopy, 0, sizeof(selfcopy));
+  memset (&overall, 0, sizeof(overall));
 
   if (!file)
     return;
@@ -944,7 +912,7 @@ dump_static_insn_cost (file, message, prefix)
     {
       unsigned HOST_WIDE_INT block_cost = bb->frequency;
       rtx insn, set;
-      for (insn = bb->head; insn; insn = NEXT_INSN (insn))
+      for (insn = BB_HEAD (bb); insn; insn = NEXT_INSN (insn))
        {
          /* Yes, yes.  We don't calculate the costs precisely.
             Only for "simple enough" insns.  Those containing single
@@ -983,7 +951,7 @@ dump_static_insn_cost (file, message, prefix)
                  pcost->count++;
                }
            }
-         if (insn == bb->end)
+         if (insn == BB_END (bb))
            break;
        }
     }
@@ -991,25 +959,23 @@ dump_static_insn_cost (file, message, prefix)
   if (!prefix)
     prefix = "";
   fprintf (file, "static insn cost %s\n", message ? message : "");
-  fprintf (file, "  %soverall:\tnum=%6d\tcost=%8d\n", prefix, overall.count,
-          overall.cost);
-  fprintf (file, "  %sloads:\tnum=%6d\tcost=%8d\n", prefix, load.count,
-          load.cost);
-  fprintf (file, "  %sstores:\tnum=%6d\tcost=%8d\n", prefix,
-          store.count, store.cost);
-  fprintf (file, "  %sregcopy:\tnum=%6d\tcost=%8d\n", prefix, regcopy.count,
-          regcopy.cost);
-  fprintf (file, "  %sselfcpy:\tnum=%6d\tcost=%8d\n", prefix, selfcopy.count,
-          selfcopy.cost);
+  fprintf (file, "  %soverall:\tnum=%6d\tcost=% 8" HOST_WIDE_INT_PRINT "d\n",
+          prefix, overall.count, overall.cost);
+  fprintf (file, "  %sloads:\tnum=%6d\tcost=% 8" HOST_WIDE_INT_PRINT "d\n",
+          prefix, load.count, load.cost);
+  fprintf (file, "  %sstores:\tnum=%6d\tcost=% 8" HOST_WIDE_INT_PRINT "d\n",
+          prefix, store.count, store.cost);
+  fprintf (file, "  %sregcopy:\tnum=%6d\tcost=% 8" HOST_WIDE_INT_PRINT "d\n",
+          prefix, regcopy.count, regcopy.cost);
+  fprintf (file, "  %sselfcpy:\tnum=%6d\tcost=% 8" HOST_WIDE_INT_PRINT "d\n",
+          prefix, selfcopy.count, selfcopy.cost);
 }
 
 /* Returns nonzero, if WEB1 and WEB2 have some possible
    hardregs in common.  */
 
 int
-web_conflicts_p (web1, web2)
-     struct web *web1;
-     struct web *web2;
+web_conflicts_p (struct web *web1, struct web *web2)
 {
   if (web1->type == PRECOLORED && web2->type == PRECOLORED)
     return 0;
@@ -1026,8 +992,7 @@ web_conflicts_p (web1, web2)
 /* Dump all uids of insns in which WEB is mentioned.  */
 
 void
-dump_web_insns (web)
-     struct web *web;
+dump_web_insns (struct web *web)
 {
   unsigned int i;
 
@@ -1053,8 +1018,7 @@ dump_web_insns (web)
 /* Dump conflicts for web WEB.  */
 
 void
-dump_web_conflicts (web)
-     struct web *web;
+dump_web_conflicts (struct web *web)
 {
   int num = 0;
   unsigned int def2;
@@ -1105,11 +1069,10 @@ dump_web_conflicts (web)
 /* Output HARD_REG_SET to stderr.  */
 
 void
-debug_hard_reg_set (set)
-     HARD_REG_SET set;
+debug_hard_reg_set (HARD_REG_SET set)
 {
   int i;
-  for (i=0; i < FIRST_PSEUDO_REGISTER; ++i)
+  for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
     {
       if (TEST_HARD_REG_BIT (set, i))
        {