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
This commit is contained in:
Jan Hubicka 2005-12-17 09:39:12 +01:00 committed by Jan Hubicka
parent 471eeb830d
commit 86051306a1
5 changed files with 74 additions and 25 deletions

View File

@ -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.

View File

@ -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

View File

@ -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. */

View File

@ -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);

View File

@ -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);