]> git.ipfire.org Git - thirdparty/gcc.git/commit
passes: Remove limit on the number of params
authorAndrew Pinski <quic_apinski@quicinc.com>
Sun, 13 Oct 2024 22:57:41 +0000 (15:57 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Tue, 15 Oct 2024 14:45:01 +0000 (07:45 -0700)
commit061a4e35c81f24c6ec5e56214469d229f1808971
tree677a6b5eefd8a25033769621e5a135740116295e
parent7f65f94917866c6b18d9698eec6451c1bf21e0f9
passes: Remove limit on the number of params

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).

Tested INSERT_PASS_AFTER/INSERT_PASS_BEFORE manually by changing config/i386/i386-passes.def's
stv lines to have a 2nd argument and checked the resuling pass-instances.def to see the NEXT_PASS_WITH_ARGS
was correctly done.

changes from v1:
* v2: Handle INSERT_PASS_AFTER/INSERT_PASS_BEFORE too.

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
gcc/pass_manager.h
gcc/passes.cc