This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

missing free_machine_status


Nick's patches reminded me that these were missing.


r~


        * config/alpha/alpha.c (alpha_free_machine_status): New.
        (override_options): Install it.
        (alpha_mark_machine_status): Verify machine non-null.
        * config/i386/i386.c (ix86_free_machine_status): New.
        (override_options): Install it.
        (ix86_init_machine_status): Use xcalloc.
        (ix86_mark_machine_status): Verify machine non-null.
        * config/ia64/ia64.c (ia64_free_machine_status): New.
        (ia64_override_options): Install it.
        (ia64_mark_machine_status): Verify machine non-null.

Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.c,v
retrieving revision 1.152
diff -c -p -d -r1.152 alpha.c
*** alpha.c	2000/12/29 11:51:01	1.152
--- alpha.c	2001/01/10 19:57:46
*************** static void alpha_init_machine_status
*** 119,124 ****
--- 119,126 ----
    PARAMS ((struct function *p));
  static void alpha_mark_machine_status
    PARAMS ((struct function *p));
+ static void alpha_free_machine_status
+   PARAMS ((struct function *p));
  static int alpha_ra_ever_killed
    PARAMS ((void));
  static rtx set_frame_related_p
*************** override_options ()
*** 347,352 ****
--- 349,355 ----
    /* Set up function hooks.  */
    init_machine_status = alpha_init_machine_status;
    mark_machine_status = alpha_mark_machine_status;
+   free_machine_status = alpha_free_machine_status;
  }
  
  /* Returns 1 if VALUE is a mask that contains full bytes of zero or ones.  */
*************** alpha_mark_machine_status (p)
*** 3660,3667 ****
  {
    struct machine_function *machine = p->machine;
  
!   ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
!   ggc_mark_rtx (machine->ra_rtx);
  }
  
  /* Start the ball rolling with RETURN_ADDR_RTX.  */
--- 3663,3681 ----
  {
    struct machine_function *machine = p->machine;
  
!   if (machine)
!     {
!       ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
!       ggc_mark_rtx (machine->ra_rtx);
!     }
! }
! 
! static void
! alpha_free_machine_status (p)
!      struct function *p;
! {
!   free (p->machine);
!   p->machine = NULL;
  }
  
  /* Start the ball rolling with RETURN_ADDR_RTX.  */
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.197
diff -c -p -d -r1.197 i386.c
*** i386.c	2001/01/10 15:39:55	1.197
--- i386.c	2001/01/10 19:57:46
*************** static rtx * ix86_pent_find_pair PARAMS 
*** 404,409 ****
--- 404,410 ----
  					 rtx));
  static void ix86_init_machine_status PARAMS ((struct function *));
  static void ix86_mark_machine_status PARAMS ((struct function *));
+ static void ix86_free_machine_status PARAMS ((struct function *));
  static int ix86_split_to_parts PARAMS ((rtx, rtx *, enum machine_mode));
  static int ix86_safe_length_prefix PARAMS ((rtx));
  static HOST_WIDE_INT ix86_compute_frame_size PARAMS((HOST_WIDE_INT,
*************** override_options ()
*** 536,541 ****
--- 537,543 ----
    /* Arrange to set up i386_stack_locals for all functions.  */
    init_machine_status = ix86_init_machine_status;
    mark_machine_status = ix86_mark_machine_status;
+   free_machine_status = ix86_free_machine_status;
  
    /* Validate registers in register allocation order.  */
    if (ix86_reg_alloc_order)
*************** static void
*** 6336,6350 ****
  ix86_init_machine_status (p)
       struct function *p;
  {
!   enum machine_mode mode;
!   int n;
!   p->machine
!     = (struct machine_function *) xmalloc (sizeof (struct machine_function));
! 
!   for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
!        mode = (enum machine_mode) ((int) mode + 1))
!     for (n = 0; n < MAX_386_STACK_LOCALS; n++)
!       ix86_stack_locals[(int) mode][n] = NULL_RTX;
  }
  
  /* Mark machine specific bits of P for GC.  */
--- 6338,6345 ----
  ix86_init_machine_status (p)
       struct function *p;
  {
!   p->machine = (struct machine_function *)
!     xcalloc (1, sizeof (struct machine_function));
  }
  
  /* Mark machine specific bits of P for GC.  */
*************** static void
*** 6352,6364 ****
  ix86_mark_machine_status (p)
       struct function *p;
  {
    enum machine_mode mode;
    int n;
  
    for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
         mode = (enum machine_mode) ((int) mode + 1))
      for (n = 0; n < MAX_386_STACK_LOCALS; n++)
!       ggc_mark_rtx (p->machine->stack_locals[(int) mode][n]);
  }
  
  /* Return a MEM corresponding to a stack slot with mode MODE.
--- 6347,6371 ----
  ix86_mark_machine_status (p)
       struct function *p;
  {
+   struct machine_function *machine = p->machine;
    enum machine_mode mode;
    int n;
  
+   if (! machine)
+     return;
+ 
    for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
         mode = (enum machine_mode) ((int) mode + 1))
      for (n = 0; n < MAX_386_STACK_LOCALS; n++)
!       ggc_mark_rtx (machine->stack_locals[(int) mode][n]);
! }
! 
! static void
! ix86_free_machine_status (p)
!      struct function *p;
! {
!   free (p->machine);
!   p->machine = NULL;
  }
  
  /* Return a MEM corresponding to a stack slot with mode MODE.
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64.c,v
retrieving revision 1.67
diff -c -p -d -r1.67 ia64.c
*** ia64.c	2001/01/04 14:17:40	1.67
--- ia64.c	2001/01/10 19:57:47
*************** static void fix_range PARAMS ((const cha
*** 115,120 ****
--- 115,121 ----
  static void ia64_add_gc_roots PARAMS ((void));
  static void ia64_init_machine_status PARAMS ((struct function *));
  static void ia64_mark_machine_status PARAMS ((struct function *));
+ static void ia64_free_machine_status PARAMS ((struct function *));
  static void emit_insn_group_barriers PARAMS ((FILE *, rtx));
  static void emit_all_insn_group_barriers PARAMS ((FILE *, rtx));
  static void emit_predicate_relation_info PARAMS ((void));
*************** static void
*** 3663,3673 ****
  ia64_mark_machine_status (p)
       struct function *p;
  {
!   ggc_mark_rtx (p->machine->ia64_eh_epilogue_sp);
!   ggc_mark_rtx (p->machine->ia64_eh_epilogue_bsp);
!   ggc_mark_rtx (p->machine->ia64_gp_save);
  }
  
  
  /* Handle TARGET_OPTIONS switches.  */
  
--- 3664,3686 ----
  ia64_mark_machine_status (p)
       struct function *p;
  {
!   struct machine_function *machine = p->machine;
! 
!   if (machine)
!     {
!       ggc_mark_rtx (machine->ia64_eh_epilogue_sp);
!       ggc_mark_rtx (machine->ia64_eh_epilogue_bsp);
!       ggc_mark_rtx (machine->ia64_gp_save);
!     }
  }
  
+ static void
+ ia64_free_machine_status (p)
+      struct function *p;
+ {
+   free (p->machine);
+   p->machine = NULL;
+ }
  
  /* Handle TARGET_OPTIONS switches.  */
  
*************** ia64_override_options ()
*** 3690,3695 ****
--- 3703,3709 ----
  
    init_machine_status = ia64_init_machine_status;
    mark_machine_status = ia64_mark_machine_status;
+   free_machine_status = ia64_free_machine_status;
  
    ia64_add_gc_roots ();
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]