1.1.1 local-alloc alloca removal

Richard Henderson rth@cygnus.com
Mon Nov 16 21:54:00 GMT 1998


There is a nasty function in glibc 2.0.99 that has max_regno
sitting about 110k.  Which kills the compiler rather quickly
using alloca here.


r~


	* local-alloc.c (local_alloc): Use malloc not alloca for
	reg_qty, reg_offset, ref_next_in_qty.

Index: local-alloc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/local-alloc.c,v
retrieving revision 1.18
diff -c -p -d -r1.18 local-alloc.c
*** local-alloc.c	1998/06/24 21:49:34	1.18
--- local-alloc.c	1998/11/17 05:46:34
*************** local_alloc ()
*** 448,456 ****
    qty_n_refs = (int *) alloca (max_qty * sizeof (int));
    qty_changes_size = (char *) alloca (max_qty * sizeof (char));
  
!   reg_qty = (int *) alloca (max_regno * sizeof (int));
!   reg_offset = (char *) alloca (max_regno * sizeof (char));
!   reg_next_in_qty = (int *) alloca (max_regno * sizeof (int));
  
    /* Allocate the reg_renumber array */
    allocate_reg_info (max_regno, FALSE, TRUE);
--- 448,456 ----
    qty_n_refs = (int *) alloca (max_qty * sizeof (int));
    qty_changes_size = (char *) alloca (max_qty * sizeof (char));
  
!   reg_qty = (int *) xmalloc (max_regno * sizeof (int));
!   reg_offset = (char *) xmalloc (max_regno * sizeof (char));
!   reg_next_in_qty = (int *) xmalloc(max_regno * sizeof (int));
  
    /* Allocate the reg_renumber array */
    allocate_reg_info (max_regno, FALSE, TRUE);
*************** local_alloc ()
*** 519,524 ****
--- 519,528 ----
        alloca (0);
  #endif
      }
+ 
+   free (reg_qty);
+   free (reg_offset);
+   free (reg_next_in_qty);
  }
  
  /* Depth of loops we are in while in update_equiv_regs.  */



More information about the Gcc-patches mailing list