public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
       [not found] <jiejie_rong@c-sky.com@genemit.c_(main):_split_insn-emit.c_for_compiling_parallelly>
@ 2020-09-15  9:15 ` Jojo R
  2020-09-27  2:34   ` Jojo R
  2020-10-27 14:14   ` Richard Sandiford
  2020-10-30  9:42 ` [PATCH v8] " Jojo R
  2020-11-04  1:53 ` [PATCH v9] " Jojo R
  2 siblings, 2 replies; 13+ messages in thread
From: Jojo R @ 2020-09-15  9:15 UTC (permalink / raw)
  To: jiejie_rong, segher, richard.sandiford, ro, richard.guenther,
	joseph, gcc-patches, yunhai.syh

gcc/ChangeLog:

	* genemit.c (main): Print 'split line'.
	* Makefile.in (insn-emit.c): Define split count and file

---
 gcc/Makefile.in |  19 +++++++++
 gcc/genemit.c   | 104 +++++++++++++++++++++++++++++-------------------
 2 files changed, 83 insertions(+), 40 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 79e854aa938..a7fcc7d5949 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
 # We put the *-match.o and insn-*.o files first so that a parallel make
 # will build them sooner, because they are large and otherwise tend to be
 # the last objects to finish building.
+
+# target overrides
+-include $(tmake_file)
+
+INSN-GENERATED-SPLIT-NUM ?= 0
+
+insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
+	while test $$i -le $$j; do \
+	  echo $$i; i=`expr $$i + 1`; \
+	done)
+
+insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
+insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
+$(insn-emit-split-c): insn-emit.c
+
 OBJS = \
 	gimple-match.o \
 	generic-match.o \
@@ -1265,6 +1280,7 @@ OBJS = \
 	insn-automata.o \
 	insn-dfatab.o \
 	insn-emit.o \
+	$(insn-emit-split-obj) \
 	insn-extract.o \
 	insn-latencytab.o \
 	insn-modes.o \
@@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
 	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
 	  $(filter insn-conditions.md,$^) > tmp-$*.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
+	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
+	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
+	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
 	$(STAMP) s-$*
 
 # gencheck doesn't read the machine description, and the file produced
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 84d07d388ee..54a0d909d9d 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
     }
 }
 
-int
-main (int argc, const char **argv)
-{
-  progname = "genemit";
-
-  if (!init_rtx_reader_args (argc, argv))
-    return (FATAL_EXIT_CODE);
-
-#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
-  nofail_optabs[OPTAB##_optab] = true;
-#include "internal-fn.def"
-
-  /* Assign sequential codes to all entries in the machine description
-     in parallel with the tables in insn-output.c.  */
-
-  printf ("/* Generated automatically by the program `genemit'\n\
-from the machine description file `md'.  */\n\n");
+/* Print include header.  */
 
+static void
+printf_include (void)
+{
+  printf ("/* Generated automatically by the program `genemit'\n"
+	  "from the machine description file `md'.  */\n\n");
   printf ("#define IN_TARGET_CODE 1\n");
   printf ("#include \"config.h\"\n");
   printf ("#include \"system.h\"\n");
@@ -900,35 +889,70 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"tm-constrs.h\"\n");
   printf ("#include \"ggc.h\"\n");
   printf ("#include \"target.h\"\n\n");
+}
 
-  /* Read the machine description.  */
+/* Generate the `gen_...' function from GET_CODE().  */
 
