OSDN Git Service

2004-05-13 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / ra-colorize.c
index 6c514df..4411f00 100644 (file)
@@ -1,5 +1,5 @@
 /* Graph coloring register allocator
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
    Contributed by Michael Matz <matz@suse.de>
    and Daniel Berlin <dan@cgsoftware.com>.
 
    Additionally there is a custom step to locally improve the overall
    spill cost of the colored graph (recolor_spills).  */
 
-static void push_list PARAMS ((struct dlist *, struct dlist **));
-static void push_list_end PARAMS ((struct dlist *, struct dlist **));
-static void free_dlist PARAMS ((struct dlist **));
-static void put_web_at_end PARAMS ((struct web *, enum node_type));
-static void put_move PARAMS ((struct move *, enum move_type));
-static void build_worklists PARAMS ((struct df *));
-static void enable_move PARAMS ((struct web *));
-static void decrement_degree PARAMS ((struct web *, int));
-static void simplify PARAMS ((void));
-static void remove_move_1 PARAMS ((struct web *, struct move *));
-static void remove_move PARAMS ((struct web *, struct move *));
-static void add_worklist PARAMS ((struct web *));
-static int ok PARAMS ((struct web *, struct web *));
-static int conservative PARAMS ((struct web *, struct web *));
-static inline unsigned int simplify_p PARAMS ((enum node_type));
-static void combine PARAMS ((struct web *, struct web *));
-static void coalesce PARAMS ((void));
-static void freeze_moves PARAMS ((struct web *));
-static void freeze PARAMS ((void));
-static void select_spill PARAMS ((void));
-static int color_usable_p PARAMS ((int, HARD_REG_SET, HARD_REG_SET,
-                                  enum machine_mode));
-int get_free_reg PARAMS ((HARD_REG_SET, HARD_REG_SET, enum machine_mode));
-static int get_biased_reg PARAMS ((HARD_REG_SET, HARD_REG_SET, HARD_REG_SET,
-                                  HARD_REG_SET, enum machine_mode));
-static int count_long_blocks PARAMS ((HARD_REG_SET, int));
-static char * hardregset_to_string PARAMS ((HARD_REG_SET));
-static void calculate_dont_begin PARAMS ((struct web *, HARD_REG_SET *));
-static void colorize_one_web PARAMS ((struct web *, int));
-static void assign_colors PARAMS ((void));
-static void try_recolor_web PARAMS ((struct web *));
-static void insert_coalesced_conflicts PARAMS ((void));
-static int comp_webs_maxcost PARAMS ((const void *, const void *));
-static void recolor_spills PARAMS ((void));
-static void check_colors PARAMS ((void));
-static void restore_conflicts_from_coalesce PARAMS ((struct web *));
-static void break_coalesced_spills PARAMS ((void));
-static void unalias_web PARAMS ((struct web *));
-static void break_aliases_to_web PARAMS ((struct web *));
-static void break_precolored_alias PARAMS ((struct web *));
-static void init_web_pairs PARAMS ((void));
-static void add_web_pair_cost PARAMS ((struct web *, struct web *,
-                                      unsigned HOST_WIDE_INT, unsigned int));
-static int comp_web_pairs PARAMS ((const void *, const void *));
-static void sort_and_combine_web_pairs PARAMS ((int));
-static void aggressive_coalesce PARAMS ((void));
-static void extended_coalesce_2 PARAMS ((void));
-static void check_uncoalesced_moves PARAMS ((void));
+static void push_list (struct dlist *, struct dlist **);
+static void push_list_end (struct dlist *, struct dlist **);
+static void free_dlist (struct dlist **);
+static void put_web_at_end (struct web *, enum node_type);
+static void put_move (struct move *, enum move_type);
+static void build_worklists (struct df *);
+static void enable_move (struct web *);
+static void decrement_degree (struct web *, int);
+static void simplify (void);
+static void remove_move_1 (struct web *, struct move *);
+static void remove_move (struct web *, struct move *);
+static void add_worklist (struct web *);
+static int ok (struct web *, struct web *);
+static int conservative (struct web *, struct web *);
+static inline unsigned int simplify_p (enum node_type);
+static void combine (struct web *, struct web *);
+static void coalesce (void);
+static void freeze_moves (struct web *);
+static void freeze (void);
+static void select_spill (void);
+static int color_usable_p (int, HARD_REG_SET, HARD_REG_SET,
+                          enum machine_mode);
+int get_free_reg (HARD_REG_SET, HARD_REG_SET, enum machine_mode);
+static int get_biased_reg (HARD_REG_SET, HARD_REG_SET, HARD_REG_SET,
+                          HARD_REG_SET, enum machine_mode);
+static int count_long_blocks (HARD_REG_SET, int);
+static char * hardregset_to_string (HARD_REG_SET);
+static void calculate_dont_begin (struct web *, HARD_REG_SET *);
+static void colorize_one_web (struct web *, int);
+static void assign_colors (void);
+static void try_recolor_web (struct web *);
+static void insert_coalesced_conflicts (void);
+static int comp_webs_maxcost (const void *, const void *);
+static void recolor_spills (void);
+static void check_colors (void);
+static void restore_conflicts_from_coalesce (struct web *);
+static void break_coalesced_spills (void);
+static void unalias_web (struct web *);
+static void break_aliases_to_web (struct web *);
+static void break_precolored_alias (struct web *);
+static void init_web_pairs (void);
+static void add_web_pair_cost (struct web *, struct web *,
+                              unsigned HOST_WIDE_INT, unsigned int);
+static int comp_web_pairs (const void *, const void *);
+static void sort_and_combine_web_pairs (int);
+static void aggressive_coalesce (void);
+static void extended_coalesce_2 (void);
+static void check_uncoalesced_moves (void);
 
 static struct dlist *mv_worklist, *mv_coalesced, *mv_constrained;
 static struct dlist *mv_frozen, *mv_active;
