diff options
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 7 | ||||
-rw-r--r-- | gcc/ssaexpand.h | 11 | ||||
-rw-r--r-- | gcc/tree-outof-ssa.c | 4 | ||||
-rw-r--r-- | gcc/tree-ssa-live.h | 4 | ||||
-rw-r--r-- | gcc/tree-ssa-ter.c | 22 |
6 files changed, 40 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74160c48b0a..fae01de79f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +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> * tree-cfg.c (remove_useless_stmts): Verify stmts afterwards. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index a5765f81c47..03d0996989a 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -94,8 +94,8 @@ gimple_cond_pred_to_tree (gimple stmt) tree lhs = gimple_cond_lhs (stmt); if (SA.values && TREE_CODE (lhs) == SSA_NAME - && SA.values[SSA_NAME_VERSION (lhs)]) - lhs = gimple_assign_rhs_to_tree (SA.values[SSA_NAME_VERSION (lhs)]); + && bitmap_bit_p (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, lhs, gimple_cond_rhs (stmt)); @@ -2078,7 +2078,8 @@ expand_gimple_basic_block (basic_block bb) /* Ignore this stmt if it is in the list of replaceable expressions. */ 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; } stmt_tree = gimple_to_tree (stmt); diff --git a/gcc/ssaexpand.h b/gcc/ssaexpand.h index a42282d582f..95c55596a98 100644 --- a/gcc/ssaexpand.h +++ b/gcc/ssaexpand.h @@ -31,10 +31,9 @@ struct ssaexpand /* The computed partitions of SSA names are stored here. */ var_map map; - /* For a SSA name version V values[V] contains the gimple statement - defining it iff TER decided that it should be forwarded, NULL - otherwise. */ - gimple *values; + /* For an SSA name version V bit V is set iff TER decided that + its definition should be forwarded. */ + bitmap values; /* For a partition number I partition_to_pseudo[I] contains the RTL expression of the allocated space of it (either a MEM or @@ -67,8 +66,8 @@ static inline gimple get_gimple_for_ssa_name (tree exp) { int v = SSA_NAME_VERSION (exp); - if (SA.values) - return SA.values[v]; + if (SA.values && bitmap_bit_p (SA.values, v)) + return SSA_NAME_DEF_STMT (exp); return NULL; } diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 6000a823c10..4e7c78704ae 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -791,7 +791,7 @@ expand_phi_nodes (struct ssaexpand *sa) static void remove_ssa_form (bool perform_ter, struct ssaexpand *sa) { - gimple *values = NULL; + bitmap values = NULL; var_map map; unsigned i; @@ -926,7 +926,7 @@ finish_out_of_ssa (struct ssaexpand *sa) { free (sa->partition_to_pseudo); if (sa->values) - free (sa->values); + BITMAP_FREE (sa->values); delete_var_map (sa->map); BITMAP_FREE (sa->partition_has_default_def); memset (sa, 0, sizeof *sa); diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h index d97a2133759..d7dd10dc0dc 100644 --- a/gcc/tree-ssa-live.h +++ b/gcc/tree-ssa-live.h @@ -341,8 +341,8 @@ extern var_map coalesce_ssa_name (void); /* From tree-ssa-ter.c */ -extern gimple *find_replaceable_exprs (var_map); -extern void dump_replaceable_exprs (FILE *, gimple *); +extern bitmap find_replaceable_exprs (var_map); +extern void dump_replaceable_exprs (FILE *, bitmap); #endif /* _TREE_SSA_LIVE_H */ diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c index 6fd7ca14485..3bbc8b9f866 100644 --- a/gcc/tree-ssa-ter.c +++ b/gcc/tree-ssa-ter.c @@ -159,7 +159,7 @@ typedef struct temp_expr_table_d { var_map map; 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 *kill_list; /* Expr's killed by a partition. */ int virtual_partition; /* Pseudo partition for virtual ops. */ @@ -216,10 +216,10 @@ new_temp_expr_table (var_map map) /* Free TER table T. If there are valid replacements, return the expression vector. */ -static gimple * +static bitmap free_temp_expr_table (temp_expr_table_p t) { - gimple *ret = NULL; + bitmap ret = NULL; #ifdef ENABLE_CHECKING unsigned x; @@ -255,7 +255,7 @@ version_to_be_replaced_p (temp_expr_table_p tab, int version) { if (!tab->replaceable_expressions) 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) /* Set the replaceable expression. */ if (!tab->replaceable_expressions) - tab->replaceable_expressions = XCNEWVEC (gimple, num_ssa_names + 1); - tab->replaceable_expressions[version] = SSA_NAME_DEF_STMT (var); + tab->replaceable_expressions = BITMAP_ALLOC (NULL); + bitmap_set_bit (tab->replaceable_expressions, version); } @@ -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 by SSA_NAME version numbers. */ -extern gimple * +extern bitmap find_replaceable_exprs (var_map map) { basic_block bb; temp_expr_table_p table; - gimple *ret; + bitmap ret; table = new_temp_expr_table (map); FOR_EACH_BB (bb) @@ -676,19 +676,19 @@ find_replaceable_exprs (var_map map) /* Dump TER expression table EXPR to file F. */ void -dump_replaceable_exprs (FILE *f, gimple *expr) +dump_replaceable_exprs (FILE *f, bitmap expr) { tree var; unsigned x; fprintf (f, "\nReplacing Expressions\n"); for (x = 0; x < num_ssa_names; x++) - if (expr[x]) + if (bitmap_bit_p (expr, x)) { var = ssa_name (x); print_generic_expr (f, var, TDF_SLIM); 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"); |