-  md_rtx_info info;
-  while (read_md_rtx (&info))
-    switch (GET_CODE (info.def))
-      {
-      case DEFINE_INSN:
-	gen_insn (&info);
-	break;
+static void
+gen_md_rtx (md_rtx_info *info)
+{
+  switch (GET_CODE (info->def))
+    {
+    case DEFINE_INSN:
+      gen_insn (info);
+      break;
 
-      case DEFINE_EXPAND:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_expand (&info);
-	break;
+    case DEFINE_EXPAND:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_expand (info);
+      break;
 
-      case DEFINE_SPLIT:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_split (&info);
-	break;
+    case DEFINE_SPLIT:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_split (info);
+      break;
 
-      case DEFINE_PEEPHOLE2:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_split (&info);
-	break;
+    case DEFINE_PEEPHOLE2:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_split (info);
+      break;
 
-      default:
-	break;
-      }
+    default:
+      break;
+    }
+}
+
+int
+main (int argc, const char **argv)
+{
+  progname = "genemit";
+
+  if (!init_rtx_reader_args (argc, argv))
+    return (FATAL_EXIT_CODE);
+
+#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
+  nofail_optabs[OPTAB##_optab] = true;
+#include "internal-fn.def"
+
+  /* Assign sequential codes to all entries in the machine description
+     in parallel with the tables in insn-output.c.  */
+
+  int read_count = 0;
+
+  /* Read the machine description.  */
+
+  md_rtx_info info;
+  while (read_md_rtx (&info))
+    {
+      if ((read_count++ % 10000) == 0)
+	{
+	  printf ("/* Split file into separate compilation units "
+		  "for parallel compilation %d */\n\n", read_count);
+	  printf_include();
+	}
+
+      gen_md_rtx (&info);
+    }
 
   /* Write out the routines to add CLOBBERs to a pattern and say whether they
      clobber a hard reg.  */
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-09-15  9:15 ` [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly Jojo R
@ 2020-09-27  2:34   ` Jojo R
  2020-10-08  2:01     ` Jojo R
  2020-10-27 14:14   ` Richard Sandiford
  1 sibling, 1 reply; 13+ messages in thread
From: Jojo R @ 2020-09-27  2:34 UTC (permalink / raw)
  To: segher, richard.sandiford, ro, richard.guenther, joseph,
	gcc-patches, yunhai.syh

Hi,

	Has this patch been merged ?

Jojo
在 2020年9月15日 +0800 PM5:16,Jojo R <jiejie_rong@c-sky.com>,写道:
> gcc/ChangeLog:
>
> * genemit.c (main): Print 'split line'.
> * Makefile.in (insn-emit.c): Define split count and file
>
> ---
> gcc/Makefile.in | 19 +++++++++
> gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
> 2 files changed, 83 insertions(+), 40 deletions(-)
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 79e854aa938..a7fcc7d5949 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
> # We put the *-match.o and insn-*.o files first so that a parallel make
> # will build them sooner, because they are large and otherwise tend to be
> # the last objects to finish building.
> +
> +# target overrides
> +-include $(tmake_file)
> +
> +INSN-GENERATED-SPLIT-NUM ?= 0
> +
> +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> + while test $$i -le $$j; do \
> + echo $$i; i=`expr $$i + 1`; \
> + done)
> +
> +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> +$(insn-emit-split-c): insn-emit.c
> +
> OBJS = \
> gimple-match.o \
> generic-match.o \
> @@ -1265,6 +1280,7 @@ OBJS = \
> insn-automata.o \
> insn-dfatab.o \
> insn-emit.o \
> + $(insn-emit-split-obj) \
> insn-extract.o \
> insn-latencytab.o \
> insn-modes.o \
> @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
> $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
> $(filter insn-conditions.md,$^) > tmp-$*.c
> $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
> $(STAMP) s-$*
>
> # gencheck doesn't read the machine description, and the file produced
> diff --git a/gcc/genemit.c b/gcc/genemit.c
> index 84d07d388ee..54a0d909d9d 100644
> --- a/gcc/genemit.c
> +++ b/gcc/genemit.c
> @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
> }
> }
>
> -int
> -main (int argc, const char **argv)
> -{
> - progname = "genemit";
> -
> - if (!init_rtx_reader_args (argc, argv))
> - return (FATAL_EXIT_CODE);
> -
> -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> - nofail_optabs[OPTAB##_optab] = true;
> -#include "internal-fn.def"
> -
> - /* Assign sequential codes to all entries in the machine description
> - in parallel with the tables in insn-output.c. */
> -
> - printf ("/* Generated automatically by the program `genemit'\n\
> -from the machine description file `md'. */\n\n");
> +/* Print include header. */
>
> +static void
> +printf_include (void)
> +{
> + printf ("/* Generated automatically by the program `genemit'\n"
> + "from the machine description file `md'. */\n\n");
> printf ("#define IN_TARGET_CODE 1\n");
> printf ("#include \"config.h\"\n");
> printf ("#include \"system.h\"\n");
> @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n");
> printf ("#include \"tm-constrs.h\"\n");
> printf ("#include \"ggc.h\"\n");
> printf ("#include \"target.h\"\n\n");
> +}
>
> - /* Read the machine description. */
> +/* Generate the `gen_...' function from GET_CODE(). */
>
> - md_rtx_info info;
> - while (read_md_rtx (&info))
> - switch (GET_CODE (info.def))
> - {
> - case DEFINE_INSN:
> - gen_insn (&info);
> - break;
> +static void
> +gen_md_rtx (md_rtx_info *info)
> +{
> + switch (GET_CODE (info->def))
> + {
> + case DEFINE_INSN:
> + gen_insn (info);
> + break;
>
> - case DEFINE_EXPAND:
> - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> - gen_expand (&info);
> - break;
> + case DEFINE_EXPAND:
> + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> + gen_expand (info);
> + break;
>
> - case DEFINE_SPLIT:
> - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> - gen_split (&info);
> - break;
> + case DEFINE_SPLIT:
> + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> + gen_split (info);
> + break;
>
> - case DEFINE_PEEPHOLE2:
> - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> - gen_split (&info);
> - break;
> + case DEFINE_PEEPHOLE2:
> + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> + gen_split (info);
> + break;
>
> - default:
> - break;
> - }
> + default:
> + break;
> + }
> +}
> +
> +int
> +main (int argc, const char **argv)
> +{
> + progname = "genemit";
> +
> + if (!init_rtx_reader_args (argc, argv))
> + return (FATAL_EXIT_CODE);
> +
> +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> + nofail_optabs[OPTAB##_optab] = true;
> +#include "internal-fn.def"
> +
> + /* Assign sequential codes to all entries in the machine description
> + in parallel with the tables in insn-output.c. */
> +
> + int read_count = 0;
> +
> + /* Read the machine description. */
> +
> + md_rtx_info info;
> + while (read_md_rtx (&info))
> + {
> + if ((read_count++ % 10000) == 0)
> + {
> + printf ("/* Split file into separate compilation units "
> + "for parallel compilation %d */\n\n", read_count);
> + printf_include();
> + }
> +
> + gen_md_rtx (&info);
> + }
>
> /* Write out the routines to add CLOBBERs to a pattern and say whether they
> clobber a hard reg. */
> --
> 2.24.3 (Apple Git-128)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-09-27  2:34   ` Jojo R
@ 2020-10-08  2:01     ` Jojo R
  2020-10-24  6:02       ` Jojo R
  0 siblings, 1 reply; 13+ messages in thread
From: Jojo R @ 2020-10-08  2:01 UTC (permalink / raw)
  To: segher, richard.sandiford, ro, richard.guenther, joseph,
	gcc-patches, yunhai.syh, rdsandiford

Ping …...

Jojo
在 2020年9月27日 +0800 AM10:34,Jojo R <jiejie_rong@c-sky.com>,写道:
> Hi,
>
> 	Has this patch been merged ?
>
> Jojo
> 在 2020年9月15日 +0800 PM5:16,Jojo R <jiejie_rong@c-sky.com>,写道:
> > gcc/ChangeLog:
> >
> > * genemit.c (main): Print 'split line'.
> > * Makefile.in (insn-emit.c): Define split count and file
> >
> > ---
> > gcc/Makefile.in | 19 +++++++++
> > gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
> > 2 files changed, 83 insertions(+), 40 deletions(-)
> >
> > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> > index 79e854aa938..a7fcc7d5949 100644
> > --- a/gcc/Makefile.in
> > +++ b/gcc/Makefile.in
> > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
> > # We put the *-match.o and insn-*.o files first so that a parallel make
> > # will build them sooner, because they are large and otherwise tend to be
> > # the last objects to finish building.
> > +
> > +# target overrides
> > +-include $(tmake_file)
> > +
> > +INSN-GENERATED-SPLIT-NUM ?= 0
> > +
> > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> > + while test $$i -le $$j; do \
> > + echo $$i; i=`expr $$i + 1`; \
> > + done)
> > +
> > +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> > +$(insn-emit-split-c): insn-emit.c
> > +
> > OBJS = \
> > gimple-match.o \
> > generic-match.o \
> > @@ -1265,6 +1280,7 @@ OBJS = \
> > insn-automata.o \
> > insn-dfatab.o \
> > insn-emit.o \
> > + $(insn-emit-split-obj) \
> > insn-extract.o \
> > insn-latencytab.o \
> > insn-modes.o \
> > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
> > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
> > $(filter insn-conditions.md,$^) > tmp-$*.c
> > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
> > $(STAMP) s-$*
> >
> > # gencheck doesn't read the machine description, and the file produced
> > diff --git a/gcc/genemit.c b/gcc/genemit.c
> > index 84d07d388ee..54a0d909d9d 100644
> > --- a/gcc/genemit.c
> > +++ b/gcc/genemit.c
> > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
> > }
> > }
> >
> > -int
> > -main (int argc, const char **argv)
> > -{
> > - progname = "genemit";
> > -
> > - if (!init_rtx_reader_args (argc, argv))
> > - return (FATAL_EXIT_CODE);
> > -
> > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > - nofail_optabs[OPTAB##_optab] = true;
> > -#include "internal-fn.def"
> > -
> > - /* Assign sequential codes to all entries in the machine description
> > - in parallel with the tables in insn-output.c. */
> > -
> > - printf ("/* Generated automatically by the program `genemit'\n\
> > -from the machine description file `md'. */\n\n");
> > +/* Print include header. */
> >
> > +static void
> > +printf_include (void)
> > +{
> > + printf ("/* Generated automatically by the program `genemit'\n"
> > + "from the machine description file `md'. */\n\n");
> > printf ("#define IN_TARGET_CODE 1\n");
> > printf ("#include \"config.h\"\n");
> > printf ("#include \"system.h\"\n");
> > @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n");
> > printf ("#include \"tm-constrs.h\"\n");
> > printf ("#include \"ggc.h\"\n");
> > printf ("#include \"target.h\"\n\n");
> > +}
> >
> > - /* Read the machine description. */
> > +/* Generate the `gen_...' function from GET_CODE(). */
> >
> > - md_rtx_info info;
> > - while (read_md_rtx (&info))
> > - switch (GET_CODE (info.def))
> > - {
> > - case DEFINE_INSN:
> > - gen_insn (&info);
> > - break;
> > +static void
> > +gen_md_rtx (md_rtx_info *info)
> > +{
> > + switch (GET_CODE (info->def))
> > + {
> > + case DEFINE_INSN:
> > + gen_insn (info);
> > + break;
> >
> > - case DEFINE_EXPAND:
> > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > - gen_expand (&info);
> > - break;
> > + case DEFINE_EXPAND:
> > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > + gen_expand (info);
> > + break;
> >
> > - case DEFINE_SPLIT:
> > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > - gen_split (&info);
> > - break;
> > + case DEFINE_SPLIT:
> > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > + gen_split (info);
> > + break;
> >
> > - case DEFINE_PEEPHOLE2:
> > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > - gen_split (&info);
> > - break;
> > + case DEFINE_PEEPHOLE2:
> > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > + gen_split (info);
> > + break;
> >
> > - default:
> > - break;
> > - }
> > + default:
> > + break;
> > + }
> > +}
> > +
> > +int
> > +main (int argc, const char **argv)
> > +{
> > + progname = "genemit";
> > +
> > + if (!init_rtx_reader_args (argc, argv))
> > + return (FATAL_EXIT_CODE);
> > +
> > +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > + nofail_optabs[OPTAB##_optab] = true;
> > +#include "internal-fn.def"
> > +
> > + /* Assign sequential codes to all entries in the machine description
> > + in parallel with the tables in insn-output.c. */
> > +
> > + int read_count = 0;
> > +
> > + /* Read the machine description. */
> > +
> > + md_rtx_info info;
> > + while (read_md_rtx (&info))
> > + {
> > + if ((read_count++ % 10000) == 0)
> > + {
> > + printf ("/* Split file into separate compilation units "
> > + "for parallel compilation %d */\n\n", read_count);
> > + printf_include();
> > + }
> > +
> > + gen_md_rtx (&info);
> > + }
> >
> > /* Write out the routines to add CLOBBERs to a pattern and say whether they
> > clobber a hard reg. */
> > --
> > 2.24.3 (Apple Git-128)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-10-08  2:01     ` Jojo R
@ 2020-10-24  6:02       ` Jojo R
  2020-10-27  5:59         ` Jojo R
  0 siblings, 1 reply; 13+ messages in thread
From: Jojo R @ 2020-10-24  6:02 UTC (permalink / raw)
  To: segher, richard.sandiford, ro, richard.guenther, joseph,
	gcc-patches, yunhai.syh, rdsandiford

Hi,

	Has this patch been merged ?

	I track this some weeks and the patch has reviewed still on the way ...

	Could someone help me ?

	Thanks so much.

Jojo
在 2020年10月8日 +0800 AM10:01,Jojo R <jiejie_rong@c-sky.com>,写道:
> Ping …...
>
> Jojo
> 在 2020年9月27日 +0800 AM10:34,Jojo R <jiejie_rong@c-sky.com>,写道:
> > Hi,
> >
> > 	Has this patch been merged ?
> >
> > Jojo
> > 在 2020年9月15日 +0800 PM5:16,Jojo R <jiejie_rong@c-sky.com>,写道:
> > > gcc/ChangeLog:
> > >
> > > * genemit.c (main): Print 'split line'.
> > > * Makefile.in (insn-emit.c): Define split count and file
> > >
> > > ---
> > > gcc/Makefile.in | 19 +++++++++
> > > gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
> > > 2 files changed, 83 insertions(+), 40 deletions(-)
> > >
> > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> > > index 79e854aa938..a7fcc7d5949 100644
> > > --- a/gcc/Makefile.in
> > > +++ b/gcc/Makefile.in
> > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
> > > # We put the *-match.o and insn-*.o files first so that a parallel make
> > > # will build them sooner, because they are large and otherwise tend to be
> > > # the last objects to finish building.
> > > +
> > > +# target overrides
> > > +-include $(tmake_file)
> > > +
> > > +INSN-GENERATED-SPLIT-NUM ?= 0
> > > +
> > > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> > > + while test $$i -le $$j; do \
> > > + echo $$i; i=`expr $$i + 1`; \
> > > + done)
> > > +
> > > +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> > > +$(insn-emit-split-c): insn-emit.c
> > > +
> > > OBJS = \
> > > gimple-match.o \
> > > generic-match.o \
> > > @@ -1265,6 +1280,7 @@ OBJS = \
> > > insn-automata.o \
> > > insn-dfatab.o \
> > > insn-emit.o \
> > > + $(insn-emit-split-obj) \
> > > insn-extract.o \
> > > insn-latencytab.o \
> > > insn-modes.o \
> > > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
> > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
> > > $(filter insn-conditions.md,$^) > tmp-$*.c
> > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> > > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> > > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> > > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
> > > $(STAMP) s-$*
> > >
> > > # gencheck doesn't read the machine description, and the file produced
> > > diff --git a/gcc/genemit.c b/gcc/genemit.c
> > > index 84d07d388ee..54a0d909d9d 100644
> > > --- a/gcc/genemit.c
> > > +++ b/gcc/genemit.c
> > > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
> > > }
> > > }
> > >
> > > -int
> > > -main (int argc, const char **argv)
> > > -{
> > > - progname = "genemit";
> > > -
> > > - if (!init_rtx_reader_args (argc, argv))
> > > - return (FATAL_EXIT_CODE);
> > > -
> > > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > > - nofail_optabs[OPTAB##_optab] = true;
> > > -#include "internal-fn.def"
> > > -
> > > - /* Assign sequential codes to all entries in the machine description
> > > - in parallel with the tables in insn-output.c. */
> > > -
> > > - printf ("/* Generated automatically by the program `genemit'\n\
> > > -from the machine description file `md'. */\n\n");
> > > +/* Print include header. */
> > >
> > > +static void
> > > +printf_include (void)
> > > +{
> > > + printf ("/* Generated automatically by the program `genemit'\n"
> > > + "from the machine description file `md'. */\n\n");
> > > printf ("#define IN_TARGET_CODE 1\n");
> > > printf ("#include \"config.h\"\n");
> > > printf ("#include \"system.h\"\n");
> > > @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n");
> > > printf ("#include \"tm-constrs.h\"\n");
> > > printf ("#include \"ggc.h\"\n");
> > > printf ("#include \"target.h\"\n\n");
> > > +}
> > >
> > > - /* Read the machine description. */
> > > +/* Generate the `gen_...' function from GET_CODE(). */
> > >
> > > - md_rtx_info info;
> > > - while (read_md_rtx (&info))
> > > - switch (GET_CODE (info.def))
> > > - {
> > > - case DEFINE_INSN:
> > > - gen_insn (&info);
> > > - break;
> > > +static void
> > > +gen_md_rtx (md_rtx_info *info)
> > > +{
> > > + switch (GET_CODE (info->def))
> > > + {
> > > + case DEFINE_INSN:
> > > + gen_insn (info);
> > > + break;
> > >
> > > - case DEFINE_EXPAND:
> > > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > > - gen_expand (&info);
> > > - break;
> > > + case DEFINE_EXPAND:
> > > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > > + gen_expand (info);
> > > + break;
> > >
> > > - case DEFINE_SPLIT:
> > > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > > - gen_split (&info);
> > > - break;
> > > + case DEFINE_SPLIT:
> > > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > > + gen_split (info);
> > > + break;
> > >
> > > - case DEFINE_PEEPHOLE2:
> > > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > > - gen_split (&info);
> > > - break;
> > > + case DEFINE_PEEPHOLE2:
> > > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > > + gen_split (info);
> > > + break;
> > >
> > > - default:
> > > - break;
> > > - }
> > > + default:
> > > + break;
> > > + }
> > > +}
> > > +
> > > +int
> > > +main (int argc, const char **argv)
> > > +{
> > > + progname = "genemit";
> > > +
> > > + if (!init_rtx_reader_args (argc, argv))
> > > + return (FATAL_EXIT_CODE);
> > > +
> > > +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > > + nofail_optabs[OPTAB##_optab] = true;
> > > +#include "internal-fn.def"
> > > +
> > > + /* Assign sequential codes to all entries in the machine description
> > > + in parallel with the tables in insn-output.c. */
> > > +
> > > + int read_count = 0;
> > > +
> > > + /* Read the machine description. */
> > > +
> > > + md_rtx_info info;
> > > + while (read_md_rtx (&info))
> > > + {
> > > + if ((read_count++ % 10000) == 0)
> > > + {
> > > + printf ("/* Split file into separate compilation units "
> > > + "for parallel compilation %d */\n\n", read_count);
> > > + printf_include();
> > > + }
> > > +
> > > + gen_md_rtx (&info);
> > > + }
> > >
> > > /* Write out the routines to add CLOBBERs to a pattern and say whether they
> > > clobber a hard reg. */
> > > --
> > > 2.24.3 (Apple Git-128)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-10-24  6:02       ` Jojo R
@ 2020-10-27  5:59         ` Jojo R
  0 siblings, 0 replies; 13+ messages in thread
From: Jojo R @ 2020-10-27  5:59 UTC (permalink / raw)
  To: segher, richard.sandiford, ro, richard.guenther, joseph,
	gcc-patches, yunhai.syh, rdsandiford

Ping …. ….

Jojo
在 2020年10月24日 +0800 PM2:02,Jojo R <jiejie_rong@c-sky.com>,写道:
> Hi,
>
> 	Has this patch been merged ?
>
> 	I track this some weeks and the patch has reviewed still on the way ...
>
> 	Could someone help me ?
>
> 	Thanks so much.
>
> Jojo
> 在 2020年10月8日 +0800 AM10:01,Jojo R <jiejie_rong@c-sky.com>,写道:
> > Ping …...
> >
> > Jojo
> > 在 2020年9月27日 +0800 AM10:34,Jojo R <jiejie_rong@c-sky.com>,写道:
> > > Hi,
> > >
> > > 	Has this patch been merged ?
> > >
> > > Jojo
> > > 在 2020年9月15日 +0800 PM5:16,Jojo R <jiejie_rong@c-sky.com>,写道:
> > > > gcc/ChangeLog:
> > > >
> > > > * genemit.c (main): Print 'split line'.
> > > > * Makefile.in (insn-emit.c): Define split count and file
> > > >
> > > > ---
> > > > gcc/Makefile.in | 19 +++++++++
> > > > gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
> > > > 2 files changed, 83 insertions(+), 40 deletions(-)
> > > >
> > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> > > > index 79e854aa938..a7fcc7d5949 100644
> > > > --- a/gcc/Makefile.in
> > > > +++ b/gcc/Makefile.in
> > > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
> > > > # We put the *-match.o and insn-*.o files first so that a parallel make
> > > > # will build them sooner, because they are large and otherwise tend to be
> > > > # the last objects to finish building.
> > > > +
> > > > +# target overrides
> > > > +-include $(tmake_file)
> > > > +
> > > > +INSN-GENERATED-SPLIT-NUM ?= 0
> > > > +
> > > > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> > > > + while test $$i -le $$j; do \
> > > > + echo $$i; i=`expr $$i + 1`; \
> > > > + done)
> > > > +
> > > > +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> > > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> > > > +$(insn-emit-split-c): insn-emit.c
> > > > +
> > > > OBJS = \
> > > > gimple-match.o \
> > > > generic-match.o \
> > > > @@ -1265,6 +1280,7 @@ OBJS = \
> > > > insn-automata.o \
> > > > insn-dfatab.o \
> > > > insn-emit.o \
> > > > + $(insn-emit-split-obj) \
> > > > insn-extract.o \
> > > > insn-latencytab.o \
> > > > insn-modes.o \
> > > > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
> > > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
> > > > $(filter insn-conditions.md,$^) > tmp-$*.c
> > > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> > > > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> > > > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> > > > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
> > > > $(STAMP) s-$*
> > > >
> > > > # gencheck doesn't read the machine description, and the file produced
> > > > diff --git a/gcc/genemit.c b/gcc/genemit.c
> > > > index 84d07d388ee..54a0d909d9d 100644
> > > > --- a/gcc/genemit.c
> > > > +++ b/gcc/genemit.c
> > > > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
> > > > }
> > > > }
> > > >
> > > > -int
> > > > -main (int argc, const char **argv)
> > > > -{
> > > > - progname = "genemit";
> > > > -
> > > > - if (!init_rtx_reader_args (argc, argv))
> > > > - return (FATAL_EXIT_CODE);
> > > > -
> > > > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > > > - nofail_optabs[OPTAB##_optab] = true;
> > > > -#include "internal-fn.def"
> > > > -
> > > > - /* Assign sequential codes to all entries in the machine description
> > > > - in parallel with the tables in insn-output.c. */
> > > > -
> > > > - printf ("/* Generated automatically by the program `genemit'\n\
> > > > -from the machine description file `md'. */\n\n");
> > > > +/* Print include header. */
> > > >
> > > > +static void
> > > > +printf_include (void)
> > > > +{
> > > > + printf ("/* Generated automatically by the program `genemit'\n"
> > > > + "from the machine description file `md'. */\n\n");
> > > > printf ("#define IN_TARGET_CODE 1\n");
> > > > printf ("#include \"config.h\"\n");
> > > > printf ("#include \"system.h\"\n");
> > > > @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n");
> > > > printf ("#include \"tm-constrs.h\"\n");
> > > > printf ("#include \"ggc.h\"\n");
> > > > printf ("#include \"target.h\"\n\n");
> > > > +}
> > > >
> > > > - /* Read the machine description. */
> > > > +/* Generate the `gen_...' function from GET_CODE(). */
> > > >
> > > > - md_rtx_info info;
> > > > - while (read_md_rtx (&info))
> > > > - switch (GET_CODE (info.def))
> > > > - {
> > > > - case DEFINE_INSN:
> > > > - gen_insn (&info);
> > > > - break;
> > > > +static void
> > > > +gen_md_rtx (md_rtx_info *info)
> > > > +{
> > > > + switch (GET_CODE (info->def))
> > > > + {
> > > > + case DEFINE_INSN:
> > > > + gen_insn (info);
> > > > + break;
> > > >
> > > > - case DEFINE_EXPAND:
> > > > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > > > - gen_expand (&info);
> > > > - break;
> > > > + case DEFINE_EXPAND:
> > > > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > > > + gen_expand (info);
> > > > + break;
> > > >
> > > > - case DEFINE_SPLIT:
> > > > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > > > - gen_split (&info);
> > > > - break;
> > > > + case DEFINE_SPLIT:
> > > > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > > > + gen_split (info);
> > > > + break;
> > > >
> > > > - case DEFINE_PEEPHOLE2:
> > > > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > > > - gen_split (&info);
> > > > - break;
> > > > + case DEFINE_PEEPHOLE2:
> > > > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > > > + gen_split (info);
> > > > + break;
> > > >
> > > > - default:
> > > > - break;
> > > > - }
> > > > + default:
> > > > + break;
> > > > + }
> > > > +}
> > > > +
> > > > +int
> > > > +main (int argc, const char **argv)
> > > > +{
> > > > + progname = "genemit";
> > > > +
> > > > + if (!init_rtx_reader_args (argc, argv))
> > > > + return (FATAL_EXIT_CODE);
> > > > +
> > > > +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > > > + nofail_optabs[OPTAB##_optab] = true;
> > > > +#include "internal-fn.def"
> > > > +
> > > > + /* Assign sequential codes to all entries in the machine description
> > > > + in parallel with the tables in insn-output.c. */
> > > > +
> > > > + int read_count = 0;
> > > > +
> > > > + /* Read the machine description. */
> > > > +
> > > > + md_rtx_info info;
> > > > + while (read_md_rtx (&info))
> > > > + {
> > > > + if ((read_count++ % 10000) == 0)
> > > > + {
> > > > + printf ("/* Split file into separate compilation units "
> > > > + "for parallel compilation %d */\n\n", read_count);
> > > > + printf_include();
> > > > + }
> > > > +
> > > > + gen_md_rtx (&info);
> > > > + }
> > > >
> > > > /* Write out the routines to add CLOBBERs to a pattern and say whether they
> > > > clobber a hard reg. */
> > > > --
> > > > 2.24.3 (Apple Git-128)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-09-15  9:15 ` [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly Jojo R
  2020-09-27  2:34   ` Jojo R
@ 2020-10-27 14:14   ` Richard Sandiford
  2020-10-30  9:41     ` Jojo R
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Sandiford @ 2020-10-27 14:14 UTC (permalink / raw)
  To: Jojo R; +Cc: segher, ro, richard.guenther, joseph, gcc-patches, yunhai.syh

Jojo R <jiejie_rong@c-sky.com> writes:
> gcc/ChangeLog:
>
> 	* genemit.c (main): Print 'split line'.
> 	* Makefile.in (insn-emit.c): Define split count and file
>
> ---
>  gcc/Makefile.in |  19 +++++++++
>  gcc/genemit.c   | 104 +++++++++++++++++++++++++++++-------------------
>  2 files changed, 83 insertions(+), 40 deletions(-)
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 79e854aa938..a7fcc7d5949 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
>  # We put the *-match.o and insn-*.o files first so that a parallel make
>  # will build them sooner, because they are large and otherwise tend to be
>  # the last objects to finish building.
> +
> +# target overrides
> +-include $(tmake_file)
> +
> +INSN-GENERATED-SPLIT-NUM ?= 0
> +
> +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> +	while test $$i -le $$j; do \
> +	  echo $$i; i=`expr $$i + 1`; \
> +	done)
> +
> +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> +$(insn-emit-split-c): insn-emit.c

Sorry for the slow reply.  I stand by what I said in
https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552863.html:

    I think we should use the same wordlist technique as check_p_numbers[0-6].
    So I guess the first step would be to rename check_p_numbers[0-6] to
    something more general and use it both here and in check_p_numbers.

I think that would be better than having two different ways of
generating lists of numbers, one directly in make and one calling
out to the shell.  But I didn't want to reassert that comment in
case anyone was prepared to approve the patch in its current form.

BTW, do you have a copyright assignment on file?

Thanks,
Richard

> +
>  OBJS = \
>  	gimple-match.o \
>  	generic-match.o \
> @@ -1265,6 +1280,7 @@ OBJS = \
>  	insn-automata.o \
>  	insn-dfatab.o \
>  	insn-emit.o \
> +	$(insn-emit-split-obj) \
>  	insn-extract.o \
>  	insn-latencytab.o \
>  	insn-modes.o \
> @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
>  	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
>  	  $(filter insn-conditions.md,$^) > tmp-$*.c
>  	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> +	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> +	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> +	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
>  	$(STAMP) s-$*
>  
>  # gencheck doesn't read the machine description, and the file produced
> diff --git a/gcc/genemit.c b/gcc/genemit.c
> index 84d07d388ee..54a0d909d9d 100644
> --- a/gcc/genemit.c
> +++ b/gcc/genemit.c
> @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
>      }
>  }
>  
> -int
> -main (int argc, const char **argv)
> -{
> -  progname = "genemit";
> -
> -  if (!init_rtx_reader_args (argc, argv))
> -    return (FATAL_EXIT_CODE);
> -
> -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> -  nofail_optabs[OPTAB##_optab] = true;
> -#include "internal-fn.def"
> -
> -  /* Assign sequential codes to all entries in the machine description
> -     in parallel with the tables in insn-output.c.  */
> -
> -  printf ("/* Generated automatically by the program `genemit'\n\
> -from the machine description file `md'.  */\n\n");
> +/* Print include header.  */
>  
> +static void
> +printf_include (void)
> +{
> +  printf ("/* Generated automatically by the program `genemit'\n"
> +	  "from the machine description file `md'.  */\n\n");
>    printf ("#define IN_TARGET_CODE 1\n");
>    printf ("#include \"config.h\"\n");
>    printf ("#include \"system.h\"\n");
> @@ -900,35 +889,70 @@ from the machine description file `md'.  */\n\n");
>    printf ("#include \"tm-constrs.h\"\n");
>    printf ("#include \"ggc.h\"\n");
>    printf ("#include \"target.h\"\n\n");
> +}
>  
> -  /* Read the machine description.  */
> +/* Generate the `gen_...' function from GET_CODE().  */
>  
> -  md_rtx_info info;
> -  while (read_md_rtx (&info))
> -    switch (GET_CODE (info.def))
> -      {
> -      case DEFINE_INSN:
> -	gen_insn (&info);
> -	break;
> +static void
> +gen_md_rtx (md_rtx_info *info)
> +{
> +  switch (GET_CODE (info->def))
> +    {
> +    case DEFINE_INSN:
> +      gen_insn (info);
> +      break;
>  
> -      case DEFINE_EXPAND:
> -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> -	gen_expand (&info);
> -	break;
> +    case DEFINE_EXPAND:
> +      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> +      gen_expand (info);
> +      break;
>  
> -      case DEFINE_SPLIT:
> -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> -	gen_split (&info);
> -	break;
> +    case DEFINE_SPLIT:
> +      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> +      gen_split (info);
> +      break;
>  
> -      case DEFINE_PEEPHOLE2:
> -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> -	gen_split (&info);
> -	break;
> +    case DEFINE_PEEPHOLE2:
> +      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> +      gen_split (info);
> +      break;
>  
> -      default:
> -	break;
> -      }
> +    default:
> +      break;
> +    }
> +}
> +
> +int
> +main (int argc, const char **argv)
> +{
> +  progname = "genemit";
> +
> +  if (!init_rtx_reader_args (argc, argv))
> +    return (FATAL_EXIT_CODE);
> +
> +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> +  nofail_optabs[OPTAB##_optab] = true;
> +#include "internal-fn.def"
> +
> +  /* Assign sequential codes to all entries in the machine description
> +     in parallel with the tables in insn-output.c.  */
> +
> +  int read_count = 0;
> +
> +  /* Read the machine description.  */
> +
> +  md_rtx_info info;
> +  while (read_md_rtx (&info))
> +    {
> +      if ((read_count++ % 10000) == 0)
> +	{
> +	  printf ("/* Split file into separate compilation units "
> +		  "for parallel compilation %d */\n\n", read_count);
> +	  printf_include();
> +	}
> +
> +      gen_md_rtx (&info);
> +    }
>  
>    /* Write out the routines to add CLOBBERs to a pattern and say whether they
>       clobber a hard reg.  */

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-10-27 14:14   ` Richard Sandiford
@ 2020-10-30  9:41     ` Jojo R
  2020-10-30 15:29       ` Richard Sandiford
  0 siblings, 1 reply; 13+ messages in thread
From: Jojo R @ 2020-10-30  9:41 UTC (permalink / raw)
  To: Richard Sandiford
  Cc: segher, ro, richard.guenther, joseph, gcc-patches, yunhai.syh


Jojo
在 2020年10月27日 +0800 PM10:14,Richard Sandiford <richard.sandiford@arm.com>,写道:
> Jojo R <jiejie_rong@c-sky.com> writes:
> > gcc/ChangeLog:
> >
> > * genemit.c (main): Print 'split line'.
> > * Makefile.in (insn-emit.c): Define split count and file
> >
> > ---
> > gcc/Makefile.in | 19 +++++++++
> > gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
> > 2 files changed, 83 insertions(+), 40 deletions(-)
> >
> > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> > index 79e854aa938..a7fcc7d5949 100644
> > --- a/gcc/Makefile.in
> > +++ b/gcc/Makefile.in
> > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
> > # We put the *-match.o and insn-*.o files first so that a parallel make
> > # will build them sooner, because they are large and otherwise tend to be
> > # the last objects to finish building.
> > +
> > +# target overrides
> > +-include $(tmake_file)
> > +
> > +INSN-GENERATED-SPLIT-NUM ?= 0
> > +
> > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> > + while test $$i -le $$j; do \
> > + echo $$i; i=`expr $$i + 1`; \
> > + done)
> > +
> > +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> > +$(insn-emit-split-c): insn-emit.c
>
> Sorry for the slow reply. I stand by what I said in
> https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552863.html:
>
> I think we should use the same wordlist technique as check_p_numbers[0-6].
> So I guess the first step would be to rename check_p_numbers[0-6] to
> something more general and use it both here and in check_p_numbers.
>
> I think that would be better than having two different ways of
> generating lists of numbers, one directly in make and one calling
> out to the shell. But I didn't want to reassert that comment in
> case anyone was prepared to approve the patch in its current form.
>

Ok & Thanks.

It’s fixed in patch v8.
> BTW, do you have a copyright assignment on file?

I email the patch without copyright, and I think it is same with other gcc community patch.
>
> Thanks,
> Richard
>
> > +
> > OBJS = \
> > gimple-match.o \
> > generic-match.o \
> > @@ -1265,6 +1280,7 @@ OBJS = \
> > insn-automata.o \
> > insn-dfatab.o \
> > insn-emit.o \
> > + $(insn-emit-split-obj) \
> > insn-extract.o \
> > insn-latencytab.o \
> > insn-modes.o \
> > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
> > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
> > $(filter insn-conditions.md,$^) > tmp-$*.c
> > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
> > $(STAMP) s-$*
> >
> > # gencheck doesn't read the machine description, and the file produced
> > diff --git a/gcc/genemit.c b/gcc/genemit.c
> > index 84d07d388ee..54a0d909d9d 100644
> > --- a/gcc/genemit.c
> > +++ b/gcc/genemit.c
> > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
> > }
> > }
> >
> > -int
> > -main (int argc, const char **argv)
> > -{
> > - progname = "genemit";
> > -
> > - if (!init_rtx_reader_args (argc, argv))
> > - return (FATAL_EXIT_CODE);
> > -
> > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > - nofail_optabs[OPTAB##_optab] = true;
> > -#include "internal-fn.def"
> > -
> > - /* Assign sequential codes to all entries in the machine description
> > - in parallel with the tables in insn-output.c. */
> > -
> > - printf ("/* Generated automatically by the program `genemit'\n\
> > -from the machine description file `md'. */\n\n");
> > +/* Print include header. */
> >
> > +static void
> > +printf_include (void)
> > +{
> > + printf ("/* Generated automatically by the program `genemit'\n"
> > + "from the machine description file `md'. */\n\n");
> > printf ("#define IN_TARGET_CODE 1\n");
> > printf ("#include \"config.h\"\n");
> > printf ("#include \"system.h\"\n");
> > @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n");
> > printf ("#include \"tm-constrs.h\"\n");
> > printf ("#include \"ggc.h\"\n");
> > printf ("#include \"target.h\"\n\n");
> > +}
> >
> > - /* Read the machine description. */
> > +/* Generate the `gen_...' function from GET_CODE(). */
> >
> > - md_rtx_info info;
> > - while (read_md_rtx (&info))
> > - switch (GET_CODE (info.def))
> > - {
> > - case DEFINE_INSN:
> > - gen_insn (&info);
> > - break;
> > +static void
> > +gen_md_rtx (md_rtx_info *info)
> > +{
> > + switch (GET_CODE (info->def))
> > + {
> > + case DEFINE_INSN:
> > + gen_insn (info);
> > + break;
> >
> > - case DEFINE_EXPAND:
> > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > - gen_expand (&info);
> > - break;
> > + case DEFINE_EXPAND:
> > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > + gen_expand (info);
> > + break;
> >
> > - case DEFINE_SPLIT:
> > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > - gen_split (&info);
> > - break;
> > + case DEFINE_SPLIT:
> > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > + gen_split (info);
> > + break;
> >
> > - case DEFINE_PEEPHOLE2:
> > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> > - gen_split (&info);
> > - break;
> > + case DEFINE_PEEPHOLE2:
> > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> > + gen_split (info);
> > + break;
> >
> > - default:
> > - break;
> > - }
> > + default:
> > + break;
> > + }
> > +}
> > +
> > +int
> > +main (int argc, const char **argv)
> > +{
> > + progname = "genemit";
> > +
> > + if (!init_rtx_reader_args (argc, argv))
> > + return (FATAL_EXIT_CODE);
> > +
> > +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> > + nofail_optabs[OPTAB##_optab] = true;
> > +#include "internal-fn.def"
> > +
> > + /* Assign sequential codes to all entries in the machine description
> > + in parallel with the tables in insn-output.c. */
> > +
> > + int read_count = 0;
> > +
> > + /* Read the machine description. */
> > +
> > + md_rtx_info info;
> > + while (read_md_rtx (&info))
> > + {
> > + if ((read_count++ % 10000) == 0)
> > + {
> > + printf ("/* Split file into separate compilation units "
> > + "for parallel compilation %d */\n\n", read_count);
> > + printf_include();
> > + }
> > +
> > + gen_md_rtx (&info);
> > + }
> >
> > /* Write out the routines to add CLOBBERs to a pattern and say whether they
> > clobber a hard reg. */

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v8] genemit.c (main): split insn-emit.c for compiling parallelly
       [not found] <jiejie_rong@c-sky.com@genemit.c_(main):_split_insn-emit.c_for_compiling_parallelly>
  2020-09-15  9:15 ` [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly Jojo R
@ 2020-10-30  9:42 ` Jojo R
  2020-11-04  1:53 ` [PATCH v9] " Jojo R
  2 siblings, 0 replies; 13+ messages in thread
From: Jojo R @ 2020-10-30  9:42 UTC (permalink / raw)
  To: jiejie_rong, segher, richard.sandiford, ro, richard.guenther,
	joseph, gcc-patches, yunhai.syh

gcc/ChangeLog:

	* genemit.c (main): Print 'split line'.
	* Makefile.in (insn-emit.c): Define split count and file

---
 gcc/Makefile.in |  33 +++++++++++----
 gcc/genemit.c   | 104 +++++++++++++++++++++++++++++-------------------
 2 files changed, 89 insertions(+), 48 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7fc03c8d946..974b65c560d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1154,6 +1154,15 @@ export STRIP_FOR_TARGET
 export RANLIB_FOR_TARGET
 export libsubdir
 
+check_p_numbers0:=1 2 3 4 5 6 7 8 9
+check_p_numbers1:=0 $(check_p_numbers0)
+check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
+check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
+check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
+check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
+check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
+check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
+
 FLAGS_TO_PASS = \
 	"ADA_CFLAGS=$(ADA_CFLAGS)" \
 	"BISON=$(BISON)" \
@@ -1259,6 +1268,18 @@ ANALYZER_OBJS = \
 # We put the *-match.o and insn-*.o files first so that a parallel make
 # will build them sooner, because they are large and otherwise tend to be
 # the last objects to finish building.
+
+# target overrides
+-include $(tmake_file)
+
+INSN-GENERATED-SPLIT-NUM ?= 0
+
+insn-generated-split-num = $(wordlist 1,$(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1),$(check_p_numbers))
+
+insn-emit-split-c := $(foreach o, $(insn-generated-split-num), insn-emit$(o).c)
+insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
+$(insn-emit-split-c): insn-emit.c
+
 OBJS = \
 	gimple-match.o \
 	generic-match.o \
@@ -1266,6 +1287,7 @@ OBJS = \
 	insn-automata.o \
 	insn-dfatab.o \
 	insn-emit.o \
+	$(insn-emit-split-obj) \
 	insn-extract.o \
 	insn-latencytab.o \
 	insn-modes.o \
@@ -2375,6 +2397,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
 	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
 	  $(filter insn-conditions.md,$^) > tmp-$*.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
+	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
+	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
+	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
 	$(STAMP) s-$*
 
 # gencheck doesn't read the machine description, and the file produced
@@ -4094,14 +4119,6 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets:
 check_p_tool=$(firstword $(subst _, ,$*))
 check_p_count=$(check_$(check_p_tool)_parallelize)
 check_p_subno=$(word 2,$(subst _, ,$*))
-check_p_numbers0:=1 2 3 4 5 6 7 8 9
-check_p_numbers1:=0 $(check_p_numbers0)
-check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
-check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
-check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
-check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
-check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
-check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
 check_p_subdir=$(subst _,,$*)
 check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
 		$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 84d07d388ee..54a0d909d9d 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
     }
 }
 
-int
-main (int argc, const char **argv)
-{
-  progname = "genemit";
-
-  if (!init_rtx_reader_args (argc, argv))
-    return (FATAL_EXIT_CODE);
-
-#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
-  nofail_optabs[OPTAB##_optab] = true;
-#include "internal-fn.def"
-
-  /* Assign sequential codes to all entries in the machine description
-     in parallel with the tables in insn-output.c.  */
-
-  printf ("/* Generated automatically by the program `genemit'\n\
-from the machine description file `md'.  */\n\n");
+/* Print include header.  */
 
+static void
+printf_include (void)
+{
+  printf ("/* Generated automatically by the program `genemit'\n"
+	  "from the machine description file `md'.  */\n\n");
   printf ("#define IN_TARGET_CODE 1\n");
   printf ("#include \"config.h\"\n");
   printf ("#include \"system.h\"\n");
@@ -900,35 +889,70 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"tm-constrs.h\"\n");
   printf ("#include \"ggc.h\"\n");
   printf ("#include \"target.h\"\n\n");
+}
 
-  /* Read the machine description.  */
+/* Generate the `gen_...' function from GET_CODE().  */
 
-  md_rtx_info info;
-  while (read_md_rtx (&info))
-    switch (GET_CODE (info.def))
-      {
-      case DEFINE_INSN:
-	gen_insn (&info);
-	break;
+static void
+gen_md_rtx (md_rtx_info *info)
+{
+  switch (GET_CODE (info->def))
+    {
+    case DEFINE_INSN:
+      gen_insn (info);
+      break;
 
-      case DEFINE_EXPAND:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_expand (&info);
-	break;
+    case DEFINE_EXPAND:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_expand (info);
+      break;
 
-      case DEFINE_SPLIT:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_split (&info);
-	break;
+    case DEFINE_SPLIT:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_split (info);
+      break;
 
-      case DEFINE_PEEPHOLE2:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_split (&info);
-	break;
+    case DEFINE_PEEPHOLE2:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_split (info);
+      break;
 
-      default:
-	break;
-      }
+    default:
+      break;
+    }
+}
+
+int
+main (int argc, const char **argv)
+{
+  progname = "genemit";
+
+  if (!init_rtx_reader_args (argc, argv))
+    return (FATAL_EXIT_CODE);
+
+#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
+  nofail_optabs[OPTAB##_optab] = true;
+#include "internal-fn.def"
+
+  /* Assign sequential codes to all entries in the machine description
+     in parallel with the tables in insn-output.c.  */
+
+  int read_count = 0;
+
+  /* Read the machine description.  */
+
+  md_rtx_info info;
+  while (read_md_rtx (&info))
+    {
+      if ((read_count++ % 10000) == 0)
+	{
+	  printf ("/* Split file into separate compilation units "
+		  "for parallel compilation %d */\n\n", read_count);
+	  printf_include();
+	}
+
+      gen_md_rtx (&info);
+    }
 
   /* Write out the routines to add CLOBBERs to a pattern and say whether they
      clobber a hard reg.  */
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-10-30  9:41     ` Jojo R
@ 2020-10-30 15:29       ` Richard Sandiford
  2020-11-04  2:25         ` Jojo R
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Sandiford @ 2020-10-30 15:29 UTC (permalink / raw)
  To: Jojo R; +Cc: segher, yunhai.syh, gcc-patches, joseph

Jojo R <jiejie_rong@c-sky.com> writes:
> Jojo
> 在 2020年10月27日 +0800 PM10:14,Richard Sandiford <richard.sandiford@arm.com>,写道:
>> Jojo R <jiejie_rong@c-sky.com> writes:
>> > gcc/ChangeLog:
>> >
>> > * genemit.c (main): Print 'split line'.
>> > * Makefile.in (insn-emit.c): Define split count and file
>> >
>> > ---
>> > gcc/Makefile.in | 19 +++++++++
>> > gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
>> > 2 files changed, 83 insertions(+), 40 deletions(-)
>> >
>> > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
>> > index 79e854aa938..a7fcc7d5949 100644
>> > --- a/gcc/Makefile.in
>> > +++ b/gcc/Makefile.in
>> > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
>> > # We put the *-match.o and insn-*.o files first so that a parallel make
>> > # will build them sooner, because they are large and otherwise tend to be
>> > # the last objects to finish building.
>> > +
>> > +# target overrides
>> > +-include $(tmake_file)
>> > +
>> > +INSN-GENERATED-SPLIT-NUM ?= 0
>> > +
>> > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
>> > + while test $$i -le $$j; do \
>> > + echo $$i; i=`expr $$i + 1`; \
>> > + done)
>> > +
>> > +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
>> > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
>> > +$(insn-emit-split-c): insn-emit.c
>>
>> Sorry for the slow reply. I stand by what I said in
>> https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552863.html:
>>
>> I think we should use the same wordlist technique as check_p_numbers[0-6].
>> So I guess the first step would be to rename check_p_numbers[0-6] to
>> something more general and use it both here and in check_p_numbers.
>>
>> I think that would be better than having two different ways of
>> generating lists of numbers, one directly in make and one calling
>> out to the shell. But I didn't want to reassert that comment in
>> case anyone was prepared to approve the patch in its current form.
>>
>
> Ok & Thanks.
>
> It’s fixed in patch v8.

Thanks.  Like I say, I think we should rename check_p_numbers* at the
same time, since it's now used for more than just parallel check.  Maybe
s/check_p_numbers/number_series/.

But otherwise it looks good.

>> BTW, do you have a copyright assignment on file?
>
> I email the patch without copyright, and I think it is same with other gcc community patch.

Some changes can be so small and mechanical that they're not in practice
copyrightable, but all other changes need a copyright assignment.
Unfortunately this patch is too complex to fall into the first category.
See:

  https://gcc.gnu.org/contribute.html#legal

for more details about the requirement and process.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v9] genemit.c (main): split insn-emit.c for compiling parallelly
       [not found] <jiejie_rong@c-sky.com@genemit.c_(main):_split_insn-emit.c_for_compiling_parallelly>
  2020-09-15  9:15 ` [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly Jojo R
  2020-10-30  9:42 ` [PATCH v8] " Jojo R
@ 2020-11-04  1:53 ` Jojo R
  2020-11-04 11:06   ` Richard Sandiford
  2020-11-06 10:12   ` Richard Sandiford
  2 siblings, 2 replies; 13+ messages in thread
From: Jojo R @ 2020-11-04  1:53 UTC (permalink / raw)
  To: jiejie_rong, segher, richard.sandiford, ro, richard.guenther,
	joseph, gcc-patches, yunhai.syh

gcc/ChangeLog:

	* genemit.c (main): Print 'split line'.
	* Makefile.in (insn-emit.c): Define split count and file

---
 gcc/Makefile.in |  35 +++++++++++-----
 gcc/genemit.c   | 104 +++++++++++++++++++++++++++++-------------------
 2 files changed, 90 insertions(+), 49 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 978a08f7b04..de846c0fcd4 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1154,6 +1154,15 @@ export STRIP_FOR_TARGET
 export RANLIB_FOR_TARGET
 export libsubdir
 
+number_series0:=1 2 3 4 5 6 7 8 9
+number_series1:=0 $(number_series0)
+number_series2:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series1)))
+number_series3:=$(addprefix 0,$(number_series1)) $(number_series2)
+number_series4:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series3)))
+number_series5:=$(addprefix 0,$(number_series3)) $(number_series4)
+number_series6:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series5)))
+number_series:=$(number_series0) $(number_series2) $(number_series4) $(number_series6)
+
 FLAGS_TO_PASS = \
 	"ADA_CFLAGS=$(ADA_CFLAGS)" \
 	"BISON=$(BISON)" \
@@ -1259,6 +1268,18 @@ ANALYZER_OBJS = \
 # We put the *-match.o and insn-*.o files first so that a parallel make
 # will build them sooner, because they are large and otherwise tend to be
 # the last objects to finish building.
+
+# target overrides
+-include $(tmake_file)
+
+INSN-GENERATED-SPLIT-NUM ?= 0
+
+insn-generated-split-num = $(wordlist 1,$(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1),$(number_series))
+
+insn-emit-split-c := $(foreach o, $(insn-generated-split-num), insn-emit$(o).c)
+insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
+$(insn-emit-split-c): insn-emit.c
+
 OBJS = \
 	gimple-match.o \
 	generic-match.o \
@@ -1266,6 +1287,7 @@ OBJS = \
 	insn-automata.o \
 	insn-dfatab.o \
 	insn-emit.o \
+	$(insn-emit-split-obj) \
 	insn-extract.o \
 	insn-latencytab.o \
 	insn-modes.o \
@@ -2376,6 +2398,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
 	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
 	  $(filter insn-conditions.md,$^) > tmp-$*.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
+	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
+	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
+	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
 	$(STAMP) s-$*
 
 # gencheck doesn't read the machine description, and the file produced
@@ -4096,18 +4121,10 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets:
 check_p_tool=$(firstword $(subst _, ,$*))
 check_p_count=$(check_$(check_p_tool)_parallelize)
 check_p_subno=$(word 2,$(subst _, ,$*))
-check_p_numbers0:=1 2 3 4 5 6 7 8 9
-check_p_numbers1:=0 $(check_p_numbers0)
-check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
-check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
-check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
-check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
-check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
-check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
 check_p_subdir=$(subst _,,$*)
 check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
 		$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
-		$(check_p_numbers)))
+		$(number_series)))
 
 # For parallelized check-% targets, this decides whether parallelization
 # is desirable (if -jN is used).  If desirable, recursive make is run with
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 84d07d388ee..54a0d909d9d 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
     }
 }
 
