tree-complex.c (init_parameter_lattice_values): Don't call var_ann.
* tree-complex.c (init_parameter_lattice_values): Don't call var_ann. * tree-dfa.c (struct dfa_stats_d): Remove num_var_anns member. (dump_dfa_stats): Don't dump stats about var anns. (collect_dfa_stats): Don't collect them. (add_referenced_var_1): Don't set var annotation pointers. (remove_referenced_var): Ditto, and only remove it it's in the hash table. * tree-flow-inline.h (var_ann): Remove. * tree-flow.h (struct var_ann_d, var_ann_t): Remove. * tree-inline.c (remapped_type): Remove. (can_be_nonlocal): Most variable will be considered live here, return false earlier. (remap_decls): Don't call var_ann, all variables will be considered referenced here. (copy_debug_stmt): Ditto, and use is_global_var. * tree-into-ssa.c (rewrite_debug_stmt_uses): Use get_current_def to determine if a variable was referred to, not var_ann. * tree-ssa-live.c (remove_unused_scope_block_p): Don't check var_ann. (remove_unused_locals): Ditto. * tree-ssa.c (delete_tree_ssa): Don't free/clear var ann pointers. * tree-tailcall.c (arg_needs_copy_p): Don't check var_ann. * tree.c (copy_node_stat): Don't clear var ann pointer. * tree.h (tree_result_decl, tree_parm_decl, tree_var_decl): Remove ann member. (DECL_VAR_ANN_PTR): Remove. * tree-flow.h (struct var_ann_d): Rename used member. (set_is_used): Don't declare. * tree-flow-inline.h (clear_is_used): Remove. (set_is_used, is_used_p): Move to ... * tree-ssa-live.c (set_is_used, is_used_p): ... here, and use on the side bitmap. (usedvars): New bitmap. (dump_scope_block): Don't dump unusedness. (remove_unused_locals): Allocate and free usedvars. * tree-nrv.c (tree_nrv): Don't clear used flags here. * tree-flow.h (struct var_ann_d): Remove base_var_processed and base_index members. * tree-ssa-live.h (struct _var_map): Remove basevars member. (VAR_ANN_BASE_INDEX): Remove. * tree-ssa-live.c (var_map_base_init): Use a hash table instead of var annotation to compress index space. Don't deal with above removed members. (var_map_base_fini): Don't free basevars. (init_var_map): Don't clear basevars. From-SVN: r190039
This commit is contained in:
parent
3cfd446903
commit
5f564b8f56
@ -1,3 +1,59 @@
|
||||
2012-08-01 Michael Matz <matz@suse.de>
|
||||
|
||||
* tree-complex.c (init_parameter_lattice_values): Don't call var_ann.
|
||||
* tree-dfa.c (struct dfa_stats_d): Remove num_var_anns member.
|
||||
(dump_dfa_stats): Don't dump stats about var anns.
|
||||
(collect_dfa_stats): Don't collect them.
|
||||
(add_referenced_var_1): Don't set var annotation pointers.
|
||||
(remove_referenced_var): Ditto, and only remove it it's in the
|
||||
hash table.
|
||||
|
||||
* tree-flow-inline.h (var_ann): Remove.
|
||||
* tree-flow.h (struct var_ann_d, var_ann_t): Remove.
|
||||
|
||||
* tree-inline.c (remapped_type): Remove.
|
||||
(can_be_nonlocal): Most variable will be considered live here,
|
||||
return false earlier.
|
||||
(remap_decls): Don't call var_ann, all variables will be considered
|
||||
referenced here.
|
||||
(copy_debug_stmt): Ditto, and use is_global_var.
|
||||
|
||||
* tree-into-ssa.c (rewrite_debug_stmt_uses): Use get_current_def to
|
||||
determine if a variable was referred to, not var_ann.
|
||||
* tree-ssa-live.c (remove_unused_scope_block_p): Don't check var_ann.
|
||||
(remove_unused_locals): Ditto.
|
||||
* tree-ssa.c (delete_tree_ssa): Don't free/clear var ann pointers.
|
||||
* tree-tailcall.c (arg_needs_copy_p): Don't check var_ann.
|
||||
* tree.c (copy_node_stat): Don't clear var ann pointer.
|
||||
* tree.h (tree_result_decl, tree_parm_decl, tree_var_decl): Remove
|
||||
ann member.
|
||||
(DECL_VAR_ANN_PTR): Remove.
|
||||
|
||||
2012-08-01 Michael Matz <matz@suse.de>
|
||||
|
||||
* tree-flow.h (struct var_ann_d): Rename used member.
|
||||
(set_is_used): Don't declare.
|
||||
* tree-flow-inline.h (clear_is_used): Remove.
|
||||
(set_is_used, is_used_p): Move to ...
|
||||
* tree-ssa-live.c (set_is_used, is_used_p): ... here, and use
|
||||
on the side bitmap.
|
||||
(usedvars): New bitmap.
|
||||
(dump_scope_block): Don't dump unusedness.
|
||||
(remove_unused_locals): Allocate and free usedvars.
|
||||
* tree-nrv.c (tree_nrv): Don't clear used flags here.
|
||||
|
||||
2012-08-01 Michael Matz <matz@suse.de>
|
||||
|
||||
* tree-flow.h (struct var_ann_d): Remove base_var_processed and
|
||||
base_index members.
|
||||
* tree-ssa-live.h (struct _var_map): Remove basevars member.
|
||||
(VAR_ANN_BASE_INDEX): Remove.
|
||||
* tree-ssa-live.c (var_map_base_init): Use a hash table instead
|
||||
of var annotation to compress index space. Don't deal with above
|
||||
removed members.
|
||||
(var_map_base_fini): Don't free basevars.
|
||||
(init_var_map): Don't clear basevars.
|
||||
|
||||
2012-08-01 Bill Schmidt <wschmidt@linux.ibm.com>
|
||||
|
||||
* gimple-ssa-strength-reduction.c (struct slsr_cand_d): Change
|
||||
|
@ -176,7 +176,6 @@ init_parameter_lattice_values (void)
|
||||
|
||||
for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm))
|
||||
if (is_complex_reg (parm)
|
||||
&& var_ann (parm) != NULL
|
||||
&& (ssa_name = gimple_default_def (cfun, parm)) != NULL_TREE)
|
||||
VEC_replace (complex_lattice_t, complex_lattice_values,
|
||||
SSA_NAME_VERSION (ssa_name), VARYING);
|
||||
|
@ -46,7 +46,6 @@ along with GCC; see the file COPYING3. If not see
|
||||
/* Counters used to display DFA and SSA statistics. */
|
||||
struct dfa_stats_d
|
||||
{
|
||||
long num_var_anns;
|
||||
long num_defs;
|
||||
long num_uses;
|
||||
long num_phis;
|
||||
@ -303,11 +302,6 @@ dump_dfa_stats (FILE *file)
|
||||
fprintf (file, fmt_str_1, "Referenced variables", (unsigned long)num_referenced_vars,
|
||||
SCALE (size), LABEL (size));
|
||||
|
||||
size = dfa_stats.num_var_anns * sizeof (struct var_ann_d);
|
||||
total += size;
|
||||
fprintf (file, fmt_str_1, "Variables annotated", dfa_stats.num_var_anns,
|
||||
SCALE (size), LABEL (size));
|
||||
|
||||
size = dfa_stats.num_uses * sizeof (tree *);
|
||||
total += size;
|
||||
fprintf (file, fmt_str_1, "USE operands", dfa_stats.num_uses,
|
||||
@ -374,9 +368,6 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
|
||||
|
||||
memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d));
|
||||
|
||||
/* Count all the variable annotations. */
|
||||
dfa_stats_p->num_var_anns = htab_elements (gimple_referenced_vars (cfun));
|
||||
|
||||
/* Walk all the statements in the function counting references. */
|
||||
FOR_EACH_BB (bb)
|
||||
{
|
||||
@ -561,11 +552,7 @@ add_referenced_var_1 (tree var, struct function *fn)
|
||||
/* Insert VAR into the referenced_vars hash table if it isn't present
|
||||
and allocate its var-annotation. */
|
||||
if (referenced_var_check_and_insert (var, fn))
|
||||
{
|
||||
gcc_checking_assert (!*DECL_VAR_ANN_PTR (var));
|
||||
*DECL_VAR_ANN_PTR (var) = ggc_alloc_cleared_var_ann_d ();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -576,7 +563,6 @@ add_referenced_var_1 (tree var, struct function *fn)
|
||||
void
|
||||
remove_referenced_var (tree var)
|
||||
{
|
||||
var_ann_t v_ann;
|
||||
struct tree_decl_minimal in;
|
||||
void **loc;
|
||||
unsigned int uid = DECL_UID (var);
|
||||
@ -587,14 +573,11 @@ remove_referenced_var (tree var)
|
||||
|
||||
gcc_checking_assert (!is_global_var (var));
|
||||
|
||||
v_ann = var_ann (var);
|
||||
ggc_free (v_ann);
|
||||
*DECL_VAR_ANN_PTR (var) = NULL;
|
||||
|
||||
in.uid = uid;
|
||||
loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
|
||||
NO_INSERT);
|
||||
htab_clear_slot (gimple_referenced_vars (cfun), loc);
|
||||
if (loc)
|
||||
htab_clear_slot (gimple_referenced_vars (cfun), loc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,15 +136,6 @@ next_referenced_var (referenced_var_iterator *iter)
|
||||
return (tree) next_htab_element (&iter->hti);
|
||||
}
|
||||
|
||||
/* Return the variable annotation for T, which must be a _DECL node.
|
||||
Return NULL if the variable annotation doesn't already exist. */
|
||||
static inline var_ann_t
|
||||
var_ann (const_tree t)
|
||||
{
|
||||
const var_ann_t *p = DECL_VAR_ANN_PTR (t);
|
||||
return p ? *p : NULL;
|
||||
}
|
||||
|
||||
/* Get the number of the next statement uid to be allocated. */
|
||||
static inline unsigned int
|
||||
gimple_stmt_max_uid (struct function *fn)
|
||||
@ -558,33 +549,6 @@ phi_arg_index_from_use (use_operand_p use)
|
||||
return index;
|
||||
}
|
||||
|
||||
/* Mark VAR as used, so that it'll be preserved during rtl expansion. */
|
||||
|
||||
static inline void
|
||||
set_is_used (tree var)
|
||||
{
|
||||
var_ann_t ann = var_ann (var);
|
||||
ann->used = true;
|
||||
}
|
||||
|
||||
/* Clear VAR's used flag. */
|
||||
|
||||
static inline void
|
||||
clear_is_used (tree var)
|
||||
{
|
||||
var_ann_t ann = var_ann (var);
|
||||
ann->used = false;
|
||||
}
|
||||
|
||||
/* Return true if VAR is marked as used. */
|
||||
|
||||
static inline bool
|
||||
is_used_p (tree var)
|
||||
{
|
||||
var_ann_t ann = var_ann (var);
|
||||
return ann->used;
|
||||
}
|
||||
|
||||
/* Return true if T (assumed to be a DECL) is a global variable.
|
||||
A variable is considered global if its storage is not automatic. */
|
||||
|
||||
|
@ -177,19 +177,6 @@ enum need_phi_state {
|
||||
};
|
||||
|
||||
|
||||
struct GTY(()) var_ann_d {
|
||||
/* Used when building base variable structures in a var_map. */
|
||||
unsigned base_var_processed : 1;
|
||||
|
||||
/* Nonzero if this variable was used after SSA optimizations were
|
||||
applied. We set this when translating out of SSA form. */
|
||||
unsigned used : 1;
|
||||
|
||||
/* Used by var_map for the base index of ssa base variables. */
|
||||
unsigned base_index;
|
||||
};
|
||||
|
||||
|
||||
/* Immediate use lists are used to directly access all uses for an SSA
|
||||
name and get pointers to the statement for each use.
|
||||
|
||||
@ -284,9 +271,6 @@ typedef struct immediate_use_iterator_d
|
||||
|
||||
|
||||
|
||||
typedef struct var_ann_d *var_ann_t;
|
||||
|
||||
static inline var_ann_t var_ann (const_tree);
|
||||
static inline void update_stmt (gimple);
|
||||
static inline int get_lineno (const_gimple);
|
||||
|
||||
@ -747,7 +731,6 @@ extern enum move_pos movement_possibility (gimple);
|
||||
char *get_lsm_tmp_name (tree, unsigned);
|
||||
|
||||
/* In tree-flow-inline.h */
|
||||
static inline void set_is_used (tree);
|
||||
static inline bool unmodifiable_var_p (const_tree);
|
||||
static inline bool ref_contains_array_ref (const_tree);
|
||||
|
||||
|
@ -501,26 +501,6 @@ remap_type (tree type, copy_body_data *id)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* Return previously remapped type of TYPE in ID. Return NULL if TYPE
|
||||
is NULL or TYPE has not been remapped before. */
|
||||
|
||||
static tree
|
||||
remapped_type (tree type, copy_body_data *id)
|
||||
{
|
||||
tree *node;
|
||||
|
||||
if (type == NULL)
|
||||
return type;
|
||||
|
||||
/* See if we have remapped this type. */
|
||||
node = (tree *) pointer_map_contains (id->decl_map, type);
|
||||
if (node)
|
||||
return *node;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The type only needs remapping if it's variably modified. */
|
||||
/* Decide if DECL can be put into BLOCK_NONLOCAL_VARs. */
|
||||
|
||||
static bool
|
||||
@ -536,26 +516,7 @@ can_be_nonlocal (tree decl, copy_body_data *id)
|
||||
&& !auto_var_in_fn_p (decl, id->src_fn))
|
||||
return true;
|
||||
|
||||
/* At the moment dwarf2out can handle only these types of nodes. We
|
||||
can support more later. */
|
||||
if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != PARM_DECL)
|
||||
return false;
|
||||
|
||||
/* We must use global type. We call remapped_type instead of
|
||||
remap_type since we don't want to remap this type here if it
|
||||
hasn't been remapped before. */
|
||||
if (TREE_TYPE (decl) != remapped_type (TREE_TYPE (decl), id))
|
||||
return false;
|
||||
|
||||
/* Wihtout SSA we can't tell if variable is used. */
|
||||
if (!gimple_in_ssa_p (cfun))
|
||||
return false;
|
||||
|
||||
/* Live variables must be copied so we can attach DECL_RTL. */
|
||||
if (var_ann (decl))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static tree
|
||||
@ -571,9 +532,10 @@ remap_decls (tree decls, VEC(tree,gc) **nonlocalized_list, copy_body_data *id)
|
||||
|
||||
if (can_be_nonlocal (old_var, id))
|
||||
{
|
||||
/* We need to add this variable to the local decls as otherwise
|
||||
nothing else will do so. */
|
||||
if (TREE_CODE (old_var) == VAR_DECL
|
||||
&& ! DECL_EXTERNAL (old_var)
|
||||
&& (var_ann (old_var) || !gimple_in_ssa_p (cfun)))
|
||||
&& ! DECL_EXTERNAL (old_var))
|
||||
add_local_decl (cfun, old_var);
|
||||
if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
|
||||
&& !DECL_IGNORED_P (old_var)
|
||||
@ -2371,10 +2333,8 @@ copy_debug_stmt (gimple stmt, copy_body_data *id)
|
||||
t = *n;
|
||||
}
|
||||
else if (TREE_CODE (t) == VAR_DECL
|
||||
&& !TREE_STATIC (t)
|
||||
&& gimple_in_ssa_p (cfun)
|
||||
&& !pointer_map_contains (id->decl_map, t)
|
||||
&& !var_ann (t))
|
||||
&& !is_global_var (t)
|
||||
&& !pointer_map_contains (id->decl_map, t))
|
||||
/* T is a non-localized variable. */;
|
||||
else
|
||||
walk_tree (&t, remap_gimple_op_r, &wi, NULL);
|
||||
|
@ -1274,9 +1274,10 @@ rewrite_debug_stmt_uses (gimple stmt)
|
||||
|
||||
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
|
||||
{
|
||||
tree var = USE_FROM_PTR (use_p), def = NULL_TREE;
|
||||
tree var = USE_FROM_PTR (use_p), def;
|
||||
gcc_assert (DECL_P (var));
|
||||
if (var_ann (var) == NULL)
|
||||
def = get_current_def (var);
|
||||
if (!def)
|
||||
{
|
||||
if (TREE_CODE (var) == PARM_DECL && single_succ_p (ENTRY_BLOCK_PTR))
|
||||
{
|
||||
@ -1318,38 +1319,34 @@ rewrite_debug_stmt_uses (gimple stmt)
|
||||
}
|
||||
else
|
||||
{
|
||||
def = get_current_def (var);
|
||||
/* Check if get_current_def can be trusted. */
|
||||
if (def)
|
||||
basic_block bb = gimple_bb (stmt);
|
||||
basic_block def_bb
|
||||
= SSA_NAME_IS_DEFAULT_DEF (def)
|
||||
? NULL : gimple_bb (SSA_NAME_DEF_STMT (def));
|
||||
|
||||
/* If definition is in current bb, it is fine. */
|
||||
if (bb == def_bb)
|
||||
;
|
||||
/* If definition bb doesn't dominate the current bb,
|
||||
it can't be used. */
|
||||
else if (def_bb && !dominated_by_p (CDI_DOMINATORS, bb, def_bb))
|
||||
def = NULL;
|
||||
/* If there is just one definition and dominates the current
|
||||
bb, it is fine. */
|
||||
else if (get_phi_state (var) == NEED_PHI_STATE_NO)
|
||||
;
|
||||
else
|
||||
{
|
||||
basic_block bb = gimple_bb (stmt);
|
||||
basic_block def_bb
|
||||
= SSA_NAME_IS_DEFAULT_DEF (def)
|
||||
? NULL : gimple_bb (SSA_NAME_DEF_STMT (def));
|
||||
struct def_blocks_d *db_p = get_def_blocks_for (var);
|
||||
|
||||
/* If definition is in current bb, it is fine. */
|
||||
if (bb == def_bb)
|
||||
;
|
||||
/* If definition bb doesn't dominate the current bb,
|
||||
it can't be used. */
|
||||
else if (def_bb && !dominated_by_p (CDI_DOMINATORS, bb, def_bb))
|
||||
def = NULL;
|
||||
/* If there is just one definition and dominates the current
|
||||
bb, it is fine. */
|
||||
else if (get_phi_state (var) == NEED_PHI_STATE_NO)
|
||||
/* If there are some non-debug uses in the current bb,
|
||||
it is fine. */
|
||||
if (bitmap_bit_p (db_p->livein_blocks, bb->index))
|
||||
;
|
||||
/* Otherwise give up for now. */
|
||||
else
|
||||
{
|
||||
struct def_blocks_d *db_p = get_def_blocks_for (var);
|
||||
|
||||
/* If there are some non-debug uses in the current bb,
|
||||
it is fine. */
|
||||
if (bitmap_bit_p (db_p->livein_blocks, bb->index))
|
||||
;
|
||||
/* Otherwise give up for now. */
|
||||
else
|
||||
def = NULL;
|
||||
}
|
||||
def = NULL;
|
||||
}
|
||||
}
|
||||
if (def == NULL)
|
||||
|
@ -261,8 +261,6 @@ tree_nrv (void)
|
||||
SET_DECL_VALUE_EXPR (found, result);
|
||||
DECL_HAS_VALUE_EXPR_P (found) = 1;
|
||||
|
||||
/* FOUND is no longer used. Ensure it gets removed. */
|
||||
clear_is_used (found);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -59,59 +59,49 @@ static void verify_live_on_entry (tree_live_info_p);
|
||||
static void
|
||||
var_map_base_init (var_map map)
|
||||
{
|
||||
int x, num_part, num;
|
||||
int x, num_part;
|
||||
tree var;
|
||||
var_ann_t ann;
|
||||
htab_t decl_to_index;
|
||||
struct tree_int_map *m, *mapstorage;
|
||||
|
||||
num = 0;
|
||||
num_part = num_var_partitions (map);
|
||||
decl_to_index = htab_create (num_part, tree_decl_map_hash,
|
||||
tree_int_map_eq, NULL);
|
||||
/* We can have at most num_part entries in the hash tables, so it's
|
||||
enough to allocate so many map elements once, saving some malloc
|
||||
calls. */
|
||||
mapstorage = m = XNEWVEC (struct tree_int_map, num_part);
|
||||
|
||||
/* If a base table already exists, clear it, otherwise create it. */
|
||||
if (map->partition_to_base_index != NULL)
|
||||
{
|
||||
free (map->partition_to_base_index);
|
||||
VEC_truncate (tree, map->basevars, 0);
|
||||
}
|
||||
else
|
||||
map->basevars = VEC_alloc (tree, heap, MAX (40, (num_part / 10)));
|
||||
|
||||
free (map->partition_to_base_index);
|
||||
map->partition_to_base_index = (int *) xmalloc (sizeof (int) * num_part);
|
||||
|
||||
/* Build the base variable list, and point partitions at their bases. */
|
||||
for (x = 0; x < num_part; x++)
|
||||
{
|
||||
struct tree_int_map **slot;
|
||||
unsigned baseindex;
|
||||
var = partition_to_var (map, x);
|
||||
if (TREE_CODE (var) == SSA_NAME)
|
||||
var = SSA_NAME_VAR (var);
|
||||
ann = var_ann (var);
|
||||
var = SSA_NAME_VAR (var);
|
||||
/* If base variable hasn't been seen, set it up. */
|
||||
if (!ann->base_var_processed)
|
||||
{
|
||||
ann->base_var_processed = 1;
|
||||
VAR_ANN_BASE_INDEX (ann) = num++;
|
||||
VEC_safe_push (tree, heap, map->basevars, var);
|
||||
m->base.from = var;
|
||||
slot = (struct tree_int_map **) htab_find_slot (decl_to_index, m, INSERT);
|
||||
if (!*slot)
|
||||
{
|
||||
baseindex = m - mapstorage;
|
||||
m->to = baseindex;
|
||||
*slot = m;
|
||||
m++;
|
||||
}
|
||||
map->partition_to_base_index[x] = VAR_ANN_BASE_INDEX (ann);
|
||||
else
|
||||
baseindex = (*slot)->to;
|
||||
map->partition_to_base_index[x] = baseindex;
|
||||
}
|
||||
|
||||
map->num_basevars = num;
|
||||
map->num_basevars = m - mapstorage;
|
||||
|
||||
/* Now clear the processed bit. */
|
||||
for (x = 0; x < num; x++)
|
||||
{
|
||||
var = VEC_index (tree, map->basevars, x);
|
||||
var_ann (var)->base_var_processed = 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CHECKING
|
||||
for (x = 0; x < num_part; x++)
|
||||
{
|
||||
tree var2;
|
||||
var = SSA_NAME_VAR (partition_to_var (map, x));
|
||||
var2 = VEC_index (tree, map->basevars, basevar_index (map, x));
|
||||
gcc_assert (var == var2);
|
||||
}
|
||||
#endif
|
||||
free (mapstorage);
|
||||
htab_delete (decl_to_index);
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +113,6 @@ var_map_base_fini (var_map map)
|
||||
/* Free the basevar info if it is present. */
|
||||
if (map->partition_to_base_index != NULL)
|
||||
{
|
||||
VEC_free (tree, heap, map->basevars);
|
||||
free (map->partition_to_base_index);
|
||||
map->partition_to_base_index = NULL;
|
||||
map->num_basevars = 0;
|
||||
@ -145,7 +134,6 @@ init_var_map (int size)
|
||||
map->partition_size = size;
|
||||
map->num_basevars = 0;
|
||||
map->partition_to_base_index = NULL;
|
||||
map->basevars = NULL;
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -341,6 +329,24 @@ partition_view_bitmap (var_map map, bitmap only, bool want_bases)
|
||||
}
|
||||
|
||||
|
||||
static bitmap usedvars;
|
||||
|
||||
/* Mark VAR as used, so that it'll be preserved during rtl expansion. */
|
||||
|
||||
static inline void
|
||||
set_is_used (tree var)
|
||||
{
|
||||
bitmap_set_bit (usedvars, DECL_UID (var));
|
||||
}
|
||||
|
||||
/* Return true if VAR is marked as used. */
|
||||
|
||||
static inline bool
|
||||
is_used_p (tree var)
|
||||
{
|
||||
return bitmap_bit_p (usedvars, DECL_UID (var));
|
||||
}
|
||||
|
||||
static inline void mark_all_vars_used (tree *, void *data);
|
||||
|
||||
/* Helper function for mark_all_vars_used, called via walk_tree. */
|
||||
@ -471,7 +477,7 @@ remove_unused_scope_block_p (tree scope, bitmap global_unused_vars)
|
||||
at all so user can't get into the scopes at first place. */
|
||||
else if ((is_global_var (*t)
|
||||
&& !bitmap_bit_p (global_unused_vars, DECL_UID (*t)))
|
||||
|| (var_ann (*t) != NULL && is_used_p (*t)))
|
||||
|| is_used_p (*t))
|
||||
unused = false;
|
||||
else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
|
||||
/* For labels that are still used in the IL, the decision to
|
||||
@ -635,14 +641,9 @@ dump_scope_block (FILE *file, int indent, tree scope, int flags)
|
||||
fprintf (file, " \n");
|
||||
for (var = BLOCK_VARS (scope); var; var = DECL_CHAIN (var))
|
||||
{
|
||||
bool used = false;
|
||||
|
||||
if (var_ann (var))
|
||||
used = is_used_p (var);
|
||||
|
||||
fprintf (file, "%*s", indent, "");
|
||||
print_generic_decl (file, var, flags);
|
||||
fprintf (file, "%s\n", used ? "" : " (unused)");
|
||||
fprintf (file, "\n");
|
||||
}
|
||||
for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (scope); i++)
|
||||
{
|
||||
@ -707,9 +708,7 @@ remove_unused_locals (void)
|
||||
|
||||
mark_scope_block_unused (DECL_INITIAL (current_function_decl));
|
||||
|
||||
/* Assume all locals are unused. */
|
||||
FOR_EACH_REFERENCED_VAR (cfun, t, rvi)
|
||||
clear_is_used (t);
|
||||
usedvars = BITMAP_ALLOC (NULL);
|
||||
|
||||
/* Assume all globals in local decls are unused. */
|
||||
global_unused_vars = BITMAP_ALLOC (NULL);
|
||||
@ -827,11 +826,9 @@ remove_unused_locals (void)
|
||||
if (bitmap_bit_p (global_unused_vars, DECL_UID (var)))
|
||||
continue;
|
||||
}
|
||||
else if (var_ann (var) == NULL
|
||||
|| !is_used_p (var))
|
||||
else if (!is_used_p (var))
|
||||
{
|
||||
if (var_ann (var))
|
||||
remove_referenced_var (var);
|
||||
remove_referenced_var (var);
|
||||
if (cfun->nonlocal_goto_save_area
|
||||
&& TREE_OPERAND (cfun->nonlocal_goto_save_area, 0) == var)
|
||||
cfun->nonlocal_goto_save_area = NULL;
|
||||
@ -862,6 +859,7 @@ remove_unused_locals (void)
|
||||
global_unused_vars);
|
||||
|
||||
BITMAP_FREE (global_unused_vars);
|
||||
BITMAP_FREE (usedvars);
|
||||
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
{
|
||||
|
@ -31,13 +31,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
/* Used to create the variable mapping when we go out of SSA form.
|
||||
|
||||
Mapping from an ssa_name to a partition number is maintained, as well as
|
||||
partition number to back to ssa_name. A partition can also be represented
|
||||
by a non-ssa_name variable. This allows ssa_names and their partition to
|
||||
be coalesced with live on entry compiler variables, as well as eventually
|
||||
having real compiler variables assigned to each partition as part of the
|
||||
final stage of going of of ssa.
|
||||
|
||||
Non-ssa_names maintain their partition index in the variable annotation.
|
||||
partition number back to ssa_name.
|
||||
|
||||
This data structure also supports "views", which work on a subset of all
|
||||
partitions. This allows the coalescer to decide what partitions are
|
||||
@ -72,16 +66,9 @@ typedef struct _var_map
|
||||
|
||||
/* Map of partitions numbers to base variable table indexes. */
|
||||
int *partition_to_base_index;
|
||||
|
||||
/* Table of base variable's. */
|
||||
VEC (tree, heap) *basevars;
|
||||
} *var_map;
|
||||
|
||||
|
||||
/* Index to the basevar table of a non ssa-name variable. */
|
||||
#define VAR_ANN_BASE_INDEX(ann) (ann->base_index)
|
||||
|
||||
|
||||
/* Value used to represent no partition number. */
|
||||
#define NO_PARTITION -1
|
||||
|
||||
|
@ -1150,15 +1150,7 @@ struct gimple_opt_pass pass_init_datastructures =
|
||||
void
|
||||
delete_tree_ssa (void)
|
||||
{
|
||||
referenced_var_iterator rvi;
|
||||
tree var;
|
||||
|
||||
/* Remove annotations from every referenced local variable. */
|
||||
FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
|
||||
{
|
||||
ggc_free (var_ann (var));
|
||||
*DECL_VAR_ANN_PTR (var) = NULL;
|
||||
}
|
||||
htab_delete (gimple_referenced_vars (cfun));
|
||||
cfun->gimple_df->referenced_vars = NULL;
|
||||
|
||||
|
@ -765,7 +765,7 @@ arg_needs_copy_p (tree param)
|
||||
{
|
||||
tree def;
|
||||
|
||||
if (!is_gimple_reg (param) || !var_ann (param))
|
||||
if (!is_gimple_reg (param))
|
||||
return false;
|
||||
|
||||
/* Parameters that are only defined but never used need not be copied. */
|
||||
|
@ -961,8 +961,6 @@ copy_node_stat (tree node MEM_STAT_DECL)
|
||||
TREE_CHAIN (t) = 0;
|
||||
TREE_ASM_WRITTEN (t) = 0;
|
||||
TREE_VISITED (t) = 0;
|
||||
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
|
||||
*DECL_VAR_ANN_PTR (t) = 0;
|
||||
|
||||
if (TREE_CODE_CLASS (code) == tcc_declaration)
|
||||
{
|
||||
|
10
gcc/tree.h
10
gcc/tree.h
@ -3116,10 +3116,8 @@ struct GTY(()) tree_label_decl {
|
||||
int eh_landing_pad_nr;
|
||||
};
|
||||
|
||||
struct var_ann_d;
|
||||
struct GTY(()) tree_result_decl {
|
||||
struct tree_decl_with_rtl common;
|
||||
struct var_ann_d *ann;
|
||||
};
|
||||
|
||||
struct GTY(()) tree_const_decl {
|
||||
@ -3138,7 +3136,6 @@ struct GTY(()) tree_const_decl {
|
||||
struct GTY(()) tree_parm_decl {
|
||||
struct tree_decl_with_rtl common;
|
||||
rtx incoming_rtl;
|
||||
struct var_ann_d *ann;
|
||||
};
|
||||
|
||||
|
||||
@ -3355,15 +3352,8 @@ extern void decl_fini_priority_insert (tree, priority_type);
|
||||
#define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
|
||||
(VAR_DECL_CHECK (NODE)->base.saturating_flag)
|
||||
|
||||
#define DECL_VAR_ANN_PTR(NODE) \
|
||||
(TREE_CODE (NODE) == VAR_DECL ? &(NODE)->var_decl.ann \
|
||||
: TREE_CODE (NODE) == PARM_DECL ? &(NODE)->parm_decl.ann \
|
||||
: TREE_CODE (NODE) == RESULT_DECL ? &(NODE)->result_decl.ann \
|
||||
: NULL)
|
||||
|
||||
struct GTY(()) tree_var_decl {
|
||||
struct tree_decl_with_vis common;
|
||||
struct var_ann_d *ann;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user