Following on from Richi's RFC[1] this is another attempt to split up match.pd
into multiple gimple-match and generic-match files. This version is fully
automated and requires no human intervention.
First things first, some perf numbers. The following shows the effect of the
patch on my desktop doing parallel compilation of gimple-match:
As can be seen there seems to be a point of diminishing returns in doing splits.
This comes from the fact that these match files consume a sizeable amount of
headers. At a certain point the parsing overhead of the headers dominate and
you start losing in gains.
As such from this I've made the default 10 splits per file to allow for some
room for growth in the future without needing changes to the split amount.
Since 5-10 show roughly the same gains it means we can afford to double the
file sizes before we need to up the split amount. This can be controlled
by the configure parameter --with-matchpd-partitions=.
The reason gimple-match-1.cc is so large is because it got allocated a very
large function: gimple_simplify_NE_EXPR.
Because of these sporadically large functions the allocation to a split happens
based on the amount of data already written to a split instead of just a simple
round robin allocation (though the patch supports that too.). This means that
once gimple_simplify_NE_EXPR is allocated to gimple-match-1.cc nothing uses it
again until the rest of the files catch up.
To support this split a new header file *-match-auto.h is generated to allow
the individual files to compile separately.
Lastly for the auto generated files I use pragmas to silence the unused
predicate warnings instead of the previous Makefile way because I couldn't find
a way to set them without knowing the number of split files beforehand.
Finally with this change, bootstrap time has dropped 8 minutes on AArch64.
PR bootstrap/84402
* genmatch.cc (emit_func, SIZED_BASED_CHUNKS, get_out_file): New.
(decision_tree::gen): Accept list of files instead of single and update
to write function definition to header and main file.
(write_predicate): Likewise.
(write_header): Emit pragmas and new includes.
(main): Create file buffers and cleanup.
(showUsage, write_header_includes): New.