mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-21 08:40:30 +08:00
tree-flow-inline.h (gimple_var_anns): New function.
* tree-flow-inline.h (gimple_var_anns): New function. (var_ann): Use hashtable for static functions. * tree-dfa.c (create_var_ann): Likewise. * tree-ssa.c (var_ann_eq, var_ann_hash): New functions. (init_tree_ssa): Initialize var anns. (delete_tree_ssa): Delete var anns; also clear out gimple_df. * tree-flow.h (struct static_var_ann_d): New structure. (gimple_df): Add var_anns. From-SVN: r120089
This commit is contained in:
parent
0fd212e1bd
commit
adb6509f4b
@ -1,3 +1,14 @@
|
||||
2006-12-20 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* tree-flow-inline.h (gimple_var_anns): New function.
|
||||
(var_ann): Use hashtable for static functions.
|
||||
* tree-dfa.c (create_var_ann): Likewise.
|
||||
* tree-ssa.c (var_ann_eq, var_ann_hash): New functions.
|
||||
(init_tree_ssa): Initialize var anns.
|
||||
(delete_tree_ssa): Delete var anns; also clear out gimple_df.
|
||||
* tree-flow.h (struct static_var_ann_d): New structure.
|
||||
(gimple_df): Add var_anns.
|
||||
|
||||
2006-12-20 Carlos O'Donell <carlos@codesourcery.com>
|
||||
|
||||
PR bootstrap/30242
|
||||
|
@ -124,16 +124,33 @@ var_ann_t
|
||||
create_var_ann (tree t)
|
||||
{
|
||||
var_ann_t ann;
|
||||
struct static_var_ann_d *sann = NULL;
|
||||
|
||||
gcc_assert (t);
|
||||
gcc_assert (DECL_P (t));
|
||||
gcc_assert (!t->base.ann || t->base.ann->common.type == VAR_ANN);
|
||||
|
||||
ann = GGC_CNEW (struct var_ann_d);
|
||||
if (TREE_STATIC (t))
|
||||
{
|
||||
sann = GGC_CNEW (struct static_var_ann_d);
|
||||
ann = &sann->ann;
|
||||
}
|
||||
else
|
||||
ann = GGC_CNEW (struct var_ann_d);
|
||||
|
||||
ann->common.type = VAR_ANN;
|
||||
|
||||
t->base.ann = (tree_ann_t) ann;
|
||||
if (TREE_STATIC (t))
|
||||
{
|
||||
void **slot;
|
||||
sann->uid = DECL_UID (t);
|
||||
slot = htab_find_slot_with_hash (gimple_var_anns (cfun),
|
||||
t, DECL_UID (t), INSERT);
|
||||
gcc_assert (!*slot);
|
||||
*slot = sann;
|
||||
}
|
||||
else
|
||||
t->base.ann = (tree_ann_t) ann;
|
||||
|
||||
return ann;
|
||||
}
|
||||
|
@ -91,6 +91,15 @@ gimple_nonlocal_all (struct function *fun)
|
||||
gcc_assert (fun && fun->gimple_df);
|
||||
return fun->gimple_df->nonlocal_all;
|
||||
}
|
||||
|
||||
/* Hashtable of variables annotations. Used for static variables only;
|
||||
local variables have direct pointer in the tree node. */
|
||||
static inline htab_t
|
||||
gimple_var_anns (struct function *fun)
|
||||
{
|
||||
return fun->gimple_df->var_anns;
|
||||
}
|
||||
|
||||
/* Initialize the hashtable iterator HTI to point to hashtable TABLE */
|
||||
|
||||
static inline void *
|
||||
@ -194,6 +203,16 @@ var_ann (tree t)
|
||||
gcc_assert (t);
|
||||
gcc_assert (DECL_P (t));
|
||||
gcc_assert (TREE_CODE (t) != FUNCTION_DECL);
|
||||
if (TREE_STATIC (t))
|
||||
{
|
||||
struct static_var_ann_d *sann
|
||||
= ((struct static_var_ann_d *)
|
||||
htab_find_with_hash (gimple_var_anns (cfun), t, DECL_UID (t)));
|
||||
if (!sann)
|
||||
return NULL;
|
||||
gcc_assert (sann->ann.common.type = VAR_ANN);
|
||||
return &sann->ann;
|
||||
}
|
||||
gcc_assert (!t->base.ann
|
||||
|| t->base.ann->common.type == VAR_ANN);
|
||||
|
||||
|
@ -38,6 +38,7 @@ typedef struct edge_def *edge;
|
||||
struct basic_block_def;
|
||||
typedef struct basic_block_def *basic_block;
|
||||
#endif
|
||||
struct static_var_ann_d;
|
||||
|
||||
/* Gimple dataflow datastructure. All publicly available fields shall have
|
||||
gimple_ accessor defined in tree-flow-inline.h, all publicly modifiable
|
||||
@ -92,6 +93,10 @@ struct gimple_df GTY(()) {
|
||||
unsigned int in_ssa_p : 1;
|
||||
|
||||
struct ssa_operands ssa_operands;
|
||||
|
||||
/* Hashtable of variables annotations. Used for static variables only;
|
||||
local variables have direct pointer in the tree node. */
|
||||
htab_t GTY((param_is (struct static_var_ann_d))) var_anns;
|
||||
};
|
||||
|
||||
/* Accessors for internal use only. Generic code should use abstraction
|
||||
@ -283,6 +288,14 @@ struct var_ann_d GTY(())
|
||||
unsigned int escape_mask;
|
||||
};
|
||||
|
||||
/* Contianer for variable annotation used by hashtable for annotations for
|
||||
static variables. */
|
||||
struct static_var_ann_d GTY(())
|
||||
{
|
||||
struct var_ann_d ann;
|
||||
unsigned int uid;
|
||||
};
|
||||
|
||||
struct function_ann_d GTY(())
|
||||
{
|
||||
struct tree_ann_common_d common;
|
||||
|
@ -745,6 +745,24 @@ int_tree_map_hash (const void *item)
|
||||
return ((const struct int_tree_map *)item)->uid;
|
||||
}
|
||||
|
||||
/* Return true if the uid in both int tree maps are equal. */
|
||||
|
||||
static int
|
||||
var_ann_eq (const void *va, const void *vb)
|
||||
{
|
||||
const struct static_var_ann_d *a = (const struct static_var_ann_d *) va;
|
||||
tree b = (tree) vb;
|
||||
return (a->uid == DECL_UID (b));
|
||||
}
|
||||
|
||||
/* Hash a UID in a int_tree_map. */
|
||||
|
||||
static unsigned int
|
||||
var_ann_hash (const void *item)
|
||||
{
|
||||
return ((const struct static_var_ann_d *)item)->uid;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize global DFA and SSA structures. */
|
||||
|
||||
@ -756,6 +774,8 @@ init_tree_ssa (void)
|
||||
int_tree_map_eq, NULL);
|
||||
cfun->gimple_df->default_defs = htab_create_ggc (20, int_tree_map_hash,
|
||||
int_tree_map_eq, NULL);
|
||||
cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash,
|
||||
var_ann_eq, NULL);
|
||||
cfun->gimple_df->call_clobbered_vars = BITMAP_GGC_ALLOC ();
|
||||
cfun->gimple_df->addressable_vars = BITMAP_GGC_ALLOC ();
|
||||
init_alias_heapvars ();
|
||||
@ -805,7 +825,8 @@ delete_tree_ssa (void)
|
||||
/* Remove annotations from every referenced variable. */
|
||||
FOR_EACH_REFERENCED_VAR (var, rvi)
|
||||
{
|
||||
ggc_free (var->base.ann);
|
||||
if (var->base.ann)
|
||||
ggc_free (var->base.ann);
|
||||
var->base.ann = NULL;
|
||||
}
|
||||
htab_delete (gimple_referenced_vars (cfun));
|
||||
@ -817,6 +838,9 @@ delete_tree_ssa (void)
|
||||
cfun->gimple_df->global_var = NULL_TREE;
|
||||
|
||||
htab_delete (cfun->gimple_df->default_defs);
|
||||
cfun->gimple_df->default_defs = NULL;
|
||||
htab_delete (cfun->gimple_df->var_anns);
|
||||
cfun->gimple_df->var_anns = NULL;
|
||||
cfun->gimple_df->call_clobbered_vars = NULL;
|
||||
cfun->gimple_df->addressable_vars = NULL;
|
||||
cfun->gimple_df->modified_noreturn_calls = NULL;
|
||||
@ -824,6 +848,7 @@ delete_tree_ssa (void)
|
||||
|
||||
delete_alias_heapvars ();
|
||||
gcc_assert (!need_ssa_update_p ());
|
||||
cfun->gimple_df = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user