diff options
author | Jan Hubicka <jh@suse.cz> | 2005-12-17 09:39:12 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2005-12-17 08:39:12 +0000 |
commit | 86051306a1a4da9a1fb5da12325cac62cd4ca883 (patch) | |
tree | 5206804d3351b2f304e2c368d857807d77d69f91 /gcc/tree-dfa.c | |
parent | 471eeb830d1f4a7c607c78dc9d2cd3a1d2e7c31d (diff) | |
download | gcc-86051306a1a4da9a1fb5da12325cac62cd4ca883.zip gcc-86051306a1a4da9a1fb5da12325cac62cd4ca883.tar.gz gcc-86051306a1a4da9a1fb5da12325cac62cd4ca883.tar.bz2 |
tree-flow-inline.h (set_default_def, [...]): Kill.
* 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.
From-SVN: r108712
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r-- | gcc/tree-dfa.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 771c9f8..913fd57 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 |