diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-17 08:39:12 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-17 08:39:12 +0000 |
commit | f7553d0a989fa4467612016b437d8734c65a4c50 (patch) | |
tree | 5206804d3351b2f304e2c368d857807d77d69f91 /gcc | |
parent | 3a938499464a0b9cee6a892064b46b9fef64e46c (diff) | |
download | gcc-f7553d0a989fa4467612016b437d8734c65a4c50.tar.gz |
* tree-flow-inline.h (set_default_def, default_def): Kill.
* tree-dfa.c (default_defs): New global variable.
(default_def, set_default_def): New functions.
* tree-ssa.c (init_tree_ssa, delete_tree_ssa): Add default_def hash.
* tree-flow.h (struct var_ann_d): Kill default_def field.
(set_default_def, default_def): Update prototype.
(default_defs): Declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108712 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 55 | ||||
-rw-r--r-- | gcc/tree-flow-inline.h | 17 | ||||
-rw-r--r-- | gcc/tree-flow.h | 14 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 3 |
5 files changed, 74 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24902912746..c310b264c6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2005-12-17 Jan Hubicka <jh@suse.cz> + + * tree-flow-inline.h (set_default_def, default_def): Kill. + * tree-dfa.c (default_defs): New global variable. + (default_def, set_default_def): New functions. + * tree-ssa.c (init_tree_ssa, delete_tree_ssa): Add default_def hash. + * tree-flow.h (struct var_ann_d): Kill default_def field. + (set_default_def, default_def): Update prototype. + (default_defs): Declare. + 2005-12-16 Jeff Law <law@redhat.com> * tree-ssa-dom.c (update_rhs_and_lookup_avail_expr): Kill. diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 771c9f8d4ab..913fd5751c0 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -85,6 +85,12 @@ static void add_referenced_var (tree, struct walk_state *); /* Array of all variables referenced in the function. */ htab_t referenced_vars; +/* Default definition for this symbols. If set for symbol, it + means that the first reference to this variable in the function is a + USE or a VUSE. In those cases, the SSA renamer creates an SSA name + for this variable with an empty defining statement. */ +htab_t default_defs; + /*--------------------------------------------------------------------------- Dataflow analysis (DFA) routines @@ -609,6 +615,55 @@ referenced_var_insert (unsigned int uid, tree to) *(struct int_tree_map **) loc = h; } +/* Lookup VAR UID in the default_defs hashtable and return the associated + variable. */ + +tree +default_def (tree var) +{ + struct int_tree_map *h, in; + gcc_assert (SSA_VAR_P (var)); + in.uid = DECL_UID (var); + h = htab_find_with_hash (default_defs, &in, DECL_UID (var)); + if (h) + return h->to; + return NULL_TREE; +} + +/* Insert the pair VAR's UID, DEF into the default_defs hashtable. */ + +void +set_default_def (tree var, tree def) +{ + struct int_tree_map in; + struct int_tree_map *h; + void **loc; + + gcc_assert (SSA_VAR_P (var)); + in.uid = DECL_UID (var); + if (!def && default_def (var)) + { + loc = htab_find_slot_with_hash (default_defs, &in, DECL_UID (var), INSERT); + htab_remove_elt (default_defs, *loc); + return; + } + gcc_assert (TREE_CODE (def) == SSA_NAME); + loc = htab_find_slot_with_hash (default_defs, &in, DECL_UID (var), INSERT); + /* Default definition might be changed by tail call optimization. */ + if (!*loc) + { + h = ggc_alloc (sizeof (struct int_tree_map)); + h->uid = DECL_UID (var); + h->to = def; + *(struct int_tree_map **) loc = h; + } + else + { + h = *loc; + h->to = def; + } +} + /* Add VAR to the list of dereferenced variables. WALK_STATE contains a hash table used to avoid adding the same diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index ddfa77a7c0c..7aae23f967c 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -675,23 +675,6 @@ is_label_stmt (tree t) return false; } -/* Set the default definition for VAR to DEF. */ -static inline void -set_default_def (tree var, tree def) -{ - var_ann_t ann = get_var_ann (var); - ann->default_def = def; -} - -/* Return the default definition for variable VAR, or NULL if none - exists. */ -static inline tree -default_def (tree var) -{ - var_ann_t ann = var_ann (var); - return ann ? ann->default_def : NULL_TREE; -} - /* PHI nodes should contain only ssa_names and invariants. A test for ssa_name is definitely simpler; don't let invalid contents slip in in the meantime. */ diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 9ebfeb8bc0e..ab9eab9ef7e 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -205,12 +205,6 @@ struct var_ann_d GTY(()) /* Used by the root-var object in tree-ssa-live.[ch]. */ unsigned root_index; - /* Default definition for this symbol. If this field is not NULL, it - means that the first reference to this variable in the function is a - USE or a VUSE. In those cases, the SSA renamer creates an SSA name - for this variable with an empty defining statement. */ - tree default_def; - /* During into-ssa and the dominator optimizer, this field holds the current version of this variable (an SSA_NAME). */ tree current_def; @@ -327,8 +321,6 @@ static inline const char *get_filename (tree); static inline bool is_exec_stmt (tree); static inline bool is_label_stmt (tree); static inline bitmap addresses_taken (tree); -static inline void set_default_def (tree, tree); -static inline tree default_def (tree); /*--------------------------------------------------------------------------- Structure representing predictions in tree level. @@ -396,6 +388,9 @@ typedef struct /* Array of all variables referenced in the function. */ extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars; +/* Default defs for undefined symbols. */ +extern GTY((param_is (struct int_tree_map))) htab_t default_defs; + extern tree referenced_var_lookup (unsigned int); extern tree referenced_var_lookup_if_exists (unsigned int); #define num_referenced_vars htab_elements (referenced_vars) @@ -560,6 +555,9 @@ extern void mark_new_vars_to_rename (tree); extern void find_new_referenced_vars (tree *); extern tree make_rename_temp (tree, const char *); +extern void set_default_def (tree, tree); +extern tree default_def (tree); +extern tree default_def_fn (struct function *, tree); /* In tree-phinodes.c */ extern void reserve_phi_args_for_new_edge (basic_block); diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 4c683f1b0f6..33ce98d7b56 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -801,6 +801,7 @@ init_tree_ssa (void) { referenced_vars = htab_create_ggc (20, int_tree_map_hash, int_tree_map_eq, NULL); + default_defs = htab_create_ggc (20, int_tree_map_hash, int_tree_map_eq, NULL); call_clobbered_vars = BITMAP_ALLOC (NULL); addressable_vars = BITMAP_ALLOC (NULL); init_alias_heapvars (); @@ -862,6 +863,8 @@ delete_tree_ssa (void) fini_phinodes (); global_var = NULL_TREE; + + htab_delete (default_defs); BITMAP_FREE (call_clobbered_vars); call_clobbered_vars = NULL; BITMAP_FREE (addressable_vars); |