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]
Other format: [Raw text]

[PCH] remove ggc_add_tree_root, ggc_add_rtx_root



This nearly completes the switchover to gengtype for tacking roots.
There are still a few instances of ggc_add_root, for some
non-GCable structures that hold GCable pointers; those will be a
project for later.

Bootstrapped & tested on i686-pc-linux-gnu with gcac checking;
tested on powerpc-eabisim with gcac checking;
bootstrapped on sparc-sun-solaris2.6 (and it got further than the
branchpoint, which doesn't bootstrap).

I know that ada is broken with the last few patches.  That'll be work
for later.

-- 
Geoff Keating <geoffk@redhat.com>

===File ~/patches/pchbranch-machroot.patch==================
Index: ChangeLog
2002-04-09  Geoffrey Keating  <geoffk@redhat.com>

	* Makefile.in (cselib.o): Include gt-<filename>.h.
	(gcse.o): Likewise.
	(profile.o): Likewise.
	(alias.o): Likewise.
	(GTFILES): Add alias.c, cselib.c, gcse.c, profile.c, and
	alphabetize backend files.
	(gt-alias.h, gt-cselib.h, gt-gcse.h, gt-profile.h): New rules.
	* alias.c: Use gengtype for roots.
	* c-common.h (struct stmt_tree_s): Use gengtype.
	* c-decl.c: Use gengtype for roots.
	* cselib.c: Use gengtype for roots.
	* expr.c: Use gengtype for roots.
	* fold-const.c: Use gengtype for roots.
	* gcse.c: Use gengtype for roots.
	* gengtype-lex.l: Handle typedefs of function types.
	Allow for empty array bounds.
	Allow processing to stop on initialisers.
	* gengtype-yacc.y (externstatic): Stop processing on initialisers.
	(semiequal): New rule.
	* gengtype.c (create_file): Tidy output files.
	(get_output_file_with_visibility): Fix paren warning.  Fix bug
	involving multiple input files mapping to one output file.
	(write_gc_structure_fields): Skip arrays of scalars.
	(write_gc_types): Tidy output files.
	(write_gc_root): New function.
	(write_gc_roots): Fix bugs, add support for roots that are
	structures.
	* ggc-common.c (ggc_mark_rtx_ptr): Delete.
	(ggc_mark_tree_ptr): Delete.
	(ggc_add_rtx_root): Delete.
	(ggc_add_tree_root): Delete.
	(ggc_del_root): Delete.
	* integrate.c (get_func_hard_reg_initial_val): Use ggc_alloc to
	allocate struct initial_value_struct.
	* profile.c: Use gengtype for roots.
	* sdbout.c: Use gengtype for roots.
	* varasm.c (mark_weak_decls): Delete unused prototype.
	(mark_const_hash_entry): Delete unused function.
	* config/darwin-protos.h: Use gengtype for roots.
	(machopic_add_gc_roots): Delete.
	* config/arm/arm.c: Use gengtype for roots.
	* config/arm/arm.h: Use gengtype for roots.
	* config/c4x/c4x-protos.h: Use gengtype for roots.
	* config/c4x/c4x.c (c4x_add_gc_roots): Delete.
	* config/d30v/d30v-protos.h: Use gengtype for roots.
	* config/d30v/d30v.c (d30v_add_gc_roots): Delete.
	* config/dsp16xx/dsp16xx.c (override_options): Use gengtype for roots.
	* config/dsp16xx/dsp16xx.h: Use gengtype for roots.
	* config/ia64/ia64-protos.h: Use gengtype for roots.
	* config/ia64/ia64.c (ia64_add_gc_roots): Delete.
	* config/m68hc11/m68hc11-protos.h: Use gengtype for roots.
	* config/m68hc11/m68hc11.c (z_reg): Make global.
	(z_reg_qi): Make global.
	(m68hc11_add_gc_roots): Delete.
	* config/mcore/mcore-protos.h: Use gengtype for roots.
	* config/mcore/mcore.c (mcore_add_gc_roots): Delete.
	* config/mips/mips.c (mips_add_gc_roots): Delete.
	* config/mips/mips.h: Use gengtype for roots.
	* config/mmix/mmix.c (override_options): Use gengtype for roots.
	* config/mmix/mmix.h: Use gengtype for roots.
	* config/mn10200/mn10200.c (asm_file_start): Use gengtype for roots.
	* config/mn10200/mn10200.h: Use gengtype for roots.
	* config/pa/pa.c: Use gengtype for roots, marking.
	(struct deferred_plabel): Use GGC, gengtype.
	(pa_add_gc_roots): Delete.
	(mark_deferred_plabels): Delete.
	* config/pj/pj-protos.h: Use gengtype for roots.
	* config/pj/pj.h (OVERRIDE_OPTIONS): Don't define.
	* config/rs6000/rs6000.c: Use gengtype for roots.  Don't call
	machopic_add_gc_roots.
	* config/rs6000/rs6000.h: Use gengtype for roots.
	* config/rs6000/t-darwin (darwin.o): Add dependency on gt-darwin.h.
	(gt-darwin.h): Add rule.
	* config/sh/sh.c: Use gengtype for roots.
	* config/sh/t-sh ($(out_object_file)): Add dependency on gt-sh.h.
	(gt-sh.h): Add rule.
	* config/sparc/sparc.c: Use gengtype for roots.
	(sparc_add_gc_roots): Delete.
	(struct ultrasparc_pipeline_state): Use GGC, gengtype.
	(mark_ultrasparc_pipeline_state): Delete.
	* config/sparc/sparc.h: Use gengtype for roots.

Index: ada/ChangeLog
2002-04-09  Geoffrey Keating  <geoffk@redhat.com>

	* Makefile.in (decl.o): Include gt-ada-<filename>.h.
	(misc.o): Likewise.
	(utils.o): Include gt-ada-<filename>.h and gtype-ada.h.
	* config-lang.in (gtfiles): New.
	* decl.c: Use gengtype for roots.
	* gigi.h: Use gengtype for roots.
	* trans.c: Use gengtype for roots.
	* utils.c: Use gengtype for roots, marking.  Include gtype-ada.h.

Index: cp/ChangeLog
2002-04-09  Geoffrey Keating  <geoffk@redhat.com>

	* Make-lang.in (gt-cp-call.h gt-cp-decl2.h gt-cp-parse.h
	gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h): New rules.
	(cp/spew.o): Add dependency on gt-<filename>.h.
	(cp/decl2.o): Add dependency on gt-<filename>.h.
	(cp/call.o): Add dependency on gt-<filename>.h.
	(cp/pt.o): Add dependency on gt-<filename>.h.
	(cp/repo.o): Add dependency on gt-<filename>.h.
	(cp/parse.o): Add dependency on gt-<filename>.h.
	* call.c: Use gengtype for roots.
	* config-lang.in (gtfiles): Add cp-tree.h decl.h lex.h call.c
	decl2.c parse.y pt.c repo.c spew.c.
	* cp-tree.h: Use gengtype for roots.
	(struct saved_scope): Use GGC, gengtype.
	(cp_parse_init): Delete prototype.
	(init_pt): Delete prototype.
	* decl.c: Use gengtype for roots.
	(mark_saved_scope): Delete.
	(cxx_init_decl_processing): Don't call deleted initilisation
	routines.
	(signed_size_zero_node): Delete, unused.
	* decl.h: Use gengtype for roots.
	* decl2.c: Use gengtype for roots.
	* lex.h: Use gengtype for roots.
	* parse.y: Use gengtype for roots.
	(cp_parse_init): Delete.
	* pt.c: Use gengtype for roots.
	(init_pt): Delete.
	* repo.c: Use gengtype for roots.
	* spew.c: Use gengtype for roots.

Index: java/ChangeLog
2002-04-09  Geoffrey Keating  <geoffk@redhat.com>

	* Make-lang.in (gt-java-builtins.h): New rule.
	(java/builtins.o): Add dependency on gt-<filename>.h.
	* builtins.c: Use gengtype for roots.
	(union string_or_tree): Use gengtype.
	(struct builtin_record): Use gengtype.
	* config-lang.in (gtfiles): Add builtins.c.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.822.2.10
diff -p -u -p -r1.822.2.10 Makefile.in
--- Makefile.in	6 Apr 2002 00:08:43 -0000	1.822.2.10
+++ Makefile.in	9 Apr 2002 19:40:35 -0000
@@ -1456,13 +1456,13 @@ simplify-rtx.o : simplify-rtx.c $(CONFIG
    output.h function.h $(GGC_H) $(OBSTACK_H) $(TM_P_H)
 cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) \
    hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
-   output.h function.h cselib.h $(GGC_H) $(OBSTACK_H) $(TM_P_H)
+   output.h function.h cselib.h $(GGC_H) $(OBSTACK_H) $(TM_P_H) gt-cselib.h
 cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
    real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h function.h \
    $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H)
 gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) hard-reg-set.h \
    flags.h real.h insn-config.h ggc.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) \
-   function.h output.h toplev.h $(TM_P_H) $(PARAMS_H)
+   function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) gt-gcse.h
 sibcall.o : sibcall.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) function.h \
    hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H)
 resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) \
@@ -1486,7 +1486,8 @@ conflict.o : conflict.c $(CONFIG_H) $(SY
    $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H)
 profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \
-   gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H)
+   gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H) \
+   gt-profile.h
 loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) \
    insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
    real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h \
@@ -1549,7 +1550,7 @@ reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H
    $(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h $(PARAMS_H) $(TM_P_H)
 alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h hard-reg-set.h \
    $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) \
-   $(GGC_H) function.h cselib.h $(TREE_H) $(TM_P_H) langhooks.h
+   $(GGC_H) function.h cselib.h $(TREE_H) $(TM_P_H) langhooks.h gt-alias.h
 regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) insn-config.h \
    $(RECOG_H) output.h $(REGS_H) hard-reg-set.h flags.h function.h \
    $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) except.h reload.h
@@ -1781,10 +1782,13 @@ GTFILES = $(GCONFIG_H) \
   $(srcdir)/function.h  $(srcdir)/rtl.h $(srcdir)/optabs.h \
   $(srcdir)/tree.h $(srcdir)/libfuncs.h \
   $(srcdir)/c-common.h $(srcdir)/c-tree.h \
-  $(srcdir)/except.c $(srcdir)/function.c $(srcdir)/integrate.c \
-  $(srcdir)/stmt.c $(srcdir)/tree.c $(srcdir)/varasm.c \
-  $(srcdir)/emit-rtl.c $(srcdir)/explow.c $(srcdir)/stor-layout.c \
-  $(srcdir)/regclass.c $(srcdir)/lists.c \
+  $(srcdir)/alias.c $(srcdir)/cselib.c $(srcdir)/emit-rtl.c \
+  $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
+  $(srcdir)/fold-const.c $(srcdir)/function.c \
+  $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c \
+  $(srcdir)/profile.c $(srcdir)/regclass.c $(srcdir)/sdbout.c \
+  $(srcdir)/stmt.c $(srcdir)/stor-layout.c $(srcdir)/tree.c \
+  $(srcdir)/varasm.c \
   $(srcdir)/c-common.c $(srcdir)/c-parse.in \
   $(out_file) \
   $(srcdir)/c-decl.c $(srcdir)/c-pragma.c \
@@ -1793,6 +1797,8 @@ GTFILES = $(GCONFIG_H) \
 gtype-desc.h gtype-desc.c gt-except.h gt-function.h : s-gtype; @true
 gt-integrate.h gt-stmt.h gt-tree.h gt-varasm.h gt-emit-rtl.h : s-gtype; @true
 gt-explow.h gt-stor-layout.h gt-regclass.h gt-lists.h : s-gtype; @true
+gt-alias.h gt-cselib.h gt-fold-const.h gt-gcse.h gt-profile.h : s-gtype; @true
+gt-expr.h gt-sdbout.h : s-gtype ; @true
 gt-c-common.h gt-c-decl.h gt-c-parse.h gt-c-pragma.h : s-gtype; @true
 gtype-c.h : s-gtype ; @true
 
Index: alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/alias.c,v
retrieving revision 1.162.2.2
diff -p -u -p -r1.162.2.2 alias.c
--- alias.c	14 Mar 2002 21:33:45 -0000	1.162.2.2
+++ alias.c	9 Apr 2002 19:40:36 -0000
@@ -145,7 +145,7 @@ static int nonlocal_mentioned_p         
    current function performs nonlocal memory memory references for the
    purposes of marking the function as a constant function.  */
 
-static rtx *reg_base_value;
+static GTY((length ("reg_base_value_size"))) rtx *reg_base_value;
 static rtx *new_reg_base_value;
 static unsigned int reg_base_value_size; /* size of reg_base_value array */
 
@@ -2457,8 +2457,8 @@ init_alias_analysis ()
      optimization.  Loop unrolling can create a large number of
      registers.  */
   reg_base_value_size = maxreg * 2;
-  reg_base_value = (rtx *) xcalloc (reg_base_value_size, sizeof (rtx));
-  ggc_add_rtx_root (reg_base_value, reg_base_value_size);
+  reg_base_value = (rtx *) ggc_alloc_cleared (reg_base_value_size
+					      * sizeof (rtx));
 
   new_reg_base_value = (rtx *) xmalloc (reg_base_value_size * sizeof (rtx));
   reg_seen = (char *) xmalloc (reg_base_value_size);
@@ -2672,12 +2672,7 @@ end_alias_analysis ()
   reg_known_value_size = 0;
   free (reg_known_equiv_p + FIRST_PSEUDO_REGISTER);
   reg_known_equiv_p = 0;
-  if (reg_base_value)
-    {
-      ggc_del_root (reg_base_value);
-      free (reg_base_value);
-      reg_base_value = 0;
-    }
+  reg_base_value = 0;
   reg_base_value_size = 0;
   if (alias_invariant)
     {
@@ -2685,3 +2680,5 @@ end_alias_analysis ()
       alias_invariant = 0;
     }
 }
+
+#include "gt-alias.h"
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.112.4.3
diff -p -u -p -r1.112.4.3 c-common.h
--- c-common.h	6 Apr 2002 00:08:43 -0000	1.112.4.3
+++ c-common.h	9 Apr 2002 19:40:36 -0000
@@ -251,7 +251,7 @@ c_language_kind;
 
 /* Information about a statement tree.  */
 
