[PATCH][2a/2] Remove referenced vars
Richard Guenther
rguenther@suse.de
Wed Aug 1 11:57:00 GMT 2012
This is part one of the patch (and thus single commit) that will
remove referenced vars once we got rid of var annotations.
It removes referenced_var_lookup and all callers - which shows
you where dumping will be affected.
Bootstrap & regtest pending on x86_64-unknown-linux-gnu.
Richard.
2012-08-01 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (referenced_var_lookup): Remove.
* tree-flow.h (referenced_var_lookup): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars): Remove assert.
* gimple-pretty-print.c (pp_points_to_solution): Dump UIDs
unconditionally.
* tree-into-ssa.c (dump_decl_set): Likewise.
* tree-ssa.c (target_for_debug_bind): Virtual operands are
not suitable, but all register type vars are.
Index: trunk/gcc/cfgexpand.c
===================================================================
*** trunk.orig/gcc/cfgexpand.c 2012-07-20 12:11:05.000000000 +0200
--- trunk/gcc/cfgexpand.c 2012-08-01 11:46:40.447070164 +0200
*************** update_alias_info_with_stack_vars (void)
*** 620,632 ****
{
tree decl = stack_vars[j].decl;
unsigned int uid = DECL_PT_UID (decl);
- /* We should never end up partitioning SSA names (though they
- may end up on the stack). Neither should we allocate stack
- space to something that is unused and thus unreferenced, except
- for -O0 where we are preserving even unreferenced variables. */
- gcc_assert (DECL_P (decl)
- && (!optimize
- || referenced_var_lookup (cfun, DECL_UID (decl))));
bitmap_set_bit (part, uid);
*((bitmap *) pointer_map_insert (decls_to_partitions,
(void *)(size_t) uid)) = part;
--- 620,625 ----
Index: trunk/gcc/gimple-pretty-print.c
===================================================================
*** trunk.orig/gcc/gimple-pretty-print.c 2012-07-26 10:46:42.000000000 +0200
--- trunk/gcc/gimple-pretty-print.c 2012-08-01 11:49:41.513063937 +0200
*************** pp_points_to_solution (pretty_printer *b
*** 597,617 ****
pp_string (buffer, "{ ");
EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
{
! tree var = referenced_var_lookup (cfun, i);
! if (var)
! {
! dump_generic_node (buffer, var, 0, dump_flags, false);
! if (DECL_PT_UID (var) != DECL_UID (var))
! {
! pp_string (buffer, "ptD.");
! pp_decimal_int (buffer, DECL_PT_UID (var));
! }
! }
! else
! {
! pp_string (buffer, "D.");
! pp_decimal_int (buffer, i);
! }
pp_character (buffer, ' ');
}
pp_character (buffer, '}');
--- 597,604 ----
pp_string (buffer, "{ ");
EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
{
! pp_string (buffer, "D.");
! pp_decimal_int (buffer, i);
pp_character (buffer, ' ');
}
pp_character (buffer, '}');
Index: trunk/gcc/tree-dfa.c
===================================================================
*** trunk.orig/gcc/tree-dfa.c 2012-08-01 11:16:45.000000000 +0200
--- trunk/gcc/tree-dfa.c 2012-08-01 11:49:57.773063325 +0200
*************** find_referenced_vars_in (gimple stmt)
*** 430,448 ****
}
- /* Lookup UID in the referenced_vars hashtable and return the associated
- variable. */
-
- tree
- referenced_var_lookup (struct function *fn, unsigned int uid)
- {
- tree h;
- struct tree_decl_minimal in;
- in.uid = uid;
- h = (tree) htab_find_with_hash (gimple_referenced_vars (fn), &in, uid);
- return h;
- }
-
/* Check if TO is in the referenced_vars hash table and insert it if not.
Return true if it required insertion. */
--- 430,435 ----
Index: trunk/gcc/tree-flow.h
===================================================================
*** trunk.orig/gcc/tree-flow.h 2012-08-01 11:16:45.000000000 +0200
--- trunk/gcc/tree-flow.h 2012-08-01 12:02:27.703037366 +0200
*************** typedef struct
*** 323,329 ****
!end_referenced_vars_p (&(ITER)); \
(VAR) = next_referenced_var (&(ITER)))
- extern tree referenced_var_lookup (struct function *, unsigned int);
#define num_referenced_vars htab_elements (gimple_referenced_vars (cfun))
#define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
--- 323,328 ----
Index: trunk/gcc/tree-into-ssa.c
===================================================================
*** trunk.orig/gcc/tree-into-ssa.c 2012-08-01 11:16:45.000000000 +0200
--- trunk/gcc/tree-into-ssa.c 2012-08-01 11:50:17.248062660 +0200
*************** dump_decl_set (FILE *file, bitmap set)
*** 1554,1564 ****
EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
{
! tree var = referenced_var_lookup (cfun, i);
! if (var)
! print_generic_expr (file, var, 0);
! else
! fprintf (file, "D.%u", i);
fprintf (file, " ");
}
--- 1554,1560 ----
EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
{
! fprintf (file, "D.%u", i);
fprintf (file, " ");
}
Index: trunk/gcc/tree-ssa.c
===================================================================
*** trunk.orig/gcc/tree-ssa.c 2012-08-01 11:16:45.000000000 +0200
--- trunk/gcc/tree-ssa.c 2012-08-01 12:07:47.475026283 +0200
*************** target_for_debug_bind (tree var)
*** 249,255 ****
if (!MAY_HAVE_DEBUG_STMTS)
return NULL_TREE;
! if (TREE_CODE (var) != VAR_DECL
&& TREE_CODE (var) != PARM_DECL)
return NULL_TREE;
--- 249,256 ----
if (!MAY_HAVE_DEBUG_STMTS)
return NULL_TREE;
! if ((TREE_CODE (var) != VAR_DECL
! || VAR_DECL_IS_VIRTUAL_OPERAND (var))
&& TREE_CODE (var) != PARM_DECL)
return NULL_TREE;
*************** target_for_debug_bind (tree var)
*** 259,271 ****
if (DECL_IGNORED_P (var))
return NULL_TREE;
! if (!is_gimple_reg (var))
! {
! if (is_gimple_reg_type (TREE_TYPE (var))
! && referenced_var_lookup (cfun, DECL_UID (var)) == NULL_TREE)
! return var;
! return NULL_TREE;
! }
return var;
}
--- 260,268 ----
if (DECL_IGNORED_P (var))
return NULL_TREE;
! /* var-tracking only tracks registers. */
! if (!is_gimple_reg_type (TREE_TYPE (var)))
! return NULL_TREE;
return var;
}
More information about the Gcc-patches
mailing list