|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: [patch][plugins] Provide unique names to all compiler passesOn Thu, Nov 5, 2009 at 11:32 PM, Joern Rennecke <amylaar@...> wrote:
> Zbigniew Chamski: >> >> plugins refer to passes by their name, hence all compiler passes need >> a unique name: >> >> * passes with NULL name should get a new unique name; >> * passes which had duplicate names should be disambiguated by >> changing at least one name to achieve uniqueness. > > I have updated the patch to the current trunk. > It needed an extra change in passes.c:make_pass_instance to avoid > changing static_pass_number for the non-dumped passes, lest one would end > up with a static_pass_number of -2. > > Diego Novillo: >> >> Additionally, the pass manager should assert that every >> registered pass has a name. This can be done in next_pass_1. >> >> OK with that change. > > I have added that. > > Paolo Bonzini: >> >> The pass name should also be prefixed by * to avoid creating dump files >> uselessly. > > And that too. > > This exposed a problem with the patch: the renaming of passes changes > the dump file names and options. The -fdump-postreload option was > suddenly missing. > > To rectify this, I have backed out the name changes where there was no > actual pass name conflict, and where an actual name clash had to be > resolved, I have used a prefix followed with ASCII STX, which a bit of > new code in register_one_dump_file skips, so that the old dump file and > option names continue to be used. Ick. Why use STX when you could have used for example '@'? > There might be a case to disambiguate some dump options, but I don't want > to bundle such user interface changes and the test suite changes that would > then be required with the plugin prerequisites. Fair enough... OTOH the disambiguator seems to be GIMPLE_PASS vs. RTL_PASS in the cases where there were dump options available. When there were no dump options available you could have simply renamed the pass. So, is using the pass kind enough to resolve ambiguities? Thanks, Richard. > Regression tested in trunk revision 153936 on i686-pc-linux-gnu . |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesQuoting Richard Guenther <richard.guenther@...>:
> On Thu, Nov 5, 2009 at 11:32 PM, Joern Rennecke <amylaar@...> wrote: ... >> This exposed a problem with the patch: the renaming of passes changes >> the dump file names and options. The -fdump-postreload option was >> suddenly missing. >> >> To rectify this, I have backed out the name changes where there was no >> actual pass name conflict, and where an actual name clash had to be >> resolved, I have used a prefix followed with ASCII STX, which a bit of >> new code in register_one_dump_file skips, so that the old dump file and >> option names continue to be used. > > Ick. Why use STX when you could have used for example '@'? I would have thought '@' to be in the dump file name / options namespace. Also, STX indeed marks the 'start of text' with regards to that purpose. That being said, although not my first choice, I think '@' would work as well, so if you think that would be better, I can prepare & test a patch with '@'. Or whatever other character people might prefer. >> There might be a case to disambiguate some dump options, but I don't want >> to bundle such user interface changes and the test suite changes that would >> then be required with the plugin prerequisites. > > Fair enough... OTOH the disambiguator seems to be > GIMPLE_PASS vs. RTL_PASS in the cases where there were > dump options available. > When there were no dump options > available you could have simply renamed the pass. I did use "*all-postreload" for the postreload pass to avoid a clash with the "postreload" of postreload_cse (technically "*postreload" and "postreload" do not clash at the moment, but it seemed like a bug waiting to happen to rely on that). > So, is using the pass kind enough to resolve ambiguities? It would work for pre and eh passes, but not for dce - all of the dce passes are rtl passes. Also, if we ever get to the point of putting the mudflap and the nomudflap passes in the same executable, we can't distinguish them by the type either. Moreover, it would make identifying passes more complicated if we couldn't simply identify them by a string. You'd either have to pass around a tuple of multiple identifying data items, or some pointer to a struct. If you pass a pointer to the pass as such, the plugins would have to know about the structure of that struct, which may be subject to change. I could put type and name in their own struct, but then all the code that uses pass structs would need changing. Plus, the plugins would need to know about enum opt_pass_type, and we might want to change that too at some point in time. Also, a lot of the ICI pass handling would have to be rewritten if we can't identify a pass by a name. For debug purposes, it would also be more convenient if we can output a single identifying string rather than have to look at multiple fields. |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesQuoting Richard Guenther <richard.guenther@...>:
> So, is using the pass kind enough to resolve ambiguities? P.S.: The dfinit passes also can't be distinguished by type. |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesOn Fri, Nov 6, 2009 at 11:53 AM, Joern Rennecke <amylaar@...> wrote:
> Quoting Richard Guenther <richard.guenther@...>: > >> On Thu, Nov 5, 2009 at 11:32 PM, Joern Rennecke <amylaar@...> >> wrote: > > ... >>> >>> This exposed a problem with the patch: the renaming of passes changes >>> the dump file names and options. The -fdump-postreload option was >>> suddenly missing. >>> >>> To rectify this, I have backed out the name changes where there was no >>> actual pass name conflict, and where an actual name clash had to be >>> resolved, I have used a prefix followed with ASCII STX, which a bit of >>> new code in register_one_dump_file skips, so that the old dump file and >>> option names continue to be used. >> >> Ick. Why use STX when you could have used for example '@'? > > I would have thought '@' to be in the dump file name / options namespace. > Also, STX indeed marks the 'start of text' with regards to that purpose. > > That being said, although not my first choice, I think '@' would work as > well, so if you think that would be better, I can prepare & test a patch > with '@'. Or whatever other character people might prefer. > >>> There might be a case to disambiguate some dump options, but I don't want >>> to bundle such user interface changes and the test suite changes that >>> would >>> then be required with the plugin prerequisites. >> >> Fair enough... OTOH the disambiguator seems to be >> GIMPLE_PASS vs. RTL_PASS in the cases where there were >> dump options available. >> When there were no dump options >> available you could have simply renamed the pass. > > I did use "*all-postreload" for the postreload pass to avoid a clash > with the "postreload" of postreload_cse (technically "*postreload" > and "postreload" do not clash at the moment, but it seemed like a bug > waiting to happen to rely on that). > >> So, is using the pass kind enough to resolve ambiguities? > > It would work for pre and eh passes, but not for dce - all of the dce passes > are rtl passes. > Also, if we ever get to the point of putting the mudflap and the nomudflap > passes in the same executable, we can't distinguish them by the type either. > > Moreover, it would make identifying passes more complicated if we couldn't > simply identify them by a string. > You'd either have to pass around a tuple of multiple identifying data items, > or some pointer to a struct. If you pass a pointer to the pass as such, the > plugins would have to know about the structure of that struct, which may be > subject to change. > > I could put type and name in their own struct, but then all the code that > uses pass structs would need changing. Plus, the plugins would need to > know about enum opt_pass_type, and we might want to change that too at > some point in time. > > Also, a lot of the ICI pass handling would have to be rewritten if we can't > identify a pass by a name. > For debug purposes, it would also be more convenient if we can output > a single identifying string rather than have to look at multiple fields. Ok. The patch is ok after waiting another 24h to let others the time to comment. Thanks, Richard. |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesQuoting Richard Guenther <richard.guenther@...>:
> Ok. The patch is ok after waiting another 24h to let others > the time to comment. The one with STX or with '@' ? I have attahed the '@' variant, bootstrapped & regression tested on i686-pc-linux-gnu . 2009-11-06 Zbigniew Chamski <zbigniew.chamski@...> Joern Rennecke <amylaar@...> * cfgrtl.c (pass_free_cfg): Add pass name. * cgraphbuild.c (pass_build_cgraph_edges, pass_rebuild_cgraph_edges, pass_remove_cgraph_callee_edges): Likewise. * dce.c (pass_ud_rtl_dce, pass_fast_rtl_dce): Change pass name. * df-core.c (pass_df_initialize_no_opt): Likewise. * except.c (pass_rtl_eh): Likewise. * function.c (pass_init_function, pass_leaf_regs): Likewise. * gcse.c (pass_rtl_pre): Change pass name. * passes.c (pass_postreload): Add pass name. (make_pass_instance): Don't use duplicate-tracking logic for names starting with '*'. (next_pass_1): Assert that pass has a name. (register_one_dump_file): If there is an @ in the name, skip past it. * predict.c (pass_strip_predict_hints): Add pass name. * reg-stack.c (pass_stack_regs): Likewise. * stack-ptr-mod.c (pass_stack_ptr_mod): Likewise. * tree-cfg.c (pass_warn_function_return, pass_warn_function_noreturn): Add pass name. * tree-dfa.c (pass_referenced_vars): Likewise. * tree-optimize.c (pass_cleanup_cfg_post_optimizing): Fix whitespace before comment. (pass_fixup_cfg): Add pass name, fix whitespace before comment. (pass_init_datastructures): Add pass name. * tree-ssa-loop.c (pass_record_bounds): Likewise. * tree-ssa.c (pass_early_warn_uninitialized, pass_late_warn_uninitialized): Likewise. * tree.c (pass_ipa_free_lang_data): Likewise. Index: gcc/cgraphbuild.c =================================================================== --- gcc/cgraphbuild.c (revision 153936) +++ gcc/cgraphbuild.c (working copy) @@ -205,7 +205,7 @@ struct gimple_opt_pass pass_build_cgraph { { GIMPLE_PASS, - NULL, /* name */ + "*build_cgraph_edges", /* name */ NULL, /* gate */ build_cgraph_edges, /* execute */ NULL, /* sub */ @@ -270,7 +270,7 @@ struct gimple_opt_pass pass_rebuild_cgra { { GIMPLE_PASS, - NULL, /* name */ + "*rebuild_cgraph_edges", /* name */ NULL, /* gate */ rebuild_cgraph_edges, /* execute */ NULL, /* sub */ @@ -297,7 +297,7 @@ struct gimple_opt_pass pass_remove_cgrap { { GIMPLE_PASS, - NULL, /* name */ + "*remove_cgraph_callee_edges", /* name */ NULL, /* gate */ remove_cgraph_callee_edges, /* execute */ NULL, /* sub */ Index: gcc/tree.c =================================================================== --- gcc/tree.c (revision 153936) +++ gcc/tree.c (working copy) @@ -4988,7 +4988,7 @@ struct simple_ipa_opt_pass pass_ipa_free { { SIMPLE_IPA_PASS, - NULL, /* name */ + "*free_lang_data", /* name */ NULL, /* gate */ free_lang_data, /* execute */ NULL, /* sub */ Index: gcc/df-core.c =================================================================== --- gcc/df-core.c (revision 153936) +++ gcc/df-core.c (working copy) @@ -780,7 +780,7 @@ struct rtl_opt_pass pass_df_initialize_n { { RTL_PASS, - "dfinit", /* name */ + "no-opt@" "dfinit", /* name */ gate_no_opt, /* gate */ rest_of_handle_df_initialize, /* execute */ NULL, /* sub */ Index: gcc/tree-ssa-loop.c =================================================================== --- gcc/tree-ssa-loop.c (revision 153936) +++ gcc/tree-ssa-loop.c (working copy) @@ -455,7 +455,7 @@ struct gimple_opt_pass pass_record_bound { { GIMPLE_PASS, - NULL, /* name */ + "*record_bounds", /* name */ NULL, /* gate */ tree_ssa_loop_bounds, /* execute */ NULL, /* sub */ Index: gcc/predict.c =================================================================== --- gcc/predict.c (revision 153936) +++ gcc/predict.c (working copy) @@ -2246,7 +2246,7 @@ struct gimple_opt_pass pass_strip_predic { { GIMPLE_PASS, - NULL, /* name */ + "*strip_predict_hints", /* name */ NULL, /* gate */ strip_predict_hints, /* execute */ NULL, /* sub */ Index: gcc/function.c =================================================================== --- gcc/function.c (revision 153936) +++ gcc/function.c (working copy) @@ -4228,7 +4228,7 @@ struct rtl_opt_pass pass_init_function = { { RTL_PASS, - NULL, /* name */ + "*init_function", /* name */ NULL, /* gate */ init_function_for_compilation, /* execute */ NULL, /* sub */ @@ -5538,7 +5538,7 @@ struct rtl_opt_pass pass_leaf_regs = { { RTL_PASS, - NULL, /* name */ + "*leaf_regs", /* name */ NULL, /* gate */ rest_of_handle_check_leaf_regs, /* execute */ NULL, /* sub */ Index: gcc/gcse.c =================================================================== --- gcc/gcse.c (revision 153936) +++ gcc/gcse.c (working copy) @@ -5147,7 +5147,7 @@ struct rtl_opt_pass pass_rtl_pre = { { RTL_PASS, - "pre", /* name */ + "rtl@" "pre", /* name */ gate_rtl_pre, /* gate */ execute_rtl_pre, /* execute */ NULL, /* sub */ Index: gcc/tree-dfa.c =================================================================== --- gcc/tree-dfa.c (revision 153936) +++ gcc/tree-dfa.c (working copy) @@ -106,7 +106,7 @@ struct gimple_opt_pass pass_referenced_v { { GIMPLE_PASS, - NULL, /* name */ + "*referenced_vars", /* name */ NULL, /* gate */ find_referenced_vars, /* execute */ NULL, /* sub */ Index: gcc/except.c =================================================================== --- gcc/except.c (revision 153936) +++ gcc/except.c (working copy) @@ -1465,7 +1465,7 @@ struct rtl_opt_pass pass_rtl_eh = { { RTL_PASS, - "eh", /* name */ + "rtl@" "eh", /* name */ gate_handle_eh, /* gate */ rest_of_handle_eh, /* execute */ NULL, /* sub */ Index: gcc/tree-ssa.c =================================================================== --- gcc/tree-ssa.c (revision 153936) +++ gcc/tree-ssa.c (working copy) @@ -1856,7 +1856,7 @@ struct gimple_opt_pass pass_early_warn_u { { GIMPLE_PASS, - NULL, /* name */ + "*early_warn_uninitialized", /* name */ gate_warn_uninitialized, /* gate */ execute_early_warn_uninitialized, /* execute */ NULL, /* sub */ @@ -1875,7 +1875,7 @@ struct gimple_opt_pass pass_late_warn_un { { GIMPLE_PASS, - NULL, /* name */ + "*late_warn_uninitialized", /* name */ gate_warn_uninitialized, /* gate */ execute_late_warn_uninitialized, /* execute */ NULL, /* sub */ Index: gcc/tree-optimize.c =================================================================== --- gcc/tree-optimize.c (revision 153936) +++ gcc/tree-optimize.c (working copy) @@ -201,7 +201,7 @@ struct gimple_opt_pass pass_cleanup_cfg_ { { GIMPLE_PASS, - "optimized", /* name */ + "optimized", /* name */ NULL, /* gate */ execute_cleanup_cfg_post_optimizing, /* execute */ NULL, /* sub */ @@ -287,9 +287,9 @@ struct gimple_opt_pass pass_fixup_cfg = { { GIMPLE_PASS, - NULL, /* name */ + "*free_cfg_annotations", /* name */ NULL, /* gate */ - execute_fixup_cfg, /* execute */ + execute_fixup_cfg, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ @@ -317,7 +317,7 @@ struct gimple_opt_pass pass_init_datastr { { GIMPLE_PASS, - NULL, /* name */ + "*init_datastructures", /* name */ NULL, /* gate */ execute_init_datastructures, /* execute */ NULL, /* sub */ Index: gcc/stack-ptr-mod.c =================================================================== --- gcc/stack-ptr-mod.c (revision 153936) +++ gcc/stack-ptr-mod.c (working copy) @@ -95,7 +95,7 @@ struct rtl_opt_pass pass_stack_ptr_mod = { { RTL_PASS, - NULL, /* name */ + "*stack_ptr_mod", /* name */ NULL, /* gate */ rest_of_handle_stack_ptr_mod, /* execute */ NULL, /* sub */ Index: gcc/reg-stack.c =================================================================== --- gcc/reg-stack.c (revision 153936) +++ gcc/reg-stack.c (working copy) @@ -3275,7 +3275,7 @@ struct rtl_opt_pass pass_stack_regs = { { RTL_PASS, - NULL, /* name */ + "*stack_regs", /* name */ gate_handle_stack_regs, /* gate */ NULL, /* execute */ NULL, /* sub */ Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 153936) +++ gcc/tree-cfg.c (working copy) @@ -7191,7 +7191,7 @@ struct gimple_opt_pass pass_warn_functio { { GIMPLE_PASS, - NULL, /* name */ + "*warn_function_return", /* name */ NULL, /* gate */ execute_warn_function_return, /* execute */ NULL, /* sub */ @@ -7225,7 +7225,7 @@ struct gimple_opt_pass pass_warn_functio { { GIMPLE_PASS, - NULL, /* name */ + "*warn_function_noreturn", /* name */ NULL, /* gate */ execute_warn_function_noreturn, /* execute */ NULL, /* sub */ Index: gcc/passes.c =================================================================== --- gcc/passes.c (revision 153936) +++ gcc/passes.c (working copy) @@ -314,7 +314,7 @@ struct rtl_opt_pass pass_postreload = { { RTL_PASS, - NULL, /* name */ + "*all-postreload", /* name */ gate_postreload, /* gate */ NULL, /* execute */ NULL, /* sub */ @@ -374,7 +374,7 @@ void register_one_dump_file (struct opt_pass *pass) { char *dot_name, *flag_name, *glob_name; - const char *prefix; + const char *name, *prefix; char num[10]; int flags, id; @@ -384,7 +384,15 @@ register_one_dump_file (struct opt_pass sprintf (num, "%d", ((int) pass->static_pass_number < 0 ? 1 : pass->static_pass_number)); - dot_name = concat (".", pass->name, num, NULL); + /* The name is both used to identify the pass for the purposes of plugins, + and to specify dump file name and option. + The latter two might want something short which is not quite unique; + for that reason, we may have a disambiguating prefix, followed by an + '@' character to mark the start of the following dump file + name / option string. */ + name = strchr (pass->name, '@'); + name = name ? name + 1 : pass->name; + dot_name = concat (".", name, num, NULL); if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) prefix = "ipa-", flags = TDF_IPA; else if (pass->type == GIMPLE_PASS) @@ -392,8 +400,8 @@ register_one_dump_file (struct opt_pass else prefix = "rtl-", flags = TDF_RTL; - flag_name = concat (prefix, pass->name, num, NULL); - glob_name = concat (prefix, pass->name, NULL); + flag_name = concat (prefix, name, num, NULL); + glob_name = concat (prefix, name, NULL); id = dump_register (dot_name, flag_name, glob_name, flags); set_pass_for_id (id, pass); } @@ -461,7 +469,7 @@ make_pass_instance (struct opt_pass *pas and so it should rename the dump file. The first instance will be -1, and be number of duplicates = -static_pass_number - 1. Subsequent instances will be > 0 and just the duplicate number. */ - if (pass->name || track_duplicates) + if ((pass->name && pass->name[0] != '*') || track_duplicates) { pass->static_pass_number -= 1; new_pass->static_pass_number = -pass->static_pass_number; @@ -482,6 +490,9 @@ make_pass_instance (struct opt_pass *pas static struct opt_pass ** next_pass_1 (struct opt_pass **list, struct opt_pass *pass) { + /* Every pass should have a name so that plugins can refer to them. */ + gcc_assert (pass->name != NULL); + *list = make_pass_instance (pass, false); return &(*list)->next; Index: gcc/cfgrtl.c =================================================================== --- gcc/cfgrtl.c (revision 153936) +++ gcc/cfgrtl.c (working copy) @@ -433,7 +433,7 @@ struct rtl_opt_pass pass_free_cfg = { { RTL_PASS, - NULL, /* name */ + "*free_cfg", /* name */ NULL, /* gate */ rest_of_pass_free_cfg, /* execute */ NULL, /* sub */ Index: gcc/dce.c =================================================================== --- gcc/dce.c (revision 153936) +++ gcc/dce.c (working copy) @@ -738,9 +738,9 @@ struct rtl_opt_pass pass_ud_rtl_dce = { { RTL_PASS, - "dce", /* name */ - gate_ud_dce, /* gate */ - rest_of_handle_ud_dce, /* execute */ + "ud@" "dce", /* name */ + gate_ud_dce, /* gate */ + rest_of_handle_ud_dce, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ @@ -1123,7 +1123,7 @@ struct rtl_opt_pass pass_fast_rtl_dce = { { RTL_PASS, - "dce", /* name */ + "rtl@" "dce", /* name */ gate_fast_dce, /* gate */ rest_of_handle_fast_dce, /* execute */ NULL, /* sub */ |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesOn Fri, Nov 6, 2009 at 3:10 PM, Joern Rennecke <amylaar@...> wrote:
> Quoting Richard Guenther <richard.guenther@...>: >> >> Ok. The patch is ok after waiting another 24h to let others >> the time to comment. > > The one with STX or with '@' ? I personally prefer '@' here. Richard. > I have attahed the '@' variant, bootstrapped & regression tested > on i686-pc-linux-gnu . > > 2009-11-06 Zbigniew Chamski <zbigniew.chamski@...> > Joern Rennecke <amylaar@...> > > * cfgrtl.c (pass_free_cfg): Add pass name. > * cgraphbuild.c (pass_build_cgraph_edges, > pass_rebuild_cgraph_edges, pass_remove_cgraph_callee_edges): > Likewise. > * dce.c (pass_ud_rtl_dce, pass_fast_rtl_dce): Change pass name. > * df-core.c (pass_df_initialize_no_opt): Likewise. > * except.c (pass_rtl_eh): Likewise. > * function.c (pass_init_function, pass_leaf_regs): Likewise. > * gcse.c (pass_rtl_pre): Change pass name. > * passes.c (pass_postreload): Add pass name. > (make_pass_instance): Don't use duplicate-tracking logic for > names starting with '*'. > (next_pass_1): Assert that pass has a name. > (register_one_dump_file): If there is an @ in the name, > skip past it. > * predict.c (pass_strip_predict_hints): Add pass name. > * reg-stack.c (pass_stack_regs): Likewise. > * stack-ptr-mod.c (pass_stack_ptr_mod): Likewise. > * tree-cfg.c (pass_warn_function_return, > pass_warn_function_noreturn): Add pass name. > * tree-dfa.c (pass_referenced_vars): Likewise. > * tree-optimize.c (pass_cleanup_cfg_post_optimizing): > Fix whitespace before comment. > (pass_fixup_cfg): Add pass name, fix whitespace before comment. > (pass_init_datastructures): Add pass name. > * tree-ssa-loop.c (pass_record_bounds): Likewise. > * tree-ssa.c (pass_early_warn_uninitialized, > pass_late_warn_uninitialized): Likewise. > * tree.c (pass_ipa_free_lang_data): Likewise. > > Index: gcc/cgraphbuild.c > =================================================================== > --- gcc/cgraphbuild.c (revision 153936) > +++ gcc/cgraphbuild.c (working copy) > @@ -205,7 +205,7 @@ struct gimple_opt_pass pass_build_cgraph > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*build_cgraph_edges", /* name */ > NULL, /* gate */ > build_cgraph_edges, /* execute */ > NULL, /* sub */ > @@ -270,7 +270,7 @@ struct gimple_opt_pass pass_rebuild_cgra > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*rebuild_cgraph_edges", /* name */ > NULL, /* gate */ > rebuild_cgraph_edges, /* execute */ > NULL, /* sub */ > @@ -297,7 +297,7 @@ struct gimple_opt_pass pass_remove_cgrap > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*remove_cgraph_callee_edges", /* name */ > NULL, /* gate */ > remove_cgraph_callee_edges, /* execute */ > NULL, /* sub */ > Index: gcc/tree.c > =================================================================== > --- gcc/tree.c (revision 153936) > +++ gcc/tree.c (working copy) > @@ -4988,7 +4988,7 @@ struct simple_ipa_opt_pass pass_ipa_free > { > { > SIMPLE_IPA_PASS, > - NULL, /* name */ > + "*free_lang_data", /* name */ > NULL, /* gate */ > free_lang_data, /* execute */ > NULL, /* sub */ > Index: gcc/df-core.c > =================================================================== > --- gcc/df-core.c (revision 153936) > +++ gcc/df-core.c (working copy) > @@ -780,7 +780,7 @@ struct rtl_opt_pass pass_df_initialize_n > { > { > RTL_PASS, > - "dfinit", /* name */ > + "no-opt@" "dfinit", /* name */ > gate_no_opt, /* gate */ > rest_of_handle_df_initialize, /* execute */ > NULL, /* sub */ > Index: gcc/tree-ssa-loop.c > =================================================================== > --- gcc/tree-ssa-loop.c (revision 153936) > +++ gcc/tree-ssa-loop.c (working copy) > @@ -455,7 +455,7 @@ struct gimple_opt_pass pass_record_bound > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*record_bounds", /* name */ > NULL, /* gate */ > tree_ssa_loop_bounds, /* execute */ > NULL, /* sub */ > Index: gcc/predict.c > =================================================================== > --- gcc/predict.c (revision 153936) > +++ gcc/predict.c (working copy) > @@ -2246,7 +2246,7 @@ struct gimple_opt_pass pass_strip_predic > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*strip_predict_hints", /* name */ > NULL, /* gate */ > strip_predict_hints, /* execute */ > NULL, /* sub */ > Index: gcc/function.c > =================================================================== > --- gcc/function.c (revision 153936) > +++ gcc/function.c (working copy) > @@ -4228,7 +4228,7 @@ struct rtl_opt_pass pass_init_function = > { > { > RTL_PASS, > - NULL, /* name */ > + "*init_function", /* name */ > NULL, /* gate */ > init_function_for_compilation, /* execute */ > NULL, /* sub */ > @@ -5538,7 +5538,7 @@ struct rtl_opt_pass pass_leaf_regs = > { > { > RTL_PASS, > - NULL, /* name */ > + "*leaf_regs", /* name */ > NULL, /* gate */ > rest_of_handle_check_leaf_regs, /* execute */ > NULL, /* sub */ > Index: gcc/gcse.c > =================================================================== > --- gcc/gcse.c (revision 153936) > +++ gcc/gcse.c (working copy) > @@ -5147,7 +5147,7 @@ struct rtl_opt_pass pass_rtl_pre = > { > { > RTL_PASS, > - "pre", /* name */ > + "rtl@" "pre", /* name */ > gate_rtl_pre, /* gate */ > execute_rtl_pre, /* execute */ > NULL, /* sub */ > Index: gcc/tree-dfa.c > =================================================================== > --- gcc/tree-dfa.c (revision 153936) > +++ gcc/tree-dfa.c (working copy) > @@ -106,7 +106,7 @@ struct gimple_opt_pass pass_referenced_v > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*referenced_vars", /* name */ > NULL, /* gate */ > find_referenced_vars, /* execute */ > NULL, /* sub */ > Index: gcc/except.c > =================================================================== > --- gcc/except.c (revision 153936) > +++ gcc/except.c (working copy) > @@ -1465,7 +1465,7 @@ struct rtl_opt_pass pass_rtl_eh = > { > { > RTL_PASS, > - "eh", /* name */ > + "rtl@" "eh", /* name */ > gate_handle_eh, /* gate */ > rest_of_handle_eh, /* execute */ > NULL, /* sub */ > Index: gcc/tree-ssa.c > =================================================================== > --- gcc/tree-ssa.c (revision 153936) > +++ gcc/tree-ssa.c (working copy) > @@ -1856,7 +1856,7 @@ struct gimple_opt_pass pass_early_warn_u > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*early_warn_uninitialized", /* name */ > gate_warn_uninitialized, /* gate */ > execute_early_warn_uninitialized, /* execute */ > NULL, /* sub */ > @@ -1875,7 +1875,7 @@ struct gimple_opt_pass pass_late_warn_un > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*late_warn_uninitialized", /* name */ > gate_warn_uninitialized, /* gate */ > execute_late_warn_uninitialized, /* execute */ > NULL, /* sub */ > Index: gcc/tree-optimize.c > =================================================================== > --- gcc/tree-optimize.c (revision 153936) > +++ gcc/tree-optimize.c (working copy) > @@ -201,7 +201,7 @@ struct gimple_opt_pass pass_cleanup_cfg_ > { > { > GIMPLE_PASS, > - "optimized", /* name */ > + "optimized", /* name */ > NULL, /* gate */ > execute_cleanup_cfg_post_optimizing, /* execute */ > NULL, /* sub */ > @@ -287,9 +287,9 @@ struct gimple_opt_pass pass_fixup_cfg = > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*free_cfg_annotations", /* name */ > NULL, /* gate */ > - execute_fixup_cfg, /* execute */ > + execute_fixup_cfg, /* execute */ > NULL, /* sub */ > NULL, /* next */ > 0, /* static_pass_number */ > @@ -317,7 +317,7 @@ struct gimple_opt_pass pass_init_datastr > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*init_datastructures", /* name */ > NULL, /* gate */ > execute_init_datastructures, /* execute */ > NULL, /* sub */ > Index: gcc/stack-ptr-mod.c > =================================================================== > --- gcc/stack-ptr-mod.c (revision 153936) > +++ gcc/stack-ptr-mod.c (working copy) > @@ -95,7 +95,7 @@ struct rtl_opt_pass pass_stack_ptr_mod = > { > { > RTL_PASS, > - NULL, /* name */ > + "*stack_ptr_mod", /* name */ > NULL, /* gate */ > rest_of_handle_stack_ptr_mod, /* execute */ > NULL, /* sub */ > Index: gcc/reg-stack.c > =================================================================== > --- gcc/reg-stack.c (revision 153936) > +++ gcc/reg-stack.c (working copy) > @@ -3275,7 +3275,7 @@ struct rtl_opt_pass pass_stack_regs = > { > { > RTL_PASS, > - NULL, /* name */ > + "*stack_regs", /* name */ > gate_handle_stack_regs, /* gate */ > NULL, /* execute */ > NULL, /* sub */ > Index: gcc/tree-cfg.c > =================================================================== > --- gcc/tree-cfg.c (revision 153936) > +++ gcc/tree-cfg.c (working copy) > @@ -7191,7 +7191,7 @@ struct gimple_opt_pass pass_warn_functio > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*warn_function_return", /* name */ > NULL, /* gate */ > execute_warn_function_return, /* execute */ > NULL, /* sub */ > @@ -7225,7 +7225,7 @@ struct gimple_opt_pass pass_warn_functio > { > { > GIMPLE_PASS, > - NULL, /* name */ > + "*warn_function_noreturn", /* name */ > NULL, /* gate */ > execute_warn_function_noreturn, /* execute */ > NULL, /* sub */ > Index: gcc/passes.c > =================================================================== > --- gcc/passes.c (revision 153936) > +++ gcc/passes.c (working copy) > @@ -314,7 +314,7 @@ struct rtl_opt_pass pass_postreload = > { > { > RTL_PASS, > - NULL, /* name */ > + "*all-postreload", /* name */ > gate_postreload, /* gate */ > NULL, /* execute */ > NULL, /* sub */ > @@ -374,7 +374,7 @@ void > register_one_dump_file (struct opt_pass *pass) > { > char *dot_name, *flag_name, *glob_name; > - const char *prefix; > + const char *name, *prefix; > char num[10]; > int flags, id; > > @@ -384,7 +384,15 @@ register_one_dump_file (struct opt_pass > sprintf (num, "%d", ((int) pass->static_pass_number < 0 > ? 1 : pass->static_pass_number)); > > - dot_name = concat (".", pass->name, num, NULL); > + /* The name is both used to identify the pass for the purposes of > plugins, > + and to specify dump file name and option. > + The latter two might want something short which is not quite unique; > + for that reason, we may have a disambiguating prefix, followed by an > + '@' character to mark the start of the following dump file > + name / option string. */ > + name = strchr (pass->name, '@'); > + name = name ? name + 1 : pass->name; > + dot_name = concat (".", name, num, NULL); > if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) > prefix = "ipa-", flags = TDF_IPA; > else if (pass->type == GIMPLE_PASS) > @@ -392,8 +400,8 @@ register_one_dump_file (struct opt_pass > else > prefix = "rtl-", flags = TDF_RTL; > > - flag_name = concat (prefix, pass->name, num, NULL); > - glob_name = concat (prefix, pass->name, NULL); > + flag_name = concat (prefix, name, num, NULL); > + glob_name = concat (prefix, name, NULL); > id = dump_register (dot_name, flag_name, glob_name, flags); > set_pass_for_id (id, pass); > } > @@ -461,7 +469,7 @@ make_pass_instance (struct opt_pass *pas > and so it should rename the dump file. The first instance will > be -1, and be number of duplicates = -static_pass_number - 1. > Subsequent instances will be > 0 and just the duplicate number. */ > - if (pass->name || track_duplicates) > + if ((pass->name && pass->name[0] != '*') || track_duplicates) > { > pass->static_pass_number -= 1; > new_pass->static_pass_number = -pass->static_pass_number; > @@ -482,6 +490,9 @@ make_pass_instance (struct opt_pass *pas > static struct opt_pass ** > next_pass_1 (struct opt_pass **list, struct opt_pass *pass) > { > + /* Every pass should have a name so that plugins can refer to them. */ > + gcc_assert (pass->name != NULL); > + > *list = make_pass_instance (pass, false); > > return &(*list)->next; > Index: gcc/cfgrtl.c > =================================================================== > --- gcc/cfgrtl.c (revision 153936) > +++ gcc/cfgrtl.c (working copy) > @@ -433,7 +433,7 @@ struct rtl_opt_pass pass_free_cfg = > { > { > RTL_PASS, > - NULL, /* name */ > + "*free_cfg", /* name */ > NULL, /* gate */ > rest_of_pass_free_cfg, /* execute */ > NULL, /* sub */ > Index: gcc/dce.c > =================================================================== > --- gcc/dce.c (revision 153936) > +++ gcc/dce.c (working copy) > @@ -738,9 +738,9 @@ struct rtl_opt_pass pass_ud_rtl_dce = > { > { > RTL_PASS, > - "dce", /* name */ > - gate_ud_dce, /* gate */ > - rest_of_handle_ud_dce, /* execute */ > + "ud@" "dce", /* name */ > + gate_ud_dce, /* gate */ > + rest_of_handle_ud_dce, /* execute */ > NULL, /* sub */ > NULL, /* next */ > 0, /* static_pass_number */ > @@ -1123,7 +1123,7 @@ struct rtl_opt_pass pass_fast_rtl_dce = > { > { > RTL_PASS, > - "dce", /* name */ > + "rtl@" "dce", /* name */ > gate_fast_dce, /* gate */ > rest_of_handle_fast_dce, /* execute */ > NULL, /* sub */ > > |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesOn Fri, Nov 6, 2009 at 10:00, Richard Guenther
<richard.guenther@...> wrote: > On Fri, Nov 6, 2009 at 3:10 PM, Joern Rennecke <amylaar@...> wrote: >> Quoting Richard Guenther <richard.guenther@...>: >>> >>> Ok. The patch is ok after waiting another 24h to let others >>> the time to comment. >> >> The one with STX or with '@' ? > > I personally prefer '@' here. Likewise. The patch is OK with me as well. Diego. |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesQuoting Richard Guenther <richard.guenther@...>:
> On Fri, Nov 6, 2009 at 3:10 PM, Joern Rennecke <amylaar@...> wrote: >> Quoting Richard Guenther <richard.guenther@...>: >>> >>> Ok. The patch is ok after waiting another 24h to let others >>> the time to comment. >> >> The one with STX or with '@' ? > > I personally prefer '@' here. It just occurred to me that we could use a space. That character must not be part of an option name and therefore is taboo for the dump options, and even if we could make it part of a dump file name it would be a rather odd thing to do; on the other hand, it will look fine both in the source code and when printing out the name for debug purposes. Also, it gives us good portability across character sets. |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesOn Fri, Nov 6, 2009 at 4:06 PM, Joern Rennecke <amylaar@...> wrote:
> Quoting Richard Guenther <richard.guenther@...>: > >> On Fri, Nov 6, 2009 at 3:10 PM, Joern Rennecke <amylaar@...> >> wrote: >>> >>> Quoting Richard Guenther <richard.guenther@...>: >>>> >>>> Ok. The patch is ok after waiting another 24h to let others >>>> the time to comment. >>> >>> The one with STX or with '@' ? >> >> I personally prefer '@' here. > > It just occurred to me that we could use a space. That character > must not be part of an option name and therefore is taboo for > the dump options, and even if we could make it part of a dump > file name it would be a rather odd thing to do; on the other hand, > it will look fine both in the source code and when printing out > the name for debug purposes. > Also, it gives us good portability across character sets. Good idea. Richard. |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesRichard Guenther wrote:
> On Fri, Nov 6, 2009 at 4:06 PM, Joern Rennecke <amylaar@...> wrote: >> Quoting Richard Guenther <richard.guenther@...>: >> >>> On Fri, Nov 6, 2009 at 3:10 PM, Joern Rennecke <amylaar@...> >>> wrote: >>>> Quoting Richard Guenther <richard.guenther@...>: >>>>> Ok. The patch is ok after waiting another 24h to let others >>>>> the time to comment. >>>> The one with STX or with '@' ? >>> I personally prefer '@' here. >> It just occurred to me that we could use a space. Agreed, but I would like that the patch also contains a *texi bit to document whatever convention is taken. Otherwise, I am happy with the patch. Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} *** Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} *** |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesQuoting Basile STARYNKEVITCH <basile@...>:
> Richard Guenther wrote: >> On Fri, Nov 6, 2009 at 4:06 PM, Joern Rennecke <amylaar@...> wrote: ... >>> It just occurred to me that we could use a space. See attached patch. bootstrapped & regression tested on i686-pc-linux-gnu . > Agreed, but I would like that the patch also contains a *texi bit to > document whatever convention is taken. > > Otherwise, I am happy with the patch. I have updated the pass manager description in passes.texi. tested with "make info" and "make pdf". 2009-11-06 Zbigniew Chamski <zbigniew.chamski@...> Joern Rennecke <amylaar@...> * cfgrtl.c (pass_free_cfg): Add pass name. * cgraphbuild.c (pass_build_cgraph_edges, pass_rebuild_cgraph_edges, pass_remove_cgraph_callee_edges): Likewise. * dce.c (pass_ud_rtl_dce, pass_fast_rtl_dce): Change pass name. * df-core.c (pass_df_initialize_no_opt): Likewise. * except.c (pass_rtl_eh): Likewise. * function.c (pass_init_function, pass_leaf_regs): Likewise. * gcse.c (pass_rtl_pre): Change pass name. * passes.c (pass_postreload): Add pass name. (make_pass_instance): Don't use duplicate-tracking logic for names starting with '*'. (next_pass_1): Assert that pass has a name. (register_one_dump_file): If there is an space in the name, skip past it. * predict.c (pass_strip_predict_hints): Add pass name. * reg-stack.c (pass_stack_regs): Likewise. * stack-ptr-mod.c (pass_stack_ptr_mod): Likewise. * tree-cfg.c (pass_warn_function_return, pass_warn_function_noreturn): Add pass name. * tree-dfa.c (pass_referenced_vars): Likewise. * tree-optimize.c (pass_cleanup_cfg_post_optimizing): Fix whitespace before comment. (pass_fixup_cfg): Add pass name, fix whitespace before comment. (pass_init_datastructures): Add pass name. * tree-ssa-loop.c (pass_record_bounds): Likewise. * tree-ssa.c (pass_early_warn_uninitialized, pass_late_warn_uninitialized): Likewise. * tree.c (pass_ipa_free_lang_data): Likewise. * doc/passes.texi (pass manager): Document how to disambiguate pass names. Index: gcc/doc/passes.texi =================================================================== --- gcc/doc/passes.texi (revision 153936) +++ gcc/doc/passes.texi (working copy) @@ -166,9 +166,14 @@ not attempt to (re-)generate data struct language form based on the requirements of the next pass. Nevertheless, what is present is useful, and a far sight better than nothing at all. +Each pass should have a unique name. Each pass may have its own dump file (for GCC debugging purposes). -Passes without any names, or with a name starting with a star, do not -dump anything. +Passes with a name starting with a star do not dump anything. +Sometimes passes are supposed to share a dump file / option name. +To still give these unique names, you can use a prefix that is delimited +by a space from the part that is used for the dump file / option name. +E.g. When the pass name is "ud dce", the name used for dump file/options +is "dce". TODO: describe the global variables set up by the pass manager, and a brief description of how a new pass should use it. Index: gcc/cgraphbuild.c =================================================================== --- gcc/cgraphbuild.c (revision 153936) +++ gcc/cgraphbuild.c (working copy) @@ -205,7 +205,7 @@ struct gimple_opt_pass pass_build_cgraph { { GIMPLE_PASS, - NULL, /* name */ + "*build_cgraph_edges", /* name */ NULL, /* gate */ build_cgraph_edges, /* execute */ NULL, /* sub */ @@ -270,7 +270,7 @@ struct gimple_opt_pass pass_rebuild_cgra { { GIMPLE_PASS, - NULL, /* name */ + "*rebuild_cgraph_edges", /* name */ NULL, /* gate */ rebuild_cgraph_edges, /* execute */ NULL, /* sub */ @@ -297,7 +297,7 @@ struct gimple_opt_pass pass_remove_cgrap { { GIMPLE_PASS, - NULL, /* name */ + "*remove_cgraph_callee_edges", /* name */ NULL, /* gate */ remove_cgraph_callee_edges, /* execute */ NULL, /* sub */ Index: gcc/tree.c =================================================================== --- gcc/tree.c (revision 153936) +++ gcc/tree.c (working copy) @@ -4988,7 +4988,7 @@ struct simple_ipa_opt_pass pass_ipa_free { { SIMPLE_IPA_PASS, - NULL, /* name */ + "*free_lang_data", /* name */ NULL, /* gate */ free_lang_data, /* execute */ NULL, /* sub */ Index: gcc/df-core.c =================================================================== --- gcc/df-core.c (revision 153936) +++ gcc/df-core.c (working copy) @@ -780,7 +780,7 @@ struct rtl_opt_pass pass_df_initialize_n { { RTL_PASS, - "dfinit", /* name */ + "no-opt dfinit", /* name */ gate_no_opt, /* gate */ rest_of_handle_df_initialize, /* execute */ NULL, /* sub */ Index: gcc/tree-ssa-loop.c =================================================================== --- gcc/tree-ssa-loop.c (revision 153936) +++ gcc/tree-ssa-loop.c (working copy) @@ -455,7 +455,7 @@ struct gimple_opt_pass pass_record_bound { { GIMPLE_PASS, - NULL, /* name */ + "*record_bounds", /* name */ NULL, /* gate */ tree_ssa_loop_bounds, /* execute */ NULL, /* sub */ Index: gcc/predict.c =================================================================== --- gcc/predict.c (revision 153936) +++ gcc/predict.c (working copy) @@ -2246,7 +2246,7 @@ struct gimple_opt_pass pass_strip_predic { { GIMPLE_PASS, - NULL, /* name */ + "*strip_predict_hints", /* name */ NULL, /* gate */ strip_predict_hints, /* execute */ NULL, /* sub */ Index: gcc/function.c =================================================================== --- gcc/function.c (revision 153936) +++ gcc/function.c (working copy) @@ -4228,7 +4228,7 @@ struct rtl_opt_pass pass_init_function = { { RTL_PASS, - NULL, /* name */ + "*init_function", /* name */ NULL, /* gate */ init_function_for_compilation, /* execute */ NULL, /* sub */ @@ -5538,7 +5538,7 @@ struct rtl_opt_pass pass_leaf_regs = { { RTL_PASS, - NULL, /* name */ + "*leaf_regs", /* name */ NULL, /* gate */ rest_of_handle_check_leaf_regs, /* execute */ NULL, /* sub */ Index: gcc/gcse.c =================================================================== --- gcc/gcse.c (revision 153936) +++ gcc/gcse.c (working copy) @@ -5147,7 +5147,7 @@ struct rtl_opt_pass pass_rtl_pre = { { RTL_PASS, - "pre", /* name */ + "rtl pre", /* name */ gate_rtl_pre, /* gate */ execute_rtl_pre, /* execute */ NULL, /* sub */ Index: gcc/tree-dfa.c =================================================================== --- gcc/tree-dfa.c (revision 153936) +++ gcc/tree-dfa.c (working copy) @@ -106,7 +106,7 @@ struct gimple_opt_pass pass_referenced_v { { GIMPLE_PASS, - NULL, /* name */ + "*referenced_vars", /* name */ NULL, /* gate */ find_referenced_vars, /* execute */ NULL, /* sub */ Index: gcc/except.c =================================================================== --- gcc/except.c (revision 153936) +++ gcc/except.c (working copy) @@ -1465,7 +1465,7 @@ struct rtl_opt_pass pass_rtl_eh = { { RTL_PASS, - "eh", /* name */ + "rtl eh", /* name */ gate_handle_eh, /* gate */ rest_of_handle_eh, /* execute */ NULL, /* sub */ Index: gcc/tree-ssa.c =================================================================== --- gcc/tree-ssa.c (revision 153936) +++ gcc/tree-ssa.c (working copy) @@ -1856,7 +1856,7 @@ struct gimple_opt_pass pass_early_warn_u { { GIMPLE_PASS, - NULL, /* name */ + "*early_warn_uninitialized", /* name */ gate_warn_uninitialized, /* gate */ execute_early_warn_uninitialized, /* execute */ NULL, /* sub */ @@ -1875,7 +1875,7 @@ struct gimple_opt_pass pass_late_warn_un { { GIMPLE_PASS, - NULL, /* name */ + "*late_warn_uninitialized", /* name */ gate_warn_uninitialized, /* gate */ execute_late_warn_uninitialized, /* execute */ NULL, /* sub */ Index: gcc/tree-optimize.c =================================================================== --- gcc/tree-optimize.c (revision 153936) +++ gcc/tree-optimize.c (working copy) @@ -201,7 +201,7 @@ struct gimple_opt_pass pass_cleanup_cfg_ { { GIMPLE_PASS, - "optimized", /* name */ + "optimized", /* name */ NULL, /* gate */ execute_cleanup_cfg_post_optimizing, /* execute */ NULL, /* sub */ @@ -287,9 +287,9 @@ struct gimple_opt_pass pass_fixup_cfg = { { GIMPLE_PASS, - NULL, /* name */ + "*free_cfg_annotations", /* name */ NULL, /* gate */ - execute_fixup_cfg, /* execute */ + execute_fixup_cfg, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ @@ -317,7 +317,7 @@ struct gimple_opt_pass pass_init_datastr { { GIMPLE_PASS, - NULL, /* name */ + "*init_datastructures", /* name */ NULL, /* gate */ execute_init_datastructures, /* execute */ NULL, /* sub */ Index: gcc/stack-ptr-mod.c =================================================================== --- gcc/stack-ptr-mod.c (revision 153936) +++ gcc/stack-ptr-mod.c (working copy) @@ -95,7 +95,7 @@ struct rtl_opt_pass pass_stack_ptr_mod = { { RTL_PASS, - NULL, /* name */ + "*stack_ptr_mod", /* name */ NULL, /* gate */ rest_of_handle_stack_ptr_mod, /* execute */ NULL, /* sub */ Index: gcc/reg-stack.c =================================================================== --- gcc/reg-stack.c (revision 153936) +++ gcc/reg-stack.c (working copy) @@ -3275,7 +3275,7 @@ struct rtl_opt_pass pass_stack_regs = { { RTL_PASS, - NULL, /* name */ + "*stack_regs", /* name */ gate_handle_stack_regs, /* gate */ NULL, /* execute */ NULL, /* sub */ Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 153936) +++ gcc/tree-cfg.c (working copy) @@ -7191,7 +7191,7 @@ struct gimple_opt_pass pass_warn_functio { { GIMPLE_PASS, - NULL, /* name */ + "*warn_function_return", /* name */ NULL, /* gate */ execute_warn_function_return, /* execute */ NULL, /* sub */ @@ -7225,7 +7225,7 @@ struct gimple_opt_pass pass_warn_functio { { GIMPLE_PASS, - NULL, /* name */ + "*warn_function_noreturn", /* name */ NULL, /* gate */ execute_warn_function_noreturn, /* execute */ NULL, /* sub */ Index: gcc/passes.c =================================================================== --- gcc/passes.c (revision 153936) +++ gcc/passes.c (working copy) @@ -314,7 +314,7 @@ struct rtl_opt_pass pass_postreload = { { RTL_PASS, - NULL, /* name */ + "*all-postreload", /* name */ gate_postreload, /* gate */ NULL, /* execute */ NULL, /* sub */ @@ -374,7 +374,7 @@ void register_one_dump_file (struct opt_pass *pass) { char *dot_name, *flag_name, *glob_name; - const char *prefix; + const char *name, *prefix; char num[10]; int flags, id; @@ -384,7 +384,14 @@ register_one_dump_file (struct opt_pass sprintf (num, "%d", ((int) pass->static_pass_number < 0 ? 1 : pass->static_pass_number)); - dot_name = concat (".", pass->name, num, NULL); + /* The name is both used to identify the pass for the purposes of plugins, + and to specify dump file name and option. + The latter two might want something short which is not quite unique; for + that reason, we may have a disambiguating prefix, followed by a space + to mark the start of the following dump file name / option string. */ + name = strchr (pass->name, ' '); + name = name ? name + 1 : pass->name; + dot_name = concat (".", name, num, NULL); if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) prefix = "ipa-", flags = TDF_IPA; else if (pass->type == GIMPLE_PASS) @@ -392,8 +399,8 @@ register_one_dump_file (struct opt_pass else prefix = "rtl-", flags = TDF_RTL; - flag_name = concat (prefix, pass->name, num, NULL); - glob_name = concat (prefix, pass->name, NULL); + flag_name = concat (prefix, name, num, NULL); + glob_name = concat (prefix, name, NULL); id = dump_register (dot_name, flag_name, glob_name, flags); set_pass_for_id (id, pass); } @@ -461,7 +468,7 @@ make_pass_instance (struct opt_pass *pas and so it should rename the dump file. The first instance will be -1, and be number of duplicates = -static_pass_number - 1. Subsequent instances will be > 0 and just the duplicate number. */ - if (pass->name || track_duplicates) + if ((pass->name && pass->name[0] != '*') || track_duplicates) { pass->static_pass_number -= 1; new_pass->static_pass_number = -pass->static_pass_number; @@ -482,6 +489,9 @@ make_pass_instance (struct opt_pass *pas static struct opt_pass ** next_pass_1 (struct opt_pass **list, struct opt_pass *pass) { + /* Every pass should have a name so that plugins can refer to them. */ + gcc_assert (pass->name != NULL); + *list = make_pass_instance (pass, false); return &(*list)->next; Index: gcc/cfgrtl.c =================================================================== --- gcc/cfgrtl.c (revision 153936) +++ gcc/cfgrtl.c (working copy) @@ -433,7 +433,7 @@ struct rtl_opt_pass pass_free_cfg = { { RTL_PASS, - NULL, /* name */ + "*free_cfg", /* name */ NULL, /* gate */ rest_of_pass_free_cfg, /* execute */ NULL, /* sub */ Index: gcc/dce.c =================================================================== --- gcc/dce.c (revision 153936) +++ gcc/dce.c (working copy) @@ -738,9 +738,9 @@ struct rtl_opt_pass pass_ud_rtl_dce = { { RTL_PASS, - "dce", /* name */ - gate_ud_dce, /* gate */ - rest_of_handle_ud_dce, /* execute */ + "ud dce", /* name */ + gate_ud_dce, /* gate */ + rest_of_handle_ud_dce, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ @@ -1123,7 +1123,7 @@ struct rtl_opt_pass pass_fast_rtl_dce = { { RTL_PASS, - "dce", /* name */ + "rtl dce", /* name */ gate_fast_dce, /* gate */ rest_of_handle_fast_dce, /* execute */ NULL, /* sub */ |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesJoern Rennecke wrote:
> Quoting Basile STARYNKEVITCH <basile@...>: > >> Richard Guenther wrote: >>> On Fri, Nov 6, 2009 at 4:06 PM, Joern Rennecke <amylaar@...> >>> wrote: > ... >>>> It just occurred to me that we could use a space. > > See attached patch. > bootstrapped & regression tested on i686-pc-linux-gnu . This is ok for me, but I don't have the power to approve it! Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} *** Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} *** |
|
|
Re: [patch][plugins] Provide unique names to all compiler passesQuoting Richard Guenther <richard.guenther@...>:
> Ok. The patch is ok after waiting another 24h to let others > the time to comment. Thanks. I have commited the 'space' version of the patch. |
| Free embeddable forum powered by Nabble | Forum Help |