Commit ff154f78 by Mark Mitchell Committed by Mark Mitchell

local-alloc.c (local_alloc): Use xmalloc/xcalloc, not alloca.

	* local-alloc.c (local_alloc): Use xmalloc/xcalloc, not alloca.
	(update_equiv_regs): Likewise.
	(block_alloc): Likewise.
	* reg-stack.c (reg_to_stack): Likewise.
	(convert_regs_2): Likewise.
	* reload1.c (reload_as_needed): Likewise.

From-SVN: r30434
parent 951a525f
Sat Nov 6 10:00:34 1999 Mark Mitchell <mark@codesourcery.com>
* local-alloc.c (local_alloc): Use xmalloc/xcalloc, not alloca.
(update_equiv_regs): Likewise.
(block_alloc): Likewise.
* reg-stack.c (reg_to_stack): Likewise.
(convert_regs_2): Likewise.
* reload1.c (reload_as_needed): Likewise.
Sat Nov 6 09:57:59 1999 Mark Mitchell <mark@codesourcery.com> Sat Nov 6 09:57:59 1999 Mark Mitchell <mark@codesourcery.com>
* Makefile.in (dbxout.o): Depend on ggc.h. * Makefile.in (dbxout.o): Depend on ggc.h.
......
...@@ -411,9 +411,6 @@ local_alloc () ...@@ -411,9 +411,6 @@ local_alloc ()
next_qty = 0; next_qty = 0;
block_alloc (b); block_alloc (b);
#ifdef USE_C_ALLOCA
alloca (0);
#endif
} }
free (qty_phys_reg); free (qty_phys_reg);
...@@ -687,17 +684,13 @@ update_equiv_regs () ...@@ -687,17 +684,13 @@ update_equiv_regs ()
{ {
/* Set when an attempt should be made to replace a register with the /* Set when an attempt should be made to replace a register with the
associated reg_equiv_replacement entry at the end of this function. */ associated reg_equiv_replacement entry at the end of this function. */
char *reg_equiv_replace char *reg_equiv_replace;
= (char *) alloca (max_regno * sizeof *reg_equiv_replace);
rtx insn; rtx insn;
int block, depth; int block, depth;
reg_equiv_init_insns = (rtx *) alloca (max_regno * sizeof (rtx)); reg_equiv_replace = (char *) xcalloc (max_regno, sizeof *reg_equiv_replace);
reg_equiv_replacement = (rtx *) alloca (max_regno * sizeof (rtx)); reg_equiv_init_insns = (rtx *) xcalloc (max_regno, sizeof (rtx));
reg_equiv_replacement = (rtx *) xcalloc (max_regno, sizeof (rtx));
bzero ((char *) reg_equiv_init_insns, max_regno * sizeof (rtx));
bzero ((char *) reg_equiv_replacement, max_regno * sizeof (rtx));
bzero ((char *) reg_equiv_replace, max_regno * sizeof *reg_equiv_replace);
init_alias_analysis (); init_alias_analysis ();
...@@ -1017,6 +1010,9 @@ update_equiv_regs () ...@@ -1017,6 +1010,9 @@ update_equiv_regs ()
/* Clean up. */ /* Clean up. */
end_alias_analysis (); end_alias_analysis ();
free (reg_equiv_replace);
free (reg_equiv_init_insns);
free (reg_equiv_replacement);
} }
/* Mark REG as having no known equivalence. /* Mark REG as having no known equivalence.
...@@ -1080,9 +1076,8 @@ block_alloc (b) ...@@ -1080,9 +1076,8 @@ block_alloc (b)
/* +2 to leave room for a post_mark_life at the last insn and for /* +2 to leave room for a post_mark_life at the last insn and for
the birth of a CLOBBER in the first insn. */ the birth of a CLOBBER in the first insn. */
regs_live_at = (HARD_REG_SET *) alloca ((2 * insn_count + 2) regs_live_at = (HARD_REG_SET *) xcalloc ((2 * insn_count + 2),
* sizeof (HARD_REG_SET)); sizeof (HARD_REG_SET));
bzero ((char *) regs_live_at, (2 * insn_count + 2) * sizeof (HARD_REG_SET));
/* Initialize table of hardware registers currently live. */ /* Initialize table of hardware registers currently live. */
...@@ -1321,7 +1316,7 @@ block_alloc (b) ...@@ -1321,7 +1316,7 @@ block_alloc (b)
number of suggested registers they need so we allocate those with number of suggested registers they need so we allocate those with
the most restrictive needs first. */ the most restrictive needs first. */
qty_order = (int *) alloca (next_qty * sizeof (int)); qty_order = (int *) xmalloc (next_qty * sizeof (int));
for (i = 0; i < next_qty; i++) for (i = 0; i < next_qty; i++)
qty_order[i] = i; qty_order[i] = i;
...@@ -1491,6 +1486,10 @@ block_alloc (b) ...@@ -1491,6 +1486,10 @@ block_alloc (b)
for (i = qty_first_reg[q]; i >= 0; i = reg_next_in_qty[i]) for (i = qty_first_reg[q]; i >= 0; i = reg_next_in_qty[i])
reg_renumber[i] = qty_phys_reg[q] + reg_offset[i]; reg_renumber[i] = qty_phys_reg[q] + reg_offset[i];
} }
/* Clean up. */
free (regs_live_at);
free (qty_order);
} }
/* Compare two quantities' priority for getting real registers. /* Compare two quantities' priority for getting real registers.
......
...@@ -435,8 +435,7 @@ reg_to_stack (first, file) ...@@ -435,8 +435,7 @@ reg_to_stack (first, file)
life_analysis (first, max_reg_num (), file, 0); life_analysis (first, max_reg_num (), file, 0);
/* Set up block info for each basic block. */ /* Set up block info for each basic block. */
bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi)); bi = (block_info) xcalloc ((n_basic_blocks + 1), sizeof (*bi));
memset (bi, 0, (n_basic_blocks + 1) * sizeof (*bi));
for (i = n_basic_blocks - 1; i >= 0; --i) for (i = n_basic_blocks - 1; i >= 0; --i)
BASIC_BLOCK (i)->aux = bi + i; BASIC_BLOCK (i)->aux = bi + i;
EXIT_BLOCK_PTR->aux = bi + n_basic_blocks; EXIT_BLOCK_PTR->aux = bi + n_basic_blocks;
...@@ -483,7 +482,9 @@ reg_to_stack (first, file) ...@@ -483,7 +482,9 @@ reg_to_stack (first, file)
!JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN); !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
} }
/* Clean up. */
VARRAY_FREE (stack_regs_mentioned_data); VARRAY_FREE (stack_regs_mentioned_data);
free (bi);
} }
/* Check PAT, which is in INSN, for LABEL_REFs. Add INSN to the /* Check PAT, which is in INSN, for LABEL_REFs. Add INSN to the
...@@ -2616,7 +2617,7 @@ convert_regs_2 (file, block) ...@@ -2616,7 +2617,7 @@ convert_regs_2 (file, block)
basic_block *stack, *sp; basic_block *stack, *sp;
int inserted; int inserted;
stack = (basic_block *) alloca (sizeof (*stack) * n_basic_blocks); stack = (basic_block *) xmalloc (sizeof (*stack) * n_basic_blocks);
sp = stack; sp = stack;
*sp++ = block; *sp++ = block;
......
...@@ -4309,9 +4309,8 @@ reload_as_needed (live_known) ...@@ -4309,9 +4309,8 @@ reload_as_needed (live_known)
bzero ((char *) spill_reg_rtx, sizeof spill_reg_rtx); bzero ((char *) spill_reg_rtx, sizeof spill_reg_rtx);
bzero ((char *) spill_reg_store, sizeof spill_reg_store); bzero ((char *) spill_reg_store, sizeof spill_reg_store);
reg_last_reload_reg = (rtx *) alloca (max_regno * sizeof (rtx)); reg_last_reload_reg = (rtx *) xcalloc (max_regno, sizeof (rtx));
bzero ((char *) reg_last_reload_reg, max_regno * sizeof (rtx)); reg_has_output_reload = (char *) xmalloc (max_regno);
reg_has_output_reload = (char *) alloca (max_regno);
CLEAR_HARD_REG_SET (reg_reloaded_valid); CLEAR_HARD_REG_SET (reg_reloaded_valid);
set_initial_elim_offsets (); set_initial_elim_offsets ();
...@@ -4573,11 +4572,11 @@ reload_as_needed (live_known) ...@@ -4573,11 +4572,11 @@ reload_as_needed (live_known)
&& INSN_CLOBBERS_REGNO_P (insn, i)) && INSN_CLOBBERS_REGNO_P (insn, i))
CLEAR_HARD_REG_BIT (reg_reloaded_valid, i); CLEAR_HARD_REG_BIT (reg_reloaded_valid, i);
#endif #endif
#ifdef USE_C_ALLOCA
alloca (0);
#endif
} }
/* Clean up. */
free (reg_last_reload_reg);
free (reg_has_output_reload);
} }
/* Discard all record of any value reloaded from X, /* Discard all record of any value reloaded from X,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment