public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, RFC] Dumping expanded MD files
@ 2012-11-22 17:49 Kirill Yukhin
  2012-11-23  9:26 ` Mike Stump
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kirill Yukhin @ 2012-11-22 17:49 UTC (permalink / raw)
  To: Richard Henderson, Jakub Jelinek, gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]

Hi folks,

This patch adds an utility for dumping MD-files after iterators and
define_substs expanding. The new utility is named genmddump and is
built along with other gen* programs.

I also added new target to Makefile to invoke this utility. However,
I’m not sure it’s general enough to be added to the top-level
makefile, so your suggestions on where we should place it and how it
should be invoked are welcome.

ChangeLog

2012-11-22  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>

        * Makefile.in: Add targets mddump and mddump-gcc for dumping expanded
         MD-files.

gcc/ChangeLog

2012-11-22  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>

        * Makefile.in: Add targets s-mddump, build/genmddump.o.  Extend
        genprogrtl with mddump.

        * genmddump.c: New.
        * gensupport.c (dump_rtl_queue): New.
        (dump_expanded_md): New.
        * gensupport.h: Declare dump_expanded_md.

What do you guys think?

Thanks, K

[-- Attachment #2: md_expanded_dumping-1.patch --]
[-- Type: application/octet-stream, Size: 5614 bytes --]

diff --git a/Makefile.in b/Makefile.in
index 636b2ba..6a1751e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -971,6 +971,22 @@ all:
 @endif gcc-bootstrap
 	&& :
 
+.PHONY: mddump
+mddump:
+	$(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) mddump-gcc
+
+.PHONY: mddump-gcc
+mddump-gcc: configure-gcc maybe-all-build-libiberty
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS)  \
+	(cd $(HOST_SUBDIR)/gcc && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) \
+		s-mddump)
+
 .PHONY: all-build
 
 all-build: maybe-all-build-libiberty
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 88b29ea..4509dc7 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3610,6 +3610,10 @@ insn-preds.c: s-preds; @true
 tm-preds.h: s-preds-h; @true
 tm-constrs.h: s-constrs-h; @true
 
+.PHONY: s-mddump
+s-mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
+	$(RUN_GEN) build/genmddump$(build_exeext) $(md_file) 2> tmp-mddump.md
+
 s-preds: $(MD_DEPS) build/genpreds$(build_exeext)
 	$(RUN_GEN) build/genpreds$(build_exeext) $(md_file) > tmp-preds.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-preds.c insn-preds.c
@@ -3926,6 +3930,8 @@ build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
   coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
   $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
+build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
+  coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 
 # Compile the programs that generate insn-* from the machine description.
 # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
@@ -3934,7 +3940,7 @@ build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
 
 # All these programs use the RTL reader ($(BUILD_RTL)).
 genprogrtl = attr attr-common attrtab automata codes conditions config emit \
-	     extract flags opinit output peep preds recog
+	     extract flags opinit output peep preds recog mddump
 $(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
 
 # All these programs use the MD reader ($(BUILD_MD)).
diff --git a/gcc/genmddump.c b/gcc/genmddump.c
new file mode 100644
index 0000000..8823c9a
--- /dev/null
+++ b/gcc/genmddump.c
@@ -0,0 +1,55 @@
+/* Generate code from machine description to recognize rtl as insns.
+   Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
+   2012 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+
+/* This program is used to produce tmp-mddump.md, which represents
+   md-file with expanded iterators and after define_subst transformation
+   is performed.
+
+   The only argument of the program is a source md-file (e.g.
+   config/i386/i386.md).  STDERR is used for the program output.  */
+
+#include "bconfig.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "errors.h"
+#include "read-md.h"
+#include "gensupport.h"
+
+\f
+extern int main (int, char **);
+
+int
+main (int argc, char **argv)
+{
+  progname = "genmddump";
+
+  if (!init_rtx_reader_args (argc, argv))
+    return (FATAL_EXIT_CODE);
+
+  dump_expanded_md ();
+
+  fflush (stderr);
+  return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
+}
+
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 00290b0..4aa11bc 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -2949,3 +2949,24 @@ get_pattern_stats (struct pattern_stats *stats, rtvec pattern)
 				  MAX (stats->max_dup_opno,
 				       stats->max_scratch_opno)) + 1;
 }
+
+/* Dump all entries from queue Q.  */
+static void
+dump_rtl_queue (struct queue_elem **q)
+{
+  struct queue_elem *elem;
+  for (elem = *q; elem ; elem = elem->next)
+    debug_rtx (elem->data);
+}
+
+/* Dump all available rtl queues.  */
+void
+dump_expanded_md (void)
+{
+  dump_rtl_queue (&define_attr_queue);
+  dump_rtl_queue (&define_pred_queue);
+  dump_rtl_queue (&define_insn_queue);
+  dump_rtl_queue (&define_cond_exec_queue);
+  dump_rtl_queue (&define_subst_queue);
+  dump_rtl_queue (&other_queue);
+}
diff --git a/gcc/gensupport.h b/gcc/gensupport.h
index 5ae32d5..4185ffa 100644
--- a/gcc/gensupport.h
+++ b/gcc/gensupport.h
@@ -27,6 +27,7 @@ extern struct obstack *rtl_obstack;
 extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
 extern bool init_rtx_reader_args (int, char **);
 extern rtx read_md_rtx (int *, int *);
+extern void dump_expanded_md (void);
 
 /* Set this to 0 to disable automatic elision of insn patterns which
    can never be used in this configuration.  See genconditions.c.

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-22 17:49 [PATCH, RFC] Dumping expanded MD files Kirill Yukhin
@ 2012-11-23  9:26 ` Mike Stump
  2012-11-24  3:00 ` Hans-Peter Nilsson
  2012-11-27 17:34 ` Richard Henderson
  2 siblings, 0 replies; 10+ messages in thread
