diff options
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r-- | gcc/ggc-common.c | 137 |
1 files changed, 86 insertions, 51 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 55d7db4..bc2a9dc 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -35,6 +35,7 @@ static ggc_statistics *ggc_stats; 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 *)); static void ggc_mark_string_ptr PARAMS ((void *)); @@ -56,57 +57,6 @@ struct ggc_root static struct ggc_root *roots; -/* Type-correct function to pass to ggc_add_root. It just forwards - *ELT (which is an rtx) to ggc_mark_tree_varray. */ - -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 - 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); -} - -/* Type-correct function to pass to ggc_add_root. It just forwards - ELT (which is really a struct hash_table **) to - ggc_mark_tree_hash_table. */ - -static void -ggc_mark_tree_hash_table_ptr (elt) - void *elt; -{ - ggc_mark_tree_hash_table (*(struct hash_table **) elt); -} - -/* Type-correct function to pass to ggc_add_root. It just forwards - ELT (which is really a char **) to ggc_mark_string. */ - -static void -ggc_mark_string_ptr (elt) - void *elt; -{ - ggc_mark_string (*(char **) elt); -} - /* Add BASE as a new garbage collection root. It is an array of length NELT with each element SIZE bytes long. CB is a function that will be called with a pointer to each element @@ -150,6 +100,17 @@ ggc_add_tree_root (base, nelt) ggc_add_root (base, nelt, sizeof(tree), ggc_mark_tree_ptr); } +/* Register a varray of rtxs as a GC root. */ + +void +ggc_add_rtx_varray_root (base, nelt) + varray_type *base; + int nelt; +{ + ggc_add_root (base, nelt, sizeof (varray_type), + ggc_mark_rtx_varray_ptr); +} + /* Register a varray of trees as a GC root. */ void @@ -476,6 +437,19 @@ ggc_mark_tree_children (t) } } +/* Mark all the elements of the varray V, which contains rtxs. */ + +void +ggc_mark_rtx_varray (v) + varray_type v; +{ + int i; + + if (v) + for (i = v->num_elements - 1; i >= 0; --i) + ggc_mark_rtx (VARRAY_RTX (v, i)); +} + /* Mark all the elements of the varray V, which contains trees. */ void @@ -509,6 +483,67 @@ ggc_mark_tree_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 + ELT (which is really a varray_type *) to ggc_mark_rtx_varray. */ + +static void +ggc_mark_rtx_varray_ptr (elt) + void *elt; +{ + ggc_mark_rtx_varray (*(varray_type *) 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); +} + +/* Type-correct function to pass to ggc_add_root. It just forwards + ELT (which is really a struct hash_table **) to + ggc_mark_tree_hash_table. */ + +static void +ggc_mark_tree_hash_table_ptr (elt) + void *elt; +{ + ggc_mark_tree_hash_table (*(struct hash_table **) elt); +} + +/* Type-correct function to pass to ggc_add_root. It just forwards + ELT (which is really a char **) to ggc_mark_string. */ + +static void +ggc_mark_string_ptr (elt) + void *elt; +{ + ggc_mark_string (*(char **) elt); +} + /* Allocate a gc-able string. If CONTENTS is null, then the memory will be uninitialized. If LENGTH is -1, then CONTENTS is assumed to be a null-terminated string and the memory sized accordingly. Otherwise, |