From: Richard Henderson Date: Wed, 10 Jan 2001 19:59:23 +0000 (-0800) Subject: alpha.c (alpha_free_machine_status): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37b157440f7843845adaa98df765d4ab824b4437;p=gcc.git alpha.c (alpha_free_machine_status): New. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ef486ed64e..049a3f72b80 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2001-01-10 Richard Henderson + + * 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 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index cfebe6a9f09..a4fe8883b17 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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; } /* 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. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 49a88820b9b..217426bcfc9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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. diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 82fca4ae10f..14948b0dab1 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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 (); }