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
This commit is contained in:
Bernd Schmidt 1998-10-28 10:22:48 +00:00 committed by Jeff Law
parent e626b8402c
commit ed396e6800
4 changed files with 43 additions and 27 deletions

View File

@ -1,5 +1,14 @@
Wed Oct 28 03:59:29 1998 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* 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.
* final.c (cleanup_subreg_operands): ASM_INPUTs need no treatment.
Wed Oct 28 02:38:12 1998 Jason Merrill <jason@yorick.cygnus.com>

View File

@ -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.

View File

@ -1010,7 +1010,7 @@ extern rtx find_use_as_address PROTO((rtx, rtx, HOST_WIDE_INT));
extern int max_parallel;
/* Free up register info memory. */
extern void allocate_reg_info PROTO((size_t, int, int));
extern void free_reg_info PROTO((void));
/* recog.c */
extern int asm_noperands PROTO((rtx));

View File

@ -3067,6 +3067,7 @@ compile_file (name)
ASM_FILE_END (asm_out_file);
#endif
/* Language-specific end of compilation actions. */
finish_syntax:
lang_finish ();
@ -3097,6 +3098,9 @@ compile_file (name)
&& (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0))
fatal_io_error (asm_file_name);
/* Free up memory for the benefit of leak detectors. */
free_reg_info ();
/* Print the times. */
if (! quiet_flag)