diff mbox series

[5/5] passes: Remove limit on the number of params

Message ID 20241014022201.1011677-5-quic_apinski@quicinc.com
State New
Headers show
Series [1/5] passes: Move #undef to pass-instances.def | expand

Commit Message

Andrew Pinski Oct. 14, 2024, 2:22 a.m. UTC
Having a limit of 2 params for NEXT_PASS was just done because I didn't think there was
a way to handle arbitrary number of params. But I found that we can handle this
via a static const variable array (constexpr so we know it is true or false at compile time)
and just loop over the array.

Note I keep around NEXT_PASS_WITH_ARG and NEXT_PASS macros instead of always using
NEXT_PASS_WITH_ARGS macro to make sure these cases get optimized for -O0 (stage1).

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	* gen-pass-instances.awk: Remove the limit of the params.
	* pass_manager.h (NEXT_PASS_WITH_ARG2): Rename to ...
	(NEXT_PASS_WITH_ARGS): This.
	* passes.cc (NEXT_PASS_WITH_ARG2): Rename to ...
	(NEXT_PASS_WITH_ARGS): This and support more than 2 params by using
	a constexpr array.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/gen-pass-instances.awk | 11 ++---------
 gcc/pass_manager.h         |  2 +-
 gcc/passes.cc              | 13 +++++++++----
 3 files changed, 12 insertions(+), 14 deletions(-)

Comments

Richard Biener Oct. 14, 2024, 1:08 p.m. UTC | #1
On Mon, Oct 14, 2024 at 4:32 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> Having a limit of 2 params for NEXT_PASS was just done because I didn't think there was
> a way to handle arbitrary number of params. But I found that we can handle this
> via a static const variable array (constexpr so we know it is true or false at compile time)
> and just loop over the array.
>
> Note I keep around NEXT_PASS_WITH_ARG and NEXT_PASS macros instead of always using
> NEXT_PASS_WITH_ARGS macro to make sure these cases get optimized for -O0 (stage1).
>
> Bootstrapped and tested on x86_64-linux-gnu.

OK if nobody has additional comments - do we document passes.def in
the internals manual btw?
Maybe that should be adjusted?

