diff options
author | Geoffrey Keating <geoffk@redhat.com> | 2002-06-04 07:11:05 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2002-06-04 07:11:05 +0000 |
commit | e2500fedef1a1c5b9e818fd1e2c281adff80df4a (patch) | |
tree | 720630adca0f6b357e05c4feb8cbe33d556925ce /gcc/tree.c | |
parent | c2ae66169b8326bbf9b1dfa63083d2560fea7ddf (diff) | |
download | gcc-e2500fedef1a1c5b9e818fd1e2c281adff80df4a.zip gcc-e2500fedef1a1c5b9e818fd1e2c281adff80df4a.tar.gz gcc-e2500fedef1a1c5b9e818fd1e2c281adff80df4a.tar.bz2 |
Merge from pch-branch up to tag pch-commit-20020603.
From-SVN: r54232
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 86 |
1 files changed, 43 insertions, 43 deletions
@@ -105,7 +105,7 @@ static int next_type_uid = 1; /* Since we cannot rehash a type after it is in the table, we have to keep the hash code. */ -struct type_hash +struct type_hash GTY(()) { unsigned long hash; tree type; @@ -121,7 +121,8 @@ struct type_hash same table, they are completely independent, and the hash code is computed differently for each of these. */ -htab_t type_hash_table; +static GTY ((if_marked ("type_hash_marked_p"), param_is (struct type_hash))) + htab_t type_hash_table; static void set_type_quals PARAMS ((tree, int)); static void append_random_chars PARAMS ((char *)); @@ -131,8 +132,6 @@ static void print_type_hash_statistics PARAMS((void)); static void finish_vector_type PARAMS((tree)); static tree make_vector PARAMS ((enum machine_mode, tree, int)); static int type_hash_marked_p PARAMS ((const void *)); -static void type_hash_mark PARAMS ((const void *)); -static int mark_tree_hashtable_entry PARAMS((void **, void *)); tree global_trees[TI_MAX]; tree integer_types[itk_none]; @@ -147,10 +146,6 @@ init_obstacks () /* Initialize the hash table of types. */ type_hash_table = htab_create (TYPE_HASH_INITIAL_SIZE, type_hash_hash, type_hash_eq, 0); - ggc_add_deletable_htab (type_hash_table, type_hash_marked_p, - type_hash_mark); - ggc_add_tree_root (global_trees, TI_MAX); - ggc_add_tree_root (integer_types, itk_none); } @@ -1527,6 +1522,44 @@ first_rtl_op (code) } } +/* Return which tree structure is used by T. */ + +enum tree_node_structure_enum +tree_node_structure (t) + tree t; +{ + enum tree_code code = TREE_CODE (t); + + switch (TREE_CODE_CLASS (code)) + { + case 'd': return TS_DECL; + case 't': return TS_TYPE; + case 'b': return TS_BLOCK; + case 'r': case '<': case '1': case '2': case 'e': case 's': + return TS_EXP; + default: /* 'c' and 'x' */ + break; + } + switch (code) + { + /* 'c' cases. */ + case INTEGER_CST: return TS_INT_CST; + case REAL_CST: return TS_REAL_CST; + case COMPLEX_CST: return TS_COMPLEX; + case VECTOR_CST: return TS_VECTOR; + case STRING_CST: return TS_STRING; + /* 'x' cases. */ + case ERROR_MARK: return TS_COMMON; + case IDENTIFIER_NODE: return TS_IDENTIFIER; + case TREE_LIST: return TS_LIST; + case TREE_VEC: return TS_VEC; + case PLACEHOLDER_EXPR: return TS_COMMON; + + default: + abort (); + } +} + /* Perform any modifications to EXPR required when it is unsaved. Does not recurse into EXPR's subtrees. */ @@ -3044,41 +3077,6 @@ type_hash_marked_p (p) return ggc_marked_p (type) || TYPE_SYMTAB_POINTER (type); } -/* Mark the entry in the type hash table the type it points to is marked. - Also mark the type in case we are considering this entry "marked" by - virtue of TYPE_SYMTAB_POINTER being set. */ - -static void -type_hash_mark (p) - const void *p; -{ - ggc_mark (p); - ggc_mark_tree (((struct type_hash *) p)->type); -} - -/* Mark the hashtable slot pointed to by ENTRY (which is really a - `tree**') for GC. */ - -static int -mark_tree_hashtable_entry (entry, data) - void **entry; - void *data ATTRIBUTE_UNUSED; -{ - ggc_mark_tree ((tree) *entry); - return 1; -} - -/* Mark ARG (which is really a htab_t whose slots are trees) for - GC. */ - -void -mark_tree_hashtable (arg) - void *arg; -{ - htab_t t = *(htab_t *) arg; - htab_traverse (t, mark_tree_hashtable_entry, 0); -} - static void print_type_hash_statistics () { @@ -4865,3 +4863,5 @@ initializer_zerop (init) return false; } } + +#include "gt-tree.h" |