* Makefile.in (GTFILES): Add cgraph.h.
* cgraph.c (known_decls): Remove.
(cgraph_hash, cgraph_nodes, cgraph_nodes_queue,
cgraph_varpool_hash, cgraph_varpool_nodes_queue): GTYize.
(cgraph_node): Do not allocate known_decls; use polutate hashtable.
(cgraph_varpool_node): Likewise; add next pointer.
(cgraph_varpool_nodes): New static variable.
* cgraph.h (cgraph_local_info, cgraph_global_info, cgraph_rtl_info,
cgraph_node, cgraph_edge, cgraph_varpool_node, cgraph_nodes, cgraph_n_nodes,
cgraph_varpool_n_nodes, cgraph_varpool_nodes_queue): GTYize.
* gengtype.c (open_base_files): Include cgraph.h
From-SVN: r68742
+Mon Jun 30 23:47:33 CEST 2003 Jan Hubicka <jh@suse.cz>
+
+ * Makefile.in (GTFILES): Add cgraph.h.
+ * cgraph.c (known_decls): Remove.
+ (cgraph_hash, cgraph_nodes, cgraph_nodes_queue,
+ cgraph_varpool_hash, cgraph_varpool_nodes_queue): GTYize.
+ (cgraph_node): Do not allocate known_decls; use polutate hashtable.
+ (cgraph_varpool_node): Likewise; add next pointer.
+ (cgraph_varpool_nodes): New static variable.
+ * cgraph.h (cgraph_local_info, cgraph_global_info, cgraph_rtl_info,
+ cgraph_node, cgraph_edge, cgraph_varpool_node, cgraph_nodes, cgraph_n_nodes,
+ cgraph_varpool_n_nodes, cgraph_varpool_nodes_queue): GTYize.
+ * gengtype.c (open_base_files): Include cgraph.h
+
2003-06-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* Changelog: Remove ">>>>>>>" from previous change.
$(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h $(srcdir)/rtl.h \
$(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \
$(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h \
- $(srcdir)/cselib.h $(srcdir)/basic-block.h \
+ $(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \
$(srcdir)/c-common.h $(srcdir)/c-tree.h \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
$(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
#include "varray.h"
#include "output.h"
-/* The known declarations must not get garbage collected. Callgraph
- datastructures should not get saved via PCH code since this would
- make it difficult to extend into intra-module optimizer later. So
- we store only the references into the array to prevent gabrage
- collector from deleting live data. */
-static GTY(()) varray_type known_decls;
/* Hash table used to convert declarations into nodes. */
-static htab_t cgraph_hash = 0;
+static GTY((param_is (struct cgraph_node))) htab_t cgraph_hash;
/* The linked list of cgraph nodes. */
struct cgraph_node *cgraph_nodes;
bool cgraph_global_info_ready = false;
/* Hash table used to convert declarations into nodes. */
-static htab_t cgraph_varpool_hash = 0;
+static GTY((param_is (struct cgraph_varpool_node))) htab_t cgraph_varpool_hash;
/* Queue of cgraph nodes scheduled to be lowered and output. */
struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
/* Number of nodes in existence. */
int cgraph_varpool_n_nodes;
+/* The linked list of cgraph varpool nodes. */
+static GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes;
+
static struct cgraph_edge *create_edge PARAMS ((struct cgraph_node *,
struct cgraph_node *));
static void cgraph_remove_edge PARAMS ((struct cgraph_node *, struct cgraph_node *));
hash_node (p)
const void *p;
{
- return (hashval_t)
- htab_hash_pointer (DECL_ASSEMBLER_NAME
- (((struct cgraph_node *) p)->decl));
+ return ((hashval_t)
+ IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME
+ (((struct cgraph_node *) p)->decl)));
}
/* Returns nonzero if P1 and P2 are equal. */
abort ();
if (!cgraph_hash)
- {
- cgraph_hash = htab_create (10, hash_node, eq_node, NULL);
- if (!known_decls)
- VARRAY_TREE_INIT (known_decls, 32, "known_decls");
- }
+ cgraph_hash = htab_create_ggc (10, hash_node, eq_node, NULL);
- slot =
- (struct cgraph_node **) htab_find_slot_with_hash (cgraph_hash,
- DECL_ASSEMBLER_NAME (decl),
- htab_hash_pointer
- (DECL_ASSEMBLER_NAME
- (decl)), 1);
+ slot = (struct cgraph_node **)
+ htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (decl),
+ IDENTIFIER_HASH_VALUE
+ (DECL_ASSEMBLER_NAME (decl)), 1);
if (*slot)
return *slot;
- node = xcalloc (sizeof (*node), 1);
+ node = ggc_alloc_cleared (sizeof (*node));
node->decl = decl;
node->next = cgraph_nodes;
if (cgraph_nodes)
node->next_nested = node->origin->nested;
node->origin->nested = node;
}
- VARRAY_PUSH_TREE (known_decls, decl);
return node;
}
if (!cgraph_hash)
return NULL;
- slot =
- (struct cgraph_node **) htab_find_slot_with_hash (cgraph_hash, id,
- htab_hash_pointer (id), 0);
+ slot = (struct cgraph_node **)
+ htab_find_slot_with_hash (cgraph_hash, id,
+ IDENTIFIER_HASH_VALUE (id), 0);
if (!slot)
return NULL;
return *slot;
create_edge (caller, callee)
struct cgraph_node *caller, *callee;
{
- struct cgraph_edge *edge = xmalloc (sizeof (struct cgraph_edge));
+ struct cgraph_edge *edge = ggc_alloc (sizeof (struct cgraph_edge));
edge->caller = caller;
edge->callee = callee;
static hashval_t
cgraph_varpool_hash_node (const PTR p)
{
- return (hashval_t)
- htab_hash_pointer (DECL_ASSEMBLER_NAME
- (((struct cgraph_varpool_node *) p)->decl));
+ return ((hashval_t)
+ IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME
+ (((struct cgraph_varpool_node *) p)->decl)));
}
/* Returns nonzero if P1 and P2 are equal. */
abort ();
if (!cgraph_varpool_hash)
- {
- cgraph_varpool_hash = htab_create (10, cgraph_varpool_hash_node, eq_cgraph_varpool_node, NULL);
- if (!known_decls)
- VARRAY_TREE_INIT (known_decls, 32, "known_decls");
- }
+ cgraph_varpool_hash = htab_create_ggc (10, cgraph_varpool_hash_node,
+ eq_cgraph_varpool_node, NULL);
+
- slot =
- (struct cgraph_varpool_node **) htab_find_slot_with_hash (cgraph_varpool_hash,
- DECL_ASSEMBLER_NAME (decl),
- htab_hash_pointer
- (DECL_ASSEMBLER_NAME
- (decl)), 1);
+ slot = (struct cgraph_varpool_node **)
+ htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl),
+ IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (decl)),
+ 1);
if (*slot)
return *slot;
- node = xcalloc (sizeof (*node), 1);
+ node = ggc_alloc_cleared (sizeof (*node));
node->decl = decl;
cgraph_varpool_n_nodes++;
+ cgraph_varpool_nodes = node;
*slot = node;
- VARRAY_PUSH_TREE (known_decls, decl);
return node;
}
if (!cgraph_varpool_hash)
return NULL;
- slot =
- (struct cgraph_varpool_node **) htab_find_slot_with_hash (cgraph_varpool_hash, id,
- htab_hash_pointer (id), 0);
+ slot = (struct cgraph_varpool_node **)
+ htab_find_slot_with_hash (cgraph_varpool_hash, id,
+ IDENTIFIER_HASH_VALUE (id), 0);
if (!slot)
return NULL;
return *slot;
/* Information about the function collected locally.
Available after function is lowered */
-struct cgraph_local_info
+struct cgraph_local_info GTY(())
{
/* Set when function function is visiable in current compilation unit only
and it's address is never taken. */
/* Information about the function that needs to be computed globally
once compilation is finished. Available only with -funit-at-time. */
-struct cgraph_global_info
+struct cgraph_global_info GTY(())
{
/* Set when the function will be inlined exactly once. */
bool inline_once;
/* Information about the function that is propagated by the RTL backend.
Available only for functions that has been already assembled. */
-struct cgraph_rtl_info
+struct cgraph_rtl_info GTY(())
{
- bool const_function, pure_function;
+ bool const_function;
+ bool pure_function;
int preferred_incoming_stack_boundary;
};
/* The cgraph data strutcture.
Each function decl has assigned cgraph_node listing calees and callers. */
-struct cgraph_node
+struct cgraph_node GTY(())
{
tree decl;
struct cgraph_edge *callees;
struct cgraph_edge *callers;
- struct cgraph_node *next, *previous;
+ struct cgraph_node *next;
+ struct cgraph_node *previous;
/* For nested functions points to function the node is nested in. */
struct cgraph_node *origin;
/* Points to first nested function, if any. */
struct cgraph_node *nested;
/* Pointer to the next function with same origin, if any. */
struct cgraph_node *next_nested;
- void *aux;
+ PTR GTY ((skip (""))) aux;
/* Set when function must be output - it is externally visible
or it's address is taken. */
struct cgraph_rtl_info rtl;
};
-struct cgraph_edge
+struct cgraph_edge GTY(())
{
- struct cgraph_node *caller, *callee;
+ struct cgraph_node *caller;
+ struct cgraph_node *callee;
struct cgraph_edge *next_caller;
struct cgraph_edge *next_callee;
};
/* The cgraph_varpool data strutcture.
Each static variable decl has assigned cgraph_varpool_node. */
-struct cgraph_varpool_node
+struct cgraph_varpool_node GTY(())
{
tree decl;
- void *aux;
+ PTR GTY ((skip (""))) aux;
/* Set when function must be output - it is externally visible
or it's address is taken. */
bool output;
};
-extern struct cgraph_node *cgraph_nodes;
-extern int cgraph_n_nodes;
+extern GTY(()) struct cgraph_node *cgraph_nodes;
+extern GTY(()) int cgraph_n_nodes;
extern bool cgraph_global_info_ready;
-extern struct cgraph_node *cgraph_nodes_queue;
+extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
-extern int cgraph_varpool_n_nodes;
-extern struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
+extern GTY(()) int cgraph_varpool_n_nodes;
+extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
/* In cgraph.c */
"hashtab.h", "splay-tree.h", "bitmap.h", "tree.h", "rtl.h",
"function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
"basic-block.h", "cselib.h", "insn-addr.h", "ssa.h", "optabs.h",
- "libfuncs.h", "debug.h", "ggc.h",
+ "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
NULL
};
const char *const *ifp;