-struct stmt_tree_s {
+struct stmt_tree_s GTY(()) {
   /* The last statement added to the tree.  */
   tree x_last_stmt;
   /* The type of the last expression statement.  (This information is
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.288.2.6
diff -p -u -p -r1.288.2.6 c-decl.c
--- c-decl.c	6 Apr 2002 00:08:44 -0000	1.288.2.6
+++ c-decl.c	9 Apr 2002 19:40:37 -0000
@@ -103,7 +103,7 @@ static int current_function_prototype_li
 
 /* The current statement tree.  */
 
-static struct stmt_tree_s c_stmt_tree;
+static GTY(()) struct stmt_tree_s c_stmt_tree;
 
 /* The current scope statement stack.  */
 
@@ -2954,10 +2954,6 @@ c_init_decl_processing ()
   start_fname_decls ();
 
   incomplete_decl_finalize_hook = finish_incomplete_decl;
-
-  /* Record our roots.  */
-
-  ggc_add_root (&c_stmt_tree, 1, sizeof c_stmt_tree, mark_stmt_tree);
 }
 
 /* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the
Index: cselib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cselib.c,v
retrieving revision 1.15.6.2
diff -p -u -p -r1.15.6.2 cselib.c
--- cselib.c	14 Mar 2002 21:34:19 -0000	1.15.6.2
+++ cselib.c	9 Apr 2002 19:40:38 -0000
@@ -110,7 +110,7 @@ static varray_type used_regs;
 
 /* We pass this to cselib_invalidate_mem to invalidate all of
    memory for a non-const call instruction.  */
-static rtx callmem;
+static GTY(()) rtx callmem;
 
 /* Memory for our structures is allocated from this obstack.  */
 static struct obstack cselib_obstack;
@@ -1373,7 +1373,6 @@ cselib_init ()
       cselib_startobj = obstack_alloc (&cselib_obstack, 0);
 
       callmem = gen_rtx_MEM (BLKmode, const0_rtx);
-      ggc_add_rtx_root (&callmem, 1);
     }
 
   cselib_nregs = max_reg_num ();
@@ -1393,3 +1392,5 @@ cselib_finish ()
   VARRAY_FREE (used_regs);
   htab_delete (hash_table);
 }
+
+#include "gt-cselib.h"
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.413.2.5
diff -p -u -p -r1.413.2.5 expr.c
--- expr.c	14 Mar 2002 21:34:22 -0000	1.413.2.5
+++ expr.c	9 Apr 2002 19:40:39 -0000
@@ -1596,6 +1596,7 @@ move_by_pieces_1 (genfun, mode, data)
    Return the address of the new block, if memcpy is called and returns it,
    0 otherwise.  */
 
+static GTY(()) tree block_move_fn;
 rtx
 emit_block_move (x, y, size)
      rtx x, y;
@@ -1603,7 +1604,6 @@ emit_block_move (x, y, size)
 {
   rtx retval = 0;
 #ifdef TARGET_MEM_FUNCTIONS
-  static tree fn;
   tree call_expr, arg_list;
 #endif
   unsigned int align = MIN (MEM_ALIGN (x), MEM_ALIGN (y));
@@ -1727,23 +1727,22 @@ emit_block_move (x, y, size)
 
 	 So instead of using a libcall sequence we build up a suitable
 	 CALL_EXPR and expand the call in the normal fashion.  */
-      if (fn == NULL_TREE)
+      if (block_move_fn == NULL_TREE)
 	{
 	  tree fntype;
 
 	  /* This was copied from except.c, I don't know if all this is
 	     necessary in this context or not.  */
-	  fn = get_identifier ("memcpy");
+	  block_move_fn = get_identifier ("memcpy");
 	  fntype = build_pointer_type (void_type_node);
 	  fntype = build_function_type (fntype, NULL_TREE);
-	  fn = build_decl (FUNCTION_DECL, fn, fntype);
-	  ggc_add_tree_root (&fn, 1);
-	  DECL_EXTERNAL (fn) = 1;
-	  TREE_PUBLIC (fn) = 1;
-	  DECL_ARTIFICIAL (fn) = 1;
-	  TREE_NOTHROW (fn) = 1;
-	  make_decl_rtl (fn, NULL);
-	  assemble_external (fn);
+	  block_move_fn = build_decl (FUNCTION_DECL, block_move_fn, fntype);
+	  DECL_EXTERNAL (block_move_fn) = 1;
+	  TREE_PUBLIC (block_move_fn) = 1;
+	  DECL_ARTIFICIAL (block_move_fn) = 1;
+	  TREE_NOTHROW (block_move_fn) = 1;
+	  make_decl_rtl (block_move_fn, NULL);
+	  assemble_external (block_move_fn);
 	}
 
       /* We need to make an argument list for the function call.
@@ -1761,8 +1760,10 @@ emit_block_move (x, y, size)
       TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arg_list))) = NULL_TREE;
 
       /* Now we have to build up the CALL_EXPR itself.  */
-      call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
-      call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
+      call_expr = build1 (ADDR_EXPR, 
+			  build_pointer_type (TREE_TYPE (block_move_fn)), 
+			  block_move_fn);
+      call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (block_move_fn)),
 			 call_expr, arg_list, NULL_TREE);
       TREE_SIDE_EFFECTS (call_expr) = 1;
 
@@ -2527,13 +2528,13 @@ store_by_pieces_2 (genfun, mode, data)
 /* Write zeros through the storage of OBJECT.  If OBJECT has BLKmode, SIZE is
    its length in bytes.  */
 
+static GTY(()) tree block_clear_fn;
 rtx
 clear_storage (object, size)
      rtx object;
      rtx size;
 {
 #ifdef TARGET_MEM_FUNCTIONS
-  static tree fn;
   tree call_expr, arg_list;
 #endif
   rtx retval = 0;
@@ -2646,23 +2647,23 @@ clear_storage (object, size)
 
 	     So instead of using a libcall sequence we build up a suitable
 	     CALL_EXPR and expand the call in the normal fashion.  */
-	  if (fn == NULL_TREE)
+	  if (block_clear_fn == NULL_TREE)
 	    {
 	      tree fntype;
 
 	      /* This was copied from except.c, I don't know if all this is
 		 necessary in this context or not.  */
-	      fn = get_identifier ("memset");
+	      block_clear_fn = get_identifier ("memset");
 	      fntype = build_pointer_type (void_type_node);
 	      fntype = build_function_type (fntype, NULL_TREE);
-	      fn = build_decl (FUNCTION_DECL, fn, fntype);
-	      ggc_add_tree_root (&fn, 1);
-	      DECL_EXTERNAL (fn) = 1;
-	      TREE_PUBLIC (fn) = 1;
-	      DECL_ARTIFICIAL (fn) = 1;
-	      TREE_NOTHROW (fn) = 1;
-	      make_decl_rtl (fn, NULL);
-	      assemble_external (fn);
+	      block_clear_fn = build_decl (FUNCTION_DECL, block_clear_fn,
+					   fntype);
+	      DECL_EXTERNAL (block_clear_fn) = 1;
+	      TREE_PUBLIC (block_clear_fn) = 1;
+	      DECL_ARTIFICIAL (block_clear_fn) = 1;
+	      TREE_NOTHROW (block_clear_fn) = 1;
+	      make_decl_rtl (block_clear_fn, NULL);
+	      assemble_external (block_clear_fn);
 	    }
 
 	  /* We need to make an argument list for the function call.
@@ -2683,8 +2684,9 @@ clear_storage (object, size)
 
 	  /* Now we have to build up the CALL_EXPR itself.  */
 	  call_expr = build1 (ADDR_EXPR,
-			      build_pointer_type (TREE_TYPE (fn)), fn);
-	  call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
+			      build_pointer_type (TREE_TYPE (block_clear_fn)),
+			      block_clear_fn);
+	  call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (block_clear_fn)),
 			     call_expr, arg_list, NULL_TREE);
 	  TREE_SIDE_EFFECTS (call_expr) = 1;
 
@@ -10498,3 +10500,5 @@ try_tablejump (index_type, index_expr, m
 		table_label, default_label);
   return 1;
 }
+
+#include "gt-expr.h"
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.181.4.2
diff -p -u -p -r1.181.4.2 fold-const.c
--- fold-const.c	14 Mar 2002 21:34:30 -0000	1.181.4.2
+++ fold-const.c	9 Apr 2002 19:40:40 -0000
@@ -1410,13 +1410,13 @@ size_int_wide (number, kind)
 
 /* Likewise, but the desired type is specified explicitly.  */
 
+static GTY(()) tree new_const;
+static htab_t size_htab;
 tree
 size_int_type_wide (number, type)
      HOST_WIDE_INT number;
      tree type;
 {
-  static htab_t size_htab = 0;
-  static tree new_const = 0;
   PTR *slot;
 
   if (size_htab == 0)
@@ -1424,7 +1424,6 @@ size_int_type_wide (number, type)
       size_htab = htab_create (1024, size_htab_hash, size_htab_eq, NULL);
       ggc_add_deletable_htab (size_htab, NULL, NULL);
       new_const = make_node (INTEGER_CST);
-      ggc_add_tree_root (&new_const, 1);
     }
 
   /* Adjust NEW_CONST to be the constant we want.  If it's already in the
@@ -7121,3 +7120,5 @@ rtl_expr_nonnegative_p (r)
       return 0;
     }
 }
+
+#include "gt-fold-const.h"
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.176.2.1
diff -p -u -p -r1.176.2.1 gcse.c
--- gcse.c	14 Mar 2002 21:34:34 -0000	1.176.2.1
+++ gcse.c	9 Apr 2002 19:40:41 -0000
@@ -1301,11 +1301,11 @@ static int current_bb;
 /* See whether X, the source of a set, is something we want to consider for
    GCSE.  */
 
+static GTY(()) rtx test_insn;
 static int
 want_to_gcse_p (x)
      rtx x;
 {
-  static rtx test_insn = 0;
   int num_clobbers = 0;
   int icode;
 
@@ -1339,7 +1339,6 @@ want_to_gcse_p (x)
 						   FIRST_PSEUDO_REGISTER * 2),
 				      const0_rtx));
       NEXT_INSN (test_insn) = PREV_INSN (test_insn) = 0;
-      ggc_add_rtx_root (&test_insn, 1);
     }
 
   /* Now make an insn like the one we would make when GCSE'ing and see if
@@ -6977,3 +6976,5 @@ store_motion ()
   remove_fake_edges ();
   end_alias_analysis ();
 }
+
+#include "gt-gcse.h"
Index: gengtype-lex.l
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gengtype-lex.l,v
retrieving revision 1.1.2.2
diff -p -u -p -r1.1.2.2 gengtype-lex.l
--- gengtype-lex.l	13 Mar 2002 18:31:59 -0000	1.1.2.2
+++ gengtype-lex.l	9 Apr 2002 19:40:41 -0000
@@ -115,6 +115,22 @@ ITYPE	{IWORD}({WS}{IWORD})*
   update_lineno (yytext, yyleng);
 }
 
+[^[:alnum:]_]typedef{WS}{ID}{WS}{ID}{WS}PARAMS {
+  char *namestart;
+  size_t namelen;
+  struct type *t;
+
+  for (namestart = yytext + yyleng - 7; isspace (*namestart); namestart--)
+    ;
+  for (namelen = 1; !isspace (namestart[-namelen]); namelen++)
+    ;
+  namestart -= namelen - 1;
+
+  t = create_scalar_type ("function type", sizeof ("function type")-1);
+  do_typedef (xmemdup (namestart, namelen, namelen+1), t, &lexer_line);
+  update_lineno (yytext, yyleng);
+}
+
 [^[:alnum:]_](typedef{WS})?(struct|union){WS}{ID}{WS}/"GTY" {
   char *tagstart;
   size_t taglen;
@@ -184,14 +200,14 @@ ITYPE	{IWORD}({WS}{IWORD})*
   yylval.s = xmemdup (yytext+1, yyleng-2, yyleng-1);
   return STRING;
 }
-"["[^\[\]]+"]"			{
+"["[^\[\]]*"]"			{
   yylval.s = xmemdup (yytext+1, yyleng-2, yyleng-1);
   return ARRAY;
 }
 
-[(){},*:=]			{ return yytext[0]; }
+[(){},*:]			{ return yytext[0]; }
 
-";"				{
+[;=]				{
   if (lexer_toplevel_done)
     {
       BEGIN(INITIAL);
Index: gengtype-yacc.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gengtype-yacc.y,v
retrieving revision 1.1.2.3
diff -p -u -p -r1.1.2.3 gengtype-yacc.y
--- gengtype-yacc.y	13 Mar 2002 18:32:01 -0000	1.1.2.3
+++ gengtype-yacc.y	9 Apr 2002 19:40:41 -0000
@@ -81,16 +81,16 @@ typedef_struct: ENT_TYPEDEF_STRUCT optio
 		   }
 		 ';'
 
-externstatic: ENT_EXTERNSTATIC options lasttype ID ';'
+externstatic: ENT_EXTERNSTATIC options lasttype ID semiequal
 	         {
 	           note_variable ($4, $3, $2, &lexer_line);
 	         }
-	      | ENT_EXTERNSTATIC options lasttype ID ARRAY ';'
+	      | ENT_EXTERNSTATIC options lasttype ID ARRAY semiequal
 	         {
 	           note_variable ($4, create_array ($3, $5),
 	      		    $2, &lexer_line);
 	         }
-	      | ENT_EXTERNSTATIC options lasttype ID ARRAY ARRAY ';'
+	      | ENT_EXTERNSTATIC options lasttype ID ARRAY ARRAY semiequal
 	         {
 	           note_variable ($4, create_array (create_array ($3, $6),
 	      				      $5),
@@ -102,6 +102,9 @@ lasttype: type
 	      lexer_toplevel_done = 1;
 	      $$ = $1;
 	    }
+
+semiequal: ';'
+	   | '='
 
 struct_fields: { $$ = NULL; }
 	       | type optionsopt ID bitfieldopt ';' struct_fields
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gengtype.c,v
retrieving revision 1.1.2.7
diff -p -u -p -r1.1.2.7 gengtype.c
--- gengtype.c	6 Apr 2002 00:08:46 -0000	1.1.2.7
+++ gengtype.c	9 Apr 2002 19:40:41 -0000
@@ -256,8 +256,7 @@ create_file (name)
     "Software Foundation, 59 Temple Place - Suite 330, Boston, MA\n",
     "02111-1307, USA.  */\n",
     "\n",
-    "/* This file is machine generated.  Do not edit.  */\n",
-    "\n"
+    "/* This file is machine generated.  Do not edit.  */\n"
   };
   FILE *f;
   size_t i;
