Commit e97809c6 by Michael Matz Committed by Michael Matz

ssaexpand.h (struct ssaexpand): Member 'values' is a bitmap.

	* ssaexpand.h (struct ssaexpand): Member 'values' is a bitmap.
	(get_gimple_for_ssa_name): Adjust, lookup using SSA_NAME_DEF_STMT.
	* tree-ssa-live.h: (find_replaceable_exprs): Return a bitmap.
	(dump_replaceable_exprs): Take a bitmap.
	* cfgexpand.c (gimple_cond_pred_to_tree): Handle bitmap instead of
	array.
	(expand_gimple_basic_block): Likewise.
	* tree-ssa-ter.c (struct temp_expr_table_d): Make
	replaceable_expressions member a bitmap.
	(free_temp_expr_table): Pass back and deal with bitmap, not gimple*.
	(mark_replaceable): Likewise.
	(find_replaceable_in_bb, dump_replaceable_exprs): Likewise.
	* tree-outof-ssa.c (remove_ssa_form): 'values' is a bitmap.

From-SVN: r146837
parent 211ca15c
2009-04-27 Michael Matz <matz@suse.de>
* ssaexpand.h (struct ssaexpand): Member 'values' is a bitmap.
(get_gimple_for_ssa_name): Adjust, lookup using SSA_NAME_DEF_STMT.
* tree-ssa-live.h: (find_replaceable_exprs): Return a bitmap.
(dump_replaceable_exprs): Take a bitmap.
* cfgexpand.c (gimple_cond_pred_to_tree): Handle bitmap instead of
array.
(expand_gimple_basic_block): Likewise.
* tree-ssa-ter.c (struct temp_expr_table_d): Make
replaceable_expressions member a bitmap.
(free_temp_expr_table): Pass back and deal with bitmap, not gimple*.
(mark_replaceable): Likewise.
(find_replaceable_in_bb, dump_replaceable_exprs): Likewise.
* tree-outof-ssa.c (remove_ssa_form): 'values' is a bitmap.
2009-04-27 Richard Guenther <rguenther@suse.de> 2009-04-27 Richard Guenther <rguenther@suse.de>
* tree-cfg.c (remove_useless_stmts): Verify stmts afterwards. * tree-cfg.c (remove_useless_stmts): Verify stmts afterwards.
......
...@@ -94,8 +94,8 @@ gimple_cond_pred_to_tree (gimple stmt) ...@@ -94,8 +94,8 @@ gimple_cond_pred_to_tree (gimple stmt)
tree lhs = gimple_cond_lhs (stmt); tree lhs = gimple_cond_lhs (stmt);
if (SA.values if (SA.values
&& TREE_CODE (lhs) == SSA_NAME && TREE_CODE (lhs) == SSA_NAME
&& SA.values[SSA_NAME_VERSION (lhs)]) && bitmap_bit_p (SA.values, SSA_NAME_VERSION (lhs)))
lhs = gimple_assign_rhs_to_tree (SA.values[SSA_NAME_VERSION (lhs)]); lhs = gimple_assign_rhs_to_tree (SSA_NAME_DEF_STMT (lhs));
return build2 (gimple_cond_code (stmt), boolean_type_node, return build2 (gimple_cond_code (stmt), boolean_type_node,
lhs, gimple_cond_rhs (stmt)); lhs, gimple_cond_rhs (stmt));
...@@ -2078,7 +2078,8 @@ expand_gimple_basic_block (basic_block bb) ...@@ -2078,7 +2078,8 @@ expand_gimple_basic_block (basic_block bb)
/* Ignore this stmt if it is in the list of /* Ignore this stmt if it is in the list of
replaceable expressions. */ replaceable expressions. */
if (SA.values if (SA.values
&& SA.values[SSA_NAME_VERSION (DEF_FROM_PTR (def_p))]) && bitmap_bit_p (SA.values,
SSA_NAME_VERSION (DEF_FROM_PTR (def_p))))
continue; continue;
} }
stmt_tree = gimple_to_tree (stmt); stmt_tree = gimple_to_tree (stmt);
......
...@@ -31,10 +31,9 @@ struct ssaexpand ...@@ -31,10 +31,9 @@ struct ssaexpand
/* The computed partitions of SSA names are stored here. */ /* The computed partitions of SSA names are stored here. */
var_map map; var_map map;
/* For a SSA name version V values[V] contains the gimple statement /* For an SSA name version V bit V is set iff TER decided that
defining it iff TER decided that it should be forwarded, NULL its definition should be forwarded. */
otherwise. */ bitmap values;
gimple *values;
/* For a partition number I partition_to_pseudo[I] contains the /* For a partition number I partition_to_pseudo[I] contains the
RTL expression of the allocated space of it (either a MEM or RTL expression of the allocated space of it (either a MEM or
...@@ -67,8 +66,8 @@ static inline gimple ...@@ -67,8 +66,8 @@ static inline gimple
get_gimple_for_ssa_name (tree exp) get_gimple_for_ssa_name (tree exp)
{ {
int v = SSA_NAME_VERSION (exp); int v = SSA_NAME_VERSION (exp);
if (SA.values) if (SA.values && bitmap_bit_p (SA.values, v))
return SA.values[v]; return SSA_NAME_DEF_STMT (exp);
return NULL; return NULL;
} }
......
...@@ -791,7 +791,7 @@ expand_phi_nodes (struct ssaexpand *sa) ...@@ -791,7 +791,7 @@ expand_phi_nodes (struct ssaexpand *sa)
static void static void
remove_ssa_form (bool perform_ter, struct ssaexpand *sa) remove_ssa_form (bool perform_ter, struct ssaexpand *sa)
{ {
gimple *values = NULL; bitmap values = NULL;
var_map map; var_map map;
unsigned i; unsigned i;
...@@ -926,7 +926,7 @@ finish_out_of_ssa (struct ssaexpand *sa) ...@@ -926,7 +926,7 @@ finish_out_of_ssa (struct ssaexpand *sa)
{ {
free (sa->partition_to_pseudo); free (sa->partition_to_pseudo);
if (sa->values) if (sa->values)
free (sa->values); BITMAP_FREE (sa->values);
delete_var_map (sa->map); delete_var_map (sa->map);
BITMAP_FREE (sa->partition_has_default_def); BITMAP_FREE (sa->partition_has_default_def);
memset (sa, 0, sizeof *sa); memset (sa, 0, sizeof *sa);
......
...@@ -341,8 +341,8 @@ extern var_map coalesce_ssa_name (void); ...@@ -341,8 +341,8 @@ extern var_map coalesce_ssa_name (void);
/* From tree-ssa-ter.c */ /* From tree-ssa-ter.c */
extern gimple *find_replaceable_exprs (var_map); extern bitmap find_replaceable_exprs (var_map);
extern void dump_replaceable_exprs (FILE *, gimple *); extern void dump_replaceable_exprs (FILE *, bitmap);
#endif /* _TREE_SSA_LIVE_H */ #endif /* _TREE_SSA_LIVE_H */
...@@ -159,7 +159,7 @@ typedef struct temp_expr_table_d ...@@ -159,7 +159,7 @@ typedef struct temp_expr_table_d
{ {
var_map map; var_map map;
bitmap *partition_dependencies; /* Partitions expr is dependent on. */ bitmap *partition_dependencies; /* Partitions expr is dependent on. */
gimple *replaceable_expressions; /* Replacement expression table. */ bitmap replaceable_expressions; /* Replacement expression table. */
bitmap *expr_decl_uids; /* Base uids of exprs. */ bitmap *expr_decl_uids; /* Base uids of exprs. */
bitmap *kill_list; /* Expr's killed by a partition. */ bitmap *kill_list; /* Expr's killed by a partition. */
int virtual_partition; /* Pseudo partition for virtual ops. */ int virtual_partition; /* Pseudo partition for virtual ops. */
...@@ -216,10 +216,10 @@ new_temp_expr_table (var_map map) ...@@ -216,10 +216,10 @@ new_temp_expr_table (var_map map)
/* Free TER table T. If there are valid replacements, return the expression /* Free TER table T. If there are valid replacements, return the expression
vector. */ vector. */
static gimple * static bitmap
free_temp_expr_table (temp_expr_table_p t) free_temp_expr_table (temp_expr_table_p t)
{ {
gimple *ret = NULL; bitmap ret = NULL;
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
unsigned x; unsigned x;
...@@ -255,7 +255,7 @@ version_to_be_replaced_p (temp_expr_table_p tab, int version) ...@@ -255,7 +255,7 @@ version_to_be_replaced_p (temp_expr_table_p tab, int version)
{ {
if (!tab->replaceable_expressions) if (!tab->replaceable_expressions)
return false; return false;
return tab->replaceable_expressions[version] != NULL; return bitmap_bit_p (tab->replaceable_expressions, version);
} }
...@@ -562,8 +562,8 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing) ...@@ -562,8 +562,8 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing)
/* Set the replaceable expression. */ /* Set the replaceable expression. */
if (!tab->replaceable_expressions) if (!tab->replaceable_expressions)
tab->replaceable_expressions = XCNEWVEC (gimple, num_ssa_names + 1); tab->replaceable_expressions = BITMAP_ALLOC (NULL);
tab->replaceable_expressions[version] = SSA_NAME_DEF_STMT (var); bitmap_set_bit (tab->replaceable_expressions, version);
} }
...@@ -653,12 +653,12 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb) ...@@ -653,12 +653,12 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
NULL is returned by the function, otherwise an expression vector indexed NULL is returned by the function, otherwise an expression vector indexed
by SSA_NAME version numbers. */ by SSA_NAME version numbers. */
extern gimple * extern bitmap
find_replaceable_exprs (var_map map) find_replaceable_exprs (var_map map)
{ {
basic_block bb; basic_block bb;
temp_expr_table_p table; temp_expr_table_p table;
gimple *ret; bitmap ret;
table = new_temp_expr_table (map); table = new_temp_expr_table (map);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
...@@ -676,19 +676,19 @@ find_replaceable_exprs (var_map map) ...@@ -676,19 +676,19 @@ find_replaceable_exprs (var_map map)
/* Dump TER expression table EXPR to file F. */ /* Dump TER expression table EXPR to file F. */
void void
dump_replaceable_exprs (FILE *f, gimple *expr) dump_replaceable_exprs (FILE *f, bitmap expr)
{ {
tree var; tree var;
unsigned x; unsigned x;
fprintf (f, "\nReplacing Expressions\n"); fprintf (f, "\nReplacing Expressions\n");
for (x = 0; x < num_ssa_names; x++) for (x = 0; x < num_ssa_names; x++)
if (expr[x]) if (bitmap_bit_p (expr, x))
{ {
var = ssa_name (x); var = ssa_name (x);
print_generic_expr (f, var, TDF_SLIM); print_generic_expr (f, var, TDF_SLIM);
fprintf (f, " replace with --> "); fprintf (f, " replace with --> ");
print_gimple_stmt (f, expr[x], 0, TDF_SLIM); print_gimple_stmt (f, SSA_NAME_DEF_STMT (var), 0, TDF_SLIM);
fprintf (f, "\n"); fprintf (f, "\n");
} }
fprintf (f, "\n"); fprintf (f, "\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment