diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/flow.c | 4 | ||||
-rw-r--r-- | gcc/regclass.c | 52 | ||||
-rw-r--r-- | gcc/regs.h | 2 |
4 files changed, 35 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b5b42fb3ec..935f71d8902 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2000-04-24 Mark Mitchell <mark@codesourcery.com> + + * regs.h (reg_n_max): Don't declare. + * flow.c (reg_n_max): Don't define. + * regclass.c (renumber): Don't initialize to zero. + (regno_allocated): Likewise. + (reg_n_max): Define. + (allocate_reg_info): Don't initialize unnecessarily. + Mon Apr 24 00:21:36 2000 Jeffrey A Law (law@cygnus.com) * genattrtab.c (find_attr): Initialize unsigned_p, func_units_p diff --git a/gcc/flow.c b/gcc/flow.c index 24ae92c9b05..02172a1b857 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -221,10 +221,6 @@ int max_regno; varray_type reg_n_info; -/* Size of the reg_n_info table. */ - -unsigned int reg_n_max; - /* Size of a regset for the current function, in (1) bytes and (2) elements. */ diff --git a/gcc/regclass.c b/gcc/regclass.c index 3d7ba5f20da..592edb099ba 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -1983,8 +1983,9 @@ auto_inc_dec_reg_p (reg, mode) } #endif -static short *renumber = (short *)0; -static size_t regno_allocated = 0; +static short *renumber; +static size_t regno_allocated; +static unsigned int reg_n_max; /* Allocate enough space to hold NUM_REGS registers for the tables used for reg_scan and flow_analysis that are indexed by the register number. If @@ -2003,7 +2004,6 @@ allocate_reg_info (num_regs, new_p, renumber_p) size_t size_renumber; size_t min = (new_p) ? 0 : reg_n_max; struct reg_info_data *reg_data; - struct reg_info_data *reg_next; if (num_regs > regno_allocated) { @@ -2056,34 +2056,34 @@ allocate_reg_info (num_regs, new_p, renumber_p) { /* Loop through each of the segments allocated for the actual reg_info pages, and set up the pointers, zero the pages, etc. */ - for (reg_data = reg_info_head; reg_data; reg_data = reg_next) + for (reg_data = reg_info_head; + reg_data && reg_data->max_index >= min; + reg_data = reg_data->next) { size_t min_index = reg_data->min_index; size_t max_index = reg_data->max_index; + size_t max = MIN (max_index, num_regs); + size_t local_min = min - min_index; + size_t i; - reg_next = reg_data->next; - if (min <= max_index) - { - size_t max = max_index; - size_t local_min = min - min_index; - size_t i; - - if (min < min_index) - local_min = 0; - if (!reg_data->used_p) /* page just allocated with calloc */ - reg_data->used_p = 1; /* no need to zero */ - else - bzero ((char *) ®_data->data[local_min], - sizeof (reg_info) * (max - min_index - local_min + 1)); + if (reg_data->min_index > num_regs) + continue; - for (i = min_index+local_min; i <= max; i++) - { - VARRAY_REG (reg_n_info, i) = ®_data->data[i-min_index]; - REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN; - renumber[i] = -1; - reg_pref_buffer[i].prefclass = (char) NO_REGS; - reg_pref_buffer[i].altclass = (char) NO_REGS; - } + if (min < min_index) + local_min = 0; + if (!reg_data->used_p) /* page just allocated with calloc */ + reg_data->used_p = 1; /* no need to zero */ + else + bzero ((char *) ®_data->data[local_min], + sizeof (reg_info) * (max - min_index - local_min + 1)); + + for (i = min_index+local_min; i <= max; i++) + { + VARRAY_REG (reg_n_info, i) = ®_data->data[i-min_index]; + REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN; + renumber[i] = -1; + reg_pref_buffer[i].prefclass = (char) NO_REGS; + reg_pref_buffer[i].altclass = (char) NO_REGS; } } } diff --git a/gcc/regs.h b/gcc/regs.h index b0a43e16116..26fa2473104 100644 --- a/gcc/regs.h +++ b/gcc/regs.h @@ -60,8 +60,6 @@ typedef struct reg_info_def extern varray_type reg_n_info; -extern unsigned int reg_n_max; - /* Indexed by n, gives number of times (REG n) is used or set. References within loops may be counted more times. */ |