diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-04 07:11:05 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-04 07:11:05 +0000 |
commit | 1f3233d13f58417984cb2239d328b65e8d172744 (patch) | |
tree | 720630adca0f6b357e05c4feb8cbe33d556925ce /gcc/config | |
parent | 0dc11899d8781bca1da5f4421327d61890424808 (diff) | |
download | ppe42-gcc-1f3233d13f58417984cb2239d328b65e8d172744.tar.gz ppe42-gcc-1f3233d13f58417984cb2239d328b65e8d172744.zip |
Merge from pch-branch up to tag pch-commit-20020603.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54232 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
39 files changed, 221 insertions, 596 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index ab029902415..0d13840d032 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -188,12 +188,8 @@ static void alpha_elf_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); #endif -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 struct machine_function * alpha_init_machine_status + PARAMS ((void)); static void unicosmk_output_deferred_case_vectors PARAMS ((FILE *)); static void unicosmk_gen_dsib PARAMS ((unsigned long *imaskP)); @@ -562,8 +558,6 @@ 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. */ @@ -5311,9 +5305,9 @@ alpha_multipass_dfa_lookahead () /* Machine-specific function data. */ -struct machine_function +struct machine_function GTY(()) { -#if TARGET_ABI_UNICOSMK + /* For unicosmk. */ /* List of call information words for calls from this function. */ struct rtx_def *first_ciw; struct rtx_def *last_ciw; @@ -5321,58 +5315,18 @@ struct machine_function /* List of deferred case vectors. */ struct rtx_def *addr_list; -#else -#if TARGET_ABI_OSF + + /* For OSF. */ const char *some_ld_name; -#else - /* Non-empty struct. */ - char dummy; -#endif -#endif }; -/* Register global variables and machine-specific functions with the - garbage collector. */ +/* How to allocate a 'struct machine_function'. */ -static void -alpha_init_machine_status (p) - struct function *p; +static struct machine_function * +alpha_init_machine_status () { - p->machine = - (struct machine_function *) xcalloc (1, sizeof (struct machine_function)); - -#if TARGET_ABI_UNICOSMK - p->machine->first_ciw = NULL_RTX; - p->machine->last_ciw = NULL_RTX; - p->machine->ciw_count = 0; - p->machine->addr_list = NULL_RTX; -#endif -#if TARGET_ABI_OSF - p->machine->some_ld_name = NULL; -#endif -} - -static void -alpha_mark_machine_status (p) - struct function *p; -{ - struct machine_function *machine = p->machine; - - if (machine) - { -#if TARGET_ABI_UNICOSMK - ggc_mark_rtx (machine->first_ciw); - ggc_mark_rtx (machine->addr_list); -#endif - } -} - -static void -alpha_free_machine_status (p) - struct function *p; -{ - free (p->machine); - p->machine = NULL; + return ((struct machine_function *) + ggc_alloc_cleared (sizeof (struct machine_function))); } /* Functions to save and restore alpha_return_addr_rtx. */ @@ -9913,3 +9867,6 @@ unicosmk_need_dex (x) } #endif /* TARGET_ABI_UNICOSMK */ + +#include "gt-alpha.h" + diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 111884d234b..4d1b467dd49 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -82,9 +82,7 @@ static Ccstar output_multi_immediate PARAMS ((rtx *, Ccstar, Ccstar, int, Hi static void print_multi_reg PARAMS ((FILE *, Ccstar, int, int)); static Mmode select_dominance_cc_mode PARAMS ((rtx, rtx, Hint)); static Ccstar shift_op PARAMS ((rtx, Hint *)); -static void arm_init_machine_status PARAMS ((struct function *)); -static void arm_mark_machine_status PARAMS ((struct function *)); -static void arm_free_machine_status PARAMS ((struct function *)); +static struct machine_function * arm_init_machine_status PARAMS ((void)); static int number_of_first_bit_set PARAMS ((int)); static void replace_symbols_in_block PARAMS ((tree, rtx, rtx)); static void thumb_exit PARAMS ((FILE *, int, rtx)); @@ -772,10 +770,6 @@ arm_override_options () static void arm_add_gc_roots () { - ggc_add_rtx_root (&arm_compare_op0, 1); - ggc_add_rtx_root (&arm_compare_op1, 1); - ggc_add_rtx_root (&arm_target_insn, 1); /* Not sure this is really a root. */ - gcc_obstack_init(&minipool_obstack); minipool_startobj = (char *) obstack_alloc (&minipool_obstack, 0); } @@ -10091,37 +10085,16 @@ thumb_unexpanded_epilogue () /* Functions to save and restore machine-specific function data. */ -static void -arm_mark_machine_status (p) - struct function * p; -{ - machine_function *machine = p->machine; - - if (machine) - ggc_mark_rtx (machine->eh_epilogue_sp_ofs); -} - -static void -arm_init_machine_status (p) - struct function * p; +static struct machine_function * +arm_init_machine_status () { - p->machine = - (machine_function *) xcalloc (1, sizeof (machine_function)); + struct machine_function *machine; + machine = (machine_function *) ggc_alloc_cleared (sizeof (machine_function)); -#if ARM_FT_UNKNOWWN != 0 - ((machine_function *) p->machine)->func_type = ARM_FT_UNKNOWN; +#if ARM_FT_UNKNOWN != 0 + machine->func_type = ARM_FT_UNKNOWN; #endif -} - -static void -arm_free_machine_status (p) - struct function * p; -{ - if (p->machine) - { - free (p->machine); - p->machine = NULL; - } + return machine; } /* Return an RTX indicating where the return address to the @@ -10152,8 +10125,6 @@ arm_init_expanders () { /* Arrange to initialize and mark the machine per-function status. */ init_machine_status = arm_init_machine_status; - mark_machine_status = arm_mark_machine_status; - free_machine_status = arm_free_machine_status; } /* Generate the rest of a function's prologue. */ @@ -10851,10 +10822,11 @@ arm_strip_name_encoding (const char * name) return name; } +rtx aof_pic_label; + #ifdef AOF_ASSEMBLER /* Special functions only needed when producing AOF syntax assembler. */ -rtx aof_pic_label = NULL_RTX; struct pic_chain { struct pic_chain * next; @@ -10872,10 +10844,6 @@ aof_pic_entry (x) if (aof_pic_label == NULL_RTX) { - /* We mark this here and not in arm_add_gc_roots() to avoid - polluting even more code with ifdefs, and because it never - contains anything useful until we assign to it here. */ - ggc_add_rtx_root (&aof_pic_label, 1); aof_pic_label = gen_rtx_SYMBOL_REF (Pmode, "x$adcons"); } diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 3a3e6bad681..1b1b7dbe77c 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -107,21 +107,22 @@ extern arm_cc arm_current_cc; extern int arm_target_label; extern int arm_ccfsm_state; -extern struct rtx_def * arm_target_insn; +extern GTY(()) rtx arm_target_insn; /* Run-time compilation parameters selecting different hardware subsets. */ extern int target_flags; /* The floating point instruction architecture, can be 2 or 3 */ extern const char * target_fp_name; /* Define the information needed to generate branch insns. This is - stored from the compare operation. Note that we can't use "rtx" here - since it hasn't been defined! */ -extern struct rtx_def * arm_compare_op0; -extern struct rtx_def * arm_compare_op1; + stored from the compare operation. */ +extern GTY(()) rtx arm_compare_op0; +extern GTY(()) rtx arm_compare_op1; /* The label of the current constant pool. */ -extern struct rtx_def * pool_vector_label; +extern rtx pool_vector_label; /* Set to 1 when a return insn is output, this means that the epilogue is not needed. */ extern int return_used_this_function; +/* Used to produce AOF syntax assembler. */ +extern GTY(()) rtx aof_pic_label; /* Just in case configure has failed to define anything. */ #ifndef TARGET_CPU_DEFAULT @@ -1412,10 +1413,10 @@ enum reg_class /* A C structure for machine-specific, per-function data. This is added to the cfun structure. */ -typedef struct machine_function +typedef struct machine_function GTY(()) { /* Additionsl stack adjustment in __builtin_eh_throw. */ - struct rtx_def *eh_epilogue_sp_ofs; + rtx eh_epilogue_sp_ofs; /* Records if LR has to be saved for far jumps. */ int far_jump_used; /* Records if ARG_POINTER was ever live. */ diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index d8468d17090..8176d4d3723 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -272,19 +272,19 @@ extern int valid_parallel_operands_5 PARAMS ((rtx *, enum machine_mode)); extern int valid_parallel_operands_6 PARAMS ((rtx *, enum machine_mode)); -extern rtx smulhi3_libfunc; -extern rtx umulhi3_libfunc; -extern rtx fix_truncqfhi2_libfunc; -extern rtx fixuns_truncqfhi2_libfunc; -extern rtx fix_trunchfhi2_libfunc; -extern rtx fixuns_trunchfhi2_libfunc; -extern rtx floathiqf2_libfunc; -extern rtx floatunshiqf2_libfunc; -extern rtx floathihf2_libfunc; -extern rtx floatunshihf2_libfunc; - -extern struct rtx_def *c4x_compare_op0; /* Operand 0 for comparisons. */ -extern struct rtx_def *c4x_compare_op1; /* Operand 1 for comparisons. */ +extern GTY(()) rtx smulhi3_libfunc; +extern GTY(()) rtx umulhi3_libfunc; +extern GTY(()) rtx fix_truncqfhi2_libfunc; +extern GTY(()) rtx fixuns_truncqfhi2_libfunc; +extern GTY(()) rtx fix_trunchfhi2_libfunc; +extern GTY(()) rtx fixuns_trunchfhi2_libfunc; +extern GTY(()) rtx floathiqf2_libfunc; +extern GTY(()) rtx floatunshiqf2_libfunc; +extern GTY(()) rtx floathihf2_libfunc; +extern GTY(()) rtx floatunshihf2_libfunc; + +extern GTY(()) rtx c4x_compare_op0; /* Operand 0 for comparisons. */ +extern GTY(()) rtx c4x_compare_op1; /* Operand 1 for comparisons. */ #endif /* RTX_CODE */ @@ -303,7 +303,12 @@ extern void c4x_pr_FUNC_NEVER_RETURNS PARAMS ((cpp_reader *)); extern void c4x_pr_INTERRUPT PARAMS ((cpp_reader *)); extern void c4x_pr_ignored PARAMS ((cpp_reader *)); extern void c4x_init_pragma PARAMS ((int (*) (tree *))); -extern tree code_tree, data_tree, pure_tree, noreturn_tree, interrupt_tree; #endif +extern GTY(()) tree code_tree; +extern GTY(()) tree data_tree; +extern GTY(()) tree pure_tree; +extern GTY(()) tree noreturn_tree; +extern GTY(()) tree interrupt_tree; + #endif /* ! GCC_C4X_PROTOS_H */ diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 126b132f5b5..ad2ff6dff3e 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -148,8 +148,8 @@ enum machine_mode c4x_caller_save_map[FIRST_PSEUDO_REGISTER] = /* Test and compare insns in c4x.md store the information needed to generate branch and scc insns here. */ -struct rtx_def *c4x_compare_op0 = NULL_RTX; -struct rtx_def *c4x_compare_op1 = NULL_RTX; +rtx c4x_compare_op0; +rtx c4x_compare_op1; const char *c4x_rpts_cycles_string; int c4x_rpts_cycles = 0; /* Max. cycles for RPTS. */ @@ -165,7 +165,6 @@ tree noreturn_tree = NULL_TREE; tree interrupt_tree = NULL_TREE; /* Forward declarations */ -static void c4x_add_gc_roots PARAMS ((void)); static int c4x_isr_reg_used_p PARAMS ((unsigned int)); static int c4x_leaf_function_p PARAMS ((void)); static int c4x_assembler_function_p PARAMS ((void)); @@ -223,32 +222,6 @@ static void c4x_encode_section_info PARAMS ((tree, int)); struct gcc_target targetm = TARGET_INITIALIZER; -/* Called to register all of our global variables with the garbage - collector. */ - -static void -c4x_add_gc_roots () -{ - ggc_add_rtx_root (&c4x_compare_op0, 1); - ggc_add_rtx_root (&c4x_compare_op1, 1); - ggc_add_tree_root (&code_tree, 1); - ggc_add_tree_root (&data_tree, 1); - ggc_add_tree_root (&pure_tree, 1); - ggc_add_tree_root (&noreturn_tree, 1); - ggc_add_tree_root (&interrupt_tree, 1); - ggc_add_rtx_root (&smulhi3_libfunc, 1); - ggc_add_rtx_root (&umulhi3_libfunc, 1); - ggc_add_rtx_root (&fix_truncqfhi2_libfunc, 1); - ggc_add_rtx_root (&fixuns_truncqfhi2_libfunc, 1); - ggc_add_rtx_root (&fix_trunchfhi2_libfunc, 1); - ggc_add_rtx_root (&fixuns_trunchfhi2_libfunc, 1); - ggc_add_rtx_root (&floathiqf2_libfunc, 1); - ggc_add_rtx_root (&floatunshiqf2_libfunc, 1); - ggc_add_rtx_root (&floathihf2_libfunc, 1); - ggc_add_rtx_root (&floatunshihf2_libfunc, 1); -} - - /* Override command line options. Called once after all options have been parsed. Mostly we process the processor @@ -317,9 +290,6 @@ c4x_override_options () This provides compatibility with the old -mno-aliases option. */ if (! TARGET_ALIASES && ! flag_argument_noalias) flag_argument_noalias = 1; - - /* Register global variables with the garbage collector. */ - c4x_add_gc_roots (); } @@ -5087,3 +5057,4 @@ c4x_asm_named_section (name, flags) { fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name); } + diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 62912f2e424..0fa6660dc97 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -63,7 +63,7 @@ Boston, MA 02111-1307, USA. */ } while (0) /* Per-function machine data. */ -struct machine_function +struct machine_function GTY(()) { int needs_return_address_on_stack; }; @@ -85,7 +85,7 @@ static void cris_print_base PARAMS ((rtx, FILE *)); static void cris_print_index PARAMS ((rtx, FILE *)); -static void cris_init_machine_status PARAMS ((struct function *)); +static struct machine_function * cris_init_machine_status PARAMS ((void)); static int cris_initial_frame_pointer_offset PARAMS ((void)); @@ -2697,11 +2697,10 @@ cris_init_expanders () /* Zero initialization is OK for all current fields. */ -static void -cris_init_machine_status (p) - struct function *p; +static struct machine_function * +cris_init_machine_status () { - p->machine = xcalloc (1, sizeof (struct machine_function)); + return ggc_alloc_cleared (sizeof (struct machine_function)); } /* Split a 2 word move (DI or presumably DF) into component parts. @@ -3129,6 +3128,8 @@ Prev_insn (insn) } #endif +#include "gt-cris.h" + /* * Local variables: * eval: (c-set-style "gnu") diff --git a/gcc/config/cris/t-cris b/gcc/config/cris/t-cris index e79550b3881..61745e50867 100644 --- a/gcc/config/cris/t-cris +++ b/gcc/config/cris/t-cris @@ -39,3 +39,6 @@ $(LIB2FUNCS_EXTRA): $(CRIS_LIB1CSRC) echo "#define L$$name" > tmp-$@ \ && echo '#include "$<"' >> tmp-$@ \ && mv -f tmp-$@ $@ + +$(out_object_file): gt-cris.h +gt-cris.h : s-gtype ; @true diff --git a/gcc/config/d30v/d30v-protos.h b/gcc/config/d30v/d30v-protos.h index 8beaa7aea99..162a7172eb4 100644 --- a/gcc/config/d30v/d30v-protos.h +++ b/gcc/config/d30v/d30v-protos.h @@ -140,8 +140,8 @@ extern void debug_stack_info PARAMS ((d30v_stack_t *)); /* Define the information needed to generate branch and scc insns. This is stored from the compare operation. */ -extern struct rtx_def *d30v_compare_op0; -extern struct rtx_def *d30v_compare_op1; +extern GTY(()) rtx d30v_compare_op0; +extern GTY(()) rtx d30v_compare_op1; /* Define the information needed to modify the epilogue for EH. */ diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c index 12ae39ad3b5..2ce3468140b 100644 --- a/gcc/config/d30v/d30v.c +++ b/gcc/config/d30v/d30v.c @@ -47,10 +47,7 @@ static void d30v_print_operand_memory_reference PARAMS ((FILE *, rtx)); static void d30v_build_long_insn PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT, rtx, rtx)); -static void d30v_add_gc_roots PARAMS ((void)); -static void d30v_init_machine_status PARAMS ((struct function *)); -static void d30v_mark_machine_status PARAMS ((struct function *)); -static void d30v_free_machine_status PARAMS ((struct function *)); +static struct machine_function * d30v_init_machine_status PARAMS ((void)); static void d30v_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void d30v_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static int d30v_adjust_cost PARAMS ((rtx, rtx, rtx, int)); @@ -298,8 +295,6 @@ override_options () reg_class_from_letter['x'] = F0_REGS; reg_class_from_letter['y'] = F1_REGS; reg_class_from_letter['z'] = OTHER_FLAG_REGS; - - d30v_add_gc_roots (); } @@ -3482,35 +3477,10 @@ d30v_issue_rate () /* Routine to allocate, mark and free a per-function, machine specific structure. */ -static void -d30v_init_machine_status (p) - struct function *p; +static struct machine_function * +d30v_init_machine_status () { - p->machine = - (machine_function *) xcalloc (1, sizeof (machine_function)); -} - -static void -d30v_mark_machine_status (p) - struct function * p; -{ - if (p->machine == NULL) - return; - - ggc_mark_rtx (p->machine->eh_epilogue_sp_ofs); -} - -static void -d30v_free_machine_status (p) - struct function *p; -{ - struct machine_function *machine = p->machine; - - if (machine == NULL) - return; - - free (machine); - p->machine = NULL; + return ggc_alloc_cleared (sizeof (machine_function)); } /* Do anything needed before RTL is emitted for each function. */ @@ -3520,8 +3490,6 @@ d30v_init_expanders () { /* Arrange to save and restore machine status around nested functions. */ init_machine_status = d30v_init_machine_status; - mark_machine_status = d30v_mark_machine_status; - free_machine_status = d30v_free_machine_status; } /* Find the current function's return address. @@ -3536,13 +3504,3 @@ d30v_return_addr () { return get_hard_reg_initial_val (Pmode, GPR_LINK); } - -/* Called to register all of our global variables with the garbage - collector. */ - -static void -d30v_add_gc_roots () -{ - ggc_add_rtx_root (&d30v_compare_op0, 1); - ggc_add_rtx_root (&d30v_compare_op1, 1); -} diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index 122f535abcd..680f7c10cc2 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -1929,10 +1929,10 @@ typedef int CUMULATIVE_ARGS; /* A C structure for machine-specific, per-function data. This is added to the cfun structure. */ -typedef struct machine_function +typedef struct machine_function GTY(()) { /* Additionsl stack adjustment in __builtin_eh_throw. */ - struct rtx_def * eh_epilogue_sp_ofs; + rtx eh_epilogue_sp_ofs; } machine_function; diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 14077298629..19f83c62308 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -26,8 +26,6 @@ extern char *machopic_function_base_name PARAMS ((void)); extern char *machopic_non_lazy_ptr_name PARAMS ((const char*)); extern char *machopic_stub_name PARAMS ((const char*)); -extern void machopic_add_gc_roots PARAMS ((void)); - extern void machopic_picsymbol_stub_section PARAMS ((void)); extern void machopic_symbol_stub_section PARAMS ((void)); extern void machopic_lazy_symbol_ptr_section PARAMS ((void)); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 3b9ee8c3cbc..82e320babe0 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -67,7 +67,7 @@ name_needs_quotes (name) /* This module assumes that (const (symbol_ref "foo")) is a legal pic reference, which will not be changed. */ -static tree machopic_defined_list; +static GTY(()) tree machopic_defined_list; enum machopic_addr_class machopic_classify_ident (ident) @@ -257,7 +257,7 @@ machopic_function_base_name () return function_base; } -static tree machopic_non_lazy_pointers = NULL; +static GTY(()) tree machopic_non_lazy_pointers; /* Return a non-lazy pointer name corresponding to the given name, either by finding it in our list of pointer names, or by generating @@ -321,17 +321,7 @@ machopic_non_lazy_ptr_name (name) } } -static tree machopic_stubs = 0; - -/* Make sure the GC knows about our homemade lists. */ - -void -machopic_add_gc_roots () -{ - ggc_add_tree_root (&machopic_defined_list, 1); - ggc_add_tree_root (&machopic_non_lazy_pointers, 1); - ggc_add_tree_root (&machopic_stubs, 1); -} +static GTY(()) tree machopic_stubs; /* Return the name of the stub corresponding to the given name, generating a new stub name if necessary. */ @@ -1297,3 +1287,6 @@ machopic_asm_out_destructor (symbol, priority) if (!flag_pic) fprintf (asm_out_file, ".reference .destructors_used\n"); } + +#include "gt-darwin.h" + diff --git a/gcc/config/dsp16xx/dsp16xx.c b/gcc/config/dsp16xx/dsp16xx.c index 7f5cc0b06c4..cc1c9d4d279 100644 --- a/gcc/config/dsp16xx/dsp16xx.c +++ b/gcc/config/dsp16xx/dsp16xx.c @@ -1725,29 +1725,6 @@ override_options () rsect_const = tmp = (char *) xmalloc (strlen(".rsect ") + strlen(const_seg_name) + 3); sprintf (tmp, ".rsect \"%s\"", const_seg_name); - - /* Mark our global variables for GC. */ - ggc_add_rtx_root (&dsp16xx_addhf3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_subhf3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_mulhf3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_divhf3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_cmphf3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_fixhfhi2_libcall, 1); - ggc_add_rtx_root (&dsp16xx_floathihf2_libcall, 1); - ggc_add_rtx_root (&dsp16xx_neghf2_libcall, 1); - ggc_add_rtx_root (&dsp16xx_mulhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_udivqi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_udivhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_divqi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_divhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_modqi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_modhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_umodqi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_umodhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_ashrhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_ashlhi3_libcall, 1); - ggc_add_rtx_root (&dsp16xx_ucmphi2_libcall, 1); - ggc_add_rtx_root (&dsp16xx_lshrhi3_libcall, 1); } int diff --git a/gcc/config/dsp16xx/dsp16xx.h b/gcc/config/dsp16xx/dsp16xx.h index 780c8c39f0c..905b027c8f0 100644 --- a/gcc/config/dsp16xx/dsp16xx.h +++ b/gcc/config/dsp16xx/dsp16xx.h @@ -31,29 +31,30 @@ extern const char *const_seg_name; extern const char *rsect_const; extern const char *chip_name; extern const char *save_chip_name; -extern struct rtx_def *dsp16xx_compare_op0, *dsp16xx_compare_op1; -extern struct rtx_def *dsp16xx_addhf3_libcall; -extern struct rtx_def *dsp16xx_subhf3_libcall; -extern struct rtx_def *dsp16xx_mulhf3_libcall; -extern struct rtx_def *dsp16xx_divhf3_libcall; -extern struct rtx_def *dsp16xx_cmphf3_libcall; -extern struct rtx_def *dsp16xx_fixhfhi2_libcall; -extern struct rtx_def *dsp16xx_floathihf2_libcall; -extern struct rtx_def *dsp16xx_neghf2_libcall; -extern struct rtx_def *dsp16xx_umulhi3_libcall; -extern struct rtx_def *dsp16xx_mulhi3_libcall; -extern struct rtx_def *dsp16xx_udivqi3_libcall; -extern struct rtx_def *dsp16xx_udivhi3_libcall; -extern struct rtx_def *dsp16xx_divqi3_libcall; -extern struct rtx_def *dsp16xx_divhi3_libcall; -extern struct rtx_def *dsp16xx_modqi3_libcall; -extern struct rtx_def *dsp16xx_modhi3_libcall; -extern struct rtx_def *dsp16xx_umodqi3_libcall; -extern struct rtx_def *dsp16xx_umodhi3_libcall; - -extern struct rtx_def *dsp16xx_ashrhi3_libcall; -extern struct rtx_def *dsp16xx_ashlhi3_libcall; -extern struct rtx_def *dsp16xx_lshrhi3_libcall; +extern GTY(()) rtx dsp16xx_compare_op0; +extern GTY(()) rtx dsp16xx_compare_op1; +extern GTY(()) rtx dsp16xx_addhf3_libcall; +extern GTY(()) rtx dsp16xx_subhf3_libcall; +extern GTY(()) rtx dsp16xx_mulhf3_libcall; +extern GTY(()) rtx dsp16xx_divhf3_libcall; +extern GTY(()) rtx dsp16xx_cmphf3_libcall; +extern GTY(()) rtx dsp16xx_fixhfhi2_libcall; +extern GTY(()) rtx dsp16xx_floathihf2_libcall; +extern GTY(()) rtx dsp16xx_neghf2_libcall; +extern GTY(()) rtx dsp16xx_umulhi3_libcall; +extern GTY(()) rtx dsp16xx_mulhi3_libcall; +extern GTY(()) rtx dsp16xx_udivqi3_libcall; +extern GTY(()) rtx dsp16xx_udivhi3_libcall; +extern GTY(()) rtx dsp16xx_divqi3_libcall; +extern GTY(()) rtx dsp16xx_divhi3_libcall; +extern GTY(()) rtx dsp16xx_modqi3_libcall; +extern GTY(()) rtx dsp16xx_modhi3_libcall; +extern GTY(()) rtx dsp16xx_umodqi3_libcall; +extern GTY(()) rtx dsp16xx_umodhi3_libcall; + +extern GTY(()) rtx dsp16xx_ashrhi3_libcall; +extern GTY(()) rtx dsp16xx_ashlhi3_libcall; +extern GTY(()) rtx dsp16xx_lshrhi3_libcall; /* RUN-TIME TARGET SPECIFICATION */ #define DSP16XX 1 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d512646fdc5..b5ca28f4fc7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -553,7 +553,7 @@ static char const tls_model_chars[] = " GLil"; #define X86_64_VARARGS_SIZE (REGPARM_MAX * UNITS_PER_WORD + SSE_REGPARM_MAX * 16) /* Define the structure for the machine field in struct function. */ -struct machine_function +struct machine_function GTY(()) { rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; const char *some_ld_name; @@ -680,9 +680,7 @@ static int ix86_agi_dependant PARAMS ((rtx, rtx, enum attr_type)); static enum attr_ppro_uops ix86_safe_ppro_uops PARAMS ((rtx)); static void ix86_dump_ppro_packet PARAMS ((FILE *)); static void ix86_reorder_insn PARAMS ((rtx *, 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 struct machine_function * ix86_init_machine_status PARAMS ((void)); static int ix86_split_to_parts PARAMS ((rtx, rtx *, enum machine_mode)); static int ix86_nsaved_regs PARAMS ((void)); static void ix86_emit_save_regs PARAMS ((void)); @@ -1042,9 +1040,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 -mregparm= value. */ if (ix86_regparm_string) { @@ -10636,38 +10632,10 @@ ix86_expand_call (retval, fnaddr, callarg1, callarg2, pop) This is called from INIT_EXPANDERS once before RTL is emitted for each function. */ -static void -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 -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; +static struct machine_function * +ix86_init_machine_status () { - free (p->machine); - p->machine = NULL; + return ggc_alloc_cleared (sizeof (struct machine_function)); } /* Return a MEM corresponding to a stack slot with mode MODE. @@ -10693,20 +10661,19 @@ assign_386_stack_local (mode, n) /* Construct the SYMBOL_REF for the tls_get_addr function. */ +static GTY(()) rtx ix86_tls_symbol; rtx ix86_tls_get_addr () { - static rtx symbol; - if (!symbol) + if (!ix86_tls_symbol) { - symbol = gen_rtx_SYMBOL_REF (Pmode, (TARGET_GNU_TLS + ix86_tls_symbol = gen_rtx_SYMBOL_REF (Pmode, (TARGET_GNU_TLS ? "___tls_get_addr" : "__tls_get_addr")); - ggc_add_rtx_root (&symbol, 1); } - return symbol; + return ix86_tls_symbol; } /* Calculate the length of the memory address in the instruction @@ -13948,3 +13915,5 @@ x86_output_mi_thunk (file, delta, function) } } } + +#include "gt-i386.h" diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 204740a68e6..2b10ef512ae 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -21,7 +21,8 @@ Boston, MA 02111-1307, USA. */ /* Variables defined in ia64.c. */ #ifdef RTX_CODE -extern rtx ia64_compare_op0, ia64_compare_op1; +extern GTY(()) rtx ia64_compare_op0; +extern GTY(()) rtx ia64_compare_op1; #endif /* Functions defined in ia64.c */ diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 1445ae9bea3..a6066d8894c 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -127,10 +127,7 @@ static rtx gen_fr_restore_x PARAMS ((rtx, rtx, rtx)); static enum machine_mode hfa_element_mode PARAMS ((tree, int)); 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 struct machine_function * ia64_init_machine_status PARAMS ((void)); 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)); @@ -1044,27 +1041,25 @@ ia64_expand_load_address (dest, src, scratch) emit_move_insn (dest, temp); } +static GTY(()) rtx gen_tls_tga; static rtx gen_tls_get_addr () { - static rtx tga; - if (!tga) + if (!gen_tls_tga) { - tga = init_one_libfunc ("__tls_get_addr"); - ggc_add_rtx_root (&tga, 1); - } - return tga; + gen_tls_tga = init_one_libfunc ("__tls_get_addr"); + } + return gen_tls_tga; } +static GTY(()) rtx thread_pointer_rtx; static rtx gen_thread_pointer () { - static rtx tp; - if (!tp) + if (!thread_pointer_rtx) { - tp = gen_rtx_REG (Pmode, 13); - RTX_UNCHANGING_P (tp); - ggc_add_rtx_root (&tp, 1); + thread_pointer_rtx = gen_rtx_REG (Pmode, 13); + RTX_UNCHANGING_P (thread_pointer_rtx); } return tp; } @@ -4146,44 +4141,10 @@ fix_range (const_str) } } -/* Called to register all of our global variables with the garbage - collector. */ - -static void -ia64_add_gc_roots () -{ - ggc_add_rtx_root (&ia64_compare_op0, 1); - ggc_add_rtx_root (&ia64_compare_op1, 1); -} - -static void -ia64_init_machine_status (p) - struct function *p; -{ - p->machine = - (struct machine_function *) xcalloc (1, sizeof (struct machine_function)); -} - -static void -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; +static struct machine_function * +ia64_init_machine_status () { - free (p->machine); - p->machine = NULL; + return ggc_alloc_cleared (sizeof (struct machine_function)); } /* Handle TARGET_OPTIONS switches. */ @@ -4219,10 +4180,6 @@ ia64_override_options () ia64_section_threshold = g_switch_set ? g_switch_value : IA64_DEFAULT_GVALUE; 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 (); } static enum attr_itanium_requires_unit0 ia64_safe_itanium_requires_unit0 PARAMS((rtx)); @@ -8161,3 +8118,5 @@ ia64_aix_select_rtx_section (mode, x, align) ia64_select_rtx_section (mode, x, align); flag_pic = save_pic; } + +#include "gt-ia64.h" diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index d1e0556b128..cfc44d43964 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -2440,16 +2440,16 @@ extern int ia64_final_schedule; #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 15 : INVALID_REGNUM) /* This function contains machine specific function data. */ -struct machine_function +struct machine_function GTY(()) { /* The new stack pointer when unwinding from EH. */ - struct rtx_def* ia64_eh_epilogue_sp; + rtx ia64_eh_epilogue_sp; /* The new bsp value when unwinding from EH. */ - struct rtx_def* ia64_eh_epilogue_bsp; + rtx ia64_eh_epilogue_bsp; /* The GP value save register. */ - struct rtx_def* ia64_gp_save; + rtx ia64_gp_save; /* The number of varargs registers to save. */ int n_varargs; diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 0b63a859ff4..ee5bd6a7844 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -43,10 +43,15 @@ extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, #ifdef RTX_CODE extern rtx m68hc11_compare_op0; extern rtx m68hc11_compare_op1; -extern rtx m68hc11_soft_tmp_reg; -extern rtx iy_reg; -extern rtx ix_reg; -extern rtx d_reg; +extern GTY(()) rtx m68hc11_soft_tmp_reg; +extern GTY(()) rtx ix_reg; +extern GTY(()) rtx iy_reg; +extern GTY(()) rtx d_reg; +extern GTY(()) rtx da_reg; +extern GTY(()) rtx stack_push_word; +extern GTY(()) rtx stack_pop_word; +extern GTY(()) rtx z_reg; +extern GTY(()) rtx z_reg_qi; extern void m68hc11_initialize_trampoline PARAMS((rtx, rtx, rtx)); diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index a521bbd8df2..b3dab481efa 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -72,7 +72,6 @@ static tree m68hc11_handle_fntype_attribute PARAMS ((tree *, tree, tree, int, bo const struct attribute_spec m68hc11_attribute_table[]; void create_regs_rtx PARAMS ((void)); -static void m68hc11_add_gc_roots PARAMS ((void)); static void asm_print_register PARAMS ((FILE *, int)); static void m68hc11_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); @@ -94,7 +93,7 @@ rtx da_reg; rtx stack_push_word; rtx stack_pop_word; static int regs_inited = 0; -static rtx z_reg; +rtx z_reg; /* Set to 1 by expand_prologue() when the function is an interrupt handler. */ int current_function_interrupt; @@ -229,8 +228,6 @@ struct gcc_target targetm = TARGET_INITIALIZER; int m68hc11_override_options () { - m68hc11_add_gc_roots (); - memset (m68hc11_reg_valid_for_index, 0, sizeof (m68hc11_reg_valid_for_index)); memset (m68hc11_reg_valid_for_base, 0, sizeof (m68hc11_reg_valid_for_base)); @@ -4005,7 +4002,7 @@ struct replace_info int z_loaded_with_sp; }; -static rtx z_reg_qi; +rtx z_reg_qi; static int m68hc11_check_z_replacement PARAMS ((rtx, struct replace_info *)); static void m68hc11_find_z_replacement PARAMS ((rtx, struct replace_info *)); @@ -5415,20 +5412,6 @@ m68hc11_asm_file_start (out, main_file) static void -m68hc11_add_gc_roots () -{ - ggc_add_rtx_root (&m68hc11_soft_tmp_reg, 1); - ggc_add_rtx_root (&ix_reg, 1); - ggc_add_rtx_root (&iy_reg, 1); - ggc_add_rtx_root (&d_reg, 1); - ggc_add_rtx_root (&da_reg, 1); - ggc_add_rtx_root (&z_reg, 1); - ggc_add_rtx_root (&z_reg_qi, 1); - ggc_add_rtx_root (&stack_push_word, 1); - ggc_add_rtx_root (&stack_pop_word, 1); -} - -static void m68hc11_asm_out_constructor (symbol, priority) rtx symbol; int priority; diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h index f985de4c0a2..9910c3a5ec0 100644 --- a/gcc/config/mcore/mcore-protos.h +++ b/gcc/config/mcore/mcore-protos.h @@ -49,8 +49,8 @@ extern rtx mcore_function_value PARAMS ((tree, tree)); #ifdef RTX_CODE -extern rtx arch_compare_op0; -extern rtx arch_compare_op1; +extern GTY(()) rtx arch_compare_op0; +extern GTY(()) rtx arch_compare_op1; extern const char * mcore_output_bclri PARAMS ((rtx, int)); extern const char * mcore_output_bseti PARAMS ((rtx, int)); diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 7276d813e27..baf0a93f01f 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -125,7 +125,6 @@ static cond_type is_cond_candidate PARAMS ((rtx)); static rtx emit_new_cond_insn PARAMS ((rtx, int)); static rtx conditionalize_block PARAMS ((rtx)); static void conditionalize_optimization PARAMS ((rtx)); -static void mcore_add_gc_roots PARAMS ((void)); static rtx handle_structs_in_regs PARAMS ((enum machine_mode, tree, int)); static void mcore_mark_dllexport PARAMS ((tree)); static void mcore_mark_dllimport PARAMS ((tree)); @@ -3069,15 +3068,6 @@ mcore_is_same_reg (x, y) return 0; } -/* Called to register all of our global variables with the garbage - collector. */ -static void -mcore_add_gc_roots () -{ - ggc_add_rtx_root (&arch_compare_op0, 1); - ggc_add_rtx_root (&arch_compare_op1, 1); -} - void mcore_override_options () { @@ -3096,8 +3086,6 @@ mcore_override_options () /* Only the m340 supports little endian code. */ if (TARGET_LITTLE_END && ! TARGET_M340) target_flags |= M340_BIT; - - mcore_add_gc_roots (); } int diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 9bcca17dcd3..1f6f71e42ef 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -124,7 +124,6 @@ static rtx mips_find_symbol PARAMS ((rtx)); static void abort_with_insn PARAMS ((rtx, const char *)) ATTRIBUTE_NORETURN; static int symbolic_expression_p PARAMS ((rtx)); -static void mips_add_gc_roots PARAMS ((void)); static bool mips_assemble_integer PARAMS ((rtx, unsigned int, int)); static void mips_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void mips_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); @@ -143,9 +142,7 @@ static int iris6_section_align_1 PARAMS ((void **, void *)); static int mips_adjust_cost PARAMS ((rtx, rtx, rtx, int)); static int mips_issue_rate PARAMS ((void)); -static void mips_init_machine_status PARAMS ((struct function *)); -static void mips_free_machine_status PARAMS ((struct function *)); -static void mips_mark_machine_status PARAMS ((struct function *)); +static struct machine_function * mips_init_machine_status PARAMS ((void)); static void mips_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)) ATTRIBUTE_UNUSED; static void mips_unique_section PARAMS ((tree, int)) @@ -154,7 +151,7 @@ static void mips_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); static void mips_encode_section_info PARAMS ((tree, int)); -struct machine_function { +struct machine_function GTY(()) { /* Pseudo-reg holding the address of the current function when generating embedded PIC code. Created by LEGITIMIZE_ADDRESS, used by mips_finalize_pic if it was created. */ @@ -5435,44 +5432,16 @@ override_options () align_functions = 8; } - /* Register global variables with the garbage collector. */ - mips_add_gc_roots (); - - /* Functions to allocate, mark and deallocate machine-dependent - function status. */ + /* Function to allocate machine-dependent function status. */ init_machine_status = &mips_init_machine_status; - free_machine_status = &mips_free_machine_status; - mark_machine_status = &mips_mark_machine_status; } /* Allocate a chunk of memory for per-function machine-dependent data. */ -static void -mips_init_machine_status (fn) - struct function *fn; -{ - fn->machine = ((struct machine_function *) - xcalloc (1, sizeof (struct machine_function))); -} - -/* Release the chunk of memory for per-function machine-dependent data. */ -static void -mips_free_machine_status (fn) - struct function *fn; -{ - free (fn->machine); - fn->machine = NULL; -} - -/* Mark per-function machine-dependent data. */ -static void -mips_mark_machine_status (fn) - struct function *fn; +static struct machine_function * +mips_init_machine_status () { - if (fn->machine) - { - ggc_mark_rtx (fn->machine->embedded_pic_fnaddr_rtx); - ggc_mark_rtx (fn->machine->mips16_gp_pseudo_rtx); - } + return ((struct machine_function *) + ggc_alloc_cleared (sizeof (struct machine_function))); } /* On the mips16, we want to allocate $24 (T_REG) before other @@ -10128,19 +10097,6 @@ mips_output_conditional_branch (insn, return 0; } -/* Called to register all of our global variables with the garbage - collector. */ - -static void -mips_add_gc_roots () -{ - ggc_add_rtx_root (&mips_load_reg, 1); - ggc_add_rtx_root (&mips_load_reg2, 1); - ggc_add_rtx_root (&mips_load_reg3, 1); - ggc_add_rtx_root (&mips_load_reg4, 1); - ggc_add_rtx_root (branch_cmp, ARRAY_SIZE (branch_cmp)); -} - static enum processor_type mips_parse_cpu (cpu_string) const char *cpu_string; @@ -10547,3 +10503,5 @@ iris6_asm_file_end (stream) mips_asm_file_end (stream); } #endif /* TARGET_IRIX6 */ + +#include "gt-mips.h" diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 2a740684af2..b17c2a0494d 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -137,7 +137,7 @@ extern int set_noat; /* # of nested .set noat's */ extern int set_volatile; /* # of nested .set volatile's */ extern int mips_branch_likely; /* emit 'l' after br (branch likely) */ extern int mips_dbx_regno[]; /* Map register # to debug register # */ -extern struct rtx_def *branch_cmp[2]; /* operands for compare */ +extern GTY(()) rtx branch_cmp[2]; /* operands for compare */ extern enum cmp_type branch_type; /* what type of branch to use */ extern enum processor_type mips_arch; /* which cpu to codegen for */ extern enum processor_type mips_tune; /* which cpu to schedule for */ @@ -162,10 +162,10 @@ extern int dslots_jump_total; /* total # jump related delay slots */ extern int dslots_jump_filled; /* # filled jump delay slots */ extern int dslots_number_nops; /* # of nops needed by previous insn */ extern int num_refs[3]; /* # 1/2/3 word references */ -extern struct rtx_def *mips_load_reg; /* register to check for load delay */ -extern struct rtx_def *mips_load_reg2; /* 2nd reg to check for load delay */ -extern struct rtx_def *mips_load_reg3; /* 3rd reg to check for load delay */ -extern struct rtx_def *mips_load_reg4; /* 4th reg to check for load delay */ +extern GTY(()) rtx mips_load_reg; /* register to check for load delay */ +extern GTY(()) rtx mips_load_reg2; /* 2nd reg to check for load delay */ +extern GTY(()) rtx mips_load_reg3; /* 3rd reg to check for load delay */ +extern GTY(()) rtx mips_load_reg4; /* 4th reg to check for load delay */ extern int mips_string_length; /* length of strings for mips16 */ /* Functions to change what output section we are using. */ @@ -2790,7 +2790,7 @@ typedef struct mips_args { the shift patterns, and function_arg, which returns them when given a VOIDmode argument. */ unsigned int num_adjusts; - struct rtx_def *adjust[MAX_ARGS_IN_REGISTERS]; + rtx adjust[MAX_ARGS_IN_REGISTERS]; } CUMULATIVE_ARGS; /* Initialize a variable CUM of type CUMULATIVE_ARGS diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 234d84e0d05..d85b8437674 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -98,6 +98,7 @@ static void mmix_output_condition PARAMS ((FILE *, rtx, int)); static HOST_WIDEST_INT mmix_intval PARAMS ((rtx)); static void mmix_output_octa PARAMS ((FILE *, HOST_WIDEST_INT, int)); static bool mmix_assemble_integer PARAMS ((rtx, unsigned int, int)); +static struct machine_function * mmix_init_machine_status PARAMS ((void)); static void mmix_init_machine_status PARAMS ((struct function *)); static void mmix_encode_section_info PARAMS ((tree, int)); static const char *mmix_strip_name_encoding PARAMS ((const char *)); @@ -155,11 +156,6 @@ mmix_override_options () warning ("-f%s not supported: ignored", (flag_pic > 1) ? "PIC" : "pic"); flag_pic = 0; } - - /* All other targets add GC roots from their override_options function, - so play along. */ - ggc_add_rtx_root (&mmix_compare_op0, 1); - ggc_add_rtx_root (&mmix_compare_op1, 1); } /* INIT_EXPANDERS. */ @@ -172,11 +168,10 @@ mmix_init_expanders () /* Set the per-function data. */ -static void -mmix_init_machine_status (f) - struct function *f; +static struct machine_function * +mmix_init_machine_status () { - f->machine = xcalloc (1, sizeof (struct machine_function)); + return ggc_alloc_cleared (sizeof (struct machine_function)); } /* DATA_ALIGNMENT. diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 0f9d5b71698..d553aea418c 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -82,13 +82,13 @@ Boston, MA 02111-1307, USA. */ /* Declarations for helper variables that are not tied to a particular target macro. */ -extern struct rtx_def *mmix_compare_op0; -extern struct rtx_def *mmix_compare_op1; +extern GTY(()) rtx mmix_compare_op0; +extern GTY(()) rtx mmix_compare_op1; /* Per-function machine data. This is normally an opaque type just defined and used in the tm.c file, but we need to see the definition in mmix.md too. */ -struct machine_function +struct machine_function GTY(()) { int has_landing_pad; int highest_saved_stack_register; diff --git a/gcc/config/mn10200/mn10200.c b/gcc/config/mn10200/mn10200.c index 4fa4c2e1fb4..4dd1a01b393 100644 --- a/gcc/config/mn10200/mn10200.c +++ b/gcc/config/mn10200/mn10200.c @@ -85,8 +85,6 @@ asm_file_start (file) else fprintf (file, "\n\n"); output_file_directive (file, main_input_filename); - ggc_add_rtx_root (&zero_dreg, 1); - ggc_add_rtx_root (&zero_areg, 1); } /* Print operand X using operand code CODE to assembly language output file diff --git a/gcc/config/mn10200/mn10200.h b/gcc/config/mn10200/mn10200.h index 16f5f829d1f..bc9606e7129 100644 --- a/gcc/config/mn10200/mn10200.h +++ b/gcc/config/mn10200/mn10200.h @@ -983,5 +983,5 @@ struct cum_arg { int nbytes; }; SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM }}, \ {"nshift_operator", { ASHIFTRT, LSHIFTRT, ASHIFT }}, -extern struct rtx_def *zero_dreg; -extern struct rtx_def *zero_areg; +extern GTY(()) rtx zero_dreg; +extern GTY(()) rtx zero_areg; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 46d6846f770..258972534b5 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -100,8 +100,6 @@ static void pa_combine_instructions PARAMS ((rtx)); static int pa_can_combine_p PARAMS ((rtx, rtx, rtx, int, rtx, rtx, rtx)); static int forward_branch_p PARAMS ((rtx)); static int shadd_constant_p PARAMS ((int)); -static void pa_add_gc_roots PARAMS ((void)); -static void mark_deferred_plabels PARAMS ((void *)); static void compute_zdepwi_operands PARAMS ((unsigned HOST_WIDE_INT, unsigned *)); static int compute_movstrsi_length PARAMS ((rtx)); static bool pa_assemble_integer PARAMS ((rtx, unsigned int, int)); @@ -151,12 +149,14 @@ unsigned int total_code_bytes; /* Variables to handle plabels that we discover are necessary at assembly output time. They are output after the current function. */ -struct deferred_plabel +struct deferred_plabel GTY(()) { rtx internal_label; char *name; -} *deferred_plabels = 0; -int n_deferred_plabels = 0; +}; +static GTY((length ("n_deferred_plabels"))) struct deferred_plabel * + deferred_plabels; +static int n_deferred_plabels = 0; /* Initialize the GCC target structure. */ @@ -301,9 +301,6 @@ override_options () targetm.asm_out.unaligned_op.si = NULL; targetm.asm_out.unaligned_op.di = NULL; } - - /* Register global variables with the garbage collector. */ - pa_add_gc_roots (); } /* Return non-zero only if OP is a register of mode MODE, @@ -6277,10 +6274,10 @@ output_call (insn, call_dest, sibcall) if (deferred_plabels == 0) deferred_plabels = (struct deferred_plabel *) - xmalloc (1 * sizeof (struct deferred_plabel)); + ggc_alloc (sizeof (struct deferred_plabel)); else deferred_plabels = (struct deferred_plabel *) - xrealloc (deferred_plabels, + ggc_realloc (deferred_plabels, ((n_deferred_plabels + 1) * sizeof (struct deferred_plabel))); @@ -7666,31 +7663,6 @@ cmpib_comparison_operator (op, mode) || GET_CODE (op) == LEU)); } -/* Mark ARG (which is really a struct deferred_plabel **) for GC. */ - -static void -mark_deferred_plabels (arg) - void *arg; -{ - struct deferred_plabel *dp = *(struct deferred_plabel **) arg; - int i; - - for (i = 0; i < n_deferred_plabels; ++i) - ggc_mark_rtx (dp[i].internal_label); -} - -/* Called to register all of our global variables with the garbage - collector. */ - -static void -pa_add_gc_roots () -{ - ggc_add_rtx_root (&hppa_compare_op0, 1); - ggc_add_rtx_root (&hppa_compare_op1, 1); - ggc_add_root (&deferred_plabels, 1, sizeof (&deferred_plabels), - &mark_deferred_plabels); -} - /* On hpux10, the linker will give an error if we have a reference in the read-only data section to a symbol defined in a shared library. Therefore, expressions that might require a reloc can @@ -7717,3 +7689,5 @@ pa_select_section (exp, reloc, align) else data_section (); } + +#include "gt-pa.h" diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index c2a6f584e1b..9dd93f4a0c1 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -865,7 +865,8 @@ struct hppa_args {int words, nargs_prototype, indirect; }; || ((MODE) && GET_MODE_SIZE (MODE) > 8))) -extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1; +extern GTY(()) rtx hppa_compare_op0; +extern GTY(()) rtx hppa_compare_op1; extern enum cmp_type hppa_branch_type; #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 17fdd3398dd..a645695ca10 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -147,8 +147,7 @@ static int toc_hash_eq PARAMS ((const void *, const void *)); static int toc_hash_mark_entry PARAMS ((void **, void *)); static void toc_hash_mark_table PARAMS ((void *)); static int constant_pool_expr_1 PARAMS ((rtx, int *, int *)); -static void rs6000_free_machine_status PARAMS ((struct function *)); -static void rs6000_init_machine_status PARAMS ((struct function *)); +static struct machine_function * rs6000_init_machine_status PARAMS ((void)); static bool rs6000_assemble_integer PARAMS ((rtx, unsigned int, int)); static int rs6000_ra_ever_killed PARAMS ((void)); static tree rs6000_handle_longcall_attribute PARAMS ((tree *, tree, tree, int, bool *)); @@ -631,7 +630,6 @@ rs6000_override_options (default_cpu) /* Arrange to save and restore machine status around nested functions. */ init_machine_status = rs6000_init_machine_status; - free_machine_status = rs6000_free_machine_status; } /* Handle -mvrsave= options. */ @@ -6268,28 +6266,15 @@ rs6000_got_register (value) return pic_offset_table_rtx; } -/* Functions to init, mark and free struct machine_function. - These will be called, via pointer variables, - from push_function_context and pop_function_context. */ +/* Function to init struct machine_function. + This will be called, via a pointer variable, + from push_function_context. */ -static void -rs6000_init_machine_status (p) - struct function *p; -{ - p->machine = (machine_function *) xcalloc (1, sizeof (machine_function)); -} - -static void -rs6000_free_machine_status (p) - struct function *p; +static struct machine_function * +rs6000_init_machine_status () { - if (p->machine == NULL) - return; - - free (p->machine); - p->machine = NULL; + return ggc_alloc_cleared (sizeof (machine_function)); } - /* Print an operand. Recognize special options, documented below. */ @@ -11254,16 +11239,9 @@ rs6000_fatal_bad_address (op) static void rs6000_add_gc_roots () { - ggc_add_rtx_root (&rs6000_compare_op0, 1); - ggc_add_rtx_root (&rs6000_compare_op1, 1); - toc_hash_table = htab_create (1021, toc_hash_function, toc_hash_eq, NULL); ggc_add_root (&toc_hash_table, 1, sizeof (toc_hash_table), toc_hash_mark_table); - -#if TARGET_MACHO - machopic_add_gc_roots (); -#endif } #if TARGET_MACHO diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 11ccee22218..d9e0adec23e 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1559,7 +1559,7 @@ typedef struct rs6000_stack { /* A C structure for machine-specific, per-function data. This is added to the cfun structure. */ -typedef struct machine_function +typedef struct machine_function GTY(()) { /* Whether a System V.4 varargs area was created. */ int sysv_varargs_p; @@ -2400,7 +2400,8 @@ do { \ stored from the compare operation. Note that we can't use "rtx" here since it hasn't been defined! */ -extern struct rtx_def *rs6000_compare_op0, *rs6000_compare_op1; +extern GTY(()) rtx rs6000_compare_op0; +extern GTY(()) rtx rs6000_compare_op1; extern int rs6000_compare_fp_p; /* Control the assembler format that we output. */ diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin index 5839efa0cd2..16295788a73 100644 --- a/gcc/config/rs6000/t-darwin +++ b/gcc/config/rs6000/t-darwin @@ -16,13 +16,15 @@ fp-bit.c: $(srcdir)/config/fp-bit.c darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) $(RTL_BASE_H) \ $(REGS_H) hard-reg-set.h insn-config.h conditions.h output.h \ insn-attr.h flags.h $(TREE_H) $(EXPR_H) reload.h \ - function.h $(GGC_H) $(TM_P_H) + function.h $(GGC_H) $(TM_P_H) gt-darwin.h $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(C_TREE_H) c-pragma.h toplev.h cpplib.h $(TM_P_H) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< +gt-darwin.h : s-gtype ; @true + # Build the libraries for both hard and soft floating point MULTILIB_OPTIONS = msoft-float diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 3bbeb38fb44..7656151f280 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -6230,16 +6230,14 @@ reg_unused_after (reg, insn) #include "ggc.h" +static GTY(()) rtx fpscr_rtx; rtx get_fpscr_rtx () { - static rtx fpscr_rtx; - if (! fpscr_rtx) { fpscr_rtx = gen_rtx (REG, PSImode, FPSCR_REG); REG_USERVAR_P (fpscr_rtx) = 1; - ggc_add_rtx_root (&fpscr_rtx, 1); mark_user_reg (fpscr_rtx); } if (! reload_completed || mdep_reorg_phase != SH_AFTER_MDEP_REORG) @@ -6819,3 +6817,5 @@ sh_strip_name_encoding (str) str += *str == '*'; return str; } + +#include "gt-sh.h" diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh index 8d5c0728254..79528dd7d18 100644 --- a/gcc/config/sh/t-sh +++ b/gcc/config/sh/t-sh @@ -44,5 +44,8 @@ $(T)crti.o: $(srcdir)/config/sh/crti.asm $(GCC_PASSES) $(T)crtn.o: $(srcdir)/config/sh/crtn.asm $(GCC_PASSES) $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/sh/crtn.asm +$(out_object_file): gt-sh.h +gt-sh.h : s-gtype ; @true + # These are not suitable for COFF. # EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index a43f48bd0f9..b9745c7c529 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -140,7 +140,6 @@ static int hypersparc_adjust_cost PARAMS ((rtx, rtx, rtx, int)); static void sparc_output_addr_vec PARAMS ((rtx)); static void sparc_output_addr_diff_vec PARAMS ((rtx)); static void sparc_output_deferred_case_vectors PARAMS ((void)); -static void sparc_add_gc_roots PARAMS ((void)); static int check_return_regs PARAMS ((rtx)); static int epilogue_renumber PARAMS ((rtx *, int)); static bool sparc_assemble_integer PARAMS ((rtx, unsigned int, int)); @@ -438,9 +437,6 @@ sparc_override_options () /* Do various machine dependent initializations. */ sparc_init_modes (); - - /* Register global variables with the garbage collector. */ - sparc_add_gc_roots (); } /* Miscellaneous utilities. */ @@ -3114,10 +3110,10 @@ reg_unused_after (reg, insn) } /* The table we use to reference PIC data. */ -static rtx global_offset_table; +static GTY(()) rtx global_offset_table; /* The function we use to get at it. */ -static rtx get_pc_symbol; +static GTY(()) rtx get_pc_symbol; static char get_pc_symbol_name[256]; /* Ensure that we are not using patterns that are not OK with PIC. */ @@ -7786,8 +7782,8 @@ set_extends (insn) } /* We _ought_ to have only one kind per function, but... */ -static rtx sparc_addr_diff_list; -static rtx sparc_addr_list; +static GTY(()) rtx sparc_addr_diff_list; +static GTY(()) rtx sparc_addr_list; void sparc_defer_case_vector (lab, vec, diff) @@ -7997,20 +7993,6 @@ sparc_profile_hook (labelno) emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode); } -/* Called to register all of our global variables with the garbage - collector. */ - -static void -sparc_add_gc_roots () -{ - ggc_add_rtx_root (&sparc_compare_op0, 1); - ggc_add_rtx_root (&sparc_compare_op1, 1); - ggc_add_rtx_root (&global_offset_table, 1); - ggc_add_rtx_root (&get_pc_symbol, 1); - ggc_add_rtx_root (&sparc_addr_diff_list, 1); - ggc_add_rtx_root (&sparc_addr_list, 1); -} - #ifdef OBJECT_FORMAT_ELF static void sparc_elf_asm_named_section (name, flags) @@ -8530,3 +8512,5 @@ sparc_output_mi_thunk (file, thunk_fndecl, delta, function) reload_completed = 0; no_new_pseudos = 0; } + +#include "gt-sparc.h" diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 12490d38a42..333a5d56f16 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -1809,7 +1809,8 @@ function_arg_padding ((MODE), (TYPE)) stored from the compare operation. Note that we can't use "rtx" here since it hasn't been defined! */ -extern struct rtx_def *sparc_compare_op0, *sparc_compare_op1; +extern GTY(()) rtx sparc_compare_op0; +extern GTY(()) rtx sparc_compare_op1; /* Generate the special assembly code needed to tell the assembler whatever diff --git a/gcc/config/xtensa/t-xtensa b/gcc/config/xtensa/t-xtensa index 83a5ee71bb5..c29fff075c4 100644 --- a/gcc/config/xtensa/t-xtensa +++ b/gcc/config/xtensa/t-xtensa @@ -27,3 +27,6 @@ LIB1ASMFUNCS = _mulsi3 _nsau _divsi3 _modsi3 _udivsi3 _umodsi3 TARGET_LIBGCC2_CFLAGS += -mlongcalls LIB2FUNCS_EXTRA += $(srcdir)/config/xtensa/lib2funcs.S + +$(out_object_file): gt-xtensa.h +gt-xtensa.h : s-gtype ; @true diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 1fc5302b83c..6e6c6d9a3e3 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -85,7 +85,7 @@ const char *xtensa_st_opcodes[(int) MAX_MACHINE_MODE]; #define LARGEST_MOVE_RATIO 15 /* Define the structure for the machine field in struct function. */ -struct machine_function +struct machine_function GTY(()) { int accesses_prev_frame; }; @@ -193,8 +193,7 @@ static rtx gen_float_relational PARAMS ((enum rtx_code, rtx, rtx)); static rtx gen_conditional_move PARAMS ((rtx)); static rtx fixup_subreg_mem PARAMS ((rtx x)); static enum machine_mode xtensa_find_mode_for_size PARAMS ((unsigned)); -static void xtensa_init_machine_status PARAMS ((struct function *p)); -static void xtensa_free_machine_status PARAMS ((struct function *p)); +static struct machine_status * xtensa_init_machine_status PARAMS ((void)); static void printx PARAMS ((FILE *, signed int)); static void xtensa_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); @@ -1549,21 +1548,10 @@ xtensa_expand_nonlocal_goto (operands) } -static void -xtensa_init_machine_status (p) - struct function *p; +static struct machine_function * +xtensa_init_machine_status () { - p->machine = (struct machine_function *) - xcalloc (1, sizeof (struct machine_function)); -} - - -static void -xtensa_free_machine_status (p) - struct function *p; -{ - free (p->machine); - p->machine = NULL; + return ggc_alloc_cleared (sizeof (struct machine_function)); } @@ -1846,7 +1834,6 @@ override_options () } init_machine_status = xtensa_init_machine_status; - free_machine_status = xtensa_free_machine_status; /* Check PIC settings. There's no need for -fPIC on Xtensa and some targets need to always use PIC. */ @@ -2759,3 +2746,5 @@ xtensa_encode_section_info (decl, first) if (TREE_CODE (decl) == FUNCTION_DECL && ! TREE_PUBLIC (decl)) SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; } + +#include "gt-xtensa.h" |