aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-03-08 19:24:22 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2003-03-08 18:24:22 +0000
commit988d1653869158be80b797b13a60dacfc0a4fa22 (patch)
tree924b2a2b8d25bda315a461b330cfaa8c18cad7c1 /gcc/cgraph.c
parent73ba39fc86a4697b0c25fcf7cb52a577a356fb0a (diff)
downloadgcc-988d1653869158be80b797b13a60dacfc0a4fa22.zip
gcc-988d1653869158be80b797b13a60dacfc0a4fa22.tar.gz
gcc-988d1653869158be80b797b13a60dacfc0a4fa22.tar.bz2
Makefile.in (cgraph.o): Depend on gt-cgraph.h and varray.h.
* Makefile.in (cgraph.o): Depend on gt-cgraph.h and varray.h. * gt-cgraph.h: New GC file. * cgraph.c (known_fns): New static variable. (cgraph_node): Add the decl into varray. From-SVN: r63998
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index bb035b2..fd638bc 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -33,6 +33,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "debug.h"
#include "target.h"
#include "cgraph.h"
+#include "varray.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_fns;
/* Hash table used to convert declarations into nodes. */
static htab_t cgraph_hash = 0;
@@ -82,8 +90,14 @@ cgraph_node (decl)
struct cgraph_node *node;
struct cgraph_node **slot;
+ if (TREE_CODE (decl) != FUNCTION_DECL)
+ abort ();
+
if (!cgraph_hash)
- cgraph_hash = htab_create (10, hash_node, eq_node, NULL);
+ {
+ cgraph_hash = htab_create (10, hash_node, eq_node, NULL);
+ VARRAY_TREE_INIT (known_fns, 32, "known_fns");
+ }
slot =
(struct cgraph_node **) htab_find_slot_with_hash (cgraph_hash, decl,
@@ -107,6 +121,7 @@ cgraph_node (decl)
node->next_nested = node->origin->nested;
node->origin->nested = node;
}
+ VARRAY_PUSH_TREE (known_fns, decl);
return node;
}
@@ -290,3 +305,5 @@ dump_cgraph (f)
fprintf (f, "\n");
}
}
+
+#include "gt-cgraph.h"