Re: [PATCH 2/2] genattrtab: Distribute generated code across multiple files

Jeffrey Law <[email protected]> Tue, 4 Aug 2026 10:33:54 -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-attrtab.cc contains many independent get_attr_* functions.  Several have
> large switches over every instruction code, making the single source one of
> the slowest objects in each bootstrap stage.
>
> Let genattrtab write multiple attribute outputs, following genemit and
> genrecog.  Reuse --with-insnemit-partitions and make -A repeatable.  Record and
> validate every output name before opening files, rejecting duplicates and
> resolvable aliases across -A, -D, and -L.  Place each attribute function in
> the shortest output, along with the fixed delay and length functions.  Keep
> DFA and latency
> functions in their existing single files.
>
> The functions refer to one another through insn-attr.h and
> insn-attr-common.h, so generated headers do not change.  With one -A option all
> three outputs are byte-identical to the previous generator.  Close diagnostics
> retain the affected filename.
>
> With the default AArch64 partition count, the largest attribute part is about
> 85% smaller and compiles about 67% faster than the original source.
>
> Bootstrapped and tested on aarch64-none-linux-gnu and x86_64-linux.
> Ok for trunk?
> Thanks,
> Kyrill
>
> gcc/ChangeLog:
>
> 	* Makefile.in (INSNATTRTAB_SPLITS_SEQ, INSNATTRTAB_SEQ_SRC)
> 	(INSNATTRTAB_SEQ_TMP, INSNATTRTAB_SEQ_O): New variables.
> 	(OBJS): Replace insn-attrtab.o with $(INSNATTRTAB_SEQ_O).
> 	(MOSTLYCLEANFILES): Add $(INSNATTRTAB_SEQ_SRC), retaining the legacy
> 	unnumbered source for cleanup.
> 	(.PRECIOUS): Use $(INSNATTRTAB_SEQ_SRC).
> 	(s-attrtab): Generate and move numbered attribute files.  Stop when a
> 	move fails.
> 	* configure.ac (--with-insnemit-partitions): Document all generators
> 	which use the option.
> 	* configure: Regenerate.
> 	* genattrtab.cc (attr_file_name, attr_file): Remove.
> 	(attr_files, attr_file_names): New variables.
> 	(dfa_file_name, latency_file_name): Retain output names.
> 	(choose_attr_output, check_output_name): New functions.
> 	(make_automaton_attrs): Write to the first attribute file.
> 	(handle_arg): Record and validate repeatable output names.
> 	(main): Open outputs after complete validation.  Distribute attribute,
> 	delay, and length functions.  Diagnose close failures.
> 	* final.cc (length_unit_log): Update comment for partitioned output.
> 	* config/arc/arc-protos.h (regno_clobbered_p): Likewise.
> 	* config/ia64/ia64.cc (bundling): Likewise.
> 	* config/ia64/t-ia64 (insn-attrtab.o-warn): Replace with per-partition
> 	warning variables.
> 	* config/sh/sh.h (code_for_indirect_jump_scratch): Update comment for
> 	partitioned output.
Same concern here about using a different style for the _SEQ variable.  
Otherwise it looks good to me.

Jeff