-int
-main (int argc, const char **argv)
-{
-  progname = "genemit";
-
-  if (!init_rtx_reader_args (argc, argv))
-    return (FATAL_EXIT_CODE);
-
-#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
-  nofail_optabs[OPTAB##_optab] = true;
-#include "internal-fn.def"
-
-  /* Assign sequential codes to all entries in the machine description
-     in parallel with the tables in insn-output.c.  */
-
-  printf ("/* Generated automatically by the program `genemit'\n\
-from the machine description file `md'.  */\n\n");
+/* Print include header.  */
 
+static void
+printf_include (void)
+{
+  printf ("/* Generated automatically by the program `genemit'\n"
+	  "from the machine description file `md'.  */\n\n");
   printf ("#define IN_TARGET_CODE 1\n");
   printf ("#include \"config.h\"\n");
   printf ("#include \"system.h\"\n");
@@ -900,35 +889,70 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"tm-constrs.h\"\n");
   printf ("#include \"ggc.h\"\n");
   printf ("#include \"target.h\"\n\n");
+}
 
-  /* Read the machine description.  */
+/* Generate the `gen_...' function from GET_CODE().  */
 
-  md_rtx_info info;
-  while (read_md_rtx (&info))
-    switch (GET_CODE (info.def))
-      {
-      case DEFINE_INSN:
-	gen_insn (&info);
-	break;
+static void
+gen_md_rtx (md_rtx_info *info)
+{
+  switch (GET_CODE (info->def))
+    {
+    case DEFINE_INSN:
+      gen_insn (info);
+      break;
 
-      case DEFINE_EXPAND:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_expand (&info);
-	break;
+    case DEFINE_EXPAND:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_expand (info);
+      break;
 
-      case DEFINE_SPLIT:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_split (&info);
-	break;
+    case DEFINE_SPLIT:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_split (info);
+      break;
 
-      case DEFINE_PEEPHOLE2:
-	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
-	gen_split (&info);
-	break;
+    case DEFINE_PEEPHOLE2:
+      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
+      gen_split (info);
+      break;
 
-      default:
-	break;
-      }
+    default:
+      break;
+    }
+}
+
+int
+main (int argc, const char **argv)
+{
+  progname = "genemit";
+
+  if (!init_rtx_reader_args (argc, argv))
+    return (FATAL_EXIT_CODE);
+
+#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
+  nofail_optabs[OPTAB##_optab] = true;
+#include "internal-fn.def"
+
+  /* Assign sequential codes to all entries in the machine description
+     in parallel with the tables in insn-output.c.  */
+
+  int read_count = 0;
+
+  /* Read the machine description.  */
+
+  md_rtx_info info;
+  while (read_md_rtx (&info))
+    {
+      if ((read_count++ % 10000) == 0)
+	{
+	  printf ("/* Split file into separate compilation units "
+		  "for parallel compilation %d */\n\n", read_count);
+	  printf_include();
+	}
+
+      gen_md_rtx (&info);
+    }
 
   /* Write out the routines to add CLOBBERs to a pattern and say whether they
      clobber a hard reg.  */
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-10-30 15:29       ` Richard Sandiford
@ 2020-11-04  2:25         ` Jojo R
  0 siblings, 0 replies; 13+ messages in thread
From: Jojo R @ 2020-11-04  2:25 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: segher, yunhai.syh, gcc-patches, joseph


Jojo
在 2020年10月30日 +0800 PM11:29,Richard Sandiford <richard.sandiford@arm.com>,写道:
> Jojo R <jiejie_rong@c-sky.com> writes:
> > Jojo
> > 在 2020年10月27日 +0800 PM10:14,Richard Sandiford <richard.sandiford@arm.com>,写道:
> > > Jojo R <jiejie_rong@c-sky.com> writes:
> > > > gcc/ChangeLog:
> > > >
> > > > * genemit.c (main): Print 'split line'.
> > > > * Makefile.in (insn-emit.c): Define split count and file
> > > >
> > > > ---
> > > > gcc/Makefile.in | 19 +++++++++
> > > > gcc/genemit.c | 104 +++++++++++++++++++++++++++++-------------------
> > > > 2 files changed, 83 insertions(+), 40 deletions(-)
> > > >
> > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> > > > index 79e854aa938..a7fcc7d5949 100644
> > > > --- a/gcc/Makefile.in
> > > > +++ b/gcc/Makefile.in
> > > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \
> > > > # We put the *-match.o and insn-*.o files first so that a parallel make
> > > > # will build them sooner, because they are large and otherwise tend to be
> > > > # the last objects to finish building.
> > > > +
> > > > +# target overrides
> > > > +-include $(tmake_file)
> > > > +
> > > > +INSN-GENERATED-SPLIT-NUM ?= 0
> > > > +
> > > > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \
> > > > + while test $$i -le $$j; do \
> > > > + echo $$i; i=`expr $$i + 1`; \
> > > > + done)
> > > > +
> > > > +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c)
> > > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> > > > +$(insn-emit-split-c): insn-emit.c
> > >
> > > Sorry for the slow reply. I stand by what I said in
> > > https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552863.html:
> > >
> > > I think we should use the same wordlist technique as check_p_numbers[0-6].
> > > So I guess the first step would be to rename check_p_numbers[0-6] to
> > > something more general and use it both here and in check_p_numbers.
> > >
> > > I think that would be better than having two different ways of
> > > generating lists of numbers, one directly in make and one calling
> > > out to the shell. But I didn't want to reassert that comment in
> > > case anyone was prepared to approve the patch in its current form.
> > >
> >
> > Ok & Thanks.
> >
> > It’s fixed in patch v8.
>
> Thanks. Like I say, I think we should rename check_p_numbers* at the
> same time, since it's now used for more than just parallel check. Maybe
> s/check_p_numbers/number_series/.

Ok & It’s fixed in patch v9.
>
> But otherwise it looks good.
>
> > > BTW, do you have a copyright assignment on file?
> >
> > I email the patch without copyright, and I think it is same with other gcc community patch.
>
> Some changes can be so small and mechanical that they're not in practice
> copyrightable, but all other changes need a copyright assignment.
> Unfortunately this patch is too complex to fall into the first category.
> See:
>
> https://gcc.gnu.org/contribute.html#legal
>
> for more details about the requirement and process.
>

From the patch of https://gcc.gnu.org/legacy-ml/gcc-patches/2018-07/msg01289.html
we have supported c-sky port in GCC backend, I think we also need to submit
a copyright for it and have submitted that.
I am contacting assign@gnu.org to check it.

Thanks.
> Thanks,
> Richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v9] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-11-04  1:53 ` [PATCH v9] " Jojo R
@ 2020-11-04 11:06   ` Richard Sandiford
  2020-11-06 10:12   ` Richard Sandiford
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Sandiford @ 2020-11-04 11:06 UTC (permalink / raw)
  To: Jojo R; +Cc: segher, ro, richard.guenther, joseph, gcc-patches, yunhai.syh

Jojo R <jiejie_rong@c-sky.com> writes:
> gcc/ChangeLog:
>
> 	* genemit.c (main): Print 'split line'.
> 	* Makefile.in (insn-emit.c): Define split count and file

Looks good, thanks.  Will commit once the copyright situation is
sorted out.

Richard

>
> ---
>  gcc/Makefile.in |  35 +++++++++++-----
>  gcc/genemit.c   | 104 +++++++++++++++++++++++++++++-------------------
>  2 files changed, 90 insertions(+), 49 deletions(-)
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 978a08f7b04..de846c0fcd4 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1154,6 +1154,15 @@ export STRIP_FOR_TARGET
>  export RANLIB_FOR_TARGET
>  export libsubdir
>  
> +number_series0:=1 2 3 4 5 6 7 8 9
> +number_series1:=0 $(number_series0)
> +number_series2:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series1)))
> +number_series3:=$(addprefix 0,$(number_series1)) $(number_series2)
> +number_series4:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series3)))
> +number_series5:=$(addprefix 0,$(number_series3)) $(number_series4)
> +number_series6:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series5)))
> +number_series:=$(number_series0) $(number_series2) $(number_series4) $(number_series6)
> +
>  FLAGS_TO_PASS = \
>  	"ADA_CFLAGS=$(ADA_CFLAGS)" \
>  	"BISON=$(BISON)" \
> @@ -1259,6 +1268,18 @@ ANALYZER_OBJS = \
>  # We put the *-match.o and insn-*.o files first so that a parallel make
>  # will build them sooner, because they are large and otherwise tend to be
>  # the last objects to finish building.
> +
> +# target overrides
> +-include $(tmake_file)
> +
> +INSN-GENERATED-SPLIT-NUM ?= 0
> +
> +insn-generated-split-num = $(wordlist 1,$(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1),$(number_series))
> +
> +insn-emit-split-c := $(foreach o, $(insn-generated-split-num), insn-emit$(o).c)
> +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> +$(insn-emit-split-c): insn-emit.c
> +
>  OBJS = \
>  	gimple-match.o \
>  	generic-match.o \
> @@ -1266,6 +1287,7 @@ OBJS = \
>  	insn-automata.o \
>  	insn-dfatab.o \
>  	insn-emit.o \
> +	$(insn-emit-split-obj) \
>  	insn-extract.o \
>  	insn-latencytab.o \
>  	insn-modes.o \
> @@ -2376,6 +2398,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
>  	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
>  	  $(filter insn-conditions.md,$^) > tmp-$*.c
>  	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> +	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> +	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> +	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
>  	$(STAMP) s-$*
>  
>  # gencheck doesn't read the machine description, and the file produced
> @@ -4096,18 +4121,10 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets:
>  check_p_tool=$(firstword $(subst _, ,$*))
>  check_p_count=$(check_$(check_p_tool)_parallelize)
>  check_p_subno=$(word 2,$(subst _, ,$*))
> -check_p_numbers0:=1 2 3 4 5 6 7 8 9
> -check_p_numbers1:=0 $(check_p_numbers0)
> -check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
> -check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
> -check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
> -check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
> -check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
> -check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
>  check_p_subdir=$(subst _,,$*)
>  check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
>  		$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
> -		$(check_p_numbers)))
> +		$(number_series)))
>  
>  # For parallelized check-% targets, this decides whether parallelization
>  # is desirable (if -jN is used).  If desirable, recursive make is run with
> diff --git a/gcc/genemit.c b/gcc/genemit.c
> index 84d07d388ee..54a0d909d9d 100644
> --- a/gcc/genemit.c
> +++ b/gcc/genemit.c
> @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname)
>      }
>  }
>  
> -int
> -main (int argc, const char **argv)
> -{
> -  progname = "genemit";
> -
> -  if (!init_rtx_reader_args (argc, argv))
> -    return (FATAL_EXIT_CODE);
> -
> -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> -  nofail_optabs[OPTAB##_optab] = true;
> -#include "internal-fn.def"
> -
> -  /* Assign sequential codes to all entries in the machine description
> -     in parallel with the tables in insn-output.c.  */
> -
> -  printf ("/* Generated automatically by the program `genemit'\n\
> -from the machine description file `md'.  */\n\n");
> +/* Print include header.  */
>  
> +static void
> +printf_include (void)
> +{
> +  printf ("/* Generated automatically by the program `genemit'\n"
> +	  "from the machine description file `md'.  */\n\n");
>    printf ("#define IN_TARGET_CODE 1\n");
>    printf ("#include \"config.h\"\n");
>    printf ("#include \"system.h\"\n");
> @@ -900,35 +889,70 @@ from the machine description file `md'.  */\n\n");
>    printf ("#include \"tm-constrs.h\"\n");
>    printf ("#include \"ggc.h\"\n");
>    printf ("#include \"target.h\"\n\n");
> +}
>  
> -  /* Read the machine description.  */
> +/* Generate the `gen_...' function from GET_CODE().  */
>  
> -  md_rtx_info info;
> -  while (read_md_rtx (&info))
> -    switch (GET_CODE (info.def))
> -      {
> -      case DEFINE_INSN:
> -	gen_insn (&info);
> -	break;
> +static void
> +gen_md_rtx (md_rtx_info *info)
> +{
> +  switch (GET_CODE (info->def))
> +    {
> +    case DEFINE_INSN:
> +      gen_insn (info);
> +      break;
>  
> -      case DEFINE_EXPAND:
> -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> -	gen_expand (&info);
> -	break;
> +    case DEFINE_EXPAND:
> +      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> +      gen_expand (info);
> +      break;
>  
> -      case DEFINE_SPLIT:
> -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> -	gen_split (&info);
> -	break;
> +    case DEFINE_SPLIT:
> +      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> +      gen_split (info);
> +      break;
>  
> -      case DEFINE_PEEPHOLE2:
> -	printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
> -	gen_split (&info);
> -	break;
> +    case DEFINE_PEEPHOLE2:
> +      printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
> +      gen_split (info);
> +      break;
>  
> -      default:
> -	break;
> -      }
> +    default:
> +      break;
> +    }
> +}
> +
> +int
> +main (int argc, const char **argv)
> +{
> +  progname = "genemit";
> +
> +  if (!init_rtx_reader_args (argc, argv))
> +    return (FATAL_EXIT_CODE);
> +
> +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
> +  nofail_optabs[OPTAB##_optab] = true;
> +#include "internal-fn.def"
> +
> +  /* Assign sequential codes to all entries in the machine description
> +     in parallel with the tables in insn-output.c.  */
> +
> +  int read_count = 0;
> +
> +  /* Read the machine description.  */
> +
> +  md_rtx_info info;
> +  while (read_md_rtx (&info))
> +    {
> +      if ((read_count++ % 10000) == 0)
> +	{
> +	  printf ("/* Split file into separate compilation units "
> +		  "for parallel compilation %d */\n\n", read_count);
> +	  printf_include();
> +	}
> +
> +      gen_md_rtx (&info);
> +    }
>  
>    /* Write out the routines to add CLOBBERs to a pattern and say whether they
>       clobber a hard reg.  */

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v9] genemit.c (main): split insn-emit.c for compiling parallelly
  2020-11-04  1:53 ` [PATCH v9] " Jojo R
  2020-11-04 11:06   ` Richard Sandiford
@ 2020-11-06 10:12   ` Richard Sandiford
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Sandiford @ 2020-11-06 10:12 UTC (permalink / raw)
  To: Jojo R; +Cc: segher, ro, richard.guenther, joseph, gcc-patches, yunhai.syh

Sorry, going it over it again before committing, I spotted a couple
of things…

Jojo R <jiejie_rong@c-sky.com> writes:
> gcc/ChangeLog:
>
> 	* genemit.c (main): Print 'split line'.
> 	* Makefile.in (insn-emit.c): Define split count and file
>
> ---
>  gcc/Makefile.in |  35 +++++++++++-----
>  gcc/genemit.c   | 104 +++++++++++++++++++++++++++++-------------------
>  2 files changed, 90 insertions(+), 49 deletions(-)
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 978a08f7b04..de846c0fcd4 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1154,6 +1154,15 @@ export STRIP_FOR_TARGET
>  export RANLIB_FOR_TARGET
>  export libsubdir
>  
> +number_series0:=1 2 3 4 5 6 7 8 9
> +number_series1:=0 $(number_series0)
> +number_series2:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series1)))
> +number_series3:=$(addprefix 0,$(number_series1)) $(number_series2)
> +number_series4:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series3)))
> +number_series5:=$(addprefix 0,$(number_series3)) $(number_series4)
> +number_series6:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series5)))
> +number_series:=$(number_series0) $(number_series2) $(number_series4) $(number_series6)
> +
>  FLAGS_TO_PASS = \
>  	"ADA_CFLAGS=$(ADA_CFLAGS)" \
>  	"BISON=$(BISON)" \
> @@ -1259,6 +1268,18 @@ ANALYZER_OBJS = \
>  # We put the *-match.o and insn-*.o files first so that a parallel make
>  # will build them sooner, because they are large and otherwise tend to be
>  # the last objects to finish building.
> +
> +# target overrides
> +-include $(tmake_file)
> +
> +INSN-GENERATED-SPLIT-NUM ?= 0
> +
> +insn-generated-split-num = $(wordlist 1,$(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1),$(number_series))

I think it would be better to make SPLIT-NUM 1-based rather than
0-based and not have the shell expr.

> +
> +insn-emit-split-c := $(foreach o, $(insn-generated-split-num), insn-emit$(o).c)
> +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c))
> +$(insn-emit-split-c): insn-emit.c
> +
>  OBJS = \
>  	gimple-match.o \
>  	generic-match.o \
> @@ -1266,6 +1287,7 @@ OBJS = \
>  	insn-automata.o \
>  	insn-dfatab.o \
>  	insn-emit.o \
> +	$(insn-emit-split-obj) \
>  	insn-extract.o \
>  	insn-latencytab.o \
>  	insn-modes.o \
> @@ -2376,6 +2398,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
>  	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
>  	  $(filter insn-conditions.md,$^) > tmp-$*.c
>  	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
> +	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
> +	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
> +	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)

This still uses bashisms.  Also, I don't think we can require csplit.

genemit itself is quite fast, so it would probably be simpler to run
it multiple times, passing a new command-line parameter to say which
output file we want.

In other words, rather than generate a monolithic insn-emit.c and
then split it later, we should just generate the separate insn-emit.cs
directly.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-11-06 10:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <jiejie_rong@c-sky.com@genemit.c_(main):_split_insn-emit.c_for_compiling_parallelly>
2020-09-15  9:15 ` [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly Jojo R
2020-09-27  2:34   ` Jojo R
2020-10-08  2:01     ` Jojo R
2020-10-24  6:02       ` Jojo R
2020-10-27  5:59         ` Jojo R
2020-10-27 14:14   ` Richard Sandiford
2020-10-30  9:41     ` Jojo R
2020-10-30 15:29       ` Richard Sandiford
2020-11-04  2:25         ` Jojo R
2020-10-30  9:42 ` [PATCH v8] " Jojo R
2020-11-04  1:53 ` [PATCH v9] " Jojo R
2020-11-04 11:06   ` Richard Sandiford
2020-11-06 10:12   ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).