tree-ssa-alias.c (count_calls_and_maybe_create_global_var): New.

* tree-ssa-alias.c (count_calls_and_maybe_create_global_var): New.
        (pass_maybe_create_global_var): New.
        * tree-pass.h (pass_maybe_create_global_var): Declare.
        * tree-optimize.c (init_tree_optimization_passes): Link in
        pass_maybe_create_global_var.

From-SVN: r91425
This commit is contained in:
Jeff Law 2004-11-28 14:02:31 -07:00 committed by Jeff Law
parent ec017547ea
commit 856e49c207
4 changed files with 66 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2004-11-28 Jeff Law <law@redhat.com>
* tree-ssa-alias.c (count_calls_and_maybe_create_global_var): New.
(pass_maybe_create_global_var): New.
* tree-pass.h (pass_maybe_create_global_var): Declare.
* tree-optimize.c (init_tree_optimization_passes): Link in
pass_maybe_create_global_var.
2004-11-28 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree-inline.c (inline_forbidden_p_1, case RECORD_TYPE): Add comment.

View File

@ -345,6 +345,7 @@ init_tree_optimization_passes (void)
p = &pass_all_optimizations.sub;
NEXT_PASS (pass_referenced_vars);
NEXT_PASS (pass_maybe_create_global_var);
NEXT_PASS (pass_build_ssa);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_rename_ssa_copies);

View File

@ -163,5 +163,6 @@ extern struct tree_opt_pass pass_expand;
extern struct tree_opt_pass pass_rest_of_compilation;
extern struct tree_opt_pass pass_fre;
extern struct tree_opt_pass pass_linear_transform;
extern struct tree_opt_pass pass_maybe_create_global_var;
#endif /* GCC_TREE_PASS_H */

View File

@ -357,6 +357,62 @@ struct tree_opt_pass pass_may_alias =
0 /* letter */
};
/* Count the number of calls in the function and conditionally
create GLOBAL_VAR. This is performed before translation
into SSA (and thus before alias analysis) to avoid compile time
and memory utilization explosions in functions with many
of calls and call clobbered variables. */
static void
count_calls_and_maybe_create_global_var (void)
{
struct alias_info ai;
basic_block bb;
bool temp;
memset (&ai, 0, sizeof (struct alias_info));
/* First count the number of calls in the IL. */
FOR_EACH_BB (bb)
{
block_stmt_iterator si;
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
{
tree stmt = bsi_stmt (si);
if (get_call_expr_in (stmt) != NULL_TREE)
ai.num_calls_found++;
}
}
/* If there are no call clobbered variables, then maybe_create_global_var
will always create a GLOBAL_VAR. At this point we do not want that
behavior. So we turn on one bit in CALL_CLOBBERED_VARs, call
maybe_create_global_var, then reset the bit to its original state. */
temp = bitmap_bit_p (call_clobbered_vars, 0);
bitmap_set_bit (call_clobbered_vars, 0);
maybe_create_global_var (&ai);
if (!temp)
bitmap_clear_bit (call_clobbered_vars, 0);
}
struct tree_opt_pass pass_maybe_create_global_var =
{
"maybe_create_global_var", /* name */
NULL, /* gate */
count_calls_and_maybe_create_global_var, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_MAY_ALIAS, /* tv_id */
PROP_cfg, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
0, /* todo_flags_finish */
0 /* letter */
};
/* Initialize the data structures used for alias analysis. */