summaryrefslogtreecommitdiff
path: root/gcc/ggc-simple.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-05 16:08:20 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-05 16:08:20 +0000
commit1bfd55c5832c63621f3f1eac29139cd28f3d17e5 (patch)
tree53f583f3f8569b93ca268331c1f771e401b63045 /gcc/ggc-simple.c
parent68e99b40dd8701fe7d675acb9cdff108e5ad630a (diff)
downloadgcc-1bfd55c5832c63621f3f1eac29139cd28f3d17e5.tar.gz
* Makefile.in (ggc-simple.o): Depend on varray.h.
(rtl.o): Depend on ggc.h. (genattrtab.o): Depend on ggc.h. (print-tree.o): Likewise. (fold-const.o): Likewise. * emit-rtl.c (sequence_element_free_list): Remove, and all references. (make_insn_raw): Don't cache insns when GC'ing. (emit_insn_before): Likewise. (emit_insn_after): Likewise. (emit_insn): Likewise. (start_sequence): Use xmalloc to allocate the sequence_stack. (end_sequence): Add free to free it. (gen_sequence): Don't cache insns when GC'ing. (clear_emit_caches): Don't use sequence_element_free_list. (init_emit): Use xcalloc, not xmalloc+bzero. * fold-const.c (size_int_wide): Kill the cache, when GC'ing. * function.c (pop_function_context_from): Use free to free the fixup_var_refs_queue. (put_reg_into_stack): Allocate it with xmalloc. * genattrtab.c: Include ggc.h. (operate_exp): Don't use obstack_free when GC'ing. (simplify_cond): Likewise. (simplify_text_exp): Likewise. (optimize_attrs): Likewise. * gengentrtl.c (gendef): Use ggc_alloc_rtx to allocate RTL, when GC'ing. (gencode): Generate a #include for ggc.h. * ggc-callbacks.c (ggc_p): Define it to zero. * ggc-none.c (ggc_p): Likewise. * ggc-simple.c: Include varray.h. (ggc_mark_tree_varray): New function. (ggc_add_tree_varray_root): Likewise. (ggc_mark_tree_varray_ptr): Likewise. * ggc.h (ggc_p): Declare. (varray_head_tag): Likewise. (ggc_add_tree_varray_root): Declare. * print-tree.c (print_node): Don't check for TREE_PERMANENT inconsistencies when GC'ing. * rtl.c: Include ggc.h. (rtvec_alloc): Use ggc_alloc_rtvec when GC'ing. (rtx_alloc): Use ggc_alloc_rtx when GC'ing. (rtx_free): Don't call obstack_free when GC'ing. * toplev.c (rest_of_compilation): Call ggc_collect after every pass, if GC'ing. * tree.c (push_obstacks): Do nothing, if GC'ing. (pop_obstacks_nochange): Likewise. (pop_obstacks): Likewise. (make_node): Use ggc_alloc_tree when GC'ing. (copy_node): Likewise. (get_identifier): Use ggc_alloc_string when GC'ing. (build_string): Likewise. (make_tree_vec): Use ggc_alloc_tree when GC'ing. (tree_cons): Likewise. (build1): Likewise. (type_hash_canon): Don't call obstack_free when GC'ing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29125 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-simple.c')
-rw-r--r--gcc/ggc-simple.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c
index 1d0432d8940..0e7b53fc185 100644
--- a/gcc/ggc-simple.c
+++ b/gcc/ggc-simple.c
@@ -24,6 +24,7 @@
#include "tree.h"
#include "ggc.h"
#include "flags.h"
+#include "varray.h"
/* Debugging flags. */
#undef GGC_DUMP
@@ -96,6 +97,7 @@ static void ggc_free_rtx PROTO ((struct ggc_rtx *r));
static void ggc_free_tree PROTO ((struct ggc_tree *t));
static void ggc_mark_rtx_ptr PROTO ((void *elt));
static void ggc_mark_tree_ptr PROTO ((void *elt));
+static void ggc_mark_tree_varray_ptr PROTO ((void *elt));
/* These allocators are dreadfully simple, with no caching whatsoever so
that Purify-like tools that do allocation versioning can catch errors.
@@ -472,6 +474,18 @@ ggc_mark_tree (t)
}
}
+/* Mark all the elements of the varray V, which contains trees. */
+
+void
+ggc_mark_tree_varray (v)
+ varray_type v;
+{
+ int i;
+
+ for (i = v->num_elements - 1; i >= 0; --i)
+ ggc_mark_tree (VARRAY_TREE (v, i));
+}
+
void
ggc_mark_string (s)
char *s;
@@ -645,6 +659,17 @@ ggc_add_tree_root (base, nelt)
ggc_add_root (base, nelt, sizeof(tree), ggc_mark_tree_ptr);
}
+/* Add vV (a varray full of trees) to the list of GC roots. */
+
+void
+ggc_add_tree_varray_root (base, nelt)
+ varray_type *base;
+ int nelt;
+{
+ ggc_add_root (base, nelt, sizeof (varray_type),
+ ggc_mark_tree_varray_ptr);
+}
+
void
ggc_del_root (base)
void *base;
@@ -681,6 +706,16 @@ ggc_mark_tree_ptr (elt)
ggc_mark_tree (*(tree *)elt);
}
+/* Type-correct function to pass to ggc_add_root. It just forwards
+ ELT (which is really a varray_type *) to ggc_mark_tree_varray. */
+
+static void
+ggc_mark_tree_varray_ptr (elt)
+ void *elt;
+{
+ ggc_mark_tree_varray (*(varray_type *)elt);
+}
+
#ifdef GGC_DUMP
/* Don't enable this unless you want a really really lot of data. */
static void __attribute__((constructor))