From: Mike Stump @ 2012-11-23  9:26 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Richard Henderson, Jakub Jelinek, gcc-patches List

On Nov 22, 2012, at 9:48 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> This patch adds an utility for dumping MD-files after iterators and
> define_substs expanding.

> What do you guys think?

Cool.  (That's not an official review.  :-))

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-22 17:49 [PATCH, RFC] Dumping expanded MD files Kirill Yukhin
  2012-11-23  9:26 ` Mike Stump
@ 2012-11-24  3:00 ` Hans-Peter Nilsson
  2012-11-27 17:34 ` Richard Henderson
  2 siblings, 0 replies; 10+ messages in thread
From: Hans-Peter Nilsson @ 2012-11-24  3:00 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List

On Thu, 22 Nov 2012, Kirill Yukhin wrote:
> Hi folks,
>
> This patch adds an utility for dumping MD-files after iterators and
> define_substs expanding. The new utility is named genmddump and is
> built along with other gen* programs.
>
> I also added new target to Makefile to invoke this utility. However,
> I?m not sure it?s general enough to be added to the top-level
> makefile, so your suggestions on where we should place it and how it
> should be invoked are welcome.

> What do you guys think?

Very nice.

I think it should be enabled and the expanded md be dumped for
non-release builds.

There's configury bits for the development stage but with loose
ends; you'll have to add an AC_SUBST in gcc/configure.ac to use
in gcc/Makefile.in, like a @maybe_dumped_md@ set to empty or
s-mddump and added to dependencies for "all" (or probably
actually some suitable sub-dependency for "all").

brgds, H-P

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-22 17:49 [PATCH, RFC] Dumping expanded MD files Kirill Yukhin
  2012-11-23  9:26 ` Mike Stump
  2012-11-24  3:00 ` Hans-Peter Nilsson
@ 2012-11-27 17:34 ` Richard Henderson
  2012-11-29  7:22   ` Michael Zolotukhin
  2 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2012-11-27 17:34 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jakub Jelinek, gcc-patches List

On 11/22/2012 09:48 AM, Kirill Yukhin wrote:
> +.PHONY: s-mddump
> +s-mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
> +	$(RUN_GEN) build/genmddump$(build_exeext) $(md_file) 2> tmp-mddump.md

I think just 

mddump: ...
	$(RUN_GEN) ... > mddump

will be sufficient.  This is not actually used by the build at all, so we
don't need to play games with stamp files etc.

There's no need for top-level makefile changes at all.  When you want to
use this, simply cd into the gcc subdirectory.

> +/* Dump all available rtl queues.  */
> +void
> +dump_expanded_md (void)

Why?  Seems to me that you can just have genmddump.c simply use the
generic read_md_rtx interface, dumping as it goes.  You might also
consider dumping the pattern_lineno argument as a comment before the
pattern.  Otherwise it might be tricky to match up the dump pattern
with the original input file patterns.


r~

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-27 17:34 ` Richard Henderson
@ 2012-11-29  7:22   ` Michael Zolotukhin
  2012-11-29 18:41     ` Richard Henderson
  2012-11-29 19:06     ` Richard Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Zolotukhin @ 2012-11-29  7:22 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Kirill Yukhin, Jakub Jelinek, gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

Thanks for the input, the patch seems  to be much more cute now.
Do we still need to play with release/non-release builds, or is it ok
to commit this patch to the trunk as it is?

Changelog:
2012-11-29  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>

        * Makefile.in: Add target mddump, build/genmddump.o.  Extend
        genprogrtl with mddump.
        * genmddump.c: New.

On 27 November 2012 21:34, Richard Henderson <rth@redhat.com> wrote:
> On 11/22/2012 09:48 AM, Kirill Yukhin wrote:
>> +.PHONY: s-mddump
>> +s-mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
>> +     $(RUN_GEN) build/genmddump$(build_exeext) $(md_file) 2> tmp-mddump.md
>
> I think just
>
> mddump: ...
>         $(RUN_GEN) ... > mddump
>
> will be sufficient.  This is not actually used by the build at all, so we
> don't need to play games with stamp files etc.
>
> There's no need for top-level makefile changes at all.  When you want to
> use this, simply cd into the gcc subdirectory.
>
>> +/* Dump all available rtl queues.  */
>> +void
>> +dump_expanded_md (void)
>
> Why?  Seems to me that you can just have genmddump.c simply use the
> generic read_md_rtx interface, dumping as it goes.  You might also
> consider dumping the pattern_lineno argument as a comment before the
> pattern.  Otherwise it might be tricky to match up the dump pattern
> with the original input file patterns.
>
>
> r~

-- 
---
Best regards,
Michael V. Zolotukhin,
Software Engineer
Intel Corporation.

[-- Attachment #2: mddump-2.patch --]
[-- Type: application/octet-stream, Size: 3718 bytes --]

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c7b8648..c56c1db 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3620,6 +3620,10 @@ insn-preds.c: s-preds; @true
 tm-preds.h: s-preds-h; @true
 tm-constrs.h: s-constrs-h; @true
 
+.PHONY: mddump
+mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
+	$(RUN_GEN) build/genmddump$(build_exeext) $(md_file) 2> tmp-mddump.md
+
 s-preds: $(MD_DEPS) build/genpreds$(build_exeext)
 	$(RUN_GEN) build/genpreds$(build_exeext) $(md_file) > tmp-preds.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-preds.c insn-preds.c
@@ -3937,6 +3941,8 @@ build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
   coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
   $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
+build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
+  coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 
 # Compile the programs that generate insn-* from the machine description.
 # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
@@ -3945,7 +3951,7 @@ build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
 
 # All these programs use the RTL reader ($(BUILD_RTL)).
 genprogrtl = attr attr-common attrtab automata codes conditions config emit \
-	     extract flags opinit output peep preds recog
+	     extract flags opinit output peep preds recog mddump
 $(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
 
 # All these programs use the MD reader ($(BUILD_MD)).
diff --git a/gcc/genmddump.c b/gcc/genmddump.c
new file mode 100644
index 0000000..d034993
--- /dev/null
+++ b/gcc/genmddump.c
@@ -0,0 +1,66 @@
+/* Generate code from machine description to recognize rtl as insns.
+   Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
+   2012 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+
+/* This program is used to produce tmp-mddump.md, which represents
+   md-file with expanded iterators and after define_subst transformation
+   is performed.
+
+   The only argument of the program is a source md-file (e.g.
+   config/i386/i386.md).  STDERR is used for the program output.  */
+
+#include "bconfig.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "errors.h"
+#include "read-md.h"
+#include "gensupport.h"
+
+\f
+extern int main (int, char **);
+
+int
+main (int argc, char **argv)
+{
+  rtx desc;
+  int pattern_lineno;
+  int code; /* not used */
+  progname = "genmddump";
+
+  if (!init_rtx_reader_args (argc, argv))
+    return (FATAL_EXIT_CODE);
+
+  /* Read the machine description.  */
+  while (1)
+    {
+      desc = read_md_rtx (&pattern_lineno, &code);
+      if (desc == NULL)
+	break;
+      fprintf (stderr, ";; %s: %d\n", read_md_filename, pattern_lineno);
+      debug_rtx (desc);
+    }
+
+  fflush (stderr);
+  return (ferror (stderr) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
+}
+

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-29  7:22   ` Michael Zolotukhin
@ 2012-11-29 18:41     ` Richard Henderson
  2012-11-29 19:06     ` Richard Henderson
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2012-11-29 18:41 UTC (permalink / raw)
  To: Michael Zolotukhin; +Cc: Kirill Yukhin, Jakub Jelinek, gcc-patches List

On 2012-11-28 23:22, Michael Zolotukhin wrote:
> +.PHONY: mddump
> +mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
> +	$(RUN_GEN) build/genmddump$(build_exeext) $(md_file) 2> tmp-mddump.md

Why in the world are you dumping to stderr instead of stdout?


r~

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-29  7:22   ` Michael Zolotukhin
  2012-11-29 18:41     ` Richard Henderson
@ 2012-11-29 19:06     ` Richard Henderson
  2012-11-30  9:10       ` Michael Zolotukhin
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2012-11-29 19:06 UTC (permalink / raw)
  To: Michael Zolotukhin; +Cc: Kirill Yukhin, Jakub Jelinek, gcc-patches List

On 2012-11-28 23:22, Michael Zolotukhin wrote:
> +      debug_rtx (desc);

... oh, I see.  You wanted dump_rtx here, so you can output to stdout.


r~

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-29 19:06     ` Richard Henderson
@ 2012-11-30  9:10       ` Michael Zolotukhin
  2012-11-30 19:13         ` Richard Henderson
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Zolotukhin @ 2012-11-30  9:10 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Kirill Yukhin, Jakub Jelinek, gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

I didn't find any dump_rtx - instead, I used print_inline_rtx which
seems to be what we need to output to stdout, instead of stderr.
Updated version of the patch is attached. Ok for trunk?

Changelog:
2012-11-30  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>

        * Makefile.in: Add target mddump, build/genmddump.o.  Extend
        genprogrtl with mddump.
        * genmddump.c: New.

---
Thanks, Michael

On 29 November 2012 22:36, Richard Henderson <rth@redhat.com> wrote:
> On 2012-11-28 23:22, Michael Zolotukhin wrote:
>> +      debug_rtx (desc);
>
> ... oh, I see.  You wanted dump_rtx here, so you can output to stdout.
>
>
> r~



-- 
---
Best regards,
Michael V. Zolotukhin,
Software Engineer
Intel Corporation.

[-- Attachment #2: mddump-3.patch --]
[-- Type: application/octet-stream, Size: 3750 bytes --]

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c7b8648..44e46e6 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3620,6 +3620,10 @@ insn-preds.c: s-preds; @true
 tm-preds.h: s-preds-h; @true
 tm-constrs.h: s-constrs-h; @true
 
+.PHONY: mddump
+mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
+	$(RUN_GEN) build/genmddump$(build_exeext) $(md_file) > tmp-mddump.md
+
 s-preds: $(MD_DEPS) build/genpreds$(build_exeext)
 	$(RUN_GEN) build/genpreds$(build_exeext) $(md_file) > tmp-preds.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-preds.c insn-preds.c
@@ -3937,6 +3941,8 @@ build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
   coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
   $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
+build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
+  coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 
 # Compile the programs that generate insn-* from the machine description.
 # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
@@ -3945,7 +3951,7 @@ build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
 
 # All these programs use the RTL reader ($(BUILD_RTL)).
 genprogrtl = attr attr-common attrtab automata codes conditions config emit \
-	     extract flags opinit output peep preds recog
+	     extract flags opinit output peep preds recog mddump
 $(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
 
 # All these programs use the MD reader ($(BUILD_MD)).
diff --git a/gcc/genmddump.c b/gcc/genmddump.c
new file mode 100644
index 0000000..76a1550
--- /dev/null
+++ b/gcc/genmddump.c
@@ -0,0 +1,67 @@
+/* Generate code from machine description to recognize rtl as insns.
+   Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
+   2012 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+
+/* This program is used to produce tmp-mddump.md, which represents
+   md-file with expanded iterators and after define_subst transformation
+   is performed.
+
+   The only argument of the program is a source md-file (e.g.
+   config/i386/i386.md).  STDERR is used for the program output.  */
+
+#include "bconfig.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "errors.h"
+#include "read-md.h"
+#include "gensupport.h"
+
+\f
+extern int main (int, char **);
+
+int
+main (int argc, char **argv)
+{
+  rtx desc;
+  int pattern_lineno;
+  int code; /* not used */
+  progname = "genmddump";
+
+  if (!init_rtx_reader_args (argc, argv))
+    return (FATAL_EXIT_CODE);
+
+  /* Read the machine description.  */
+  while (1)
+    {
+      desc = read_md_rtx (&pattern_lineno, &code);
+      if (desc == NULL)
+	break;
+      printf (";; %s: %d\n", read_md_filename, pattern_lineno);
+      print_inline_rtx (stdout, desc, 0);
+      printf ("\n\n");
+    }
+
+  fflush (stdout);
+  return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
+}
+

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-30  9:10       ` Michael Zolotukhin
@ 2012-11-30 19:13         ` Richard Henderson
  2012-12-04 12:59           ` Kirill Yukhin
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2012-11-30 19:13 UTC (permalink / raw)
  To: Michael Zolotukhin; +Cc: Kirill Yukhin, Jakub Jelinek, gcc-patches List

On 2012-11-30 01:03, Michael Zolotukhin wrote:
> Changelog:
> 2012-11-30  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>
> 
>         * Makefile.in: Add target mddump, build/genmddump.o.  Extend
>         genprogrtl with mddump.
>         * genmddump.c: New.

Ok.


r~

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

* Re: [PATCH, RFC] Dumping expanded MD files
  2012-11-30 19:13         ` Richard Henderson
@ 2012-12-04 12:59           ` Kirill Yukhin
  0 siblings, 0 replies; 10+ messages in thread
From: Kirill Yukhin @ 2012-12-04 12:59 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Michael Zolotukhin, Jakub Jelinek, gcc-patches List

Hello
> Ok.
That was checked in:
http://gcc.gnu.org/ml/gcc-cvs/2012-12/msg00075.html
http://gcc.gnu.org/ml/gcc-cvs/2012-12/msg00077.html

Thanks, K

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

end of thread, other threads:[~2012-12-04 12:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22 17:49 [PATCH, RFC] Dumping expanded MD files Kirill Yukhin
2012-11-23  9:26 ` Mike Stump
2012-11-24  3:00 ` Hans-Peter Nilsson
2012-11-27 17:34 ` Richard Henderson
2012-11-29  7:22   ` Michael Zolotukhin
2012-11-29 18:41     ` Richard Henderson
2012-11-29 19:06     ` Richard Henderson
2012-11-30  9:10       ` Michael Zolotukhin
2012-11-30 19:13         ` Richard Henderson
2012-12-04 12:59           ` Kirill Yukhin

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).