@@ -381,9 +380,9 @@ get_output_file_with_visibility (input_f
   basename = get_file_basename (input_file);
 
   len = strlen (basename);
-  if (len > 2 && memcmp (basename+len-2, ".c", 2) == 0
-      || len > 2 && memcmp (basename+len-2, ".y", 2) == 0
-      || len > 3 && memcmp (basename+len-3, ".in", 3) == 0)
+  if ((len > 2 && memcmp (basename+len-2, ".c", 2) == 0)
+      || (len > 2 && memcmp (basename+len-2, ".y", 2) == 0)
+      || (len > 3 && memcmp (basename+len-3, ".in", 3) == 0))
     {
       char *s;
       
@@ -393,9 +392,6 @@ get_output_file_with_visibility (input_f
 	if (! isalnum (*s) && *s != '-')
 	  *s = '-';
       memcpy (s, ".h", sizeof (".h"));
-
-      fm->output = create_file (basename);
-      return fm->output;
     }
   else if (strcmp (basename, "c-common.h") == 0)
     fm->output_name = "gt-c-common.h";
@@ -430,18 +426,21 @@ get_output_file_with_visibility (input_f
   /* If not, create it.  */
   if (fmo == NULL)
     {
-      fm->output = create_file ("GCC");
-      fputs ("#include \"config.h\"\n", fm->output);
-      fputs ("#include \"system.h\"\n", fm->output);
-      fputs ("#include \"varray.h\"\n", fm->output);
-      fputs ("#include \"tree.h\"\n", fm->output);
-      fputs ("#include \"rtl.h\"\n", fm->output);
-      fputs ("#include \"function.h\"\n", fm->output);
-      fputs ("#include \"insn-config.h\"\n", fm->output);
-      fputs ("#include \"expr.h\"\n", fm->output);
-      fputs ("#include \"optabs.h\"\n", fm->output);
-      fputs ("#include \"libfuncs.h\"\n", fm->output);
-      fputs ("#include \"ggc.h\"\n", fm->output);
+      fm->output = create_file (fm->output_name);
+      if (strcmp (fm->output_name, "gtype-desc.c") == 0)
+	{
+	  fputs ("#include \"config.h\"\n", fm->output);
+	  fputs ("#include \"system.h\"\n", fm->output);
+	  fputs ("#include \"varray.h\"\n", fm->output);
+	  fputs ("#include \"tree.h\"\n", fm->output);
+	  fputs ("#include \"rtl.h\"\n", fm->output);
+	  fputs ("#include \"function.h\"\n", fm->output);
+	  fputs ("#include \"insn-config.h\"\n", fm->output);
+	  fputs ("#include \"expr.h\"\n", fm->output);
+	  fputs ("#include \"optabs.h\"\n", fm->output);
+	  fputs ("#include \"libfuncs.h\"\n", fm->output);
+	  fputs ("#include \"ggc.h\"\n", fm->output);
+	}
     }
 
   return fm->output;
@@ -532,6 +531,8 @@ static void write_gc_structure_fields 
 	   int, struct fileloc *));
 static void write_gc_types PARAMS ((type_p structures));
 static void put_mangled_filename PARAMS ((FILE *, const char *));
+static void write_gc_root PARAMS ((FILE *, pair_p, type_p, const char *, int,
+				   struct fileloc *));
 static void write_gc_roots PARAMS ((pair_p));
 
 static int counter = 0;
@@ -763,6 +764,12 @@ write_gc_structure_fields (of, s, val, p
 			     "field `%s' is array of size %s",
 			     f->name, f->type->u.a.len);
 	    
+	    /* Arrays of scalars can be ignored.  */
+	    for (t = f->type; t->kind == TYPE_ARRAY; t = t->u.a.p)
+	      ;
+	    if (t->kind == TYPE_SCALAR)
+	      break;
+
 	    fprintf (of, "%*s{\n", indent, "");
 	    indent += 2;
 	    for (t = f->type, i=0; t->kind == TYPE_ARRAY; t = t->u.a.p, i++)
@@ -859,7 +866,7 @@ write_gc_types PARAMS ((type_p structure
 {
   type_p s;
   
-  fputs ("/* GC marker procedures.  */\n", header_file);
+  fputs ("\n/* GC marker procedures.  */\n", header_file);
   for (s = structures; s; s = s->next)
     if (s->u.s.line.file
 	&& (s->kind == TYPE_STRUCT || s->u.s.opt))
@@ -980,6 +987,151 @@ finish_root_table (struct flist *flp, co
 }
 
 static void
+write_gc_root (f, v, type, name, has_length, line)
+     FILE *f;
+     pair_p v;
+     type_p type;
+     const char *name;
+     int has_length;
+     struct fileloc *line;
+{
+  switch (type->kind)
+    {
+    case TYPE_STRUCT:
+      {
+	pair_p fld;
+	for (fld = type->u.s.fields; fld; fld = fld->next)
+	  {
+	    int skip_p = 0;
+	    const char *desc = NULL;
+	    options_p o;
+	    
+	    for (o = fld->opt; o; o = o->next)
+	      if (strcmp (o->name, "skip") == 0)
+		skip_p = 1;
+	      else if (strcmp (o->name, "desc") == 0)
+		desc = (const char *)o->info;
+	      else
+		error_at_line (line,
+		       "field `%s' of global `%s' has unknown option `%s'",
+			       fld->name, name, o->name);
+	    
+	    if (skip_p)
+	      continue;
+	    else if (desc && fld->type->kind == TYPE_UNION)
+	      {
+		pair_p validf = NULL;
+		pair_p ufld;
+		
+		for (ufld = fld->type->u.s.fields; ufld; ufld = ufld->next)
+		  {
+		    const char *tag = NULL;
+		    options_p oo;
+		    
+		    for (oo = ufld->opt; oo; oo = oo->next)
+		      if (strcmp (oo->name, "tag") == 0)
+			tag = (const char *)oo->info;
+		    if (tag == NULL || strcmp (tag, desc) != 0)
+		      continue;
+		    if (validf != NULL)
+		      error_at_line (line, 
+			   "both `%s.%s.%s' and `%s.%s.%s' have tag `%s'",
+				     name, fld->name, validf->name,
+				     name, fld->name, ufld->name,
+				     tag);
+		    validf = ufld;
+		  }
+		if (validf != NULL)
+		  {
+		    char *newname;
+		    newname = xmalloc (strlen (name) + 3 + strlen (fld->name)
+				       + strlen (validf->name));
+		    sprintf (newname, "%s.%s.%s", 
+			     name, fld->name, validf->name);
+		    write_gc_root (f, v, validf->type, newname, 0, line);
+		    free (newname);
+		  }
+	      }
+	    else if (desc)
+	      error_at_line (line, 
+		     "global `%s.%s' has `desc' option but is not union",
+			     name, fld->name);
+	    else
+	      {
+		char *newname;
+		newname = xmalloc (strlen (name) + 2 + strlen (fld->name));
+		sprintf (newname, "%s.%s", name, fld->name);
+		write_gc_root (f, v, fld->type, newname, 0, line);
+		free (newname);
+	      }
+	  }
+      }
+      break;
+
+    case TYPE_ARRAY:
+      {
+	char *newname;
+	newname = xmalloc (strlen (name) + 4);
+	sprintf (newname, "%s[0]", name);
+	write_gc_root (f, v, type->u.a.p, newname, has_length, line);
+	free (newname);
+      }
+      break;
+      
+    case TYPE_POINTER:
+      {
+	type_p ap, tp;
+	
+	fputs ("  {\n", f);
+	fprintf (f, "    &%s,\n", name);
+	fputs ("    1", f);
+	
+	for (ap = v->type; ap->kind == TYPE_ARRAY; ap = ap->u.a.p)
+	  if (ap->u.a.len[0])
+	    fprintf (f, " * (%s)", ap->u.a.len);
+	  else if (ap == v->type)
+	    fprintf (f, " * (sizeof (%s) / sizeof (%s[0]))",
+		     v->name, v->name);
+	fputs (",\n", f);
+	fprintf (f, "    sizeof (%s", v->name);
+	for (ap = v->type; ap->kind == TYPE_ARRAY; ap = ap->u.a.p)
+	  fputs ("[0]", f);
+	fputs ("),\n", f);
+	
+	tp = type->u.p;
+	
+	if (! has_length
+	    && (tp->kind == TYPE_UNION || tp->kind == TYPE_STRUCT))
+	  {
+	    fprintf (f, "    &gt_ggc_m_%s\n", tp->u.s.tag);
+	  }
+	else if (has_length
+		 && tp->kind == TYPE_POINTER)
+	  {
+	    fprintf (f, "    &gt_ggc_ma_%s\n", name);
+	  }
+	else
+	  {
+	    error_at_line (line, 
+			   "global `%s' is pointer to unimplemented type",
+			   name);
+	  }
+	fputs ("  },\n", f);
+      }
+      break;
+
+    case TYPE_SCALAR:
+    case TYPE_STRING:
+      break;
+      
+    default:
+      error_at_line (line, 
+		     "global `%s' is unimplemented type",
+		     name);
+    }
+}
+
+static void
 write_gc_roots (variables)
      pair_p variables;
 {
@@ -1022,29 +1174,50 @@ write_gc_roots (variables)
       if (! deletable_p
 	  && length
 	  && v->type->kind == TYPE_POINTER
-	  && v->type->u.p->kind == TYPE_POINTER)
+	  && (v->type->u.p->kind == TYPE_POINTER
+	      || v->type->u.p->kind == TYPE_STRUCT))
 	{
-	  type_p s = v->type->u.p->u.p;
-	  
-	  fprintf (f, "static void gt_ggc_ma_%s PARAMS((void *));\n",
+	  fprintf (f, "static void gt_ggc_ma_%s PARAMS ((void *));\n",
 		   v->name);
-	  fprintf (f, "static void\ngt_ggc_ma_%s (x_p);\n      void *x_p;\n",
+	  fprintf (f, "static void\ngt_ggc_ma_%s (x_p)\n      void *x_p;\n",
 		   v->name);
 	  fputs ("{\n", f);
-	  if (s->kind != TYPE_STRUCT && s->kind != TYPE_UNION)
+	  fputs ("  size_t i;\n", f);
+
+	  if (v->type->u.p->kind == TYPE_POINTER)
 	    {
-	      error_at_line (&v->line, 
-			     "global `%s' has unsupported ** type",
-			     v->name);
-	      continue;
+	      type_p s = v->type->u.p->u.p;
+
+	      fprintf (f, "  %s %s ** const x = (%s %s **)x_p;\n",
+		       s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
+		       s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
+	      fputs ("  if (ggc_test_and_set_mark (x))\n", f);
+	      fprintf (f, "    for (i = 0; i < (%s); i++)\n", length);
+	      if (s->kind != TYPE_STRUCT && s->kind != TYPE_UNION)
+		{
+		  error_at_line (&v->line, 
+				 "global `%s' has unsupported ** type",
+				 v->name);
+		  continue;
+		}
+
+	      fprintf (f, "      gt_ggc_m_%s (x[i]);\n", s->u.s.tag);
+	    }
+	  else
+	    {
+	      type_p s = v->type->u.p;
+
+	      fprintf (f, "  %s %s * const x = (%s %s *)x_p;\n",
+		       s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
+		       s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
+	      fputs ("  if (ggc_test_and_set_mark (x))\n", f);
+	      fprintf (f, "    for (i = 0; i < (%s); i++)\n", length);
+	      fputs ("      {\n", f);
+	      write_gc_structure_fields (f, s, "x[i]", "x[i]",
+					 v->opt, 8, &v->line);
+	      fputs ("      }\n", f);
 	    }
 
-	  fprintf (f, "  %s %s * const x = (%s %s *)x_p;\n",
-		   s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
-		   s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
-	  fputs ("  size_t i;\n", f);
-	  fprintf (f, "  for (i = 0; i < (%s); i++)\n", length);
-	  fprintf (f, "    gt_ggc_m_%s (x[i])", s->u.s.tag);
 	  fputs ("}\n\n", f);
 	}
     }
@@ -1056,8 +1229,6 @@ write_gc_roots (variables)
       const char *length = NULL;
       int deletable_p = 0;
       options_p o;
-      type_p tp;
-      type_p ap;
       
       for (o = v->opt; o; o = o->next)
 	if (strcmp (o->name, "length") == 0)
@@ -1084,68 +1255,21 @@ write_gc_roots (variables)
 	  fputs ("[] = {\n", f);
 	}
 
-
-      fputs ("  {\n", f);
-      fprintf (f, "    &%s,\n", v->name);
-      fputs ("    1", f);
-
-      for (ap = v->type; ap->kind == TYPE_ARRAY; ap = ap->u.a.p)
-	fprintf (f, " * (%s)", ap->u.a.len);
-      fputs (",\n", f);
-
-      if (ap->kind != TYPE_POINTER)
-	error_at_line (&v->line, 
-		       "global `%s' is unimplemented type",
-		       v->name);
-
-      tp = ap->u.p;
-      
-      
-      if (! length
-	  && (tp->kind == TYPE_UNION || tp->kind == TYPE_STRUCT))
-	{
-	  fprintf (f, "    sizeof (%s %s *),\n    &gt_ggc_m_%s",
-		   tp->kind == TYPE_UNION ? "union" : "struct", 
-		   tp->u.s.tag, tp->u.s.tag);
-	}
-      else if (tp->kind == TYPE_POINTER
-	       && length
-	       && (tp->u.p->kind == TYPE_UNION
-		   || tp->u.p->kind == TYPE_STRUCT))
-	{
-	  fprintf (f, "    sizeof (%s %s **),\n    &gt_ggc_mp_%s",
-		   tp->kind == TYPE_UNION ? "union" : "struct", 
-		   tp->u.s.tag, v->name);
-	}
-      else
-	{
-	  error_at_line (&v->line, 
-			 "global `%s' is pointer to unimplemented type",
-			 v->name);
-	}
-      fputs ("\n  },\n", f);
+      write_gc_root (f, v, v->type, v->name, length != NULL, &v->line);
     }
 
-
   finish_root_table (flp, "r", "gt_ggc_rtab");
 
   for (v = variables; v; v = v->next)
     {
       FILE *f = get_output_file_with_visibility (v->line.file);
       struct flist *fli;
-      const char *length = NULL;
       int deletable_p = 0;
       options_p o;
 
       for (o = v->opt; o; o = o->next)
-	if (strcmp (o->name, "length") == 0)
-	  length = (const char *)o->info;
-	else if (strcmp (o->name, "deletable") == 0)
+	if (strcmp (o->name, "deletable") == 0)
 	  deletable_p = 1;
-	else
-	  error_at_line (&v->line, 
-			 "global `%s' has unknown option `%s'",
-			 v->name, o->name);
 
       if (! deletable_p)
 	continue;
Index: ggc-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc-common.c,v
retrieving revision 1.46.4.7
diff -p -u -p -r1.46.4.7 ggc-common.c
--- ggc-common.c	6 Apr 2002 00:08:46 -0000	1.46.4.7
+++ ggc-common.c	9 Apr 2002 19:40:42 -0000
@@ -43,8 +43,6 @@ void (*lang_mark_false_label_stack) PARA
 /* Trees that have been marked, but whose children still need marking.  */
 varray_type ggc_pending_trees;
 
-static void ggc_mark_rtx_ptr PARAMS ((void *));
-static void ggc_mark_tree_ptr PARAMS ((void *));
 static void ggc_mark_rtx_varray_ptr PARAMS ((void *));
 static void ggc_mark_tree_varray_ptr PARAMS ((void *));
 static void ggc_mark_tree_hash_table_ptr PARAMS ((void *));
@@ -91,26 +89,6 @@ ggc_add_root (base, nelt, size, cb)
   roots = x;
 }
 
-/* Register an array of rtx as a GC root.  */
-
-void
-ggc_add_rtx_root (base, nelt)
-     rtx *base;
-     int nelt;
-{
-  ggc_add_root (base, nelt, sizeof (rtx), ggc_mark_rtx_ptr);
-}
-
-/* Register an array of trees as a GC root.  */
-
-void
-ggc_add_tree_root (base, nelt)
-     tree *base;
-     int nelt;
-{
-  ggc_add_root (base, nelt, sizeof (tree), ggc_mark_tree_ptr);
-}
-
 /* Register a varray of rtxs as a GC root.  */
 
 void
@@ -144,30 +122,6 @@ ggc_add_tree_hash_table_root (base, nelt
 		ggc_mark_tree_hash_table_ptr);
 }
 
-/* Remove the previously registered GC root at BASE.  */
-
-void
-ggc_del_root (base)
-     void *base;
-{
-  struct ggc_root *x, **p;
-
-  p = &roots, x = roots;
-  while (x)
-    {
-      if (x->base == base)
-	{
-	  *p = x->next;
-	  free (x);
-	  return;
-	}
-      p = &x->next;
-      x = x->next;
-    }
-
-  abort ();
-}
-
 /* Add a hash table to be scanned when all roots have been processed.  We
    delete any entry in the table that has not been marked.  */
 
@@ -580,26 +534,6 @@ ggc_mark_tree_hash_table (ht)
      struct hash_table *ht;
 {
   hash_traverse (ht, ggc_mark_tree_hash_table_entry, /*info=*/0);
-}
-
-/* Type-correct function to pass to ggc_add_root.  It just forwards
-   *ELT (which is an rtx) to ggc_mark_rtx.  */
-
-static void
-ggc_mark_rtx_ptr (elt)
-     void *elt;
-{
-  ggc_mark_rtx (*(rtx *) elt);
-}
-
-/* Type-correct function to pass to ggc_add_root.  It just forwards
-   *ELT (which is a tree) to ggc_mark_tree.  */
-
-static void
-ggc_mark_tree_ptr (elt)
-     void *elt;
-{
-  ggc_mark_tree (*(tree *) elt);
 }
 
 /* Type-correct function to pass to ggc_add_root.  It just forwards
Index: ggc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc.h,v
retrieving revision 1.39.6.7
diff -p -u -p -r1.39.6.7 ggc.h
--- ggc.h	6 Apr 2002 00:08:46 -0000	1.39.6.7
+++ ggc.h	9 Apr 2002 19:40:42 -0000
@@ -43,16 +43,12 @@ extern varray_type ggc_pending_trees;
 /* Manipulate global roots that are needed between calls to gc.  */
 extern void ggc_add_root		PARAMS ((void *base, int nelt,
 						 int size, void (*)(void *)));
-extern void ggc_add_rtx_root		PARAMS ((struct rtx_def **, int nelt));
-extern void ggc_add_tree_root		PARAMS ((union tree_node **,
-						 int nelt));
 extern void ggc_add_rtx_varray_root	PARAMS ((struct varray_head_tag **,
 						 int nelt));
 extern void ggc_add_tree_varray_root	PARAMS ((struct varray_head_tag **,
 						 int nelt));
 extern void ggc_add_tree_hash_table_root PARAMS ((struct hash_table **,
 						  int nelt));
-extern void ggc_del_root		PARAMS ((void *base));
 
 /* Structures for the easy way to mark roots.  
    In an array, terminated by having base == NULL.*/
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.181.4.4
diff -p -u -p -r1.181.4.4 integrate.c
--- integrate.c	14 Mar 2002 21:34:37 -0000	1.181.4.4
+++ integrate.c	9 Apr 2002 19:40:42 -0000
@@ -3055,20 +3055,20 @@ get_func_hard_reg_initial_val (fun, reg)
 
   if (ivs == 0)
     {
-      fun->hard_reg_initial_vals = (void *) xmalloc (sizeof (initial_value_struct));
+      fun->hard_reg_initial_vals = (void *) ggc_alloc (sizeof (initial_value_struct));
       ivs = fun->hard_reg_initial_vals;
       ivs->num_entries = 0;
       ivs->max_entries = 5;
-      ivs->entries = (initial_value_pair *) xmalloc (5 * sizeof (initial_value_pair));
+      ivs->entries = (initial_value_pair *) ggc_alloc (5 * sizeof (initial_value_pair));
     }
 
   if (ivs->num_entries >= ivs->max_entries)
     {
       ivs->max_entries += 5;
       ivs->entries = 
-	(initial_value_pair *) xrealloc (ivs->entries,
-					 ivs->max_entries
-					 * sizeof (initial_value_pair));
+	(initial_value_pair *) ggc_realloc (ivs->entries,
+					    ivs->max_entries
+					    * sizeof (initial_value_pair));
     }
 
   ivs->entries[ivs->num_entries].hard_reg = reg;
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.80.4.1
diff -p -u -p -r1.80.4.1 profile.c
--- profile.c	14 Mar 2002 21:34:49 -0000	1.80.4.1
+++ profile.c	9 Apr 2002 19:40:42 -0000
@@ -1063,7 +1063,7 @@ end_branch_prob ()
 
 /* The label used by the edge profiling code.  */
 
-static rtx profiler_label;
+static GTY(()) rtx profiler_label;
 
 /* Initialize the profiler_label.  */
 
@@ -1074,7 +1074,6 @@ init_edge_profiler ()
   char buf[20];
   ASM_GENERATE_INTERNAL_LABEL (buf, "LPBX", 2);
   profiler_label = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
-  ggc_add_rtx_root (&profiler_label, 1);
 }
 
 /* Output instructions as RTL to increment the edge execution count.  */
@@ -1201,3 +1200,5 @@ output_func_start_profiler ()
     (* targetm.asm_out.constructor) (XEXP (DECL_RTL (fndecl), 0),
 				     DEFAULT_INIT_PRIORITY);
 }
+
+#include "gt-profile.h"
Index: sdbout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sdbout.c,v
retrieving revision 1.64.2.2
diff -p -u -p -r1.64.2.2 sdbout.c
--- sdbout.c	14 Mar 2002 21:34:54 -0000	1.64.2.2
+++ sdbout.c	9 Apr 2002 19:40:42 -0000
@@ -42,11 +42,14 @@ AT&T C compiler.  From the example below
 */
 
 #include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "ggc.h"
+
+static GTY(()) tree anonymous_types;
 
 #ifdef SDB_DEBUGGING_INFO
 
-#include "system.h"
-#include "tree.h"
 #include "rtl.h"
 #include "regs.h"
 #include "flags.h"
@@ -54,7 +57,6 @@ AT&T C compiler.  From the example below
 #include "reload.h"
 #include "output.h"
 #include "toplev.h"
-#include "ggc.h"
 #include "tm_p.h"
 #include "gsyms.h"
 #include "debug.h"
@@ -988,8 +990,6 @@ sdbout_toplevel_data (decl)
 
 /* Machinery to record and output anonymous types.  */
 
-static tree anonymous_types;
-
 static void
 sdbout_queue_anonymous_type (type)
      tree type;
@@ -1759,10 +1759,8 @@ sdbout_init (input_file_name)
 	&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
       sdbout_symbol (t, 0);
 #endif  
-
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
-  ggc_add_tree_root (&anonymous_types, 1);
-#endif
 }
 
 #endif /* SDB_DEBUGGING_INFO */
+
+#include "gt-sdbout.h"
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.243.2.8
diff -p -u -p -r1.243.2.8 varasm.c
--- varasm.c	4 Apr 2002 18:50:04 -0000	1.243.2.8
+++ varasm.c	9 Apr 2002 19:40:43 -0000
@@ -162,7 +162,6 @@ static unsigned HOST_WIDE_INT array_size
 static unsigned min_align		PARAMS ((unsigned, unsigned));
 static void output_constructor		PARAMS ((tree, HOST_WIDE_INT,
 						 unsigned int));
-static void mark_weak_decls		PARAMS ((void *));
 #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
 static void remove_from_pending_weak_list	PARAMS ((const char *));
 #endif
@@ -179,7 +178,6 @@ static void asm_output_aligned_bss	PARAM
 						 int, int));
 #endif
 #endif /* BSS_SECTION_ASM_OP */
