diff options
Diffstat (limited to 'contrib/gcc/ra-colorize.c')
-rw-r--r-- | contrib/gcc/ra-colorize.c | 332 |
1 files changed, 138 insertions, 194 deletions
diff --git a/contrib/gcc/ra-colorize.c b/contrib/gcc/ra-colorize.c index 5db6474..fd4660a 100644 --- a/contrib/gcc/ra-colorize.c +++ b/contrib/gcc/ra-colorize.c @@ -20,6 +20,8 @@ #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "rtl.h" #include "tm_p.h" #include "function.h" @@ -45,54 +47,54 @@ 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; @@ -100,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 (); @@ -113,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 (); @@ -133,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) @@ -151,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) @@ -163,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; } @@ -174,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) { @@ -214,7 +206,7 @@ put_web (web, type) they are coalesced to. */ void -reset_lists () +reset_lists (void) { struct dlist *d; unsigned int i; @@ -268,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; @@ -284,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)); @@ -296,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) { @@ -326,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; @@ -336,7 +322,7 @@ build_worklists (df) backed by a new pseudo, but conceptually can stand for a stackslot, i.e. it doesn't really matter if they get a color or not), on the SELECT stack first, those with lowest cost first. This way - they will be colored last, so do not contrain the coloring of the + they will be colored last, so do not constrain the coloring of the normal webs. But still those with the highest count are colored before, i.e. get a color more probable. The use of stackregs is a pure optimization, and all would work, if we used real stackslots @@ -346,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]; @@ -395,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); @@ -405,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) @@ -422,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; @@ -452,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; @@ -491,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) @@ -514,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); @@ -528,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; @@ -553,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)) @@ -567,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; @@ -642,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; @@ -659,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; @@ -697,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; @@ -709,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; } @@ -718,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; @@ -848,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); @@ -894,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) @@ -926,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); @@ -936,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; @@ -968,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; @@ -1014,10 +984,8 @@ 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) @@ -1046,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; @@ -1097,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; @@ -1130,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; @@ -1156,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 @@ -1188,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; @@ -1252,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; @@ -1277,16 +1239,13 @@ 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; int c = -1; int bestc = -1; int neighbor_needs= 0; - struct web *fat_neighbor = NULL; struct web *fats_parent = NULL; int num_fat = 0; int long_blocks = 0; @@ -1294,6 +1253,8 @@ colorize_one_web (web, hard) HARD_REG_SET fat_colors; HARD_REG_SET bias; + CLEAR_HARD_REG_SET (fat_colors); + if (web->regno >= max_normal_pseudo) hard = 0; @@ -1319,7 +1280,6 @@ colorize_one_web (web, hard) && w->add_hardregs >= neighbor_needs) { neighbor_needs = w->add_hardregs; - fat_neighbor = w; fats_parent = ptarget; num_fat++; } @@ -1348,7 +1308,7 @@ colorize_one_web (web, hard) HARD_REG_SET call_clobbered; /* Here we choose a hard-reg for the current web. For non spill - temporaries we first search in the hardregs for it's prefered + temporaries we first search in the hardregs for it's preferred class, then, if we found nothing appropriate, in those of the alternate class. For spill temporaries we only search in usable_regs of this web (which is probably larger than that of @@ -1368,10 +1328,9 @@ colorize_one_web (web, hard) else COPY_HARD_REG_SET (colors, usable_regs[reg_preferred_class (web->regno)]); -#ifdef CLASS_CANNOT_CHANGE_MODE +#ifdef CANNOT_CHANGE_MODE_CLASS if (web->mode_changed) - AND_COMPL_HARD_REG_SET (colors, reg_class_contents[ - (int) CLASS_CANNOT_CHANGE_MODE]); + AND_COMPL_HARD_REG_SET (colors, invalid_mode_change_regs); #endif COPY_HARD_REG_SET (call_clobbered, colors); AND_HARD_REG_SET (call_clobbered, call_used_reg_set); @@ -1402,10 +1361,9 @@ colorize_one_web (web, hard) else IOR_HARD_REG_SET (colors, usable_regs [reg_alternate_class (web->regno)]); -#ifdef CLASS_CANNOT_CHANGE_MODE +#ifdef CANNOT_CHANGE_MODE_CLASS if (web->mode_changed) - AND_COMPL_HARD_REG_SET (colors, reg_class_contents[ - (int) CLASS_CANNOT_CHANGE_MODE]); + AND_COMPL_HARD_REG_SET (colors, invalid_mode_change_regs); #endif COPY_HARD_REG_SET (call_clobbered, colors); AND_HARD_REG_SET (call_clobbered, call_used_reg_set); @@ -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_. @@ -1510,7 +1468,7 @@ colorize_one_web (web, hard) struct web *aw = alias (w); /* If we are a spill-temp, we also look at webs coalesced to precolored ones. Otherwise we only look at webs which - themself were colored, or coalesced to one. */ + themselves were colored, or coalesced to one. */ if (aw->type == PRECOLORED && w != aw && web->spill_temp && flag_ra_optimistic_coalescing) { @@ -1559,7 +1517,7 @@ colorize_one_web (web, hard) set_cand (6, aw); /* For boehm-gc/misc.c. If we are a difficult spilltemp, also coalesced neighbors are a chance, _even_ if they - too are spilltemps. At least their coalscing can be + too are spilltemps. At least their coalescing can be broken up, which may be reset usable_regs, and makes it easier colorable. */ if (web->spill_temp != 2 && aw->is_coalesced @@ -1664,15 +1622,13 @@ colorize_one_web (web, hard) colors of coalesced webs. */ static void -assign_colors () +assign_colors (void) { struct dlist *d; while (WEBS(SELECT)) { - struct web *web; d = pop_list (&WEBS(SELECT)); - web = DLIST_WEB (d); colorize_one_web (DLIST_WEB (d), 1); } @@ -1695,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; @@ -1704,11 +1659,10 @@ 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++) { @@ -1750,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 @@ -1807,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); @@ -1872,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 @@ -1898,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) @@ -1952,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; @@ -1969,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]; @@ -2006,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++) @@ -2028,7 +1981,7 @@ check_colors () if (!TEST_HARD_REG_BIT (web->usable_regs, aweb->color + c)) abort (); /* Search the original (pre-coalesce) conflict list. In the current - one some inprecise conflicts may be noted (due to combine() or + one some imprecise conflicts may be noted (due to combine() or insert_coalesced_conflicts() relocating partial conflicts) making it look like some wide webs are in conflict and having the same color. */ @@ -2084,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; @@ -2113,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) @@ -2156,8 +2107,7 @@ 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; @@ -2225,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; @@ -2332,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) @@ -2400,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; @@ -2412,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; @@ -2433,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; @@ -2450,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; @@ -2471,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) @@ -2523,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; @@ -2582,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; @@ -2627,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; @@ -2661,8 +2606,7 @@ 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) dump_igraph (df); @@ -2707,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; @@ -2717,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; |