On Fri, Jun 28, 2024 at 2:14 PM Thomas Schwinge <tschwi...@baylibre.com> wrote:
>
> Hi!
>
> On 2013-07-26T11:04:32-0400, David Malcolm <dmalc...@redhat.com> wrote:
> > Introduce a new gen-pass-instances.awk script, and use it at build time
> > to make a pass-instances.def from passes.def.
>
> (The script has later been rewritten and extended, but the issue I'm
> discussing is relevant already in its original version.)
>
> > The generated pass-instances.def contains similar content to passes.def,
> > but the pass instances within it are explicitly numbered, so that e.g.
> > the third instance of:
> >
> >   NEXT_PASS (pass_copy_prop)
> >
> > becomes:
> >
> >   NEXT_PASS (pass_copy_prop, 3)
>
> > --- a/gcc/passes.c
> > +++ b/gcc/passes.c
> > @@ -1315,12 +1315,12 @@ pipeline::pipeline (context *ctxt)
> >  #define POP_INSERT_PASSES() \
> >    }
> >
> > -#define NEXT_PASS(PASS)  (p = next_pass_1 (p, &((PASS).pass)))
> > +#define NEXT_PASS(PASS, NUM)  (p = next_pass_1 (p, &((PASS).pass)))
> >
> >  #define TERMINATE_PASS_LIST() \
> >    *p = NULL;
> >
> > -#include "passes.def"
> > +#include "pass-instances.def"
>
> Given this, the usage comment at the top of 'gcc/passes.def' (see below)
> no longer is accurate (even if that latter file does continue to use the
> 'NEXT_PASS' form without 'NUM') -- and, worse, the 'NEXT_PASS' etc. in
> that usage comment are processed by the 'gcc/gen-pass-instances.awk'
> script:
>
>     --- source-gcc/gcc/passes.def   2024-06-24 18:55:15.132561641 +0200
>     +++ build-gcc/gcc/pass-instances.def    2024-06-24 18:55:27.768562714 
> +0200
>     [...]
>     @@ -20,546 +22,578 @@
>      /*
>       Macros that should be defined when using this file:
>         INSERT_PASSES_AFTER (PASS)
>         PUSH_INSERT_PASSES_WITHIN (PASS)
>         POP_INSERT_PASSES ()
>     -   NEXT_PASS (PASS)
>     +   NEXT_PASS (PASS, 1)
>         TERMINATE_PASS_LIST (PASS)
>       */
>     [...]
>
> (That is, this is 'NEXT_PASS' for the first instance of pass 'PASS'.)
> That's benign so far, but with another thing that I'll be extending, I'd
> then run into an error while the script handles this comment block.  ;-\
>
> OK to push "Rewrite usage comment at the top of 'gcc/passes.def'", see
> attached?

OK

>
> Grüße
>  Thomas
>
>

Reply via email to