-static void mark_const_hash_entry	PARAMS ((void *));
 static int mark_const_str_htab_1	PARAMS ((void **, void *));
 static void mark_const_str_htab		PARAMS ((void *));
 static hashval_t const_str_htab_hash	PARAMS ((const void *x));
@@ -2423,18 +2421,6 @@ struct deferred_string GTY(())
 };
 
 static htab_t const_str_htab;
-
-/* Mark a const_hash_table descriptor for GC.  */
-
-static void
-mark_const_hash_entry (ptr)
-     void *ptr;
-{
-  struct constant_descriptor_tree *desc;
-  desc = * (struct constant_descriptor_tree **) ptr;
-
-  gt_ggc_m_constant_descriptor_tree (desc);
-}
 
 /* Mark the hash-table element X (which is really a pointer to an
    struct deferred_string *).  */
Index: ada/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/Make-lang.in,v
retrieving revision 1.7.8.1
diff -p -u -p -r1.7.8.1 Make-lang.in
--- ada/Make-lang.in	14 Mar 2002 21:35:25 -0000	1.7.8.1
+++ ada/Make-lang.in	9 Apr 2002 19:40:44 -0000
@@ -153,6 +153,9 @@ gnatlib_and_tools: gnatlib gnattools
 # use cross-gcc
 gnat-cross: force
 	$(MAKE) -C ada $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) gnat-cross
+
+gt-ada-decl.h gt-ada-trans.h gt-ada-utils.h gtype-ada.h : s-gtype ; @true
+
 
 # Build hooks:
 
Index: ada/Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/Makefile.in,v
retrieving revision 1.21.8.1
diff -p -u -p -r1.21.8.1 Makefile.in
--- ada/Makefile.in	14 Mar 2002 21:35:25 -0000	1.21.8.1
+++ ada/Makefile.in	9 Apr 2002 19:40:45 -0000
@@ -2279,7 +2279,7 @@ cuintp.o : cuintp.c $(CONFIG_H) $(TREE_H
 decl.o : decl.c $(CONFIG_H) $(TREE_H) $(srcdir)/../flags.h \
    $(srcdir)/../toplev.h $(srcdir)/../convert.h ada.h types.h atree.h \
    nlists.h elists.h uintp.h sinfo.h einfo.h snames.h namet.h \
-   stringt.h repinfo.h fe.h $(ADA_TREE_H) gigi.h
+   stringt.h repinfo.h fe.h $(ADA_TREE_H) gigi.h $(srcdir)/../gt-ada-decl.h
 
 misc.o : misc.c $(CONFIG_H) $(TREE_H) $(RTL_H) $(srcdir)/../expr.h \
    ../insn-codes.h ../insn-flags.h ../insn-config.h $(srcdir)/../recog.h \
@@ -2296,12 +2296,14 @@ targtyps.o : targtyps.c $(CONFIG_H) ada.
 trans.o : trans.c $(CONFIG_H) $(TREE_H) $(RTL_H) $(srcdir)/../flags.h ada.h \
    $(srcdir)/../except.h \
    types.h atree.h nlists.h elists.h uintp.h sinfo.h einfo.h \
-   namet.h snames.h stringt.h urealp.h fe.h $(ADA_TREE_H) gigi.h
+   namet.h snames.h stringt.h urealp.h fe.h $(ADA_TREE_H) gigi.h \
+   $(srcdir)/../gt-ada-trans.h
 
 utils.o : utils.c $(CONFIG_H) $(TREE_H) $(srcdir)/../flags.h \
    $(srcdir)/../expr.h $(srcdir)/../convert.h $(srcdir)/../defaults.h ada.h \
    types.h atree.h nlists.h elists.h sinfo.h einfo.h namet.h stringt.h \
-   uintp.h fe.h $(ADA_TREE_H) gigi.h
+   uintp.h fe.h $(ADA_TREE_H) gigi.h $(srcdir)/../gt-ada-utils.h \
+   $(srcdir)/../gtype-ada.h
 
 utils2.o : utils2.c $(CONFIG_H) $(TREE_H) $(srcdir)/../flags.h ada.h types.h \
    atree.h nlists.h elists.h sinfo.h einfo.h namet.h snames.h stringt.h \
Index: ada/config-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/config-lang.in,v
retrieving revision 1.4.8.1
diff -p -u -p -r1.4.8.1 config-lang.in
--- ada/config-lang.in	14 Mar 2002 21:35:31 -0000	1.4.8.1
+++ ada/config-lang.in	9 Apr 2002 19:40:45 -0000
@@ -35,6 +35,8 @@ compilers="gnat1\$(exeext)"
 
 stagestuff="gnatbind\$(exeext) gnat1\$(exeext)"
 
+gtfiles="\$(srcdir)/ada/gigi.h \$(srcdir)/ada/decl.c \$(srcdir)/ada/trans.c \$(srcdir)/ada/utils.c"
+
 diff_excludes="-x ada/a-einfo.h -x ada/a-sinfo.h -x ada/nmake.adb -x ada/nmake.ads -x ada/treeprs.ads -x ada/sysid.ads"
 
 outputs=ada/Makefile
Index: ada/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/decl.c,v
retrieving revision 1.9.8.1
diff -p -u -p -r1.9.8.1 decl.c
--- ada/decl.c	14 Mar 2002 21:35:31 -0000	1.9.8.1
+++ ada/decl.c	9 Apr 2002 19:40:48 -0000
@@ -4041,7 +4041,7 @@ substitution_list (gnat_subtype, gnat_ty
 /* For the following two functions: for each GNAT entity, the GCC
    tree node used as a dummy for that entity, if any.  */
 
-static tree *dummy_node_table;
+static GTY((length ("max_gnat_nodes"))) tree * dummy_node_table;
 
 /* Initialize the above table.  */
 
@@ -4050,8 +4050,7 @@ init_dummy_type ()
 {
   Node_Id gnat_node;
 
-  dummy_node_table = (tree *) xmalloc (max_gnat_nodes * sizeof (tree));
-  ggc_add_tree_root (dummy_node_table, max_gnat_nodes);
+  dummy_node_table = (tree *) ggc_alloc (max_gnat_nodes * sizeof (tree));
 
   for (gnat_node = 0; gnat_node < max_gnat_nodes; gnat_node++)
     dummy_node_table[gnat_node] = NULL_TREE;
@@ -6210,3 +6209,5 @@ concat_id_with_name (gnu_id, suffix)
   strcpy (Name_Buffer + len, suffix);
   return get_identifier (Name_Buffer);
 }
+
+#include "gt-ada-decl.h"
Index: ada/gigi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/gigi.h,v
retrieving revision 1.3.8.1
diff -p -u -p -r1.3.8.1 gigi.h
--- ada/gigi.h	14 Mar 2002 21:35:43 -0000	1.3.8.1
+++ ada/gigi.h	9 Apr 2002 19:40:49 -0000
@@ -160,7 +160,7 @@ extern const char *ref_filename;
 /* List of TREE_LIST nodes representing a block stack.  TREE_VALUE
    of each gives the variable used for the setjmp buffer in the current
    block, if any.  */
-extern tree gnu_block_stack;
+extern GTY(()) tree gnu_block_stack;
 
 /* For most front-ends, this is the parser for the language.  For us, we
    process the GNAT tree.  */
@@ -353,8 +353,8 @@ enum standard_datatypes
   ADT_raise_nodefer_decl,
   ADT_LAST};
 
-extern tree gnat_std_decls[(int) ADT_LAST];
-extern tree gnat_raise_decls[(int) LAST_REASON_CODE + 1];
+extern GTY(()) tree gnat_std_decls[(int) ADT_LAST];
+extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1];
 
 #define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type]
 #define void_type_decl_node gnat_std_decls[(int) ADT_void_type_decl]
