diff options
author | Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> | 1998-10-28 10:22:48 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-10-28 03:22:48 -0700 |
commit | ed396e68008200351bd49b4eb8a1cbe644d3b5f3 (patch) | |
tree | 930e66784844e640aa3c34f9123f16d19b6cb753 /gcc/regclass.c | |
parent | e626b8402cd9d9bfb88ddc0cc65f6cc734928d72 (diff) | |
download | gcc-ed396e68008200351bd49b4eb8a1cbe644d3b5f3.zip gcc-ed396e68008200351bd49b4eb8a1cbe644d3b5f3.tar.gz gcc-ed396e68008200351bd49b4eb8a1cbe644d3b5f3.tar.bz2 |
regclass.c (renumber, [...]): New static variables, moved out of allocate_reg_info.
* regclass.c (renumber, regno_allocated): New static variables, moved
out of allocate_reg_info.
(allocate_reg_info): Move these two variables outside the function.
Move code to free memory into new function free_reg_info.
(free_reg_info): New function, broken out of allocate_reg_info.
* toplev.c (compile_file): Call free_reg_info, not allocate_reg_info.
* rtl.h (allocate_reg_info): Don't declare.
(free_reg_info): Declare.
From-SVN: r23397
Diffstat (limited to 'gcc/regclass.c')
-rw-r--r-- | gcc/regclass.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/gcc/regclass.c b/gcc/regclass.c index 5c23453..d9b6db6 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -1827,6 +1827,9 @@ auto_inc_dec_reg_p (reg, mode) #endif /* REGISTER_CONSTRAINTS */ +static short *renumber = (short *)0; +static size_t regno_allocated = 0; + /* 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 NEW_P is non zero, initialize all of the registers, otherwise only @@ -1840,38 +1843,12 @@ allocate_reg_info (num_regs, new_p, renumber_p) int new_p; int renumber_p; { - static size_t regno_allocated = 0; - static short *renumber = (short *)0; size_t size_info; 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; - /* Free up all storage allocated */ - if (num_regs < 0) - { - if (reg_n_info) - { - VARRAY_FREE (reg_n_info); - for (reg_data = reg_info_head; reg_data; reg_data = reg_next) - { - reg_next = reg_data->next; - free ((char *)reg_data); - } - - free (prefclass_buffer); - free (altclass_buffer); - prefclass_buffer = (char *)0; - altclass_buffer = (char *)0; - reg_info_head = (struct reg_info_data *)0; - renumber = (short *)0; - } - regno_allocated = 0; - reg_n_max = 0; - return; - } - if (num_regs > regno_allocated) { size_t old_allocated = regno_allocated; @@ -1973,6 +1950,32 @@ allocate_reg_info (num_regs, new_p, renumber_p) MAX_REGNO_REG_SET (num_regs, new_p, renumber_p); } +/* Free up the space allocated by allocate_reg_info. */ +void +free_reg_info () +{ + if (reg_n_info) + { + struct reg_info_data *reg_data; + struct reg_info_data *reg_next; + + VARRAY_FREE (reg_n_info); + for (reg_data = reg_info_head; reg_data; reg_data = reg_next) + { + reg_next = reg_data->next; + free ((char *)reg_data); + } + + free (prefclass_buffer); + free (altclass_buffer); + prefclass_buffer = (char *)0; + altclass_buffer = (char *)0; + reg_info_head = (struct reg_info_data *)0; + renumber = (short *)0; + } + regno_allocated = 0; + reg_n_max = 0; +} /* This is the `regscan' pass of the compiler, run just before cse and again just before loop. |