reload1.c (reload): Use xmalloc instead of alloca for the label offsets in OFFSETS_AT and...

* reload1.c (reload): Use xmalloc instead of alloca for the label
	offsets in OFFSETS_AT and OFFSETS_KNOWN_AT.

From-SVN: r14194
This commit is contained in:
Brendan Kehoe 1997-06-09 18:24:52 -04:00
parent 812059fe0e
commit a68d4b7592

View File

@ -545,6 +545,11 @@ reload (first, global, dumpfile)
register rtx insn; register rtx insn;
register struct elim_table *ep; register struct elim_table *ep;
/* The two pointers used to track the true location of the memory used
for label offsets. */
char *real_known_ptr = NULL_PTR;
int (*real_at_ptr)[NUM_ELIMINABLE_REGS];
int something_changed; int something_changed;
int something_needs_reloads; int something_needs_reloads;
int something_needs_elimination; int something_needs_elimination;
@ -751,13 +756,17 @@ reload (first, global, dumpfile)
num_labels = max_label_num () - get_first_label_num (); num_labels = max_label_num () - get_first_label_num ();
/* Allocate the tables used to store offset information at labels. */ /* Allocate the tables used to store offset information at labels. */
offsets_known_at = (char *) alloca (num_labels); /* We used to use alloca here, but the size of what it would try to
offsets_at allocate would occasionally cause it to exceed the stack limit and
cause a core dump. */
real_known_ptr = xmalloc (num_labels);
real_at_ptr
= (int (*)[NUM_ELIMINABLE_REGS]) = (int (*)[NUM_ELIMINABLE_REGS])
alloca (num_labels * NUM_ELIMINABLE_REGS * sizeof (int)); xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (int));
offsets_known_at -= get_first_label_num (); offsets_known_at = real_known_ptr - get_first_label_num ();
offsets_at -= get_first_label_num (); offsets_at
= (int (*)[NUM_ELIMINABLE_REGS]) (real_at_ptr - get_first_label_num ());
/* Alter each pseudo-reg rtx to contain its hard reg number. /* Alter each pseudo-reg rtx to contain its hard reg number.
Assign stack slots to the pseudos that lack hard regs or equivalents. Assign stack slots to the pseudos that lack hard regs or equivalents.
@ -789,7 +798,11 @@ reload (first, global, dumpfile)
break; break;
if (i == max_regno && num_eliminable == 0 && ! caller_save_needed) if (i == max_regno && num_eliminable == 0 && ! caller_save_needed)
{
free (real_known_ptr);
free (real_at_ptr);
return; return;
}
#endif #endif
/* Compute the order of preference for hard registers to spill. /* Compute the order of preference for hard registers to spill.
@ -2154,6 +2167,11 @@ reload (first, global, dumpfile)
reg_equiv_constant = 0; reg_equiv_constant = 0;
reg_equiv_memory_loc = 0; reg_equiv_memory_loc = 0;
if (real_known_ptr)
free (real_known_ptr);
if (real_at_ptr)
free (real_at_ptr);
if (scratch_list) if (scratch_list)
free (scratch_list); free (scratch_list);
scratch_list = 0; scratch_list = 0;