alpha.c (alpha_free_machine_status): New.
authorRichard Henderson <rth@redhat.com>
Wed, 10 Jan 2001 19:59:23 +0000 (11:59 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 10 Jan 2001 19:59:23 +0000 (11:59 -0800)
        * 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.

From-SVN: r38877

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c

index 0ef486ed64e11cc650e896786fad789764891433..049a3f72b802418fcae3ab27a92193bb3b839a7e 100644 (file)
@@ -1,3 +1,16 @@
+2001-01-10  Richard Henderson  <rth@redhat.com>
+
+       * 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.
+
 Wed Jan 10 11:34:39 2001  Jeffrey A Law  (law@cygnus.com)
 
        * function.c (instantiate_virtual_regs): Instantiate virtual
index cfebe6a9f09fcbef55783c7c5fa9b0b7859fd4d7..a4fe8883b17e6c278f9fe81a470fa80f34cfeb49 100644 (file)
@@ -119,6 +119,8 @@ static void alpha_init_machine_status
   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
@@ -347,6 +349,7 @@ override_options ()
   /* 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;
 }
 \f
 /* Returns 1 if VALUE is a mask that contains full bytes of zero or ones.  */
@@ -3660,8 +3663,19 @@ alpha_mark_machine_status (p)
 {
   struct machine_function *machine = p->machine;
 
-  ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
-  ggc_mark_rtx (machine->ra_rtx);
+  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 49a88820b9b366920966065927dec6704ff35dec..217426bcfc9d88c5656b60c02e9aeb89cd5b5125 100644 (file)
@@ -404,6 +404,7 @@ static rtx * ix86_pent_find_pair PARAMS ((rtx *, rtx *, enum attr_pent_pair,
                                         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,
@@ -536,6 +537,7 @@ override_options ()
   /* 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)
@@ -6336,15 +6338,8 @@ static void
 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;
+  p->machine = (struct machine_function *)
+    xcalloc (1, sizeof (struct machine_function));
 }
 
 /* Mark machine specific bits of P for GC.  */
@@ -6352,13 +6347,25 @@ static void
 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 (p->machine->stack_locals[(int) mode][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 82fca4ae10f48e61ecebf9636f4281525ee13359..14948b0dab159e88c4e08e953c26339497ff4a56 100644 (file)
@@ -115,6 +115,7 @@ static void fix_range PARAMS ((const char *));
 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));
@@ -3663,11 +3664,23 @@ static void
 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);
+  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.  */
 
@@ -3690,6 +3703,7 @@ ia64_override_options ()
 
   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 ();
 }