Index: ada/trans.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/trans.c,v
retrieving revision 1.10.8.2
diff -p -u -p -r1.10.8.2 trans.c
--- ada/trans.c	14 Mar 2002 21:36:13 -0000	1.10.8.2
+++ ada/trans.c	9 Apr 2002 19:40:51 -0000
@@ -87,7 +87,7 @@ tree gnu_block_stack;
    variables.  TREE_VALUE is the VAR_DECL that stores the address of
    the raised exception.  Nonzero means we are in an exception
    handler.  Not used in the zero-cost case.  */
-static tree gnu_except_ptr_stack;
+static GTY(()) tree gnu_except_ptr_stack;
 
 /* Map GNAT tree codes to GCC tree codes for simple expressions.  */
 static enum tree_code gnu_codes[Number_Node_Kinds];
@@ -97,7 +97,7 @@ Node_Id error_gnat_node;
 
 /* Variable that stores a list of labels to be used as a goto target instead of
    a return in some functions.  See processing for N_Subprogram_Body.  */
-static tree gnu_return_label_stack;
+static GTY(()) tree gnu_return_label_stack;
 
 static tree tree_transform		PARAMS((Node_Id));
 static void elaborate_all_entities	PARAMS((Node_Id));
@@ -189,9 +189,6 @@ gigi (gnat_root, max_gnat_node, number_n
   save_gnu_tree (Base_Type (standard_integer),
 		 TYPE_NAME (integer_type_node), 0);
 
-  ggc_add_tree_root (&gnu_block_stack, 1);
-  ggc_add_tree_root (&gnu_except_ptr_stack, 1);
-  ggc_add_tree_root (&gnu_return_label_stack, 1);
   gnu_except_ptr_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
 
   dconstp5 = REAL_VALUE_ATOF ("0.5", DFmode);
@@ -5590,3 +5587,5 @@ init_code_table ()
   gnu_codes[N_Op_Shift_Right] = RSHIFT_EXPR;
   gnu_codes[N_Op_Shift_Right_Arithmetic] = RSHIFT_EXPR;
 }
+
+#include "gt-ada-trans.h"
Index: ada/utils.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.8.6.1
diff -p -u -p -r1.8.6.1 utils.c
--- ada/utils.c	14 Mar 2002 21:36:17 -0000	1.8.6.1
+++ ada/utils.c	9 Apr 2002 19:40:53 -0000
@@ -70,18 +70,22 @@ tree gnat_raise_decls[(int) LAST_REASON_
 /* Associates a GNAT tree node to a GCC tree node. It is used in
    `save_gnu_tree', `get_gnu_tree' and `present_gnu_tree'. See documentation
    of `save_gnu_tree' for more info.  */
-static tree *associate_gnat_to_gnu;
+static GTY((length ("max_gnat_nodes"))) tree *associate_gnat_to_gnu;
 
 /* This listhead is used to record any global objects that need elaboration.
    TREE_PURPOSE is the variable to be elaborated and TREE_VALUE is the
    initial value to assign.  */
 
-static tree pending_elaborations;
+static GTY(()) tree pending_elaborations;
 
 /* This stack allows us to momentarily switch to generating elaboration
    lists for an inner context.  */
 
-static struct e_stack {struct e_stack *next; tree elab_list; } *elist_stack;
+static struct e_stack GTY(()) {
+  struct e_stack *next; 
+  tree elab_list; 
+};
+static GTY(()) struct e_stack *elist_stack;
 
 /* This variable keeps a table for types for each precision so that we only 
    allocate each of them once. Signed and unsigned types are kept separate.
@@ -89,10 +93,10 @@ static struct e_stack {struct e_stack *n
    Note that these types are only used when fold-const requests something
    special.  Perhaps we should NOT share these types; we'll see how it
    goes later.  */
-static tree signed_and_unsigned_types[2 * MAX_BITS_PER_WORD + 1][2];
+static GTY(()) tree signed_and_unsigned_types[2 * MAX_BITS_PER_WORD + 1][2];
 
 /* Likewise for float types, but record these by mode.  */
-static tree float_types[NUM_MACHINE_MODES];
+static GTY(()) tree float_types[NUM_MACHINE_MODES];
 
 /* For each binding contour we allocate a binding_level structure which records
    the entities defined or declared in that contour. Contours include:
@@ -103,7 +107,7 @@ static tree float_types[NUM_MACHINE_MODE
 
    Binding contours are used to create GCC tree BLOCK nodes.  */
 
-struct binding_level
+struct binding_level GTY(())
 {
   /* A chain of ..._DECL nodes for all variables, constants, functions,
      parameters and type declarations.  These ..._DECL nodes are chained
@@ -122,10 +126,10 @@ struct binding_level
 };
 
 /* The binding level currently in effect.  */
-static struct binding_level *current_binding_level = NULL;
+static GTY(()) struct binding_level *current_binding_level;
 
 /* A chain of binding_level structures awaiting reuse.  */
-static struct binding_level *free_binding_level = NULL;
+static GTY((deletable (""))) struct binding_level *free_binding_level;
 
 /* The outermost binding level. This binding level is created when the
    compiler is started and it will exist through the entire compilation.  */
@@ -143,7 +147,6 @@ static tree convert_to_fat_pointer	PARAM
 static tree convert_to_thin_pointer	PARAMS ((tree, tree));
 static tree make_descriptor_field	PARAMS ((const char *,tree, tree,
 						 tree));
-static void mark_binding_level		PARAMS ((PTR));
 static void mark_e_stack	  	PARAMS ((PTR));
 
 /* Initialize the association of GNAT nodes to GCC trees.  */
@@ -153,22 +156,12 @@ init_gnat_to_gnu ()
 {
   Node_Id gnat_node;
 
-  associate_gnat_to_gnu = (tree *) xmalloc (max_gnat_nodes * sizeof (tree));
-  ggc_add_tree_root (associate_gnat_to_gnu, max_gnat_nodes);
+  associate_gnat_to_gnu = (tree *) ggc_alloc (max_gnat_nodes * sizeof (tree));
 
   for (gnat_node = 0; gnat_node < max_gnat_nodes; gnat_node++)
     associate_gnat_to_gnu[gnat_node] = NULL_TREE;
 
   pending_elaborations = build_tree_list (NULL_TREE, NULL_TREE);
-  ggc_add_tree_root (&pending_elaborations, 1);
-  ggc_add_root ((PTR) &elist_stack, 1, sizeof (struct e_stack), mark_e_stack);
-  ggc_add_tree_root (&signed_and_unsigned_types[0][0],
-		     (sizeof signed_and_unsigned_types
-		      / sizeof signed_and_unsigned_types[0][0]));
-  ggc_add_tree_root (float_types, ARRAY_SIZE (float_types));
-
-  ggc_add_root (&current_binding_level, 1, sizeof current_binding_level,
-		mark_binding_level);
 }
 
 /* GNAT_ENTITY is a GNAT tree node for an entity.   GNU_DECL is the GCC tree
@@ -261,7 +254,7 @@ pushlevel (ignore)
     }
   else
     newlevel
-      = (struct binding_level *) xmalloc (sizeof (struct binding_level));
+      = (struct binding_level *) ggc_alloc (sizeof (struct binding_level));
 
   *newlevel = clear_binding_level;
 
@@ -687,9 +680,6 @@ init_gigi_decls (long_long_float_type, e
   DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
 
   main_identifier_node = get_identifier ("main");
-
-  ggc_add_tree_root (gnat_std_decls, ARRAY_SIZE (gnat_std_decls));
-  ggc_add_tree_root (gnat_raise_decls, ARRAY_SIZE (gnat_raise_decls));
 }
 
 /* This routine is called in tree.c to print an error message for invalid use
@@ -1616,37 +1606,6 @@ get_pending_elaborations ()
   return result;
 }
 
-/* Mark the binding level stack.  */
-
-static void
-mark_binding_level (arg)
-     PTR arg;
-{
-  struct binding_level *level = *(struct binding_level **) arg;
-
-  for (; level != 0; level = level->level_chain)
-    {
-      ggc_mark_tree (level->names);
-      ggc_mark_tree (level->blocks);
-      ggc_mark_tree (level->this_block);
-    }
-}
-
-/* Mark the pending elaboration list.  */
-
-static void
-mark_e_stack (data)
-     PTR data;
-{
-  struct e_stack *p = *((struct e_stack **) data);
-
-  if (p != 0)
-    {
-      ggc_mark_tree (p->elab_list);
-      mark_e_stack (&p->next);
-    }
-}
-
 /* Return nonzero if there are pending elaborations.  */
 
 int
@@ -1661,7 +1620,7 @@ pending_elaborations_p ()
 void
 push_pending_elaborations ()
 {
-  struct e_stack *p = (struct e_stack *) xmalloc (sizeof (struct e_stack));
+  struct e_stack *p = (struct e_stack *) ggc_alloc (sizeof (struct e_stack));
 
   p->next = elist_stack;
   p->elab_list = pending_elaborations;
@@ -1678,7 +1637,6 @@ pop_pending_elaborations ()
 
   pending_elaborations = p->elab_list;
   elist_stack = p->next;
-  free (p);
 }
 
 /* Return the current position in pending_elaborations so we can insert
@@ -3381,3 +3339,6 @@ unchecked_convert (type, expr)
 
   return expr;
 }
+
+#include "gt-ada-utils.h"
+#include "gtype-ada.h'
Index: config/darwin-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin-protos.h,v
retrieving revision 1.8.6.1
diff -p -u -p -r1.8.6.1 darwin-protos.h
--- config/darwin-protos.h	14 Mar 2002 21:36:19 -0000	1.8.6.1
+++ config/darwin-protos.h	9 Apr 2002 19:40:53 -0000
@@ -26,8 +26,6 @@ extern char *machopic_function_base_name
 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));
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.17.6.1
diff -p -u -p -r1.17.6.1 darwin.c
--- config/darwin.c	14 Mar 2002 21:36:19 -0000	1.17.6.1
+++ config/darwin.c	9 Apr 2002 19:40:54 -0000
@@ -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.  */
@@ -1140,3 +1130,6 @@ machopic_asm_out_destructor (symbol, pri
   if (!flag_pic)
     fprintf (asm_out_file, ".reference .destructors_used\n");
 }
+
+#include "gt-darwin.h"
+
Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.184.2.4
diff -p -u -p -r1.184.2.4 arm.c
--- config/arm/arm.c	14 Mar 2002 21:36:27 -0000	1.184.2.4
+++ config/arm/arm.c	9 Apr 2002 19:40:56 -0000
@@ -757,10 +757,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);
 }
@@ -10787,10 +10783,11 @@ arm_strip_name_encoding (const char * na
   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;
@@ -10808,10 +10805,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");
     }
 
Index: config/arm/arm.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.h,v
retrieving revision 1.131.2.3
diff -p -u -p -r1.131.2.3 arm.h
--- config/arm/arm.h	14 Mar 2002 21:36:28 -0000	1.131.2.3
+++ config/arm/arm.h	9 Apr 2002 19:40:57 -0000
@@ -66,21 +66,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
Index: config/c4x/c4x-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x-protos.h,v
retrieving revision 1.23.6.1
diff -p -u -p -r1.23.6.1 c4x-protos.h
--- config/c4x/c4x-protos.h	14 Mar 2002 21:36:29 -0000	1.23.6.1
+++ config/c4x/c4x-protos.h	9 Apr 2002 19:40:57 -0000
@@ -274,19 +274,19 @@ extern int valid_parallel_operands_5 PAR
 
 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 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 struct rtx_def *c4x_compare_op0;	/* Operand 0 for comparisons.  */
-extern struct rtx_def *c4x_compare_op1;	/* Operand 1 for comparisons.  */
+extern GTY(()) rtx c4x_compare_op0;	/* Operand 0 for comparisons.  */
+extern GTY(()) rtx c4x_compare_op1;	/* Operand 1 for comparisons.  */
 
 #endif /* RTX_CODE */
 
@@ -305,7 +305,12 @@ extern void c4x_pr_FUNC_NEVER_RETURNS	PA
 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 */
Index: config/c4x/c4x.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x.c,v
retrieving revision 1.99.6.1
diff -p -u -p -r1.99.6.1 c4x.c
--- config/c4x/c4x.c	14 Mar 2002 21:36:29 -0000	1.99.6.1
+++ config/c4x/c4x.c	9 Apr 2002 19:40:57 -0000
@@ -148,8 +148,8 @@ enum machine_mode c4x_caller_save_map[FI
 /* 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));
@@ -219,32 +218,6 @@ static int c4x_adjust_cost PARAMS ((rtx,
 
 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
@@ -313,9 +286,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 ();
 }
 
 
@@ -5082,3 +5052,4 @@ c4x_asm_named_section (name, flags)
 {
   fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
 }
+
Index: config/d30v/d30v-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/d30v/d30v-protos.h,v
retrieving revision 1.7
diff -p -u -p -r1.7 d30v-protos.h
--- config/d30v/d30v-protos.h	4 Nov 2001 02:12:08 -0000	1.7
+++ config/d30v/d30v-protos.h	9 Apr 2002 19:40:57 -0000
@@ -140,8 +140,8 @@ extern void debug_stack_info		PARAMS ((d
 /* 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.  */
 
Index: config/d30v/d30v.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/d30v/d30v.c,v
retrieving revision 1.20.6.2
diff -p -u -p -r1.20.6.2 d30v.c
--- config/d30v/d30v.c	12 Mar 2002 18:53:30 -0000	1.20.6.2
+++ config/d30v/d30v.c	9 Apr 2002 19:40:57 -0000
@@ -46,7 +46,6 @@
 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 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));
@@ -295,8 +294,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 ();
 }
 
 
@@ -3568,14 +3565,4 @@ rtx
 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);
 }
