Re: [PATCH 1/2] genopinit: Distribute generated code across multiple files
Jeffrey Law <[email protected]> Tue, 4 Aug 2026 10:26:05 -0600
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
On 7/23/2026 7:20 AM, [email protected] wrote: > From: Kyrylo Tkachov <[email protected]> > > insn-opinit.cc contains large generated initialization functions with > thousands of target-feature expressions. The single file is among the > slowest objects in every AArch64 bootstrap stage. > > Teach genopinit to accept repeatable -O output options, following genemit and > genrecog. Reuse the existing --with-insnemit-partitions count, while > preserving the default init-opinit.c output and -cFILE interface when -O is not > used. Collect and validate all output names before opening them, rejecting > duplicates, resolvable aliases, header collisions, and incompatible -c and -O > options. > > Keep shared lookup code and all helper declarations in the first output, then > place helper definitions in the shortest output. One-file output retains the > historical static helper names. Split output uses generator-private external > names for cross-file references. > > With the default ten AArch64 partitions, the largest part compiles about 90% > faster than the original single object. > > Bootstrapped and tested on aarch64-none-linux-gnu and x86_64-linux. > Ok for trunk? > Thanks, > Kyrill > > gcc/ChangeLog: > > * Makefile.in (INSNOPINIT_SPLITS_SEQ, INSNOPINIT_SEQ_SRC) > (INSNOPINIT_SEQ_TMP, INSNOPINIT_SEQ_O): New variables. > (OBJS): Replace insn-opinit.o with $(INSNOPINIT_SEQ_O). > (MOSTLYCLEANFILES): Add $(INSNOPINIT_SEQ_SRC), retaining the legacy > unnumbered source for cleanup. > (s-opinit): Generate and move numbered insn-opinit-N.cc files. Stop if > moving an output fails. > * configure.ac (--with-insnemit-partitions): Mention genopinit outputs. > * configure: Regenerate. > * genopinit.cc (source_file_option, output_file_names, output_files): > New variables. > (handle_arg): Record and validate repeatable -O output names. > (main): Validate all output modes before opening files. Preserve static > helper linkage for one output and distribute private split helpers. > > Signed-off-by: Kyrylo Tkachov <[email protected]> It'll be interesting to see if this improves the RISC-V build times too. Robin fixed the worst of the offenders a while back, but we've got daily build data and if there's a meaningful improvement we should be able to see it. The only concern is the INSNOPINIT_SPLITS_SEQ is slightly different than the other _SEQ variables. The others use: MATCH_SPLITS_SEQ = $(wordlist 1,$(NUM_MATCH_SPLITS),$(one_to_9999)) INSNEMIT_SPLITS_SEQ = $(wordlist 1,$(NUM_INSNEMIT_SPLITS),$(one_to_9999)) INSNRECOG_SPLITS_SEQ = $(wordlist 1,$(NUM_INSNEMIT_SPLITS),$(one_to_9999)) Is there a reason you didn't use that form? jeff