public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
Date: Fri, 27 Oct 2023 23:43:10 +0000 (UTC)	[thread overview]
Message-ID: <1698449982.4e7cf4e3cf83a83932fd23c7dfb6a31903d09dd7.sam@gentoo> (raw)

commit:     4e7cf4e3cf83a83932fd23c7dfb6a31903d09dd7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 23:39:42 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 23:39:42 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4e7cf4e3

13.2.0: update 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...genemit-Split-insn-emit.cc-into-ten-files.patch | 164 ++++++++++++---------
 13.2.0/gentoo/README.history                       |   4 +
 2 files changed, 100 insertions(+), 68 deletions(-)

diff --git a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
index 19352ac..6a2f3ed 100644
--- a/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+++ b/13.2.0/gentoo/90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
@@ -1,44 +1,42 @@
 https://gcc.gnu.org/PR54179
-https://gcc.gnu.org/PR84402
-https://gcc.gnu.org/PR111600
-https://inbox.sourceware.org/gcc-patches/87il76kgk2.fsf@gentoo.org/T/
+https://inbox.sourceware.org/gcc-patches/de0f7bdc-d236-4f5b-9504-d5bfb215d023@gmail.com/
 
-From 6b25a6ca295528805d8dedd59e1ed2f1e218a819 Mon Sep 17 00:00:00 2001
+From a71bcc136fee1c5a5ec6639f802daf1b22a1aab6 Mon Sep 17 00:00:00 2001
 From: Robin Dapp <rdapp.gcc@gmail.com>
-Date: Mon, 16 Oct 2023 12:17:07 +0200
-Subject: [PATCH 6/6] genemit: Split insn-emit.cc into ten files.
+Date: Fri, 27 Oct 2023 21:04:25 +0200
+Subject: [PATCH] genemit: Split insn-emit.cc into ten files.
 
-Hi,
+After working with Sam off-list (thanks) I managed to get hppa to
+build.  Initially it looked as if hppa just had a very small number of
+instruction patterns so we wouldn't generate all 10 output files.
+However, the actual issue (which we will only hit with a low
+pattern count) was with counting all the patterns vs only counting
+the patterns that will be output.  A wrong pattern count lead to
+prematurely stopping to write output files.
 
-the attached v2 includes Tamar's suggestion of keeping the current
-stdout behavior.  When no output files are passed (via -O) the output
-is written to stdout as before.
+With that corrected, hppa "just works" until I hit linker errors
+due to relocations - most likely unrelated:
 
-Tamar also mentioned off-list that, similar to match.pd, it might make
-sense to balance the partitions in a better way than a fixed number
-of patterns threshold.  That's a good idea but I'd rather do that
-separately as the current approach already helps considerably.
+bin/ld: unwind-dw2-fde-dip_s.o(.data.rel.ro+0): cannot handle
+R_PARISC_FPTR64 for __pthread_key_create@@GLIBC_2.34
 
-Attached v2 was bootstrapped and regtested on power10, aarch64 and
-x86 are still running.
-Stefan also tested v1 on s390 where the partitioning does not help
-but also doesn't slow anything down.  insn-emit.cc isn't very large
-to begin with on s390.
+Attached is v3 that has been bootstrapped and tested on x86 and power10,
+aarch64 bootstrap was ok, testsuite is still running.  A riscv build and
+testsuite run was successful as well.
 
 Regards
  Robin
 
->From 34d05113a4e3c7e83a4731020307e26c1144af69 Mon Sep 17 00:00:00 2001
+>From 248744c328440bff9cc339d2bf622852cbaac343 Mon Sep 17 00:00:00 2001
 From: Robin Dapp <rdapp@ventanamicro.com>
 Date: Thu, 12 Oct 2023 11:23:26 +0200
-Subject: [PATCH v2] genemit: Split insn-emit.cc into several partitions.
+Subject: [PATCH v3] genemit: Split insn-emit.cc into several partitions.
 
 On riscv insn-emit.cc has grown to over 1.2 mio lines of code and
 compiling it takes considerable time.
 Therefore, this patch adjust genemit to create several partitions
-(insn-emit-1.cc to insn-emit-n.cc).  In order to do so it first counts
-the number of available patterns, calculates the number of patterns per
-file and starts a new file whenever that number is reached.
+(insn-emit-1.cc to insn-emit-n.cc).  The available patterns are
+written to the given files in a sequential fashion.
 
 Similar to match.pd a configure option --with-emitinsn-partitions=num
 is introduced that makes the number of partition configurable.