Index: config/dsp16xx/dsp16xx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/dsp16xx/dsp16xx.c,v
retrieving revision 1.26
diff -p -u -p -r1.26 dsp16xx.c
--- config/dsp16xx/dsp16xx.c	20 Dec 2001 17:36:34 -0000	1.26
+++ config/dsp16xx/dsp16xx.c	9 Apr 2002 19:40:58 -0000
@@ -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
Index: config/dsp16xx/dsp16xx.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/dsp16xx/dsp16xx.h,v
retrieving revision 1.37.2.2
diff -p -u -p -r1.37.2.2 dsp16xx.h
--- config/dsp16xx/dsp16xx.h	14 Mar 2002 21:36:33 -0000	1.37.2.2
+++ config/dsp16xx/dsp16xx.h	9 Apr 2002 19:40:59 -0000
@@ -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 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 struct rtx_def *dsp16xx_ashrhi3_libcall;
-extern struct rtx_def *dsp16xx_ashlhi3_libcall;
-extern struct rtx_def *dsp16xx_lshrhi3_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
Index: config/ia64/ia64-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64-protos.h,v
retrieving revision 1.35.6.2
diff -p -u -p -r1.35.6.2 ia64-protos.h
--- config/ia64/ia64-protos.h	14 Mar 2002 21:36:43 -0000	1.35.6.2
+++ config/ia64/ia64-protos.h	9 Apr 2002 19:41:01 -0000
@@ -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 */
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.137.6.4
diff -p -u -p -r1.137.6.4 ia64.c
--- config/ia64/ia64.c	14 Mar 2002 21:36:43 -0000	1.137.6.4
+++ config/ia64/ia64.c	9 Apr 2002 19:41:02 -0000
@@ -119,7 +119,6 @@ static rtx gen_fr_restore_x PARAMS ((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 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));
@@ -3880,16 +3879,6 @@ 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 struct machine_function *
 ia64_init_machine_status ()
 {
@@ -3920,8 +3909,6 @@ ia64_override_options ()
 
   init_machine_status = ia64_init_machine_status;
   mark_machine_status = gt_ggc_m_machine_function;
-
-  ia64_add_gc_roots ();
 }
 
 static enum attr_itanium_requires_unit0 ia64_safe_itanium_requires_unit0 PARAMS((rtx));
Index: config/m68hc11/m68hc11-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11-protos.h,v
retrieving revision 1.9.6.1
diff -p -u -p -r1.9.6.1 m68hc11-protos.h
--- config/m68hc11/m68hc11-protos.h	14 Mar 2002 21:36:44 -0000	1.9.6.1
+++ config/m68hc11/m68hc11-protos.h	9 Apr 2002 19:41:02 -0000
@@ -47,9 +47,15 @@ extern void m68hc11_encode_section_info 
 #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 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));
 
Index: config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.32.6.1
diff -p -u -p -r1.32.6.1 m68hc11.c
--- config/m68hc11/m68hc11.c	14 Mar 2002 21:36:44 -0000	1.32.6.1
+++ config/m68hc11/m68hc11.c	9 Apr 2002 19:41:02 -0000
@@ -71,7 +71,6 @@ static tree m68hc11_handle_fntype_attrib
 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));
@@ -92,7 +91,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;
@@ -224,8 +223,6 @@ struct gcc_target targetm = TARGET_INITI
 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));
@@ -3879,7 +3876,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 *));
@@ -5263,20 +5260,6 @@ m68hc11_asm_file_start (out, main_file)
   output_file_directive (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)
Index: config/mcore/mcore-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore-protos.h,v
retrieving revision 1.6.6.1
diff -p -u -p -r1.6.6.1 mcore-protos.h
--- config/mcore/mcore-protos.h	14 Mar 2002 21:36:47 -0000	1.6.6.1
+++ config/mcore/mcore-protos.h	9 Apr 2002 19:41:02 -0000
@@ -52,8 +52,8 @@ extern rtx          mcore_function_value
 
 #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));
Index: config/mcore/mcore.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore.c,v
retrieving revision 1.29.6.1
diff -p -u -p -r1.29.6.1 mcore.c
--- config/mcore/mcore.c	14 Mar 2002 21:36:47 -0000	1.29.6.1
+++ config/mcore/mcore.c	9 Apr 2002 19:41:03 -0000
@@ -125,7 +125,6 @@ static cond_type  is_cond_candidate     
 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));
@@ -3060,15 +3059,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 ()
 {
@@ -3087,8 +3077,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
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.173.6.2
diff -p -u -p -r1.173.6.2 mips.c
--- config/mips/mips.c	14 Mar 2002 21:36:48 -0000	1.173.6.2
+++ config/mips/mips.c	9 Apr 2002 19:41:03 -0000
@@ -117,7 +117,6 @@ static rtx mips_find_symbol			PARAMS ((r
 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));
@@ -5278,9 +5277,6 @@ override_options ()
       if (align_functions == 0)
 	align_functions = 8;
     }
-
-  /* Register global variables with the garbage collector.  */
-  mips_add_gc_roots ();
 }
 
 /* On the mips16, we want to allocate $24 (T_REG) before other
@@ -9842,21 +9838,6 @@ mips_output_conditional_branch (insn,
 
   /* NOTREACHED */
   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));
-  ggc_add_rtx_root (&embedded_pic_fnaddr_rtx, 1);
-  ggc_add_rtx_root (&mips16_gp_pseudo_rtx, 1);
 }
 
 static enum processor_type
Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.146.2.2
diff -p -u -p -r1.146.2.2 mips.h
--- config/mips/mips.h	14 Mar 2002 21:36:48 -0000	1.146.2.2
+++ config/mips/mips.h	9 Apr 2002 19:41:04 -0000
@@ -137,7 +137,7 @@ extern int set_noat;			/* # of nested .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,13 +162,13 @@ extern int dslots_jump_total;		/* total 
 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 struct rtx_def *embedded_pic_fnaddr_rtx;	/* function address */
+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 GTY(()) rtx embedded_pic_fnaddr_rtx;	/* function address */
 extern int mips_string_length;		/* length of strings for mips16 */
-extern struct rtx_def *mips16_gp_pseudo_rtx; /* psuedo reg holding $gp */
+extern GTY(()) rtx mips16_gp_pseudo_rtx; /* psuedo reg holding $gp */
 
 /* Functions to change what output section we are using.  */
 extern void		rdata_section PARAMS ((void));
@@ -2780,7 +2780,7 @@ typedef struct mips_args {
 				   bug in the code that sets the adjustments
 				   in function_arg.  */
   int prototype;                /* True if the function has a prototype.  */
-  struct rtx_def *adjust[MAX_ARGS_IN_REGISTERS*2];
+  rtx adjust[MAX_ARGS_IN_REGISTERS*2];
 } CUMULATIVE_ARGS;
 
 /* Initialize a variable CUM of type CUMULATIVE_ARGS
Index: config/mmix/mmix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.c,v
retrieving revision 1.14.2.3
diff -p -u -p -r1.14.2.3 mmix.c
--- config/mmix/mmix.c	14 Mar 2002 21:36:49 -0000	1.14.2.3
+++ config/mmix/mmix.c	9 Apr 2002 19:41:04 -0000
@@ -138,11 +138,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.  */
Index: config/mmix/mmix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.h,v
retrieving revision 1.13.2.2
diff -p -u -p -r1.13.2.2 mmix.h
--- config/mmix/mmix.h	14 Mar 2002 21:36:49 -0000	1.13.2.2
+++ config/mmix/mmix.h	9 Apr 2002 19:41:05 -0000
@@ -82,8 +82,8 @@ 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
Index: config/mn10200/mn10200.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10200/mn10200.c,v
retrieving revision 1.23
diff -p -u -p -r1.23 mn10200.c
--- config/mn10200/mn10200.c	3 Jan 2002 05:04:31 -0000	1.23
+++ config/mn10200/mn10200.c	9 Apr 2002 19:41:05 -0000
@@ -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
Index: config/mn10200/mn10200.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10200/mn10200.h,v
retrieving revision 1.33.2.1
diff -p -u -p -r1.33.2.1 mn10200.h
--- config/mn10200/mn10200.h	14 Mar 2002 21:36:49 -0000	1.33.2.1
+++ config/mn10200/mn10200.h	9 Apr 2002 19:41:05 -0000
@@ -987,5 +987,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;
Index: config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.144.4.2
diff -p -u -p -r1.144.4.2 pa.c
--- config/pa/pa.c	14 Mar 2002 21:36:50 -0000	1.144.4.2
+++ config/pa/pa.c	9 Apr 2002 19:41:06 -0000
@@ -76,8 +76,6 @@ static void pa_combine_instructions PARA
 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));
@@ -127,12 +125,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.  */
 
@@ -258,9 +258,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,
@@ -6128,10 +6125,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)));
 
@@ -7401,27 +7398,4 @@ 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);
-}
+#include "gt-pa.h"
Index: config/pa/pa.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.h,v
retrieving revision 1.134.2.2
diff -p -u -p -r1.134.2.2 pa.h
--- config/pa/pa.h	14 Mar 2002 21:36:50 -0000	1.134.2.2
+++ config/pa/pa.h	9 Apr 2002 19:41:06 -0000
@@ -844,7 +844,8 @@ struct hppa_args {int words, nargs_proto
       || ((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) \
Index: config/pj/pj-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pj/pj-protos.h,v
retrieving revision 1.2
diff -p -u -p -r1.2 pj-protos.h
--- config/pj/pj-protos.h	4 Nov 2001 02:12:13 -0000	1.2
+++ config/pj/pj-protos.h	9 Apr 2002 19:41:07 -0000
@@ -23,8 +23,8 @@ void pj_expand_epilogue PARAMS ((void));
 void pj_asm_output_opcode PARAMS ((FILE *, const char *));
 
 #ifdef RTX_CODE
-extern rtx pj_cmp_op0;
-extern rtx pj_cmp_op1;
+extern GTY(()) rtx pj_cmp_op0;
+extern GTY(()) rtx pj_cmp_op1;
 extern enum machine_mode pj_cmp_mode;
 extern int pj_stuff_on_line;
 extern const char *pj_standard_float_constant PARAMS ((rtx));
Index: config/pj/pj.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pj/pj.h,v
retrieving revision 1.17.2.2
diff -p -u -p -r1.17.2.2 pj.h
--- config/pj/pj.h	14 Mar 2002 21:36:51 -0000	1.17.2.2
+++ config/pj/pj.h	9 Apr 2002 19:41:07 -0000
@@ -95,11 +95,7 @@ extern int target_flags;
    We take this chance to register the global variables with the garbage
    collector. */
 
-#define OVERRIDE_OPTIONS                                                \
- do {                                                                   \
-   ggc_add_rtx_root (&pj_cmp_op0, 1);                                   \
-   ggc_add_rtx_root (&pj_cmp_op1, 1);                                   \
- } while (0)
+/* #define OVERRIDE_OPTIONS */
 
 /* Define this to change the optimizations performed by default.  */
 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                                \
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.278.2.4
diff -p -u -p -r1.278.2.4 rs6000.c
--- config/rs6000/rs6000.c	14 Mar 2002 21:36:54 -0000	1.278.2.4
+++ config/rs6000/rs6000.c	9 Apr 2002 19:41:08 -0000
@@ -11034,16 +11034,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
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.173.2.2
diff -p -u -p -r1.173.2.2 rs6000.h
--- config/rs6000/rs6000.h	14 Mar 2002 21:36:54 -0000	1.173.2.2
+++ config/rs6000/rs6000.h	9 Apr 2002 19:41:09 -0000
@@ -2374,7 +2374,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.  */
Index: config/rs6000/t-darwin
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/t-darwin,v
retrieving revision 1.5
diff -p -u -p -r1.5 t-darwin
--- config/rs6000/t-darwin	7 Dec 2001 17:36:56 -0000	1.5
+++ config/rs6000/t-darwin	9 Apr 2002 19:41:09 -0000
@@ -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-lex.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
 
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.131.6.2
diff -p -u -p -r1.131.6.2 sh.c
--- config/sh/sh.c	14 Mar 2002 21:36:56 -0000	1.131.6.2
+++ config/sh/sh.c	9 Apr 2002 19:41:09 -0000
@@ -6175,16 +6175,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)
@@ -6714,3 +6712,5 @@ sh_ms_bitfield_layout_p (record_type)
 {
   return TARGET_SH5;
 }
+
+#include "gt-sh.h"
Index: config/sh/t-sh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/t-sh,v
retrieving revision 1.9
diff -p -u -p -r1.9 t-sh
--- config/sh/t-sh	17 May 2001 03:16:12 -0000	1.9
+++ config/sh/t-sh	9 Apr 2002 19:41:10 -0000
@@ -34,5 +34,8 @@ $(T)crti.o: $(srcdir)/config/sh/crti.asm
 $(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
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.176.6.2
diff -p -u -p -r1.176.6.2 sparc.c
--- config/sparc/sparc.c	14 Mar 2002 21:36:59 -0000	1.176.6.2
+++ config/sparc/sparc.c	9 Apr 2002 19:41:11 -0000
@@ -79,7 +79,7 @@ rtx sparc_compare_op0, sparc_compare_op1
 
 /* We may need an epilogue if we spill too many registers.
    If this is non-zero, then we branch here for the epilogue.  */
-static rtx leaf_label;
+static GTY(()) rtx leaf_label;
 
 #ifdef LEAF_REGISTERS
 
@@ -146,8 +146,6 @@ static int ultrasparc_adjust_cost PARAMS
 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 void mark_ultrasparc_pipeline_state 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));
@@ -437,9 +435,6 @@ sparc_override_options ()
     {
       error ("profiling does not support code models other than medlow");
     }
-
-  /* Register global variables with the garbage collector.  */
-  sparc_add_gc_roots ();
 }
 
 /* Miscellaneous utilities.  */
@@ -2735,10 +2730,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.  */
@@ -7382,7 +7377,7 @@ static const char *const ultra_code_name
   "NONE", "IEU0", "IEU1", "IEUN", "LSU", "CTI",
   "FPM", "FPA", "SINGLE" };
 
-struct ultrasparc_pipeline_state {
+struct ultrasparc_pipeline_state GTY(()) {
   /* The insns in this group.  */
   rtx group[4];
 
@@ -7407,7 +7402,8 @@ struct ultrasparc_pipeline_state {
 };
 
 #define ULTRA_NUM_HIST	8
-static struct ultrasparc_pipeline_state ultra_pipe_hist[ULTRA_NUM_HIST];
+static GTY(()) struct ultrasparc_pipeline_state 
+  ultra_pipe_hist[ULTRA_NUM_HIST];
 static int ultra_cur_hist;
 static int ultra_cycles_elapsed;
 
@@ -8204,8 +8200,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)
@@ -8451,38 +8447,6 @@ sparc_function_profiler (file, labelno)
 }
 
 
