https://gcc.gnu.org/g:307bef6931b7e14e194871545fe69c73d832db83

commit r17-4224-g307bef6931b7e14e194871545fe69c73d832db83
Author: Kyrylo Tkachov <[email protected]>
Date:   Fri Aug 7 15:47:44 2026 +0200

    genemit: spread the overloaded-name definitions over the output files
    
    genemit picks an output file per pattern, so the gen_* definitions are
    spread evenly.  The block it writes afterwards is not: it picks a file
    once and then emits add_clobbers, added_clobbers_hard_reg_p and the
    code_for_/gen_ pair for every overloaded name into that one file.
    
    On aarch64 that left insn-emit-10.cc at 2020142 bytes against 1196464 to
    1197283 for the other nine, a 70% overhang on one of ten files.  Since
    the files are compiled in parallel, the longest one sets how long the
    group takes, so the imbalance costs wall-clock time that splitting exists
    to save.
    
    Pick a file per overloaded name.  The nine sizes become 1268108 to
    1311015 bytes, a spread of 3%.  add_clobbers and added_clobbers_hard_reg_p
    stay together, since they share the table that describes which patterns
    have clobbers.
    
    Bootstrapped on aarch64-none-linux-gnu.
    
    gcc/ChangeLog:
    
            * genemit.cc (main): Choose an output file for each overloaded name.
    
    Signed-off-by: Kyrylo Tkachov <[email protected]>

Diff:
---
 gcc/genemit.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/genemit.cc b/gcc/genemit.cc
index d1dfb296629d..9c881aa2baee 100644
--- a/gcc/genemit.cc
+++ b/gcc/genemit.cc
@@ -970,9 +970,13 @@ main (int argc, const char **argv)
   output_add_clobbers (file);
   output_added_clobbers_hard_reg_p (file);
 
+  /* Spread these over the output files too.  Emitting them all into
+     whichever file happened to be current leaves that one much bigger than
+     the rest, which is the opposite of what splitting is for.  */
   for (overloaded_name *oname = rtx_reader_ptr->get_overloads ();
        oname; oname = oname->next)
     {
+      file = choose_output (output_files, file_idx);
       handle_overloaded_code_for (oname, file);
       handle_overloaded_gen (oname, file);
     }

Reply via email to