OSDN Git Service

PR gcc/16300
authorbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Aug 1998 11:02:51 +0000 (11:02 +0000)
committerbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Aug 1998 11:02:51 +0000 (11:02 +0000)
Tue Aug 25 13:19:46 1998  Dave Brolley  <brolley@cygnus.com>
* regclass.c (regclass): Use xmalloc/free instead of alloca.
* stupid.c (stupid_life_analysis): Ditto.
* reload1.c (reload): Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21964 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/regclass.c
gcc/reload1.c
gcc/stupid.c

index d1e50cf..0a12902 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 13:19:46 1998  Dave Brolley  <brolley@cygnus.com>
+
+       * regclass.c (regclass): Use xmalloc/free instead of alloca.
+       * stupid.c (stupid_life_analysis): Ditto.
+       * reload1.c (reload): Ditto.
+
 Tue Aug 25 05:48:18 1998  Jakub Jelinek  <jj@sunsite.ms.mff.cuni.cz>
 
        * config/sparc/sparc.c (arith_4096_operand, arith_add_operand,
index 293b7c3..ac17dfe 100644 (file)
@@ -726,7 +726,7 @@ regclass (f, nregs)
 
   init_recog ();
 
-  costs = (struct costs *) alloca (nregs * sizeof (struct costs));
+  costs = (struct costs *) xmalloc (nregs * sizeof (struct costs));
 
 #ifdef FORBIDDEN_INC_DEC_CLASSES
 
@@ -1067,6 +1067,8 @@ regclass (f, nregs)
        }
     }
 #endif /* REGISTER_CONSTRAINTS */
+
+  free (costs);
 }
 \f
 #ifdef REGISTER_CONSTRAINTS
index 309fbe3..ae829f7 100644 (file)
@@ -619,17 +619,17 @@ reload (first, global, dumpfile)
      Record memory equivalents in reg_mem_equiv so they can
      be substituted eventually by altering the REG-rtx's.  */
 
-  reg_equiv_constant = (rtx *) alloca (max_regno * sizeof (rtx));
+  reg_equiv_constant = (rtx *) xmalloc (max_regno * sizeof (rtx));
   bzero ((char *) reg_equiv_constant, max_regno * sizeof (rtx));
-  reg_equiv_memory_loc = (rtx *) alloca (max_regno * sizeof (rtx));
+  reg_equiv_memory_loc = (rtx *) xmalloc (max_regno * sizeof (rtx));
   bzero ((char *) reg_equiv_memory_loc, max_regno * sizeof (rtx));
-  reg_equiv_mem = (rtx *) alloca (max_regno * sizeof (rtx));
+  reg_equiv_mem = (rtx *) xmalloc (max_regno * sizeof (rtx));
   bzero ((char *) reg_equiv_mem, max_regno * sizeof (rtx));
-  reg_equiv_init = (rtx *) alloca (max_regno * sizeof (rtx));
+  reg_equiv_init = (rtx *) xmalloc (max_regno * sizeof (rtx));
   bzero ((char *) reg_equiv_init, max_regno * sizeof (rtx));
-  reg_equiv_address = (rtx *) alloca (max_regno * sizeof (rtx));
+  reg_equiv_address = (rtx *) xmalloc (max_regno * sizeof (rtx));
   bzero ((char *) reg_equiv_address, max_regno * sizeof (rtx));
-  reg_max_ref_width = (int *) alloca (max_regno * sizeof (int));
+  reg_max_ref_width = (int *) xmalloc (max_regno * sizeof (int));
   bzero ((char *) reg_max_ref_width, max_regno * sizeof (int));
 
   if (SMALL_REGISTER_CLASSES)
@@ -799,7 +799,13 @@ reload (first, global, dumpfile)
     {
       free (real_known_ptr);
       free (real_at_ptr);
-      return;
+      free (reg_equiv_constant);
+      free (reg_equiv_memory_loc);
+      free (reg_equiv_mem);
+      free (reg_equiv_init);
+      free (reg_equiv_address);
+      free (reg_max_ref_width);
+      return 0;
     }
 #endif
 