-/* Mark ARG, which is really a struct ultrasparc_pipline_state *, for
-   GC.  */
-
-static void
-mark_ultrasparc_pipeline_state (arg)
-     void *arg;
-{
-  struct ultrasparc_pipeline_state *ups;
-  size_t i;
-
-  ups = (struct ultrasparc_pipeline_state *) arg;
-  for (i = 0; i < ARRAY_SIZE (ups->group); ++i)
-    ggc_mark_rtx (ups->group[i]);
-}
-
-/* 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 (&leaf_label, 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);
-  ggc_add_root (ultra_pipe_hist, ARRAY_SIZE (ultra_pipe_hist),
-		sizeof (ultra_pipe_hist[0]), &mark_ultrasparc_pipeline_state);
-}
-
 #ifdef OBJECT_FORMAT_ELF
 static void
 sparc_elf_asm_named_section (name, flags)
@@ -8511,3 +8475,5 @@ sparc_elf_asm_named_section (name, flags
   fputc ('\n', asm_out_file);
 }
 #endif /* OBJECT_FORMAT_ELF */
+
+#include "gt-sparc.h"
Index: config/sparc/sparc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.h,v
retrieving revision 1.156.2.2
diff -p -u -p -r1.156.2.2 sparc.h
--- config/sparc/sparc.h	14 Mar 2002 21:36:59 -0000	1.156.2.2
+++ config/sparc/sparc.h	9 Apr 2002 19:41:12 -0000
@@ -1798,7 +1798,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
Index: cp/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Make-lang.in,v
retrieving revision 1.103.6.4
diff -p -u -p -r1.103.6.4 Make-lang.in
--- cp/Make-lang.in	6 Apr 2002 00:08:49 -0000	1.103.6.4
+++ cp/Make-lang.in	9 Apr 2002 19:41:14 -0000
@@ -131,6 +131,9 @@ $(srcdir)/cp/parse.c: $(srcdir)/cp/parse
 	  false ; \
 	fi
 
+gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
+gt-cp-parse.h gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h : s-gtype; @true
+
 #
 # Build hooks:
 
@@ -143,8 +146,6 @@ c++.info: 
 c++.dvi:
 c++.generated-manpages:
 
-gtype-cp.h gt-cp-decl.h : s-gtype; @true
-
 #
 # Install hooks:
 # cc1plus is installed elsewhere as part of $(COMPILERS).
@@ -249,7 +250,8 @@ CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-co
 	function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \
 	$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
 
-cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
+cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h \
+  gt-cp-spew.h
 cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
   toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
   $(TM_P_H)
@@ -259,14 +261,14 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) flags
   output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \
   cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h gt-cp-decl.h gtype-cp.h
 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
-  output.h except.h toplev.h $(GGC_H) $(RTL_H)
+  output.h except.h toplev.h $(GGC_H) $(RTL_H) gt-cp-decl2.h
 cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
    diagnostic.h
 cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
    diagnostic.h
 cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(TARGET_H)
 cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
-     $(GGC_H) diagnostic.h
+     $(GGC_H) diagnostic.h gt-cp-call.h
 cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
 cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
   $(GGC_H) except.h
@@ -283,9 +285,10 @@ cp/except.o: cp/except.c $(CXX_TREE_H) f
 cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
   except.h $(TM_P_H)
 cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
-  $(GGC_H) $(RTL_H) except.h tree-inline.h
+  $(GGC_H) $(RTL_H) except.h tree-inline.h gt-cp-pt.h
 cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h
-cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h
+cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h \
+  gt-cp-repo.h
 cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
   flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
   tree-inline.h
@@ -295,7 +298,7 @@ cp/optimize.o: cp/optimize.c $(CXX_TREE_
 cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h
 
 cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
-	$(SYSTEM_H) toplev.h $(GGC_H)
+	$(SYSTEM_H) toplev.h $(GGC_H) gt-cp-parse.h
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
 		$(srcdir)/cp/parse.c $(OUTPUT_OPTION)
 #
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.304.2.2
diff -p -u -p -r1.304.2.2 call.c
--- cp/call.c	14 Mar 2002 21:37:08 -0000	1.304.2.2
+++ cp/call.c	9 Apr 2002 19:41:15 -0000
@@ -4363,7 +4363,7 @@ build_over_call (cand, args, flags)
   return convert_from_reference (fn);
 }
 
-static tree java_iface_lookup_fn;
+static GTY(()) tree java_iface_lookup_fn;
 
 /* Make an expression which yields the address of the Java interface
    method FN.  This is achieved by generating a call to libjava's
@@ -4388,7 +4388,6 @@ build_java_interface_fn_ref (fn, instanc
 	= builtin_function ("_Jv_LookupInterfaceMethodIdx",
 			    build_function_type (ptr_type_node, t),
 			    0, NOT_BUILT_IN, NULL);
-      ggc_add_tree_root (&java_iface_lookup_fn, 1);
     }
 
   /* Look up the pointer to the runtime java.lang.Class object for `instance'. 
@@ -5593,3 +5592,5 @@ initialize_reference (type, expr)
 
   return convert_like (conv, expr);
 }
+
+#include "gt-cp-call.h"
Index: cp/config-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/config-lang.in,v
retrieving revision 1.10.6.1
diff -p -u -p -r1.10.6.1 config-lang.in
--- cp/config-lang.in	13 Mar 2002 05:07:19 -0000	1.10.6.1
+++ cp/config-lang.in	9 Apr 2002 19:41:15 -0000
@@ -34,4 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(ex
 
 target_libs="${libstdcxx_version} target-gperf"
 
-gtfiles="\$(srcdir)/cp/decl.c"
+gtfiles="\$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/parse.y \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/spew.c"
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.671.2.3
diff -p -u -p -r1.671.2.3 cp-tree.h
--- cp/cp-tree.h	14 Mar 2002 21:37:09 -0000	1.671.2.3
+++ cp/cp-tree.h	9 Apr 2002 19:41:15 -0000
@@ -587,7 +587,7 @@ enum cp_tree_index
     CPTI_MAX
 };
 
-extern tree cp_global_trees[CPTI_MAX];
+extern GTY(()) tree cp_global_trees[CPTI_MAX];
 
 #define java_byte_type_node		cp_global_trees[CPTI_JAVA_BYTE_TYPE]
 #define java_short_type_node		cp_global_trees[CPTI_JAVA_SHORT_TYPE]
@@ -716,7 +716,7 @@ extern tree cp_global_trees[CPTI_MAX];
 
 /* Global state.  */
 
-struct saved_scope
+struct saved_scope GTY(())
 {
   tree old_bindings;
   tree old_namespace;
@@ -725,7 +725,7 @@ struct saved_scope
   tree class_type;
   tree access_specifier;
   tree function_decl;
-  varray_type lang_base;
+  varray_type GTY ((varray_type (tree))) lang_base;
   tree lang_name;
   tree template_parms;
   tree x_previous_class_type;
@@ -803,7 +803,7 @@ struct saved_scope
 
 #define type_lookups scope_chain->lookups
 
-extern struct saved_scope *scope_chain;
+extern GTY(()) struct saved_scope *scope_chain;
 
 struct unparsed_text;
 
@@ -913,7 +913,7 @@ struct cp_language_function
 #define current_function_return_value \
   (cp_function_chain->x_return_value)
 
-extern tree global_namespace;
+extern GTY(()) tree global_namespace;
 
 #define ansi_opname(CODE) \
   (operator_name_info[(int) (CODE)].identifier)
@@ -3128,7 +3128,7 @@ extern int warn_nontemplate_friend;
 
 /* in decl{2}.c */
 /* A node that is a list (length 1) of error_mark_nodes.  */
-extern tree error_mark_list;
+extern GTY(()) tree error_mark_list;
 
 /* Node for "pointer to (virtual) function".
    This may be distinct from ptr_type_node so gdb can distinguish them.  */
@@ -3136,9 +3136,10 @@ extern tree error_mark_list;
 
 
 /* For building calls to `delete'.  */
-extern tree integer_two_node, integer_three_node;
+extern GTY(()) tree integer_two_node;
+extern GTY(()) tree integer_three_node;
 
-extern tree anonymous_namespace_name;
+extern GTY(()) tree anonymous_namespace_name;
 
 /* The number of function bodies which we are currently processing.
    (Zero if we are at namespace scope, one inside the body of a
@@ -3335,8 +3336,8 @@ extern int at_eof;
 
 /* Functions called along with real static constructors and destructors.  */
 
-extern tree static_ctors;
-extern tree static_dtors;
+extern GTY(()) tree static_ctors;
+extern GTY(()) tree static_dtors;
 
 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 
@@ -3847,9 +3848,6 @@ extern tree get_guard                   
 extern tree get_guard_cond                      PARAMS ((tree));
 extern tree set_guard                           PARAMS ((tree));
 
-/* in parse.y */
-extern void cp_parse_init			PARAMS ((void));
-
 extern void cp_error_at		PARAMS ((const char *msgid, ...));
 extern void cp_warning_at	PARAMS ((const char *msgid, ...));
 extern void cp_pedwarn_at	PARAMS ((const char *msgid, ...));
@@ -3980,7 +3978,6 @@ extern int calls_setjmp_p               
 extern int maybe_clone_body                     PARAMS ((tree));
 
 /* in pt.c */
-extern void init_pt                             PARAMS ((void));
 extern void check_template_shadow		PARAMS ((tree));
 extern tree get_innermost_template_args         PARAMS ((tree, int));
 extern tree tsubst				PARAMS ((tree, tree, tsubst_flags_t, tree));
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.847.2.6
diff -p -u -p -r1.847.2.6 decl.c
--- cp/decl.c	6 Apr 2002 00:08:49 -0000	1.847.2.6
+++ cp/decl.c	9 Apr 2002 19:41:17 -0000
@@ -129,7 +129,6 @@ static void pop_cp_function_context PARA
 static void mark_binding_level PARAMS ((void *));
 static void mark_named_label_lists PARAMS ((void *, void *));
 static void mark_cp_function_context PARAMS ((void *));
-static void mark_saved_scope PARAMS ((void *));
 static void mark_lang_function PARAMS ((struct cp_language_function *));
 static void save_function_data PARAMS ((tree));
 static void check_function_type PARAMS ((tree, tree));
@@ -209,7 +208,7 @@ tree cp_global_trees[CPTI_MAX];
 /* Indicates that there is a type value in some namespace, although
    that is not necessarily in scope at the moment.  */
 
-static tree global_type_node;
+static GTY(()) tree global_type_node;
 
 /* Expect only namespace names now. */
 static int only_namespace_names;
@@ -289,10 +288,6 @@ extern int flag_conserve_space;
 
 /* C and C++ flags are in decl2.c.  */
 
-/* A expression of value 0 with the same precision as a sizetype
-   node, but signed.  */
-tree signed_size_zero_node;
-
 /* The name of the anonymous namespace, throughout this translation
    unit.  */
 tree anonymous_namespace_name;
@@ -473,7 +468,7 @@ static GTY((deletable (""))) struct cp_b
    This is created when the compiler is started and exists
    through the entire run.  */
 
-static struct cp_binding_level *global_binding_level;
+static GTY(()) struct cp_binding_level *global_binding_level;
 
 /* Nonzero means unconditionally make a BLOCK for the next level pushed.  */
 
@@ -923,7 +918,7 @@ note_level_for_catch ()
 /* A free list of CPLUS_BINDING nodes, connected by their
    TREE_CHAINs.  */
 
-static tree free_bindings;
+static GTY((deletable (""))) tree free_bindings;
 
 /* Make DECL the innermost binding for ID.  The LEVEL is the binding
    level at which this declaration is being bound.  */
@@ -2353,39 +2348,6 @@ pop_nested_namespace (ns)
    scope isn't enough, because more binding levels may be pushed.  */
 struct saved_scope *scope_chain;
 
-/* Mark ARG (which is really a struct saved_scope **) for GC.  */
-
-static void
-mark_saved_scope (arg)
-     void *arg;
-{
-  struct saved_scope *t = *(struct saved_scope **)arg;
-  while (t)
-    {
-      mark_binding_level (&t->class_bindings);
-      ggc_mark_tree (t->old_bindings);
-      ggc_mark_tree (t->old_namespace);
-      ggc_mark_tree (t->decl_ns_list);
-      ggc_mark_tree (t->class_name);
-      ggc_mark_tree (t->class_type);
-      ggc_mark_tree (t->access_specifier);
-      ggc_mark_tree (t->function_decl);
-      if (t->lang_base)
-	ggc_mark_tree_varray (t->lang_base);
-      ggc_mark_tree (t->lang_name);
-      ggc_mark_tree (t->template_parms);
-      ggc_mark_tree (t->x_previous_class_type);
-      ggc_mark_tree (t->x_previous_class_values);
-      ggc_mark_tree (t->x_saved_tree);
-      ggc_mark_tree (t->incomplete);
-      ggc_mark_tree (t->lookups);
-
-      mark_stmt_tree (&t->x_stmt_tree);
-      mark_binding_level (&t->bindings);
-      t = t->prev;
-    }
-}
-
 static tree
 store_bindings (names, old_bindings)
      tree names, old_bindings;
@@ -2438,7 +2400,7 @@ maybe_push_to_top_level (pseudo)
   tree old_bindings;
   int need_pop;
 
-  s = (struct saved_scope *) xcalloc (1, sizeof (struct saved_scope));
+  s = (struct saved_scope *) ggc_alloc_cleared (sizeof (struct saved_scope));
 
   b = scope_chain ? current_binding_level : 0;
 
@@ -2524,8 +2486,6 @@ pop_from_top_level ()
   if (s->need_pop_function_context)
     pop_function_context_from (NULL_TREE);
   current_function_decl = s->function_decl;
-
-  free (s);
 }
 
 /* Push a definition of struct, union or enum tag "name".
@@ -6388,9 +6348,7 @@ cxx_init_decl_processing ()
   mark_lang_status = &mark_cp_function_context;
   lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p;
 
-  cp_parse_init ();
   init_decl2 ();
-  init_pt ();
 
   /* Create the global variables.  */
   push_to_top_level ();
@@ -6474,9 +6432,6 @@ cxx_init_decl_processing ()
   boolean_true_node = build_int_2 (1, 0);
   TREE_TYPE (boolean_true_node) = boolean_type_node;
 
-  signed_size_zero_node = build_int_2 (0, 0);
-  TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype));
-
   empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
 
 #if 0
@@ -6588,35 +6543,6 @@ cxx_init_decl_processing ()
      say -fwritable-strings?  */
   if (flag_writable_strings)
     flag_const_strings = 0;