> gcc/ChangeLog:
>
>         * gen-pass-instances.awk: Remove the limit of the params.
>         * pass_manager.h (NEXT_PASS_WITH_ARG2): Rename to ...
>         (NEXT_PASS_WITH_ARGS): This.
>         * passes.cc (NEXT_PASS_WITH_ARG2): Rename to ...
>         (NEXT_PASS_WITH_ARGS): This and support more than 2 params by using
>         a constexpr array.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/gen-pass-instances.awk | 11 ++---------
>  gcc/pass_manager.h         |  2 +-
>  gcc/passes.cc              | 13 +++++++++----
>  3 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
> index def09347765..9bd73c9ce0f 100644
> --- a/gcc/gen-pass-instances.awk
> +++ b/gcc/gen-pass-instances.awk
> @@ -195,7 +195,6 @@ function replace_pass(line, fnname,                 num, i)
>  }
>
>  END {
> -  max_number_args = 2;
>    for (i = 1; i < lineno; i++)
>      {
>        ret = parse_line(lines[i], "NEXT_PASS");
> @@ -220,13 +219,8 @@ END {
>           if (num_args > 0)
>             {
>               printf "NEXT_PASS_WITH_ARG";
> -             if (num_args > max_number_args)
> -               {
> -                 print "ERROR: Only supports up to " max_number_args " args to NEXT_PASS";
> -                 exit 1;
> -               }
>               if (num_args != 1)
> -               printf num_args;
> +               printf "S";
>             }
>           else
>             printf "NEXT_PASS";
> @@ -266,8 +260,7 @@ END {
>    print "#undef POP_INSERT_PASSES"
>    print "#undef NEXT_PASS"
>    print "#undef NEXT_PASS_WITH_ARG"
> -  for (i = 2; i <= max_number_args; i++)
> -    print "#undef NEXT_PASS_WITH_ARG" i
> +  print "#undef NEXT_PASS_WITH_ARGS"
>    print "#undef TERMINATE_PASS_LIST"
>  }
>
> diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
> index f18ae026257..294cdd0b1f7 100644
> --- a/gcc/pass_manager.h
> +++ b/gcc/pass_manager.h
> @@ -130,7 +130,7 @@ private:
>  #define POP_INSERT_PASSES()
>  #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
>  #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
> -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
> +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
>  #define TERMINATE_PASS_LIST(PASS)
>
>  #include "pass-instances.def"
> diff --git a/gcc/passes.cc b/gcc/passes.cc
> index b5475fce522..ae80f40b96a 100644
> --- a/gcc/passes.cc
> +++ b/gcc/passes.cc
> @@ -1589,7 +1589,7 @@ pass_manager::pass_manager (context *ctxt)
>  #define POP_INSERT_PASSES()
>  #define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL
>  #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
> -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
> +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
>  #define TERMINATE_PASS_LIST(PASS)
>  #include "pass-instances.def"
>
> @@ -1636,11 +1636,16 @@ pass_manager::pass_manager (context *ctxt)
>        PASS ## _ ## NUM->set_pass_param (0, ARG);       \
>      } while (0)
>
> -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1)     \
> +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...)            \
>      do {                                               \
>        NEXT_PASS (PASS, NUM);                           \
> -      PASS ## _ ## NUM->set_pass_param (0, ARG0);      \
> -      PASS ## _ ## NUM->set_pass_param (1, ARG1);      \
> +      static constexpr bool values[] = { __VA_ARGS__ };        \
> +      unsigned i = 0;                                  \
> +      for (bool value : values)                                \
> +       {                                               \
> +         PASS ## _ ## NUM->set_pass_param (i, value);  \
> +         i++;                                          \
> +       }                                               \
>      } while (0)
>
>  #include "pass-instances.def"
> --
> 2.43.0
>
Andrew Pinski Oct. 14, 2024, 2:16 p.m. UTC | #2
On Mon, Oct 14, 2024 at 6:10 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Mon, Oct 14, 2024 at 4:32 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
> >
> > Having a limit of 2 params for NEXT_PASS was just done because I didn't think there was
> > a way to handle arbitrary number of params. But I found that we can handle this
> > via a static const variable array (constexpr so we know it is true or false at compile time)
> > and just loop over the array.
> >
> > Note I keep around NEXT_PASS_WITH_ARG and NEXT_PASS macros instead of always using
> > NEXT_PASS_WITH_ARGS macro to make sure these cases get optimized for -O0 (stage1).
> >
> > Bootstrapped and tested on x86_64-linux-gnu.
>
> OK if nobody has additional comments - do we document passes.def in
> the internals manual btw?
> Maybe that should be adjusted?

passes.def is mentioned in passes.texi but does not describe how
passes.def functions.  That is
NEXT_PASS/PUSH_INSERT_PASSES_WITHIN/etc.

I did notice that INSERT_PASS_AFTER/INSERT_PASS_BEFORE still only
supports one optional arg instead of multiple optional arg/params. I
will fix that and resubmit this patch.

Thanks,
Andrew Pinski

