Commit 75c6bd46 by Richard Henderson

cse.c (cse_main): Use xmalloc, not alloca.

        * cse.c (cse_main): Use xmalloc, not alloca.
        (cse_basic_block): Likewise.
        * local-alloc.c (local_alloc): Likewise.

From-SVN: r30399
parent 17074a35
Thu Nov 4 14:22:12 1999 David Billinghurst <David.Billinghurst@riotinto.com.au>, Alexandre Oliva <oliva@lsd.ic.unicamp.br> Thu Nov 4 12:49:52 1999 Richard Henderson <rth@cygnus.com>
* cse.c (cse_main): Use xmalloc, not alloca.
(cse_basic_block): Likewise.
* local-alloc.c (local_alloc): Likewise.
Thu Nov 4 14:22:12 1999 David Billinghurst <David.Billinghurst@riotinto.com.au>
Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* rtl.c: Include toplev.h. * rtl.c: Include toplev.h.
(fatal): Remove declaration. (fatal): Remove declaration.
......
...@@ -6877,8 +6877,8 @@ cse_main (f, nregs, after_loop, file) ...@@ -6877,8 +6877,8 @@ cse_main (f, nregs, after_loop, file)
max_insn_uid = get_max_uid (); max_insn_uid = get_max_uid ();
reg_next_eqv = (int *) alloca (nregs * sizeof (int)); reg_next_eqv = (int *) xmalloc (nregs * sizeof (int));
reg_prev_eqv = (int *) alloca (nregs * sizeof (int)); reg_prev_eqv = (int *) xmalloc (nregs * sizeof (int));
#ifdef LOAD_EXTEND_OP #ifdef LOAD_EXTEND_OP
...@@ -6896,8 +6896,7 @@ cse_main (f, nregs, after_loop, file) ...@@ -6896,8 +6896,7 @@ cse_main (f, nregs, after_loop, file)
/* Find the largest uid. */ /* Find the largest uid. */
max_uid = get_max_uid (); max_uid = get_max_uid ();
uid_cuid = (int *) alloca ((max_uid + 1) * sizeof (int)); uid_cuid = (int *) xcalloc (max_uid + 1, sizeof (int));
bzero ((char *) uid_cuid, (max_uid + 1) * sizeof (int));
/* Compute the mapping from uids to cuids. /* Compute the mapping from uids to cuids.
CUIDs are numbers assigned to insns, like uids, CUIDs are numbers assigned to insns, like uids,
...@@ -7024,6 +7023,9 @@ cse_main (f, nregs, after_loop, file) ...@@ -7024,6 +7023,9 @@ cse_main (f, nregs, after_loop, file)
/* Clean up. */ /* Clean up. */
end_alias_analysis (); end_alias_analysis ();
free (uid_cuid);
free (reg_next_eqv);
free (reg_prev_eqv);
return cse_jumps_altered || recorded_label_ref; return cse_jumps_altered || recorded_label_ref;
} }
...@@ -7050,16 +7052,16 @@ cse_basic_block (from, to, next_branch, around_loop) ...@@ -7050,16 +7052,16 @@ cse_basic_block (from, to, next_branch, around_loop)
/* Each of these arrays is undefined before max_reg, so only allocate /* Each of these arrays is undefined before max_reg, so only allocate
the space actually needed and adjust the start below. */ the space actually needed and adjust the start below. */
qty_first_reg = (int *) alloca ((max_qty - max_reg) * sizeof (int)); qty_first_reg = (int *) xmalloc ((max_qty - max_reg) * sizeof (int));
qty_last_reg = (int *) alloca ((max_qty - max_reg) * sizeof (int)); qty_last_reg = (int *) xmalloc ((max_qty - max_reg) * sizeof (int));
qty_mode = (enum machine_mode *) alloca ((max_qty - max_reg) qty_mode = (enum machine_mode *) xmalloc ((max_qty - max_reg)
* sizeof (enum machine_mode)); * sizeof (enum machine_mode));
qty_const = (rtx *) alloca ((max_qty - max_reg) * sizeof (rtx)); qty_const = (rtx *) xmalloc ((max_qty - max_reg) * sizeof (rtx));
qty_const_insn = (rtx *) alloca ((max_qty - max_reg) * sizeof (rtx)); qty_const_insn = (rtx *) xmalloc ((max_qty - max_reg) * sizeof (rtx));
qty_comparison_code qty_comparison_code
= (enum rtx_code *) alloca ((max_qty - max_reg) * sizeof (enum rtx_code)); = (enum rtx_code *) xmalloc ((max_qty - max_reg) * sizeof (enum rtx_code));
qty_comparison_qty = (int *) alloca ((max_qty - max_reg) * sizeof (int)); qty_comparison_qty = (int *) xmalloc ((max_qty - max_reg) * sizeof (int));
qty_comparison_const = (rtx *) alloca ((max_qty - max_reg) * sizeof (rtx)); qty_comparison_const = (rtx *) xmalloc ((max_qty - max_reg) * sizeof (rtx));
qty_first_reg -= max_reg; qty_first_reg -= max_reg;
qty_last_reg -= max_reg; qty_last_reg -= max_reg;
...@@ -7236,6 +7238,15 @@ cse_basic_block (from, to, next_branch, around_loop) ...@@ -7236,6 +7238,15 @@ cse_basic_block (from, to, next_branch, around_loop)
&& LABEL_NUSES (JUMP_LABEL (PREV_INSN (to))) == 1) && LABEL_NUSES (JUMP_LABEL (PREV_INSN (to))) == 1)
cse_around_loop (JUMP_LABEL (PREV_INSN (to))); cse_around_loop (JUMP_LABEL (PREV_INSN (to)));
free (qty_first_reg + max_reg);
free (qty_last_reg + max_reg);
free (qty_mode + max_reg);
free (qty_const + max_reg);
free (qty_const_insn + max_reg);
free (qty_comparison_code + max_reg);
free (qty_comparison_qty + max_reg);
free (qty_comparison_const + max_reg);
return to ? NEXT_INSN (to) : 0; return to ? NEXT_INSN (to) : 0;
} }
......
...@@ -326,25 +326,25 @@ local_alloc () ...@@ -326,25 +326,25 @@ local_alloc ()
See the declarations of these variables, above, See the declarations of these variables, above,
for what they mean. */ for what they mean. */
qty_phys_reg = (short *) alloca (max_qty * sizeof (short)); qty_phys_reg = (short *) xmalloc (max_qty * sizeof (short));
qty_phys_copy_sugg qty_phys_copy_sugg
= (HARD_REG_SET *) alloca (max_qty * sizeof (HARD_REG_SET)); = (HARD_REG_SET *) xmalloc (max_qty * sizeof (HARD_REG_SET));
qty_phys_num_copy_sugg = (short *) alloca (max_qty * sizeof (short)); qty_phys_num_copy_sugg = (short *) xmalloc (max_qty * sizeof (short));
qty_phys_sugg = (HARD_REG_SET *) alloca (max_qty * sizeof (HARD_REG_SET)); qty_phys_sugg = (HARD_REG_SET *) xmalloc (max_qty * sizeof (HARD_REG_SET));
qty_phys_num_sugg = (short *) alloca (max_qty * sizeof (short)); qty_phys_num_sugg = (short *) xmalloc (max_qty * sizeof (short));
qty_birth = (int *) alloca (max_qty * sizeof (int)); qty_birth = (int *) xmalloc (max_qty * sizeof (int));
qty_death = (int *) alloca (max_qty * sizeof (int)); qty_death = (int *) xmalloc (max_qty * sizeof (int));
qty_first_reg = (int *) alloca (max_qty * sizeof (int)); qty_first_reg = (int *) xmalloc (max_qty * sizeof (int));
qty_size = (int *) alloca (max_qty * sizeof (int)); qty_size = (int *) xmalloc (max_qty * sizeof (int));
qty_mode qty_mode
= (enum machine_mode *) alloca (max_qty * sizeof (enum machine_mode)); = (enum machine_mode *) xmalloc (max_qty * sizeof (enum machine_mode));
qty_n_calls_crossed = (int *) alloca (max_qty * sizeof (int)); qty_n_calls_crossed = (int *) xmalloc (max_qty * sizeof (int));
qty_min_class qty_min_class
= (enum reg_class *) alloca (max_qty * sizeof (enum reg_class)); = (enum reg_class *) xmalloc (max_qty * sizeof (enum reg_class));
qty_alternate_class qty_alternate_class
= (enum reg_class *) alloca (max_qty * sizeof (enum reg_class)); = (enum reg_class *) xmalloc (max_qty * sizeof (enum reg_class));
qty_n_refs = (int *) alloca (max_qty * sizeof (int)); qty_n_refs = (int *) xmalloc (max_qty * sizeof (int));
qty_changes_size = (char *) alloca (max_qty * sizeof (char)); qty_changes_size = (char *) xmalloc (max_qty * sizeof (char));
reg_qty = (int *) xmalloc (max_regno * sizeof (int)); reg_qty = (int *) xmalloc (max_regno * sizeof (int));
reg_offset = (char *) xmalloc (max_regno * sizeof (char)); reg_offset = (char *) xmalloc (max_regno * sizeof (char));
...@@ -416,9 +416,25 @@ local_alloc () ...@@ -416,9 +416,25 @@ local_alloc ()
#endif #endif
} }
free (qty_phys_reg);
free (qty_phys_copy_sugg);
free (qty_phys_num_copy_sugg);
free (qty_phys_sugg);
free (qty_birth);
free (qty_death);
free (qty_first_reg);
free (qty_size);
free (qty_mode);
free (qty_n_calls_crossed);
free (qty_min_class);
free (qty_alternate_class);
free (qty_n_refs);
free (qty_changes_size);
free (reg_qty); free (reg_qty);
free (reg_offset); free (reg_offset);
free (reg_next_in_qty); free (reg_next_in_qty);
return recorded_label_ref; return recorded_label_ref;
} }
......
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