This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] More pass cleanups, make phinodes cache global
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 May 2012 14:49:02 +0200 (CEST)
- Subject: [PATCH] More pass cleanups, make phinodes cache global
This makes some more pass structs internal to passes.c. It also
makes the phinodes cache global (which it is already - sort of,
it gets cleaned after each early optimization but is kept after
IPA opts).
Bootstrapped on x86_64-unknown-linux-gnu.
Richard.
2012-05-11 Richard Guenther <rguenther@suse.de>
* tree-pass.h (pass_rest_of_compilation,
pass_all_optimizations, pass_postreload, pass_all_early_optimizations):
Remove.
* passes.c (pass_all_optimizations, pass_postreload,
pass_all_early_optimizations): Make static.
(pass_rest_of_compilation): Likewise. Make it an RTL_PASS.
* tree-phinodes.c (init_phinodes, fini_phinodes): Remove.
* tree-ssa.c (init_tree_ssa): Do not call init_phinodes.
(delete_tree_ssa): Do not call fini_phinodes.
* tree-flow.h (init_phinodes, fini_phinodes): Remove.
Index: gcc/tree-pass.h
===================================================================
*** gcc/tree-pass.h (revision 187396)
--- gcc/tree-pass.h (working copy)
*************** extern struct gimple_opt_pass pass_tree_
*** 430,436 ****
extern struct gimple_opt_pass pass_dse;
extern struct gimple_opt_pass pass_nrv;
extern struct gimple_opt_pass pass_rename_ssa_copies;
- extern struct gimple_opt_pass pass_rest_of_compilation;
extern struct gimple_opt_pass pass_sink_code;
extern struct gimple_opt_pass pass_fre;
extern struct gimple_opt_pass pass_check_data_deps;
--- 430,435 ----
*************** extern struct simple_ipa_opt_pass pass_i
*** 477,483 ****
extern struct ipa_opt_pass_d pass_ipa_profile;
extern struct ipa_opt_pass_d pass_ipa_cdtor_merge;
- extern struct gimple_opt_pass pass_all_optimizations;
extern struct gimple_opt_pass pass_cleanup_cfg_post_optimizing;
extern struct gimple_opt_pass pass_init_datastructures;
extern struct gimple_opt_pass pass_fixup_cfg;
--- 476,481 ----
*************** extern struct rtl_opt_pass pass_sms;
*** 535,541 ****
extern struct rtl_opt_pass pass_sched;
extern struct rtl_opt_pass pass_ira;
extern struct rtl_opt_pass pass_reload;
- extern struct rtl_opt_pass pass_postreload;
extern struct rtl_opt_pass pass_clean_state;
extern struct rtl_opt_pass pass_branch_prob;
extern struct rtl_opt_pass pass_value_profile_transformations;
--- 533,538 ----
*************** extern struct rtl_opt_pass pass_rtl_seqa
*** 576,582 ****
extern struct gimple_opt_pass pass_release_ssa_names;
extern struct gimple_opt_pass pass_early_inline;
extern struct gimple_opt_pass pass_inline_parameters;
- extern struct gimple_opt_pass pass_all_early_optimizations;
extern struct gimple_opt_pass pass_update_address_taken;
extern struct gimple_opt_pass pass_convert_switch;
--- 573,578 ----
Index: gcc/passes.c
===================================================================
*** gcc/passes.c (revision 187396)
--- gcc/passes.c (working copy)
*************** gate_all_early_optimizations (void)
*** 334,340 ****
&& !seen_error ());
}
! struct gimple_opt_pass pass_all_early_optimizations =
{
{
GIMPLE_PASS,
--- 334,340 ----
&& !seen_error ());
}
! static struct gimple_opt_pass pass_all_early_optimizations =
{
{
GIMPLE_PASS,
*************** gate_all_optimizations (void)
*** 364,370 ****
&& (!seen_error () || gimple_in_ssa_p (cfun)));
}
! struct gimple_opt_pass pass_all_optimizations =
{
{
GIMPLE_PASS,
--- 364,370 ----
&& (!seen_error () || gimple_in_ssa_p (cfun)));
}
! static struct gimple_opt_pass pass_all_optimizations =
{
{
GIMPLE_PASS,
*************** gate_rest_of_compilation (void)
*** 391,400 ****
return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
}
! struct gimple_opt_pass pass_rest_of_compilation =
{
{
! GIMPLE_PASS,
"*rest_of_compilation", /* name */
gate_rest_of_compilation, /* gate */
NULL, /* execute */
--- 391,400 ----
return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
}
! static struct rtl_opt_pass pass_rest_of_compilation =
{
{
! RTL_PASS,
"*rest_of_compilation", /* name */
gate_rest_of_compilation, /* gate */
NULL, /* execute */
*************** gate_postreload (void)
*** 416,422 ****
return reload_completed;
}
! struct rtl_opt_pass pass_postreload =
{
{
RTL_PASS,
--- 416,422 ----
return reload_completed;
}
! static struct rtl_opt_pass pass_postreload =
{
{
RTL_PASS,
*************** init_optimization_passes (void)
*** 1377,1382 ****
--- 1377,1383 ----
p = &all_late_ipa_passes;
NEXT_PASS (pass_ipa_pta);
*p = NULL;
+
/* These passes are run after IPA passes on every function that is being
output to the assembler file. */
p = &all_passes;
Index: gcc/tree-phinodes.c
===================================================================
*** gcc/tree-phinodes.c (revision 187396)
--- gcc/tree-phinodes.c (working copy)
*************** along with GCC; see the file COPYING3.
*** 44,53 ****
garbage collector. Similar results have been seen on a wider variety
of tests (such as the compiler itself).
- Right now we maintain our free list on a per-function basis. It may
- or may not make sense to maintain the free list for the duration of
- a compilation unit.
-
We could also use a zone allocator for these objects since they have
a very well defined lifetime. If someone wants to experiment with that
this is the place to try it.
--- 44,49 ----
*************** unsigned int phi_nodes_reused;
*** 87,116 ****
unsigned int phi_nodes_created;
#endif
- /* Initialize management of PHIs. */
-
- void
- init_phinodes (void)
- {
- int i;
-
- for (i = 0; i < NUM_BUCKETS - 2; i++)
- free_phinodes[i] = NULL;
- free_phinode_count = 0;
- }
-
- /* Finalize management of PHIs. */
-
- void
- fini_phinodes (void)
- {
- int i;
-
- for (i = 0; i < NUM_BUCKETS - 2; i++)
- free_phinodes[i] = NULL;
- free_phinode_count = 0;
- }
-
/* Dump some simple statistics regarding the re-use of PHI nodes. */
#ifdef GATHER_STATISTICS
--- 83,88 ----
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c (revision 187396)
--- gcc/tree-ssa.c (working copy)
*************** init_tree_ssa (struct function *fn)
*** 1117,1123 ****
uid_ssaname_map_eq, NULL);
pt_solution_reset (&fn->gimple_df->escaped);
init_ssanames (fn, 0);
- init_phinodes ();
}
/* Do the actions required to initialize internal data structures used
--- 1117,1122 ----
*************** delete_tree_ssa (void)
*** 1173,1179 ****
cfun->gimple_df->referenced_vars = NULL;
fini_ssanames ();
- fini_phinodes ();
/* We no longer maintain the SSA operand cache at this point. */
if (ssa_operands_active ())
--- 1172,1177 ----
Index: gcc/tree-flow.h
===================================================================
*** gcc/tree-flow.h (revision 187401)
--- gcc/tree-flow.h (working copy)
*************** extern void add_phi_arg (gimple, tree, e
*** 514,521 ****
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
- extern void init_phinodes (void);
- extern void fini_phinodes (void);
extern void release_phi_node (gimple);
#ifdef GATHER_STATISTICS
extern void phinodes_print_statistics (void);
--- 513,518 ----