@@ -74,21 +72,19 @@ gcc/ChangeLog:
 	* gensupport.h (count_patterns): Define.
 	* read-md.cc (md_reader::print_md_ptr_loc): Add file argument.
 	* read-md.h (class md_reader): Change definition.
-
-(cherry picked from commit 646ee18fef30ade65e5ff2e7445e4915a0f9a3ad)
 ---
- gcc/Makefile.in   |  38 +++-
- gcc/configure     |  22 +-
+ gcc/Makefile.in   |  36 ++-
+ gcc/configure     |  24 +-
  gcc/configure.ac  |  13 ++
- gcc/genemit.cc    | 536 +++++++++++++++++++++++++---------------------
- gcc/gensupport.cc |  36 ++++
+ gcc/genemit.cc    | 542 +++++++++++++++++++++++++---------------------
+ gcc/gensupport.cc |  55 +++++
  gcc/gensupport.h  |   1 +
  gcc/read-md.cc    |   4 +-
  gcc/read-md.h     |   2 +-
- 8 files changed, 398 insertions(+), 254 deletions(-)
+ 8 files changed, 422 insertions(+), 255 deletions(-)
 
 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 2c16b14ad0f..9152525ec23 100644
+index 2c16b14ad0f3..b0c118e6d189 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
 @@ -232,6 +232,13 @@ GIMPLE_MATCH_PD_SEQ_O = $(patsubst %, gimple-match-%.o, $(MATCH_SPLITS_SEQ))
@@ -150,31 +146,29 @@ index 2c16b14ad0f..9152525ec23 100644
  			  insn-extract.cc insn-output.cc \
  			  insn-peep.cc insn-recog.cc
  
-@@ -2490,8 +2498,22 @@ $(simple_generated_c:insn-%.cc=s-%): s-%: build/gen%$(build_exeext)
+@@ -2490,8 +2498,20 @@ $(simple_generated_c:insn-%.cc=s-%): s-%: build/gen%$(build_exeext)
  	$(SHELL) $(srcdir)/../move-if-change tmp-$*.cc insn-$*.cc
  	$(STAMP) s-$*
  
 +# genemit splits its output into different files and doesn't write to
 +# stdout. (but rather to tmp-emit-01.cc..tmp-emit-10.cc)
-+s-tmp-emit: build/genemit$(build_exeext) insn-conditions.md
++$(INSNEMIT_SEQ_SRC): s-tmp-emit; @true
++s-tmp-emit: build/genemit$(build_exeext) $(MD_DEPS) insn-conditions.md
 +	$(RUN_GEN) build/genemit$(build_exeext) $(md_file) insn-conditions.md \
 +	  $(addprefix -O,${INSNEMIT_SEQ_TMP})
++	$(foreach id, $(INSNEMIT_SPLITS_SEQ), \
++	  $(SHELL) $(srcdir)/../move-if-change tmp-emit-$(id).cc \
++	  insn-emit-$(id).cc;)
 +	$(STAMP) s-tmp-emit
-+
-+$(INSNEMIT_SEQ_SRC): insn-emit-%.cc: s-insn-emit-%; @true
-+$(INSNEMIT_SEQ_SRC:insn-emit-%.cc=s-insn-emit-%): s-insn-emit-%: s-tmp-emit
-+	$(SHELL) $(srcdir)/../move-if-change tmp-emit-$*.cc insn-emit-$*.cc
-+	$(STAMP) s-insn-emit-$*
 +
  # gencheck doesn't read the machine description, and the file produced
  # doesn't use the insn-* convention.
 +
-+# --> s-check has prerequisite tree-check.h (though nothing to do)
  tree-check.h: s-check ; @true
  s-check : build/gencheck$(build_exeext)
  	$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
 diff --git a/gcc/configure b/gcc/configure
-index 3750f77fd03..9e8febc17b4 100755
+index 3750f77fd037..056d098618b2 100755
 --- a/gcc/configure
 +++ b/gcc/configure
 @@ -838,6 +838,7 @@ enable_gcov
@@ -230,12 +224,21 @@ index 3750f77fd03..9e8febc17b4 100755
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
 -#line 19848 "configure"
