diff options
author | Richard Guenther <rguenther@suse.de> | 2008-05-15 13:39:39 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-05-15 13:39:39 +0000 |
commit | 9fe0cb7d88323ad1be17248b06fd6b071c0a8552 (patch) | |
tree | 8b2e7b5f17ea3a9b8184b7bac245f575919ed667 /gcc/passes.c | |
parent | 77f377f70e6ff7e9854be833624c06c4ac567c8c (diff) | |
download | gcc-9fe0cb7d88323ad1be17248b06fd6b071c0a8552.zip gcc-9fe0cb7d88323ad1be17248b06fd6b071c0a8552.tar.gz gcc-9fe0cb7d88323ad1be17248b06fd6b071c0a8552.tar.bz2 |
tree-pass.h (current_pass): Declare.
2008-05-15 Richard Guenther <rguenther@suse.de>
* tree-pass.h (current_pass): Declare.
(get_pass_for_id): Likewise.
* passes.c (passes_by_id, passes_by_id_size): New globals.
(set_pass_for_id): New function.
(get_pass_for_id): Likewise.
(register_one_dump_file): Use set_pass_for_id to populate passes_by_id.
(execute_function_todo): Flush per function statistics.
* toplev.c (compile_file): Init statistics.
(general_init): Do early statistics initialization.
(finalize): Finish statistics.
* statistics.h (statistics_early_init): Declare.
(statistics_init): Likewise.
(statistics_fini): Likewise.
(statistics_fini_pass): Likewise.
(statistics_counter_event): Likewise.
(statistics_histogram_event): Likewise.
* statistics.c: New file.
* Makefile.in (OBJS-common): Add statistics.o.
(statistics.o): Add dependencies.
* doc/invoke.texi (-fdump-statistics): Document.
* tree-ssa-pre.c (compute_antic): Use statistics_histogram_event.
(insert): Likewise.
(execute_pre): Use statistics_counter_event.
* tree-ssa-propagate.c (struct prop_stats_d): Add num_dce field.
(substitute_and_fold): Increment it. Use statistics_counter_event.
* gcc.dg/tree-ssa/loadpre7.c: Adjust scan for not performed
transformation.
* gcc.dg/tree-ssa/ssa-fre-10.c: Likewise.
From-SVN: r135358
Diffstat (limited to 'gcc/passes.c')
-rw-r--r-- | gcc/passes.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/gcc/passes.c b/gcc/passes.c index bd83926..ede2cd9 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -333,6 +333,37 @@ struct rtl_opt_pass pass_postreload = /* The root of the compilation pass tree, once constructed. */ struct opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes; +/* A map from static pass id to optimization pass. */ +struct opt_pass **passes_by_id; +int passes_by_id_size; + +/* Set the static pass number of pass PASS to ID and record that + in the mapping from static pass number to pass. */ + +static void +set_pass_for_id (int id, struct opt_pass *pass) +{ + pass->static_pass_number = id; + if (passes_by_id_size <= id) + { + passes_by_id = xrealloc (passes_by_id, (id + 1) * sizeof (void *)); + memset (passes_by_id + passes_by_id_size, 0, + (id + 1 - passes_by_id_size) * sizeof (void *)); + passes_by_id_size = id + 1; + } + passes_by_id[id] = pass; +} + +/* Return the pass with the static pass number ID. */ + +struct opt_pass * +get_pass_for_id (int id) +{ + if (id >= passes_by_id_size) + return NULL; + return passes_by_id[id]; +} + /* Iterate over the pass tree allocating dump file numbers. We want to do this depth first, and independent of whether the pass is enabled or not. */ @@ -343,7 +374,7 @@ register_one_dump_file (struct opt_pass *pass) char *dot_name, *flag_name, *glob_name; const char *prefix; char num[10]; - int flags; + int flags, id; /* See below in next_pass_1. */ num[0] = '\0'; @@ -361,8 +392,8 @@ register_one_dump_file (struct opt_pass *pass) flag_name = concat (prefix, pass->name, num, NULL); glob_name = concat (prefix, pass->name, NULL); - pass->static_pass_number = dump_register (dot_name, flag_name, glob_name, - flags); + id = dump_register (dot_name, flag_name, glob_name, flags); + set_pass_for_id (id, pass); } /* Recursive worker function for register_dump_files. */ @@ -883,7 +914,9 @@ execute_function_todo (void *data) flags &= ~cfun->last_verified; if (!flags) return; - + + statistics_fini_pass (); + /* Always cleanup the CFG before trying to update SSA. */ if (flags & TODO_cleanup_cfg) { @@ -1346,4 +1379,5 @@ execute_ipa_pass_list (struct opt_pass *pass) } while (pass); } + #include "gt-passes.h" |