@@ -2176,6 +2182,13 @@ reload (first, global, dumpfile)
     free (scratch_block);
   scratch_block = 0;
 
+  free (reg_equiv_constant);
+  free (reg_equiv_memory_loc);
+  free (reg_equiv_mem);
+  free (reg_equiv_init);
+  free (reg_equiv_address);
+  free (reg_max_ref_width);
+
   CLEAR_HARD_REG_SET (used_spill_regs);
   for (i = 0; i < n_spills; i++)
     SET_HARD_REG_BIT (used_spill_regs, spill_regs[i]);
index 718c39b..dbb0ffe 100644 (file)
@@ -135,7 +135,7 @@ stupid_life_analysis (f, nregs, file)
 
   bzero (regs_ever_live, sizeof regs_ever_live);
 
-  regs_live = (char *) alloca (nregs);
+  regs_live = (char *) xmalloc (nregs);
 
   /* First find the last real insn, and count the number of insns,
      and assign insns their suids.  */
@@ -145,7 +145,7 @@ stupid_life_analysis (f, nregs, file)
       i = INSN_UID (insn);
 
   max_uid = i + 1;
-  uid_suid = (int *) alloca ((i + 1) * sizeof (int));
+  uid_suid = (int *) xmalloc ((i + 1) * sizeof (int));
 
   /* Compute the mapping from uids to suids.
      Suids are numbers assigned to insns, like uids,
@@ -168,19 +168,19 @@ stupid_life_analysis (f, nregs, file)
 
   /* Allocate tables to record info about regs.  */
 
-  reg_where_dead = (int *) alloca (nregs * sizeof (int));
+  reg_where_dead = (int *) xmalloc (nregs * sizeof (int));
   bzero ((char *) reg_where_dead, nregs * sizeof (int));
 
-  reg_where_born = (int *) alloca (nregs * sizeof (int));
+  reg_where_born = (int *) xmalloc (nregs * sizeof (int));
   bzero ((char *) reg_where_born, nregs * sizeof (int));
 
-  reg_order = (int *) alloca (nregs * sizeof (int));
+  reg_order = (int *) xmalloc (nregs * sizeof (int));
   bzero ((char *) reg_order, nregs * sizeof (int));
 
-  regs_change_size = (char *) alloca (nregs * sizeof (char));
+  regs_change_size = (char *) xmalloc (nregs * sizeof (char));
   bzero ((char *) regs_change_size, nregs * sizeof (char));
 
-  regs_crosses_setjmp = (char *) alloca (nregs * sizeof (char));
+  regs_crosses_setjmp = (char *) xmalloc (nregs * sizeof (char));
   bzero ((char *) regs_crosses_setjmp, nregs * sizeof (char));
 
   /* Allocate the reg_renumber array */
@@ -189,7 +189,7 @@ stupid_life_analysis (f, nregs, file)
     reg_renumber[i] = i;
 
   after_insn_hard_regs
-    = (HARD_REG_SET *) alloca (max_suid * sizeof (HARD_REG_SET));
+    = (HARD_REG_SET *) xmalloc (max_suid * sizeof (HARD_REG_SET));
 
   bzero ((char *) after_insn_hard_regs, max_suid * sizeof (HARD_REG_SET));
 
@@ -316,6 +316,15 @@ stupid_life_analysis (f, nregs, file)
 
   if (file)
     dump_flow_info (file);
+
+  free (regs_live);
+  free (uid_suid);
+  free (reg_where_dead);
+  free (reg_where_born);
+  free (reg_order);
+  free (regs_change_size);
+  free (regs_crosses_setjmp);
+  free (after_insn_hard_regs);
 }
 
 /* Comparison function for qsort.