-+#line 19946 "configure"
++#line 19995 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -19951,7 +19971,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 19954 "configure"
++#line 20101 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
 diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 7f8aa5329c7..efbaa0bf6ee 100644
+index 7f8aa5329c7f..efbaa0bf6eeb 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
 @@ -934,6 +934,19 @@ fi
@@ -259,7 +262,7 @@ index 7f8aa5329c7..efbaa0bf6ee 100644
  AC_ARG_ENABLE(__cxa_atexit,
  [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
 diff --git a/gcc/genemit.cc b/gcc/genemit.cc
-index 33c9ec05d6f..aee69872470 100644
+index 33c9ec05d6fc..18c95e3f6412 100644
 --- a/gcc/genemit.cc
 +++ b/gcc/genemit.cc
 @@ -49,29 +49,29 @@ struct clobber_ent
@@ -1136,7 +1139,7 @@ index 33c9ec05d6f..aee69872470 100644
      return (FATAL_EXIT_CODE);
  
  #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
-@@ -867,86 +924,81 @@ main (int argc, const char **argv)
+@@ -867,86 +924,87 @@ main (int argc, const char **argv)
    /* Assign sequential codes to all entries in the machine description
       in parallel with the tables in insn-output.cc.  */
  
@@ -1144,6 +1147,13 @@ index 33c9ec05d6f..aee69872470 100644
 -from the machine description file `md'.  */\n\n");
 +  int npatterns = count_patterns ();
 +  md_rtx_info info;
++
++  bool to_stdout = false;
++  int npatterns_per_file = npatterns;
++  if (!output_files.is_empty ())
++    npatterns_per_file = npatterns / output_files.length () + 1;
++  else
++    to_stdout = true;
  
 -  printf ("#define IN_TARGET_CODE 1\n");
 -  printf ("#include \"config.h\"\n");
@@ -1180,17 +1190,13 @@ index 33c9ec05d6f..aee69872470 100644
 -  printf ("#include \"tm-constrs.h\"\n");
 -  printf ("#include \"ggc.h\"\n");
 -  printf ("#include \"target.h\"\n\n");
-+  int npatterns_per_file = npatterns;
-+  if (!output_files.is_empty ())
-+    npatterns_per_file = npatterns / output_files.length () + 1;
- 
--  /* Read the machine description.  */
 +  gcc_assert (npatterns_per_file > 1);
  
--  md_rtx_info info;
+-  /* Read the machine description.  */
 +  /* Reverse so we can pop the first-added element.  */
 +  output_files.reverse ();
-+
+ 
+-  md_rtx_info info;
 +  int count = 0;
 +  FILE *file = NULL;
 +
@@ -1204,7 +1210,8 @@ index 33c9ec05d6f..aee69872470 100644
 +    {
 +      if (count == 0 || count == npatterns_per_file)
 +	{
-+	  if (file)
++	  bool is_last = !to_stdout && output_files.is_empty ();
++	  if (file && !is_last)
 +	    if (fclose (file) != 0)
 +	      return FATAL_EXIT_CODE;
  
@@ -1217,8 +1224,10 @@ index 33c9ec05d6f..aee69872470 100644
 +	      const char *const filename = output_files.pop ();
 +	      file = fopen (filename, "w");
 +	    }
-+	  else
++	  else if (to_stdout)
 +	    file = stdout;
++	  else
++	    break;
  
 -      case DEFINE_SPLIT:
 -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
@@ -1284,10 +1293,10 @@ index 33c9ec05d6f..aee69872470 100644
 +  return (fclose (file) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
  }
 diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
-index f9efc6eb757..8ea48ef755d 100644
+index f9efc6eb7572..f941f76a739f 100644
 --- a/gcc/gensupport.cc
 +++ b/gcc/gensupport.cc
-@@ -2631,6 +2631,42 @@ init_rtx_reader_args (int argc, const char **argv)
+@@ -2631,6 +2631,61 @@ init_rtx_reader_args (int argc, const char **argv)
    return init_rtx_reader_args_cb (argc, argv, 0);
  }
  \f
@@ -1295,32 +1304,51 @@ index f9efc6eb757..8ea48ef755d 100644
 +int
 +count_patterns ()
 +{
-+  int count = 0;
++  int count = 0, truth = 1;
++  rtx def;
 +  class queue_elem *cur = define_attr_queue;
-+  while (cur != NULL)
++  while (cur)
 +    {
-+      count++;
++      def = cur->data;
++
++      truth = maybe_eval_c_test (get_c_test (def));
++      if (truth || !insn_elision)
++	count++;
 +      cur = cur->next;
 +    }
 +
 +  cur = define_pred_queue;
-+  while (cur != NULL)
++  while (cur)
 +    {
-+      count++;
++      def = cur->data;
++
++      truth = maybe_eval_c_test (get_c_test (def));
++      if (truth || !insn_elision)
++	count++;
 +      cur = cur->next;
 +    }
 +
 +  cur = define_insn_queue;
-+  while (cur != NULL)
++  truth = 1;
++  while (cur)
 +    {
-+      count++;
++      def = cur->data;
++
++      truth = maybe_eval_c_test (get_c_test (def));
++      if (truth || !insn_elision)
++	count++;
 +      cur = cur->next;
 +    }
 +
 +  cur = other_queue;
-+  while (cur != NULL)
++  truth = 1;
++  while (cur)
 +    {
-+      count++;
++      def = cur->data;
++
++      truth = maybe_eval_c_test (get_c_test (def));
++      if (truth || !insn_elision)
++	count++;
 +      cur = cur->next;
 +    }
 +
@@ -1331,7 +1359,7 @@ index f9efc6eb757..8ea48ef755d 100644
     describing it in *INFO.  */
  
 diff --git a/gcc/gensupport.h b/gcc/gensupport.h
-index a1edfbd7190..510ba19405e 100644
+index a1edfbd71908..510ba19405e4 100644
 --- a/gcc/gensupport.h
 +++ b/gcc/gensupport.h
 @@ -129,6 +129,7 @@ extern rtx add_implicit_parallel (rtvec);
@@ -1343,7 +1371,7 @@ index a1edfbd7190..510ba19405e 100644
  extern unsigned int get_num_insn_codes ();
  
 diff --git a/gcc/read-md.cc b/gcc/read-md.cc
-index fd38818e3a3..46ab9065e3e 100644
+index fd38818e3a3e..46ab9065e3e4 100644
 --- a/gcc/read-md.cc
 +++ b/gcc/read-md.cc
 @@ -132,9 +132,9 @@ md_reader::fprint_md_ptr_loc (FILE *outf, const void *ptr)
@@ -1359,7 +1387,7 @@ index fd38818e3a3..46ab9065e3e 100644
  
  /* Return a condition that satisfies both COND1 and COND2.  Either string
 diff --git a/gcc/read-md.h b/gcc/read-md.h
-index b309c9c3deb..2adcb58478f 100644
+index b309c9c3deb6..2adcb58478fe 100644
 --- a/gcc/read-md.h
 +++ b/gcc/read-md.h
 @@ -194,7 +194,7 @@ class md_reader

diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index d58550f..4b18bf0 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+10	28 Oct 2023
+
+	U 90_all_PR54179_genemit-Split-insn-emit.cc-into-ten-files.patch
+
 9	16 Oct 2023
 
 	+ 86_all_build-Replace-seq-for-portability-with-GNU-Make-vari.patch


             reply	other threads:[~2023-10-27 23:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27 23:43 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-29 18:56 [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/ Sam James
2024-09-29 18:56 Sam James
2024-07-27 19:47 Sam James
2024-06-08 17:01 Sam James
2024-05-10 22:50 Sam James
2024-04-07 23:25 Sam James
2024-04-07 23:25 Sam James
2024-02-28  0:29 Sam James
2024-02-12  7:03 Sam James
2024-01-17  1:06 Sam James
2023-12-03  3:18 Sam James
2023-11-29 20:25 Sam James
2023-11-29 20:16 Sam James
2023-10-16 12:41 Sam James
2023-10-01  2:28 Sam James
2023-10-01  2:28 Sam James
2023-10-01  2:28 Sam James
2023-08-14  9:31 Sam James
2023-08-13  0:35 Sam James
2023-08-05 23:13 Sam James
2023-07-30 19:02 Sam James
2023-05-26  2:50 Sam James
2023-04-29 23:28 Sam James
2023-04-26 20:39 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1698449982.4e7cf4e3cf83a83932fd23c7dfb6a31903d09dd7.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox