{
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. */
/* 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;
- unsigned i;
+ bitmap ret = NULL;
#ifdef ENABLE_CHECKING
unsigned x;
for (x = 0; x <= num_var_partitions (t->map); x++)
gcc_assert (!t->kill_list[x]);
+ for (x = 0; x < num_ssa_names; x++)
+ {
+ gcc_assert (t->expr_decl_uids[x] == NULL);
+ gcc_assert (t->partition_dependencies[x] == NULL);
+ }
#endif
BITMAP_FREE (t->partition_in_use);
BITMAP_FREE (t->new_replaceable_dependencies);
- for (i = 0; i <= num_ssa_names; i++)
- if (t->expr_decl_uids[i])
- BITMAP_FREE (t->expr_decl_uids[i]);
free (t->expr_decl_uids);
-
free (t->kill_list);
free (t->partition_dependencies);
free (t->num_in_part);
{
if (!tab->replaceable_expressions)
return false;
- return tab->replaceable_expressions[version] != NULL;
+ return bitmap_bit_p (tab->replaceable_expressions, version);
}
return false;
/* There must be no VDEFs. */
- if (!(ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF)))
+ if (gimple_vdef (stmt))
return false;
/* Without alias info we can't move around loads. */
tab->expr_decl_uids[version] = def_vars;
/* If there are VUSES, add a dependence on virtual defs. */
- if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VUSE))
+ if (gimple_vuse (stmt))
{
make_dependent_on_partition (tab, version, VIRTUAL_PARTITION (tab));
add_to_partition_kill_list (tab, VIRTUAL_PARTITION (tab), version);
/* 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);
}
/* A V_{MAY,MUST}_DEF kills any expression using a virtual operand,
including the current stmt. */
- if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
+ if (gimple_vdef (stmt))
kill_virtual_exprs (tab);
}
}
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)
{
find_replaceable_in_bb (table, bb);
- gcc_assert (bitmap_empty_p (table->partition_in_use));
-
#ifdef ENABLE_CHECKING
- {
- unsigned i;
- /* Make sure all the tables have been cleared out. */
- for (i = 0; i < num_ssa_names + 1; i++)
- {
- gcc_assert (table->partition_dependencies[i] == NULL);
- gcc_assert (table->expr_decl_uids[i] == NULL);
- if (i < num_var_partitions (map))
- gcc_assert (table->kill_list[i] == NULL);
- }
- }
+ gcc_assert (bitmap_empty_p (table->partition_in_use));
#endif
}
ret = free_temp_expr_table (table);
return ret;
-}
-
+}
/* 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");