dwarf2out.c (dwarf2out_init): Use ggc_add_rtx_varray_root.

* dwarf2out.c (dwarf2out_init): Use ggc_add_rtx_varray_root.
        * ggc-common.c (ggc_add_rtx_varray_root): New.
        (ggc_mark_rtx_varray): New.
        (ggc_mark_rtx_varray_ptr): New.  Shift all ggc_mark_foo_ptr
        functions down below ggc_mark_foo.
        * ggc.h (ggc_add_rtx_varray_root, ggc_mark_rtx_varray): Declare.

From-SVN: r31607
This commit is contained in:
Richard Henderson 2000-01-25 02:47:46 -08:00 committed by Richard Henderson
parent 41bd3d4130
commit ef8288f7de
4 changed files with 98 additions and 52 deletions

View File

@ -1,3 +1,12 @@
2000-01-25 Richard Henderson <rth@cygnus.com>
* dwarf2out.c (dwarf2out_init): Use ggc_add_rtx_varray_root.
* ggc-common.c (ggc_add_rtx_varray_root): New.
(ggc_mark_rtx_varray): New.
(ggc_mark_rtx_varray_ptr): New. Shift all ggc_mark_foo_ptr
functions down below ggc_mark_foo.
* ggc.h (ggc_add_rtx_varray_root, ggc_mark_rtx_varray): Declare.
2000-01-25 Richard Henderson <rth@cygnus.com>
* alpha.c (secondary_reload_class): Don't allocate a secondary

View File

@ -9829,7 +9829,7 @@ dwarf2out_init (asm_out_file, main_input_filename)
if (ggc_p)
{
VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray");
ggc_add_tree_varray_root (&used_rtx_varray, 1);
ggc_add_rtx_varray_root (&used_rtx_varray, 1);
}
ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);

View File

@ -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,

View File

@ -50,12 +50,14 @@ void ggc_add_root PARAMS ((void *base, int nelt, int size, void (*)(void *)));
void ggc_add_rtx_root PARAMS ((struct rtx_def **, int nelt));
void ggc_add_tree_root PARAMS ((union tree_node **, int nelt));
void ggc_add_string_root PARAMS ((char **, int nelt));
void ggc_add_rtx_varray_root PARAMS ((struct varray_head_tag **, int nelt));
void ggc_add_tree_varray_root PARAMS ((struct varray_head_tag **, int nelt));
void ggc_add_tree_hash_table_root PARAMS ((struct hash_table **, int nelt));
void ggc_del_root PARAMS ((void *base));
/* Mark nodes from the gc_add_root callback. These functions follow
pointers to mark other objects too. */
extern void ggc_mark_rtx_varray PARAMS ((struct varray_head_tag *));
extern void ggc_mark_tree_varray PARAMS ((struct varray_head_tag *));
extern void ggc_mark_tree_hash_table PARAMS ((struct hash_table *));
extern void ggc_mark_roots PARAMS ((void));