@@ -102,9 +102,7 @@ static struct dlist *mv_frozen, *mv_active;
 /* Push a node onto the front of the list.  */
 
 static void
-push_list (x, list)
-     struct dlist *x;
-     struct dlist **list;
+push_list (struct dlist *x, struct dlist **list)
 {
   if (x->next || x->prev)
     abort ();
@@ -115,9 +113,7 @@ push_list (x, list)
 }
 
 static void
-push_list_end (x, list)
-     struct dlist *x;
-     struct dlist **list;
+push_list_end (struct dlist *x, struct dlist **list)
 {
   if (x->prev || x->next)
     abort ();
@@ -135,9 +131,7 @@ push_list_end (x, list)
 /* Remove a node from the list.  */
 
 void
-remove_list (x, list)
-     struct dlist *x;
-     struct dlist **list;
+remove_list (struct dlist *x, struct dlist **list)
 {
   struct dlist *y = x->prev;
   if (y)
@@ -153,8 +147,7 @@ remove_list (x, list)
 /* Pop the front of the list.  */
 
 struct dlist *
-pop_list (list)
-     struct dlist **list;
+pop_list (struct dlist **list)
 {
   struct dlist *r = *list;
   if (r)
@@ -165,8 +158,7 @@ pop_list (list)
 /* Free the given double linked list.  */
 
 static void
-free_dlist (list)
-     struct dlist **list;
+free_dlist (struct dlist **list)
 {
   *list = NULL;
 }
@@ -176,9 +168,7 @@ free_dlist (list)
    Inline, because it's called with constant TYPE every time.  */
 
 inline void
-put_web (web, type)
-     struct web *web;
-     enum node_type type;
+put_web (struct web *web, enum node_type type)
 {
   switch (type)
     {
@@ -216,7 +206,7 @@ put_web (web, type)
    they are coalesced to.  */
 
 void
-reset_lists ()
+reset_lists (void)
 {
   struct dlist *d;
   unsigned int i;
@@ -270,9 +260,7 @@ reset_lists ()
    list.  Additionally TYPE may not be SIMPLIFY.  */
 
 static void
-put_web_at_end (web, type)
-     struct web *web;
-     enum node_type type;
+put_web_at_end (struct web *web, enum node_type type)
 {
   if (type == PRECOLORED)
     type = INITIAL;
@@ -286,8 +274,7 @@ put_web_at_end (web, type)
    its current type).  */
 
 void
-remove_web_from_list (web)
-     struct web *web;
+remove_web_from_list (struct web *web)
 {
   if (web->type == PRECOLORED)
     remove_list (web->dlink, &WEBS(INITIAL));
@@ -298,9 +285,7 @@ remove_web_from_list (web)
 /* Give MOVE the TYPE, and link it into the correct list.  */
 
 static inline void
-put_move (move, type)
-     struct move *move;
-     enum move_type type;
+put_move (struct move *move, enum move_type type)
 {
   switch (type)
     {
@@ -328,8 +313,7 @@ put_move (move, type)
 /* Build the worklists we are going to process.  */
 
 static void
-build_worklists (df)
-     struct df *df ATTRIBUTE_UNUSED;
+build_worklists (struct df *df ATTRIBUTE_UNUSED)
 {
   struct dlist *d, *d_next;
   struct move_list *ml;
@@ -348,7 +332,7 @@ build_worklists (df)
       unsigned int i, num, max_num;
       struct web **order2web;
       max_num = num_webs - num_subwebs;
-      order2web = (struct web **) xmalloc (max_num * sizeof (order2web[0]));
+      order2web = xmalloc (max_num * sizeof (order2web[0]));
       for (i = 0, num = 0; i < max_num; i++)
        if (id2web[i]->regno >= max_normal_pseudo)
          order2web[num++] = id2web[i];
@@ -397,7 +381,7 @@ build_worklists (df)
     if (ml->move)
       {
        struct move *m = ml->move;
-        d = (struct dlist *) ra_calloc (sizeof (struct dlist));
+        d = ra_calloc (sizeof (struct dlist));
         DLIST_MOVE (d) = m;
         m->dlink = d;
        put_move (m, WORKLIST);
@@ -407,8 +391,7 @@ build_worklists (df)
 /* Enable the active moves, in which WEB takes part, to be processed.  */
 
 static void
-enable_move (web)
-     struct web *web;
+enable_move (struct web *web)
 {
   struct move_list *ml;
   for (ml = web->moves; ml; ml = ml->next)
@@ -424,9 +407,7 @@ enable_move (web)
    now smaller than its freedom.  */
 
 static void
-decrement_degree (web, dec)
-     struct web *web;
-     int dec;
+decrement_degree (struct web *web, int dec)
 {
   int before = web->num_conflicts;
   web->num_conflicts -= dec;
@@ -454,7 +435,7 @@ decrement_degree (web, dec)
 /* Repeatedly simplify the nodes on the simplify worklists.  */
 
 static void
-simplify ()
+simplify (void)
 {
   struct dlist *d;
   struct web *web;
@@ -493,9 +474,7 @@ simplify ()
 /* Helper function to remove a move from the movelist of the web.  */
 
 static void
-remove_move_1 (web, move)
-     struct web *web;
-     struct move *move;
+remove_move_1 (struct web *web, struct move *move)
 {
   struct move_list *ml = web->moves;
   if (!ml)
@@ -516,9 +495,7 @@ remove_move_1 (web, move)
    not in the list anymore.  */
 
 static void
-remove_move (web, move)
-     struct web *web;
-     struct move *move;
+remove_move (struct web *web, struct move *move)
 {
   struct move_list *ml;
   remove_move_1 (web, move);
@@ -530,8 +507,7 @@ remove_move (web, move)
 /* Merge the moves for the two webs into the first web's movelist.  */
 
 void
-merge_moves (u, v)
-     struct web *u, *v;
+merge_moves (struct web *u, struct web *v)
 {
   regset seen;
   struct move_list *ml, *ml_next;
@@ -555,8 +531,7 @@ merge_moves (u, v)
 /* Add a web to the simplify worklist, from the freeze worklist.  */
 
 static void
-add_worklist (web)
-     struct web *web;
+add_worklist (struct web *web)
 {
   if (web->type != PRECOLORED && !web->moves
       && web->num_conflicts < NUM_REGS (web))
@@ -569,8 +544,7 @@ add_worklist (web)
 /* Precolored node coalescing heuristic.  */
 
 static int
-ok (target, source)
-     struct web *target, *source;
+ok (struct web *target, struct web *source)
 {
   struct conflict_link *wl;
   int i;
@@ -588,7 +562,7 @@ ok (target, source)
     return 0;
 
   /* Sanity for funny modes.  */
-  size = HARD_REGNO_NREGS (color, GET_MODE (target->orig_x));
+  size = hard_regno_nregs[color][GET_MODE (target->orig_x)];
   if (!size)
     return 0;
 
@@ -644,7 +618,7 @@ ok (target, source)
        {
          /* The main webs do _not_ conflict, only some parts of both.  This
             means, that 4 is possibly true, so we need to check this too.
-            For this we go thru all sub conflicts between T and C, and see if
+            For this we go through all sub conflicts between T and C, and see if
             the target part of C already conflicts with S.  When this is not
             the case we disallow coalescing.  */
          struct sub_conflict *sl;
@@ -661,8 +635,7 @@ ok (target, source)
 /* Non-precolored node coalescing heuristic.  */
 
 static int
-conservative (target, source)
-     struct web *target, *source;
+conservative (struct web *target, struct web *source)
 {
   unsigned int k;
   unsigned int loop;
@@ -699,8 +672,7 @@ conservative (target, source)
    was passed in.  */
 
 struct web *
-alias (web)
-     struct web *web;
+alias (struct web *web)
 {
   while (web->type == COALESCED)
     web = web->alias;
@@ -711,8 +683,7 @@ alias (web)
    SIMPLIFY types.  */
 
 static inline unsigned int
-simplify_p (type)
-     enum node_type type;
+simplify_p (enum node_type type)
 {
   return type == SIMPLIFY || type == SIMPLIFY_SPILL || type == SIMPLIFY_FAT;
 }
@@ -720,8 +691,7 @@ simplify_p (type)
 /* Actually combine two webs, that can be coalesced.  */
 
 static void
-combine (u, v)
-     struct web *u, *v;
+combine (struct web *u, struct web *v)
 {
   int i;
   struct conflict_link *wl;
@@ -756,7 +726,7 @@ combine (u, v)
          struct web *web = u;
          int nregs = 1 + v->add_hardregs;
          if (u->type == PRECOLORED)
-           nregs = HARD_REGNO_NREGS (u->color, GET_MODE (v->orig_x));
+           nregs = hard_regno_nregs[u->color][GET_MODE (v->orig_x)];
 
          /* For precolored U's we need to make conflicts between V's
             neighbors and as many hardregs from U as V needed if it gets
@@ -850,7 +820,7 @@ combine (u, v)
    This is used only for iterated coalescing.  */
 
 static void
-coalesce ()
+coalesce (void)
 {
   struct dlist *d = pop_list (&mv_worklist);
   struct move *m = DLIST_MOVE (d);
@@ -896,8 +866,7 @@ coalesce ()
 /* Freeze the moves associated with the web.  Used for iterated coalescing.  */
 
 static void
-freeze_moves (web)
-     struct web *web;
+freeze_moves (struct web *web)
 {
   struct move_list *ml, *ml_next;
   for (ml = web->moves; ml; ml = ml_next)
@@ -928,7 +897,7 @@ freeze_moves (web)
    coalescing).  */
 
 static void
-freeze ()
+freeze (void)
 {
   struct dlist *d = pop_list (&WEBS(FREEZE));
   put_web (DLIST_WEB (d), SIMPLIFY);
@@ -938,17 +907,16 @@ freeze ()
 /* The current spill heuristic.  Returns a number for a WEB.
    Webs with higher numbers are selected later.  */
 
-static unsigned HOST_WIDE_INT (*spill_heuristic) PARAMS ((struct web *));
+static unsigned HOST_WIDE_INT (*spill_heuristic) (struct web *);
 
-static unsigned HOST_WIDE_INT default_spill_heuristic PARAMS ((struct web *));
+static unsigned HOST_WIDE_INT default_spill_heuristic (struct web *);
 
 /* Our default heuristic is similar to spill_cost / num_conflicts.
    Just scaled for integer arithmetic, and it favors coalesced webs,
    and webs which span more insns with deaths.  */
 
 static unsigned HOST_WIDE_INT
-default_spill_heuristic (web)
-     struct web *web;
+default_spill_heuristic (struct web *web)
 {
   unsigned HOST_WIDE_INT ret;
   unsigned int divisor = 1;
@@ -970,7 +938,7 @@ default_spill_heuristic (web)
    *actually* spill until we need to).  */
 
 static void
-select_spill ()
+select_spill (void)
 {
   unsigned HOST_WIDE_INT best = (unsigned HOST_WIDE_INT) -1;
   struct dlist *bestd = NULL;
@@ -1016,17 +984,15 @@ select_spill ()
    free colors, and MODE, returns nonzero of color C is still usable.  */
 
 static int
-color_usable_p (c, dont_begin_colors, free_colors, mode)
-     int c;
-     HARD_REG_SET dont_begin_colors, free_colors;
-     enum machine_mode mode;
+color_usable_p (int c, HARD_REG_SET dont_begin_colors,
+               HARD_REG_SET free_colors, enum machine_mode  mode)
 {
   if (!TEST_HARD_REG_BIT (dont_begin_colors, c)
       && TEST_HARD_REG_BIT (free_colors, c)
       && HARD_REGNO_MODE_OK (c, mode))
     {
       int i, size;
-      size = HARD_REGNO_NREGS (c, mode);
+      size = hard_regno_nregs[c][mode];
       for (i = 1; i < size && TEST_HARD_REG_BIT (free_colors, c + i); i++);
       if (i == size)
        return 1;
@@ -1048,9 +1014,8 @@ color_usable_p (c, dont_begin_colors, free_colors, mode)
    block could be found.  */
 
 int
-get_free_reg (dont_begin_colors, free_colors, mode)
-     HARD_REG_SET dont_begin_colors, free_colors;
-     enum machine_mode mode;
+get_free_reg (HARD_REG_SET dont_begin_colors, HARD_REG_SET free_colors,
+             enum machine_mode mode)
 {
   int c;
   int last_resort_reg = -1;
@@ -1064,7 +1029,7 @@ get_free_reg (dont_begin_colors, free_colors, mode)
        && HARD_REGNO_MODE_OK (c, mode))
       {
        int i, size;
-       size = HARD_REGNO_NREGS (c, mode);
+       size = hard_regno_nregs[c][mode];
        for (i = 1; i < size && TEST_HARD_REG_BIT (free_colors, c + i); i++);
        if (i != size)
          {
@@ -1099,9 +1064,9 @@ get_free_reg (dont_begin_colors, free_colors, mode)
    only do the last two steps.  */
 
 static int
-get_biased_reg (dont_begin_colors, bias, prefer_colors, free_colors, mode)
-     HARD_REG_SET dont_begin_colors, bias, prefer_colors, free_colors;
-     enum machine_mode mode;
+get_biased_reg (HARD_REG_SET dont_begin_colors, HARD_REG_SET bias,
+               HARD_REG_SET prefer_colors, HARD_REG_SET free_colors,
+               enum machine_mode mode)
 {
   int c = -1;
   HARD_REG_SET s;
@@ -1132,9 +1097,7 @@ get_biased_reg (dont_begin_colors, bias, prefer_colors, free_colors, mode)
    in FREE_COLORS.  */
 
 static int
-count_long_blocks (free_colors, len)
-     HARD_REG_SET free_colors;
-     int len;
+count_long_blocks (HARD_REG_SET free_colors, int len)
 {
   int i, j;
   int count = 0;
@@ -1158,8 +1121,7 @@ count_long_blocks (free_colors, len)
    of hardreg sets.  Note that this string is statically allocated.  */
 
 static char *
-hardregset_to_string (s)
-     HARD_REG_SET s;
+hardregset_to_string (HARD_REG_SET s)
 {
   static char string[/*FIRST_PSEUDO_REGISTER + 30*/1024];
 #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDE_INT
@@ -1190,9 +1152,7 @@ hardregset_to_string (s)
    3 can't be used as begin color.  */
 
 static void
-calculate_dont_begin (web, result)
-     struct web *web;
-     HARD_REG_SET *result;
+calculate_dont_begin (struct web *web, HARD_REG_SET *result)
 {
   struct conflict_link *wl;
   HARD_REG_SET dont_begin;
@@ -1212,11 +1172,11 @@ calculate_dont_begin (web, result)
          if (ptarget->type == COLORED || ptarget->type == PRECOLORED)
            {
              struct web *source = (sl) ? sl->s : web;
-             unsigned int tsize = HARD_REGNO_NREGS (ptarget->color,
-                                                    GET_MODE (w->orig_x));
+             unsigned int tsize = hard_regno_nregs[ptarget->color]
+                                                  [GET_MODE (w->orig_x)];
              /* ssize is only a first guess for the size.  */
-             unsigned int ssize = HARD_REGNO_NREGS (ptarget->color, GET_MODE
-                                                    (source->orig_x));
+             unsigned int ssize = hard_regno_nregs[ptarget->color][GET_MODE
+                                                   (source->orig_x)];
              unsigned int tofs = 0;
              unsigned int sofs = 0;
              /* C1 and C2 can become negative, so unsigned
@@ -1242,11 +1202,11 @@ calculate_dont_begin (web, result)
                     c1 to a place, where the last of sources hardregs does not
                     overlap the first of targets colors.  */
                  while (c1 + sofs
-                        + HARD_REGNO_NREGS (c1, GET_MODE (source->orig_x)) - 1
+                        + hard_regno_nregs[c1][GET_MODE (source->orig_x)] - 1
                         < ptarget->color + tofs)
                    c1++;
                  while (c1 > 0 && c1 + sofs
-                        + HARD_REGNO_NREGS (c1, GET_MODE (source->orig_x)) - 1
+                        + hard_regno_nregs[c1][GET_MODE (source->orig_x)] - 1
                         > ptarget->color + tofs)
                    c1--;
                  for (; c1 <= c2; c1++)
@@ -1254,7 +1214,7 @@ calculate_dont_begin (web, result)
                }
            }
          /* The next if() only gets true, if there was no wl->sub at all, in
-            which case we are only making one go thru this loop with W being
+            which case we are only making one go through this loop with W being
             a whole web.  */
          if (!sl)
            break;
@@ -1279,9 +1239,7 @@ calculate_dont_begin (web, result)
    register starved machines, so we try to avoid this.  */
 
 static void
-colorize_one_web (web, hard)
-     struct web *web;
-     int hard;
+colorize_one_web (struct web *web, int hard)
 {
   struct conflict_link *wl;
   HARD_REG_SET colors, dont_begin;
@@ -1475,7 +1433,7 @@ colorize_one_web (web, hard)
         even if we spill this one here, the situation won't become better
         in the next iteration.  It probably will have the same conflicts,
         those will have the same colors, and we would come here again, for
-        all parts, in which this one gets splitted by the spill.  This
+        all parts, in which this one gets split by the spill.  This
         can result in endless iteration spilling the same register again and
         again.  That's why we try to find a neighbor, which spans more
         instructions that ourself, and got a color, and try to spill _that_.
@@ -1630,7 +1588,7 @@ colorize_one_web (web, hard)
       web->color = c;
       if (flag_ra_biased)
        {
-         int nregs = HARD_REGNO_NREGS (c, GET_MODE (web->orig_x));
+         int nregs = hard_regno_nregs[c][GET_MODE (web->orig_x)];
          for (wl = web->conflict_list; wl; wl = wl->next)
            {
              struct web *ptarget = alias (wl->t);
@@ -1664,7 +1622,7 @@ colorize_one_web (web, hard)
    colors of coalesced webs.  */
 
 static void
-assign_colors ()
+assign_colors (void)
 {
   struct dlist *d;
 
@@ -1693,8 +1651,7 @@ assign_colors ()
    be aware, that currently this pass is quite slow.  */
 
 static void
-try_recolor_web (web)
-     struct web *web;
+try_recolor_web (struct web *web)
 {
   struct conflict_link *wl;
   unsigned HOST_WIDE_INT *cost_neighbors;
@@ -1702,18 +1659,17 @@ try_recolor_web (web)
   int newcol, c;
   HARD_REG_SET precolored_neighbors, spill_temps;
   HARD_REG_SET possible_begin, wide_seen;
-  cost_neighbors = (unsigned HOST_WIDE_INT *)
-    xcalloc (FIRST_PSEUDO_REGISTER, sizeof (cost_neighbors[0]));
+  cost_neighbors = xcalloc (FIRST_PSEUDO_REGISTER, sizeof (cost_neighbors[0]));
   /* For each hard-regs count the number of preceding hardregs, which
      would overlap this color, if used in WEB's mode.  */
-  min_color = (unsigned int *) xcalloc (FIRST_PSEUDO_REGISTER, sizeof (int));
+  min_color = xcalloc (FIRST_PSEUDO_REGISTER, sizeof (int));
   CLEAR_HARD_REG_SET (possible_begin);
   for (c = 0; c < FIRST_PSEUDO_REGISTER; c++)
     {
       int i, nregs;
       if (!HARD_REGNO_MODE_OK (c, GET_MODE (web->orig_x)))
        continue;
-      nregs = HARD_REGNO_NREGS (c, GET_MODE (web->orig_x));
+      nregs = hard_regno_nregs[c][GET_MODE (web->orig_x)];
       for (i = 0; i < nregs; i++)
        if (!TEST_HARD_REG_BIT (web->usable_regs, c + i))
          break;
@@ -1748,7 +1704,7 @@ try_recolor_web (web)
        }
       /* Mark colors for which some wide webs are involved.  For
         those the independent sets are not simply one-node graphs, so
-        they can't be recolored independ from their neighborhood.  This
+        they can't be recolored independent from their neighborhood.  This
         means, that our cost calculation can be incorrect (assuming it
         can avoid spilling a web because it thinks some colors are available,
         although it's neighbors which itself need recoloring might take
@@ -1763,14 +1719,14 @@ try_recolor_web (web)
       /* Note that min_color[] contains 1-based values (zero means
         undef).  */
       c1 = c1 == 0 ? web2->color : (c1 - 1);
-      c2 = web2->color + HARD_REGNO_NREGS (web2->color, GET_MODE
-                                          (web2->orig_x)) - 1;
+      c2 = web2->color + hard_regno_nregs[web2->color][GET_MODE
+                                         (web2->orig_x)] - 1;
       for (; c1 <= c2; c1++)
        if (TEST_HARD_REG_BIT (possible_begin, c1))
          {
            int nregs;
            HARD_REG_SET colors;
-           nregs = HARD_REGNO_NREGS (c1, GET_MODE (web->orig_x));
+           nregs = hard_regno_nregs[c1][GET_MODE (web->orig_x)];
            COPY_HARD_REG_SET (colors, web2->usable_regs);
            for (; nregs--;)
              CLEAR_HARD_REG_BIT (colors, c1 + nregs);
@@ -1796,7 +1752,7 @@ try_recolor_web (web)
       newcol = c;
   if (newcol >= 0 && cost_neighbors[newcol] < web->spill_cost)
     {
-      int nregs = HARD_REGNO_NREGS (newcol, GET_MODE (web->orig_x));
+      int nregs = hard_regno_nregs[newcol][GET_MODE (web->orig_x)];
       unsigned HOST_WIDE_INT cost = 0;
       int *old_colors;
       struct conflict_link *wl_next;
@@ -1805,7 +1761,7 @@ try_recolor_web (web)
       remove_list (web->dlink, &WEBS(SPILLED));
       put_web (web, COLORED);
       web->color = newcol;
-      old_colors = (int *) xcalloc (num_webs, sizeof (int));
+      old_colors = xcalloc (num_webs, sizeof (int));
       for (wl = web->conflict_list; wl; wl = wl_next)
        {
          struct web *web2 = alias (wl->t);
@@ -1819,8 +1775,8 @@ try_recolor_web (web)
          wl_next = wl->next;
          if (web2->type == COLORED)
            {
-             int nregs2 = HARD_REGNO_NREGS (web2->color, GET_MODE
-                                            (web2->orig_x));
+             int nregs2 = hard_regno_nregs[web2->color][GET_MODE
+                                           (web2->orig_x)];
              if (web->color >= web2->color + nregs2
                  || web2->color >= web->color + nregs)
                continue;
@@ -1870,7 +1826,7 @@ try_recolor_web (web)
                  else if (web2->type == SELECT)
                    /* This means, that WEB2 once was a part of a coalesced
                       web, which got spilled in the above colorize_one_web()
-                      call, and whose parts then got splitted and put back
+                      call, and whose parts then got split and put back
                       onto the SELECT stack.  As the cause for that splitting
                       (the coloring of WEB) was worthless, we should again
                       coalesce the parts, as they were before.  For now we
@@ -1896,7 +1852,7 @@ try_recolor_web (web)
    isn't used anymore, e.g. on a completely colored graph.  */
 
 static void
-insert_coalesced_conflicts ()
+insert_coalesced_conflicts (void)
 {
   struct dlist *d;
   for (d = WEBS(COALESCED); 0 && d; d = d->next)
@@ -1910,7 +1866,7 @@ insert_coalesced_conflicts ()
          int i;
          int nregs = 1 + web->add_hardregs;
          if (aweb->type == PRECOLORED)
-           nregs = HARD_REGNO_NREGS (aweb->color, GET_MODE (web->orig_x));
+           nregs = hard_regno_nregs[aweb->color][GET_MODE (web->orig_x)];
          for (i = 0; i < nregs; i++)
            {
              if (aweb->type == PRECOLORED)
@@ -1950,8 +1906,7 @@ insert_coalesced_conflicts ()
    largest cost first.  */
 
 static int
-comp_webs_maxcost (w1, w2)
-     const void *w1, *w2;
+comp_webs_maxcost (const void *w1, const void *w2)
 {
   struct web *web1 = *(struct web **)w1;
   struct web *web2 = *(struct web **)w2;
@@ -1967,12 +1922,12 @@ comp_webs_maxcost (w1, w2)
    how this is done.  This just calls it for each spilled web.  */
 
 static void
-recolor_spills ()
+recolor_spills (void)
 {
   unsigned int i, num;
   struct web **order2web;
   num = num_webs - num_subwebs;
-  order2web = (struct web **) xmalloc (num * sizeof (order2web[0]));
+  order2web = xmalloc (num * sizeof (order2web[0]));
   for (i = 0; i < num; i++)
     {
       order2web[i] = id2web[i];
@@ -2004,7 +1959,7 @@ recolor_spills ()
    not being in usable regs.  */
 
 static void
-check_colors ()
+check_colors (void)
 {
   unsigned int i;
   for (i = 0; i < num_webs - num_subwebs; i++)
@@ -2016,7 +1971,7 @@ check_colors ()
       if (aweb->type == SPILLED || web->regno >= max_normal_pseudo)
        continue;
       else if (aweb->type == COLORED)
-       nregs = HARD_REGNO_NREGS (aweb->color, GET_MODE (web->orig_x));
+       nregs = hard_regno_nregs[aweb->color][GET_MODE (web->orig_x)];
       else if (aweb->type == PRECOLORED)
        nregs = 1;
       else
@@ -2040,7 +1995,7 @@ check_colors ()
            struct web *web2 = alias (wl->t);
            int nregs2;
            if (web2->type == COLORED)
-             nregs2 = HARD_REGNO_NREGS (web2->color, GET_MODE (web2->orig_x));
+             nregs2 = hard_regno_nregs[web2->color][GET_MODE (web2->orig_x)];
            else if (web2->type == PRECOLORED)
              nregs2 = 1;
            else
@@ -2059,8 +2014,8 @@ check_colors ()
              continue;
            for (sl = wl->sub; sl; sl = sl->next)
              {
-               int ssize = HARD_REGNO_NREGS (scol, GET_MODE (sl->s->orig_x));
-               int tsize = HARD_REGNO_NREGS (tcol, GET_MODE (sl->t->orig_x));
+               int ssize = hard_regno_nregs[scol][GET_MODE (sl->s->orig_x)];
+               int tsize = hard_regno_nregs[tcol][GET_MODE (sl->t->orig_x)];
                int sofs = 0, tofs = 0;
                if (SUBWEB_P (sl->t)
                    && GET_MODE_SIZE (GET_MODE (sl->t->orig_x)) >= UNITS_PER_WORD)
@@ -2082,8 +2037,7 @@ check_colors ()
    back onto SELECT stack.  */
 
 static void
-unalias_web (web)
-     struct web *web;
+unalias_web (struct web *web)
 {
   web->alias = NULL;
   web->is_coalesced = 0;
@@ -2111,8 +2065,7 @@ unalias_web (web)
    Somewhen we'll change this to be more sane.  */
 
 static void
-break_aliases_to_web (web)
-     struct web *web;
+break_aliases_to_web (struct web *web)
 {
   struct dlist *d, *d_next;
   if (web->type != SPILLED)
@@ -2154,13 +2107,12 @@ break_aliases_to_web (web)
    from initially coalescing both.  */
 
 static void
-break_precolored_alias (web)
-     struct web *web;
+break_precolored_alias (struct web *web)
 {
   struct web *pre = web->alias;
   struct conflict_link *wl;
   unsigned int c = pre->color;
-  unsigned int nregs = HARD_REGNO_NREGS (c, GET_MODE (web->orig_x));
+  unsigned int nregs = hard_regno_nregs[c][GET_MODE (web->orig_x)];
   if (pre->type != PRECOLORED)
     abort ();
   unalias_web (web);
@@ -2223,8 +2175,7 @@ break_precolored_alias (web)
    and break up the coalescing.  */
 
 static void
-restore_conflicts_from_coalesce (web)
-     struct web *web;
+restore_conflicts_from_coalesce (struct web *web)
 {
   struct conflict_link **pcl;
   struct conflict_link *wl;
@@ -2330,7 +2281,7 @@ restore_conflicts_from_coalesce (web)
    there are any spilled coalesce targets.  */
 
 static void
-break_coalesced_spills ()
+break_coalesced_spills (void)
 {
   int changed = 0;
   while (1)
@@ -2398,7 +2349,7 @@ static unsigned int num_web_pairs;
 /* Clear the hash table of web pairs.  */
 
 static void
-init_web_pairs ()
+init_web_pairs (void)
 {
   memset (web_pair_hash, 0, sizeof web_pair_hash);
   num_web_pairs = 0;
@@ -2410,10 +2361,8 @@ init_web_pairs ()
    already in, cumulate the costs and conflict number.  */
 
 static void
-add_web_pair_cost (web1, web2, cost, conflicts)
-     struct web *web1, *web2;
-     unsigned HOST_WIDE_INT cost;
-     unsigned int conflicts;
+add_web_pair_cost (struct web *web1, struct web *web2,
+                  unsigned HOST_WIDE_INT cost, unsigned int conflicts)
 {
   unsigned int hash;
   struct web_pair *p;
@@ -2431,7 +2380,7 @@ add_web_pair_cost (web1, web2, cost, conflicts)
        p->conflicts += conflicts;
        return;
       }
-  p = (struct web_pair *) ra_alloc (sizeof *p);
+  p = ra_alloc (sizeof *p);
   p->next_hash = web_pair_hash[hash];
   p->next_list = web_pair_list;
   p->smaller = web1;
@@ -2448,8 +2397,7 @@ add_web_pair_cost (web1, web2, cost, conflicts)
    when the moves are removed) come first.  */
 
 static int
-comp_web_pairs (w1, w2)
-     const void *w1, *w2;
+comp_web_pairs (const void *w1, const void *w2)
 {
   struct web_pair *p1 = *(struct web_pair **)w1;
   struct web_pair *p2 = *(struct web_pair **)w2;
@@ -2469,15 +2417,14 @@ comp_web_pairs (w1, w2)
    with the most savings.  */
 
 static void
-sort_and_combine_web_pairs (for_move)
-     int for_move;
+sort_and_combine_web_pairs (int for_move)
 {
   unsigned int i;
   struct web_pair **sorted;
   struct web_pair *p;
   if (!num_web_pairs)
     return;
-  sorted = (struct web_pair **) xmalloc (num_web_pairs * sizeof (sorted[0]));
+  sorted = xmalloc (num_web_pairs * sizeof (sorted[0]));
   for (p = web_pair_list, i = 0; p; p = p->next_list)
     sorted[i++] = p;
   if (i != num_web_pairs)
@@ -2521,7 +2468,7 @@ sort_and_combine_web_pairs (for_move)
    giving the most saving if coalesced.  */
 
 static void
-aggressive_coalesce ()
+aggressive_coalesce (void)
 {
   struct dlist *d;
   struct move *m;
@@ -2580,7 +2527,7 @@ aggressive_coalesce ()
    all insns, and for each insn, through all defs and uses.  */
 
 static void
-extended_coalesce_2 ()
+extended_coalesce_2 (void)
 {
   rtx insn;
   struct ra_insn_info info;
@@ -2625,7 +2572,7 @@ extended_coalesce_2 ()
 /* Check if we forgot to coalesce some moves.  */
 
 static void
-check_uncoalesced_moves ()
+check_uncoalesced_moves (void)
 {
   struct move_list *ml;
   struct move *m;
@@ -2659,10 +2606,9 @@ check_uncoalesced_moves ()
    produces a list of spilled, colored and coalesced nodes.  */
 
 void
-ra_colorize_graph (df)
-     struct df *df;
+ra_colorize_graph (struct df *df)
 {
-  if (rtl_dump_file)
+  if (dump_file)
     dump_igraph (df);
   build_worklists (df);
 
@@ -2705,7 +2651,7 @@ ra_colorize_graph (df)
 
 /* Initialize this module.  */
 
-void ra_colorize_init ()
+void ra_colorize_init (void)
 {
   /* FIXME: Choose spill heuristic for platform if we have one */
   spill_heuristic = default_spill_heuristic;
@@ -2715,14 +2661,14 @@ void ra_colorize_init ()
    memory).  */
 
 void
-ra_colorize_free_all ()
+ra_colorize_free_all (void)
 {
   struct dlist *d;
   while ((d = pop_list (&WEBS(FREE))) != NULL)
     put_web (DLIST_WEB (d), INITIAL);
   while ((d = pop_list (&WEBS(INITIAL))) != NULL)
     {
-      struct web *web =DLIST_WEB (d);
+      struct web *web = DLIST_WEB (d);
       struct web *wnext;
       web->orig_conflict_list = NULL;
       web->conflict_list = NULL;