The following patch series moves the logic for creating the pipeline of optimization passes out from passes.c and into a new passes.def file (patches 1 and 2).
It then explicitly numbers those passes that have multiple instances, by using a NEXT_PASS_NUM macro in place of NEXT_PASS (patch 3) The motivation for this is subsequent work towards removing global variables from GCC's internals: by numbering the instances it becomes possible to create a "class pipeline" and have the fields be declared via suitable use of passes.def. See: http://dmalcolm.fedorapeople.org/gcc/global-state/new-classes.html#pass-classes The final patch in the sequence adds a script which sanity-checks passes.def, and prints some stats about the passes. You can see output from the script at: http://dmalcolm.fedorapeople.org/gcc/2013-07-17/pass-stats.txt Specifically, it lists single-instanced passes, then all multi-instance passes, giving the number of instances of each (alphabetically within each list). I've successfully bootstrapped and tested the sequence of patches on x86_64-unknown-linux-gnu: all testcases show the same results as an unpatched build (relative to r201011). OK to commit these to trunk? David Malcolm (4): Introduce macros when constructing the tree of passes Move the construction of the pass hierarchy into a new passes.def file. Introduce NEXT_PASS_NUM macro Add contrib/check_passes.py script contrib/check_passes.py | 58 +++++++ gcc/Makefile.in | 2 +- gcc/passes.c | 401 ++--------------------------------------------- gcc/passes.def | 406 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 481 insertions(+), 386 deletions(-) create mode 100644 contrib/check_passes.py create mode 100644 gcc/passes.def -- 1.7.11.7