>
> > gcc/ChangeLog:
> >
> >         * gen-pass-instances.awk: Remove the limit of the params.
> >         * pass_manager.h (NEXT_PASS_WITH_ARG2): Rename to ...
> >         (NEXT_PASS_WITH_ARGS): This.
> >         * passes.cc (NEXT_PASS_WITH_ARG2): Rename to ...
> >         (NEXT_PASS_WITH_ARGS): This and support more than 2 params by using
> >         a constexpr array.
> >
> > Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> > ---
> >  gcc/gen-pass-instances.awk | 11 ++---------
> >  gcc/pass_manager.h         |  2 +-
> >  gcc/passes.cc              | 13 +++++++++----
> >  3 files changed, 12 insertions(+), 14 deletions(-)
> >
> > diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
> > index def09347765..9bd73c9ce0f 100644
> > --- a/gcc/gen-pass-instances.awk
> > +++ b/gcc/gen-pass-instances.awk
> > @@ -195,7 +195,6 @@ function replace_pass(line, fnname,                 num, i)
> >  }
> >
> >  END {
> > -  max_number_args = 2;
> >    for (i = 1; i < lineno; i++)
> >      {
> >        ret = parse_line(lines[i], "NEXT_PASS");
> > @@ -220,13 +219,8 @@ END {
> >           if (num_args > 0)
> >             {
> >               printf "NEXT_PASS_WITH_ARG";
> > -             if (num_args > max_number_args)
> > -               {
> > -                 print "ERROR: Only supports up to " max_number_args " args to NEXT_PASS";
> > -                 exit 1;
> > -               }
> >               if (num_args != 1)
> > -               printf num_args;
> > +               printf "S";
> >             }
> >           else
> >             printf "NEXT_PASS";
> > @@ -266,8 +260,7 @@ END {
> >    print "#undef POP_INSERT_PASSES"
> >    print "#undef NEXT_PASS"
> >    print "#undef NEXT_PASS_WITH_ARG"
> > -  for (i = 2; i <= max_number_args; i++)
> > -    print "#undef NEXT_PASS_WITH_ARG" i
> > +  print "#undef NEXT_PASS_WITH_ARGS"
> >    print "#undef TERMINATE_PASS_LIST"
> >  }
> >
> > diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
> > index f18ae026257..294cdd0b1f7 100644
> > --- a/gcc/pass_manager.h
> > +++ b/gcc/pass_manager.h
> > @@ -130,7 +130,7 @@ private:
> >  #define POP_INSERT_PASSES()
> >  #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
> >  #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
> > -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
> > +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
> >  #define TERMINATE_PASS_LIST(PASS)
> >
> >  #include "pass-instances.def"
> > diff --git a/gcc/passes.cc b/gcc/passes.cc
> > index b5475fce522..ae80f40b96a 100644
> > --- a/gcc/passes.cc
> > +++ b/gcc/passes.cc
> > @@ -1589,7 +1589,7 @@ pass_manager::pass_manager (context *ctxt)
> >  #define POP_INSERT_PASSES()
> >  #define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL
> >  #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
> > -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
> > +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
> >  #define TERMINATE_PASS_LIST(PASS)
> >  #include "pass-instances.def"
> >
> > @@ -1636,11 +1636,16 @@ pass_manager::pass_manager (context *ctxt)
> >        PASS ## _ ## NUM->set_pass_param (0, ARG);       \
> >      } while (0)
> >
> > -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1)     \
> > +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...)            \
> >      do {                                               \
> >        NEXT_PASS (PASS, NUM);                           \
> > -      PASS ## _ ## NUM->set_pass_param (0, ARG0);      \
> > -      PASS ## _ ## NUM->set_pass_param (1, ARG1);      \
> > +      static constexpr bool values[] = { __VA_ARGS__ };        \
> > +      unsigned i = 0;                                  \
> > +      for (bool value : values)                                \
> > +       {                                               \
> > +         PASS ## _ ## NUM->set_pass_param (i, value);  \
> > +         i++;                                          \
> > +       }                                               \
> >      } while (0)
> >
> >  #include "pass-instances.def"
> > --
> > 2.43.0
> >
Eric Gallager Oct. 14, 2024, 8:13 p.m. UTC | #3
On Mon, Oct 14, 2024 at 10:17 AM Andrew Pinski <pinskia@gmail.com> wrote:
>
> On Mon, Oct 14, 2024 at 6:10 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Mon, Oct 14, 2024 at 4:32 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
> > >
> > > Having a limit of 2 params for NEXT_PASS was just done because I didn't think there was
> > > a way to handle arbitrary number of params. But I found that we can handle this
> > > via a static const variable array (constexpr so we know it is true or false at compile time)
> > > and just loop over the array.
> > >
> > > Note I keep around NEXT_PASS_WITH_ARG and NEXT_PASS macros instead of always using
> > > NEXT_PASS_WITH_ARGS macro to make sure these cases get optimized for -O0 (stage1).
> > >
> > > Bootstrapped and tested on x86_64-linux-gnu.
> >
> > OK if nobody has additional comments - do we document passes.def in
> > the internals manual btw?
> > Maybe that should be adjusted?
>
> passes.def is mentioned in passes.texi but does not describe how
> passes.def functions.