-
-  /* Add GC roots for all of our global variables.  */
-  ggc_add_tree_root (c_global_trees, ARRAY_SIZE (c_global_trees));
-  ggc_add_tree_root (cp_global_trees, ARRAY_SIZE (cp_global_trees));
-  ggc_add_tree_root (&integer_three_node, 1);
-  ggc_add_tree_root (&integer_two_node, 1);
-  ggc_add_tree_root (&signed_size_zero_node, 1);
-  ggc_add_tree_root (&size_one_node, 1);
-  ggc_add_tree_root (&size_zero_node, 1);
-  ggc_add_root (&global_binding_level, 1, sizeof global_binding_level,
-		mark_binding_level);
-  ggc_add_root (&scope_chain, 1, sizeof scope_chain, &mark_saved_scope);
-  ggc_add_tree_root (&static_ctors, 1);
-  ggc_add_tree_root (&static_dtors, 1);
-  ggc_add_tree_root (&lastiddecl, 1);
-
-  ggc_add_tree_root (&last_function_parms, 1);
-  ggc_add_tree_root (&error_mark_list, 1);
-
-  ggc_add_tree_root (&global_namespace, 1);
-  ggc_add_tree_root (&global_type_node, 1);
-  ggc_add_tree_root (&anonymous_namespace_name, 1);
-
-  ggc_add_tree_root (&got_object, 1);
-  ggc_add_tree_root (&got_scope, 1);
-
-  ggc_add_tree_root (&current_lang_name, 1);
-  ggc_add_tree_root (&static_aggregates, 1);
-  ggc_add_tree_root (&free_bindings, 1);
 }
 
 /* Generate an initializer for a function naming variable from
Index: cp/decl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.h,v
retrieving revision 1.7
diff -p -u -p -r1.7 decl.h
--- cp/decl.h	9 Jan 2002 06:32:47 -0000	1.7
+++ cp/decl.h	9 Apr 2002 19:41:17 -0000
@@ -36,13 +36,13 @@ extern tree grokdeclarator PARAMS ((tree
 
 /* Parsing a function declarator leaves a list of parameter names
    or a chain or parameter decls here.  */
-extern tree last_function_parms;
+extern GTY(()) tree last_function_parms;
 
 /* A list of objects which have constructors or destructors
    which reside in the global scope.  The decl is stored in
    the TREE_VALUE slot and the initializer is stored
    in the TREE_PURPOSE slot.  */
-extern tree static_aggregates;
+extern GTY(()) tree static_aggregates;
 
 #ifdef DEBUG_CP_BINDING_LEVELS
 /* Purely for debugging purposes.  */
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.512.2.2
diff -p -u -p -r1.512.2.2 decl2.c
--- cp/decl2.c	14 Mar 2002 21:37:11 -0000	1.512.2.2
+++ cp/decl2.c	9 Apr 2002 19:41:18 -0000
@@ -2777,13 +2777,13 @@ finish_objects (method_type, initp, body
 #define SSDF_IDENTIFIER "__static_initialization_and_destruction"
 
 /* The declaration for the __INITIALIZE_P argument.  */
-static tree initialize_p_decl;
+static GTY(()) tree initialize_p_decl;
 
 /* The declaration for the __PRIORITY argument.  */
-static tree priority_decl;
+static GTY(()) tree priority_decl;
 
 /* The declaration for the static storage duration function.  */
-static tree ssdf_decl;
+static GTY(()) tree ssdf_decl;
 
 /* All the static storage duration functions created in this
    translation unit.  */
@@ -5274,7 +5274,6 @@ init_decl2 ()
   ggc_add_tree_varray_root (&deferred_fns, 1);
   ggc_add_tree_varray_root (&pending_statics, 1);
   ggc_add_tree_varray_root (&ssdf_decls, 1);
-  ggc_add_tree_root (&ssdf_decl, 1);
-  ggc_add_tree_root (&priority_decl, 1);
-  ggc_add_tree_root (&initialize_p_decl, 1);
 }
+
+#include "gt-cp-decl2.h"
Index: cp/lex.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.h,v
retrieving revision 1.16
diff -p -u -p -r1.16 lex.h
--- cp/lex.h	26 May 2001 01:31:45 -0000	1.16
+++ cp/lex.h	9 Apr 2002 19:41:18 -0000
@@ -68,15 +68,15 @@ typedef unsigned long RID_BIT_TYPE;	/* a
    yylex must look this up to detect typedefs, which get token type TYPENAME,
    so it is left around in case the identifier is not a typedef but is
    used in a context which makes it a reference to a variable.  */
-extern tree lastiddecl;
+extern GTY(()) tree lastiddecl;
 
 /* Back-door communication channel to the lexer.  */
 extern int looking_for_typename;
 extern int looking_for_template;
 
 /* Tell the lexer where to look for names.  */
-extern tree got_scope;
-extern tree got_object;
+extern GTY(()) tree got_scope;
+extern GTY(()) tree got_object;
 
 /* Pending language change.
    Positive is push count, negative is pop count.  */
Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parse.y,v
retrieving revision 1.240.6.2
diff -p -u -p -r1.240.6.2 parse.y
--- cp/parse.y	14 Mar 2002 21:37:13 -0000	1.240.6.2
+++ cp/parse.y	9 Apr 2002 19:41:18 -0000
@@ -62,21 +62,21 @@ int have_extern_spec;
 int used_extern_spec;
 
 /* List of types and structure classes of the current declaration.  */
-static tree current_declspecs;
+static GTY(()) tree current_declspecs;
 
 /* List of prefix attributes in effect.
    Prefix attributes are parsed by the reserved_declspecs and declmods
    rules.  They create a list that contains *both* declspecs and attrs.  */
 /* ??? It is not clear yet that all cases where an attribute can now appear in
    a declspec list have been updated.  */
-static tree prefix_attributes;
+static GTY(()) tree prefix_attributes;
 
 /* When defining an enumeration, this is the type of the enumeration.  */
-static tree current_enum_type;
+static GTY(()) tree current_enum_type;
 
 /* When parsing a conversion operator name, this is the scope of the
    operator itself.  */
-static tree saved_scopes;
+static GTY(()) tree saved_scopes;
 
 static tree empty_parms PARAMS ((void));
 static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
@@ -220,15 +220,6 @@ check_class_key (key, aggr)
 	     : key == record_type_node ? "struct" : "class", aggr);
 }
 
-void
-cp_parse_init ()
-{
-  ggc_add_tree_root (&current_declspecs, 1);
-  ggc_add_tree_root (&prefix_attributes, 1);
-  ggc_add_tree_root (&current_enum_type, 1);
-  ggc_add_tree_root (&saved_scopes, 1);
-}
-
 /* Rename the "yyparse" function so that we can override it elsewhere.  */
 #define yyparse yyparse_1
 %}
@@ -3971,3 +3962,5 @@ debug_yytranslate (value)
 }
 
 #endif
+
+#include "gt-cp-parse.h"
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.572.4.2
diff -p -u -p -r1.572.4.2 pt.c
--- cp/pt.c	14 Mar 2002 21:37:13 -0000	1.572.4.2
+++ cp/pt.c	9 Apr 2002 19:41:20 -0000
@@ -56,17 +56,17 @@ extern struct obstack permanent_obstack;
    the instantiate request occurred; the TREE_VALUE is a either a DECL
    (for a function or static data member), or a TYPE (for a class)
    indicating what we are hoping to instantiate.  */
-static tree pending_templates;
+static GTY(()) tree pending_templates;
 static tree last_pending_template;
 
 int processing_template_parmlist;
 static int template_header_count;
 
-static tree saved_trees;
+static GTY(()) tree saved_trees;
 static varray_type inline_parm_levels;
 static size_t inline_parm_levels_used;
 
-static tree current_tinst_level;
+static GTY(()) tree current_tinst_level;
 
 /* A map from local variable declarations in the body of the template
    presently being instantiated to the corresponding instantiated
@@ -169,16 +169,6 @@ static tree copy_default_args_to_explici
 static void copy_default_args_to_explicit_spec PARAMS ((tree));
 static int invalid_nontype_parm_type_p PARAMS ((tree, tsubst_flags_t));
 
-/* Called once to initialize pt.c.  */
-
-void
-init_pt ()
-{
-  ggc_add_tree_root (&pending_templates, 1);
-  ggc_add_tree_root (&saved_trees, 1);
-  ggc_add_tree_root (&current_tinst_level, 1);
-}
-
 /* Do any processing required when DECL (a member template declaration
    using TEMPLATE_PARAMETERS as its innermost parameter list) is
    finished.  Returns the TEMPLATE_DECL corresponding to DECL, unless
@@ -10378,3 +10368,5 @@ invalid_nontype_parm_type_p (type, compl
               type);
   return 1;
 }
+
+#include "gt-cp-pt.h"
Index: cp/repo.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/repo.c,v
retrieving revision 1.38.12.1
diff -p -u -p -r1.38.12.1 repo.c
--- cp/repo.c	13 Feb 2002 23:36:31 -0000	1.38.12.1
+++ cp/repo.c	9 Apr 2002 19:41:20 -0000
@@ -42,8 +42,8 @@ static void open_repo_file PARAMS ((cons
 static char *afgets PARAMS ((FILE *));
 static void reopen_repo_file_for_write PARAMS ((void));
 
-static tree pending_repo;
-static tree original_repo;
+static GTY(()) tree pending_repo;
+static GTY(()) tree original_repo;
 static char *repo_name;
 static FILE *repo_file;
 
@@ -320,8 +320,6 @@ init_repo (filename)
   if (! flag_use_repository)
     return;
 
-  ggc_add_tree_root (&pending_repo, 1);
-  ggc_add_tree_root (&original_repo, 1);
   gcc_obstack_init (&temporary_obstack);
 
   open_repo_file (filename);
@@ -458,3 +456,5 @@ finish_repo ()
   if (repo_file)
     fclose (repo_file);
 }
+
+#include "gt-cp-repo.h"
Index: cp/spew.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/spew.c,v
retrieving revision 1.58.2.1
diff -p -u -p -r1.58.2.1 spew.c
--- cp/spew.c	13 Feb 2002 23:36:33 -0000	1.58.2.1
+++ cp/spew.c	9 Apr 2002 19:41:20 -0000
@@ -167,10 +167,14 @@ char *inline_text_firstobj;
    the TREE_TYPE is the current_class_type, TREE_VALUE is the FUNCTION_DECL,
    and TREE_PURPOSE is the list unprocessed dependent functions.  */
 
-static tree defarg_fns;     /* list of functions with unprocessed defargs */
-static tree defarg_parm;    /* current default parameter */
-static tree defarg_depfns;  /* list of unprocessed fns met during current fn. */
-static tree defarg_fnsdone; /* list of fns with circular defargs */
+/* list of functions with unprocessed defargs */
+static GTY(()) tree defarg_fns;
+/* current default parameter */
+static GTY(()) tree defarg_parm;
+/* list of unprocessed fns met during current fn. */
+static GTY(()) tree defarg_depfns;
+/* list of fns with circular defargs */
+static GTY(()) tree defarg_fnsdone;
 
 /* Initialize obstacks. Called once, from cxx_init.  */
 
@@ -181,10 +185,6 @@ init_spew ()
   inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0);
   gcc_obstack_init (&token_obstack);
   gcc_obstack_init (&feed_obstack);
-  ggc_add_tree_root (&defarg_fns, 1);
-  ggc_add_tree_root (&defarg_parm, 1);
-  ggc_add_tree_root (&defarg_depfns, 1);
-  ggc_add_tree_root (&defarg_fnsdone, 1);
 
   ggc_add_root (&pending_inlines, 1, sizeof (struct unparsed_text *),
 		mark_pending_inlines);
@@ -1501,3 +1501,5 @@ yyerror (msgid)
   else
     error ("%s before `%s' token", string, NAME (last_token));
 }
+
+#include "gt-cp-spew.h"
Index: java/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Make-lang.in,v
retrieving revision 1.78.6.3
diff -p -u -p -r1.78.6.3 Make-lang.in
--- java/Make-lang.in	6 Apr 2002 00:08:51 -0000	1.78.6.3
+++ java/Make-lang.in	9 Apr 2002 19:41:23 -0000
@@ -101,7 +101,7 @@ $(srcdir)/java/keyword.h: $(srcdir)/java
 gt-java-class.h gt-java-constants.h gt-java-decl.h : s-gtype ; @true
 gt-java-expr.h gt-java-jcf-parse.h gt-java-jcf-write.h : s-gtype ; @true
 gt-java-lang.h gt-java-mangle.h gt-java-parse.h : s-gtype ; @true
-gtype-java.h : s-gtype ; @true
+gt-java-builtins.h gtype-java.h : s-gtype ; @true
 
 # Executables built by this Makefile:
 JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
@@ -267,7 +267,7 @@ java/boehm.o: java/boehm.c $(CONFIG_H) $
   java/parse.h toplev.h
 java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) toplev.h
 java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
-  $(GGC_H) flags.h
+  $(GGC_H) flags.h gt-java-builtins.h
 java/check-init.o: java/check-init.c $(CONFIG_H) \
   $(JAVA_TREE_H) $(SYSTEM_H) toplev.h
 java/class.o: java/class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
Index: java/builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/builtins.c,v
retrieving revision 1.2.2.2
diff -p -u -p -r1.2.2.2 builtins.c
--- java/builtins.c	14 Mar 2002 21:37:28 -0000	1.2.2.2
+++ java/builtins.c	9 Apr 2002 19:41:23 -0000
@@ -83,21 +83,21 @@ typedef tree builtin_creator_function PA
 
 /* Hold a char*, before initialization, or a tree, after
    initialization.  */
-union string_or_tree
+union string_or_tree GTY(())
 {
-  const char *s;
-  tree t;
+  const char * GTY ((tag ("0"))) s;
+  tree GTY ((tag ("1"))) t;
 };
 
 /* Used to hold a single builtin record.  */
-struct builtin_record
+struct builtin_record GTY(())
 {
-  union string_or_tree class_name;
-  union string_or_tree method_name;
-  builtin_creator_function *creator;
+  union string_or_tree GTY ((desc ("1"))) class_name;
+  union string_or_tree GTY ((desc ("1"))) method_name;
+  builtin_creator_function * GTY((skip (""))) creator;
 };
 
-static struct builtin_record java_builtins[] =
+static GTY(()) struct builtin_record java_builtins[] =
 {
   { { "java.lang.Math" }, { "min" }, min_builtin },
   { { "java.lang.Math" }, { "max" }, max_builtin },
@@ -273,8 +273,6 @@ initialize_builtins ()
 
       java_builtins[i].class_name.t = klass_id;
       java_builtins[i].method_name.t = m;
-      ggc_add_tree_root (&java_builtins[i].class_name.t, 1);
-      ggc_add_tree_root (&java_builtins[i].method_name.t, 1);
     }
 
   void_list_node = end_params_node;
@@ -348,3 +346,5 @@ check_for_builtin (method, call)
     }
   return call;
 }
+
+#include "gt-java-builtins.h"
Index: java/config-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/config-lang.in,v
retrieving revision 1.12.6.1
diff -p -u -p -r1.12.6.1 config-lang.in
--- java/config-lang.in	6 Apr 2002 00:08:52 -0000	1.12.6.1
+++ java/config-lang.in	9 Apr 2002 19:41:23 -0000
@@ -36,7 +36,7 @@ compilers="jc1\$(exeext) jvgenmain\$(exe
 
 stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) gcjh\$(exeext) jv-scan\$(exeext) jcf-dump\$(exeext)"
 
-gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/jcf-write.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/parse.y"
+gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/builtins.c \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/jcf-write.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/parse.y"
 
 target_libs=${libgcj_saved}
 lang_dirs="zlib fastjar"
============================================================


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