On Mon, 2013-07-22 at 20:25 +0200, Martin Jambor wrote:
> Hi,
> 
> On Wed, Jul 17, 2013 at 09:18:22PM -0400, David Malcolm wrote:
> > gcc/
> > 
> >     Explicitly number the instances of passes within passes.def.
> > 
> >     This is needed by a subsequent patch so that we can create
> >     fields within the pipeline class for each pass instance (to help
> >     locate pass instances when debugging).
> > 
> 
> I don't really understand what you want to achieve.  Are you sure the
> benefits are worth the work necessary to implement the processing of
> passes.def.in?  Especially given that we already initialize
> static_pass_number at run time and copy stuff around in
> make_pass_instance when it is already set.  I assume this would
> somehow allow us to directly dump data of say forwprop3 as apposed to
> forwprop2 to but that would require constant awareness of the sequence
> number of the currently running pass, which I think is also unpleasant
> and error-prone.
> 
> I mean, you may have perfectly legitimate reasons for doing this, I'm
> just wondering whether we are perhaps over-engineering this a bit.

The main goal here is part of eliminating global variables from gcc [1],
to be able to create:

class pipeline
{
  /* omitting various other fields for clarity */

  opt_pass *pass_warn_unused_result;
  opt_pass *pass_diagnose_omp_blocks;
  opt_pass *pass_diagnose_tm_blocks;
  opt_pass *pass_mudflap_1;
  opt_pass *pass_lower_omp;
  opt_pass *pass_lower_cf;
  opt_pass *pass_lower_tm;
  opt_pass *pass_refactor_eh;
  opt_pass *pass_lower_eh;
  opt_pass *pass_build_cfg;
  opt_pass *pass_warn_function_return;
  opt_pass *pass_expand_omp;
  opt_pass *pass_build_cgraph_edges;
  opt_pass *pass_ipa_free_lang_data;
  opt_pass *pass_ipa_function_and_variable_visibility;
  opt_pass *pass_early_local_passes;
  opt_pass *pass_fixup_cfg;
  opt_pass *pass_init_datastructures;
  /* etc */
  opt_pass *pass_clean_state;
};

without having to list all of the pass kinds again, thus reusing the
pass description from passes.def.  Without the numbering, I couldn't see
a good way to avoid duplicate field names in the class.  So the
numbering gives us uniqueness of field names in that class (and also
makes debugging slightly easier, but that's a minor side-benefit).

Hope that makes sense

[BTW I've just spent much of the day fighting awk trying to write a
script to generate a pass-instances.def from passes.def, but have given
up in frustration for now (how hard can it be to capture a group from a
regex, track it in a dictionary, and print a substitution with a key and
dict lookup?  hard for me in awk, it seems); am working on fixing the
bad interaction of PCH with GTY-marking of per-pass data in the
meantime].

[1] http://dmalcolm.fedorapeople.org/gcc/global-state/

Reply via email to