I think this fits under bug 951, btw:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=951

> That is NEXT_PASS/PUSH_INSERT_PASSES_WITHIN/etc.
>
> I did notice that INSERT_PASS_AFTER/INSERT_PASS_BEFORE still only
> supports one optional arg instead of multiple optional arg/params. I
> will fix that and resubmit this patch.
>
> Thanks,
> Andrew Pinski
>
> >
> > > gcc/ChangeLog:
> > >
> > >         * gen-pass-instances.awk: Remove the limit of the params.
> > >         * pass_manager.h (NEXT_PASS_WITH_ARG2): Rename to ...
> > >         (NEXT_PASS_WITH_ARGS): This.
> > >         * passes.cc (NEXT_PASS_WITH_ARG2): Rename to ...
> > >         (NEXT_PASS_WITH_ARGS): This and support more than 2 params by using
> > >         a constexpr array.
> > >
> > > Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> > > ---
> > >  gcc/gen-pass-instances.awk | 11 ++---------
> > >  gcc/pass_manager.h         |  2 +-
> > >  gcc/passes.cc              | 13 +++++++++----
> > >  3 files changed, 12 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
> > > index def09347765..9bd73c9ce0f 100644
> > > --- a/gcc/gen-pass-instances.awk
> > > +++ b/gcc/gen-pass-instances.awk
> > > @@ -195,7 +195,6 @@ function replace_pass(line, fnname,                 num, i)
> > >  }
> > >
> > >  END {
> > > -  max_number_args = 2;
> > >    for (i = 1; i < lineno; i++)
> > >      {
> > >        ret = parse_line(lines[i], "NEXT_PASS");
> > > @@ -220,13 +219,8 @@ END {
> > >           if (num_args > 0)
> > >             {
> > >               printf "NEXT_PASS_WITH_ARG";
> > > -             if (num_args > max_number_args)
> > > -               {
> > > -                 print "ERROR: Only supports up to " max_number_args " args to NEXT_PASS";
> > > -                 exit 1;
> > > -               }
> > >               if (num_args != 1)
> > > -               printf num_args;
> > > +               printf "S";
> > >             }
> > >           else
> > >             printf "NEXT_PASS";
> > > @@ -266,8 +260,7 @@ END {
> > >    print "#undef POP_INSERT_PASSES"
> > >    print "#undef NEXT_PASS"
> > >    print "#undef NEXT_PASS_WITH_ARG"
> > > -  for (i = 2; i <= max_number_args; i++)
> > > -    print "#undef NEXT_PASS_WITH_ARG" i
> > > +  print "#undef NEXT_PASS_WITH_ARGS"
> > >    print "#undef TERMINATE_PASS_LIST"
> > >  }
> > >
> > > diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
> > > index f18ae026257..294cdd0b1f7 100644
> > > --- a/gcc/pass_manager.h
> > > +++ b/gcc/pass_manager.h
> > > @@ -130,7 +130,7 @@ private:
> > >  #define POP_INSERT_PASSES()
> > >  #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
> > >  #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
> > > -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
> > > +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
> > >  #define TERMINATE_PASS_LIST(PASS)
> > >
> > >  #include "pass-instances.def"
> > > diff --git a/gcc/passes.cc b/gcc/passes.cc
> > > index b5475fce522..ae80f40b96a 100644
> > > --- a/gcc/passes.cc
> > > +++ b/gcc/passes.cc
> > > @@ -1589,7 +1589,7 @@ pass_manager::pass_manager (context *ctxt)
> > >  #define POP_INSERT_PASSES()
> > >  #define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL
> > >  #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
> > > -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
> > > +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
> > >  #define TERMINATE_PASS_LIST(PASS)
> > >  #include "pass-instances.def"
> > >
> > > @@ -1636,11 +1636,16 @@ pass_manager::pass_manager (context *ctxt)
> > >        PASS ## _ ## NUM->set_pass_param (0, ARG);       \
> > >      } while (0)
> > >
> > > -#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1)     \
> > > +#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...)            \
> > >      do {                                               \
> > >        NEXT_PASS (PASS, NUM);                           \
> > > -      PASS ## _ ## NUM->set_pass_param (0, ARG0);      \
> > > -      PASS ## _ ## NUM->set_pass_param (1, ARG1);      \
> > > +      static constexpr bool values[] = { __VA_ARGS__ };        \
> > > +      unsigned i = 0;                                  \
> > > +      for (bool value : values)                                \
> > > +       {                                               \
> > > +         PASS ## _ ## NUM->set_pass_param (i, value);  \
> > > +         i++;                                          \
> > > +       }                                               \
> > >      } while (0)
> > >
> > >  #include "pass-instances.def"
> > > --
> > > 2.43.0
> > >
diff mbox series

Patch

diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
index def09347765..9bd73c9ce0f 100644
--- a/gcc/gen-pass-instances.awk
+++ b/gcc/gen-pass-instances.awk
@@ -195,7 +195,6 @@  function replace_pass(line, fnname,			num, i)
 }
 
 END {
-  max_number_args = 2;
   for (i = 1; i < lineno; i++)
     {
       ret = parse_line(lines[i], "NEXT_PASS");
@@ -220,13 +219,8 @@  END {
 	  if (num_args > 0)
 	    {
 	      printf "NEXT_PASS_WITH_ARG";
-	      if (num_args > max_number_args)
-		{
-		  print "ERROR: Only supports up to " max_number_args " args to NEXT_PASS";
-		  exit 1;
-		}
 	      if (num_args != 1)
-	        printf num_args;
+	        printf "S";
 	    }
 	  else
 	    printf "NEXT_PASS";
@@ -266,8 +260,7 @@  END {
   print "#undef POP_INSERT_PASSES"
   print "#undef NEXT_PASS"
   print "#undef NEXT_PASS_WITH_ARG"
-  for (i = 2; i <= max_number_args; i++)
-    print "#undef NEXT_PASS_WITH_ARG" i
+  print "#undef NEXT_PASS_WITH_ARGS"
   print "#undef TERMINATE_PASS_LIST"
 }
 
diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
index f18ae026257..294cdd0b1f7 100644
--- a/gcc/pass_manager.h
+++ b/gcc/pass_manager.h
@@ -130,7 +130,7 @@  private:
 #define POP_INSERT_PASSES()
 #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
 #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
-#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
+#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
 #define TERMINATE_PASS_LIST(PASS)
 
 #include "pass-instances.def"
diff --git a/gcc/passes.cc b/gcc/passes.cc
index b5475fce522..ae80f40b96a 100644
--- a/gcc/passes.cc
+++ b/gcc/passes.cc
@@ -1589,7 +1589,7 @@  pass_manager::pass_manager (context *ctxt)
 #define POP_INSERT_PASSES()
 #define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL
 #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
-#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1) NEXT_PASS (PASS, NUM)
+#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
 #define TERMINATE_PASS_LIST(PASS)
 #include "pass-instances.def"
 
@@ -1636,11 +1636,16 @@  pass_manager::pass_manager (context *ctxt)
       PASS ## _ ## NUM->set_pass_param (0, ARG);	\
     } while (0)
 
-#define NEXT_PASS_WITH_ARG2(PASS, NUM, ARG0, ARG1)	\
+#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...)		\
     do {						\
       NEXT_PASS (PASS, NUM);				\
-      PASS ## _ ## NUM->set_pass_param (0, ARG0);	\
-      PASS ## _ ## NUM->set_pass_param (1, ARG1);	\
+      static constexpr bool values[] = { __VA_ARGS__ };	\
+      unsigned i = 0;					\
+      for (bool value : values)				\
+	{						\
+	  PASS ## _ ## NUM->set_pass_param (i, value);	\
+	  i++;						\
+	}						\
     } while (0)
 
 #include "pass-instances.def"