On Fri, 17 Oct 2014, Jakub Jelinek wrote:

> On Wed, Oct 15, 2014 at 01:39:33PM +0200, Richard Biener wrote:
> > 2014-10-15  Richard Biener  <rguent...@suse.de>
> 
> Shouldn't Prathamesh be listed as co-author of the patch?

Yes, of course.

> > +       fprintf (f, "case SSA_NAME:\n");
> > +       fprintf (f, "{\n");
> > +       fprintf (f, "gimple def_stmt = SSA_NAME_DEF_STMT (%s);\n", 
> > kid_opname);
> 
> Etc.; so no attempt to indent the generated code, by tracking number
> of current indentation columns and trasnating that into a series of
> spaces or tabs or tabs+spaces?  Other generated sources like insn-*.c
> usually are indented, at least to some extent.

Yes, no tracking is done at the moment.  I will see how difficult it is
as a followup (the nests can become quite deep and thus have very long
lines - for debugging I chose to indent only pieces of it via vim
auto-re-indent)

> > +         char dest[32];
> > +         snprintf (dest, 32, "  res_ops[%d]", j);
> > +         const char *optype
> > +             = get_operand_type (e->operation,
> 
> This seems to be indented too much.

Fixed.

> > +                                 "type", e->expr_type,
> > +                                 j == 0
> > +                                 ? NULL : "TREE_TYPE (res_ops[0])");
> > + /* The genmatch generator progam.  It reads from a pattern description
> > +    and outputs GIMPLE or GENERIC IL matching and simplification routines. 
> >  */
> > + 
> > + int
> > + main(int argc, char **argv)
> 
> Formatting ;)

Fixed.

> > +     return 1;
> > + 
> > +   bool gimple = true;
> > +   bool verbose = false;
> > +   char *input = argv[argc-1];
> > +   for (int i = 1; i < argc - 1; ++i)
> > +     {
> > +       if (strcmp (argv[i], "-gimple") == 0)
> > +   gimple = true;
> > +       else if (strcmp (argv[i], "-generic") == 0)
> > +   gimple = false;
> > +       else if (strcmp (argv[i], "-v") == 0)
> > +   verbose = true;
> > +       else
> > +   {
> > +     fprintf (stderr, "Usage: genmatch [-gimple] [-generic] [-v] input\n");
> > +     return 1;
> > +   }
> > +     }
> 
> Wouldn't --gimple and --generic be nicer?

Changed.

Thanks,
Richard.

2014-10-20  Richard Biener  <rguent...@suse.de>

        * genmatch.c (main): Change -gimple and -generic to
        --gimple and --generic.
        * Makefile.in (s-match): Adjust.

Index: gcc/genmatch.c
===================================================================
--- gcc/genmatch.c      (revision 216459)
+++ gcc/genmatch.c      (working copy)
@@ -1950,10 +1950,10 @@ dt_simplify::gen (FILE *f, bool gimple)
              char dest[32];
              snprintf (dest, 32, "  res_ops[%d]", j);
              const char *optype
-                 = get_operand_type (e->operation,
-                                     "type", e->expr_type,
-                                     j == 0
-                                     ? NULL : "TREE_TYPE (res_ops[0])");
+               = get_operand_type (e->operation,
+                                   "type", e->expr_type,
+                                   j == 0
+                                   ? NULL : "TREE_TYPE (res_ops[0])");
              e->ops[j]->gen_transform (f, dest, true, 1, optype, indexes);
            }
 
@@ -2918,7 +2918,7 @@ round_alloc_size (size_t s)
    and outputs GIMPLE or GENERIC IL matching and simplification routines.  */
 
 int
-main(int argc, char **argv)
+main (int argc, char **argv)
 {
   cpp_reader *r;
 
@@ -2932,15 +2932,16 @@ main(int argc, char **argv)
   char *input = argv[argc-1];
   for (int i = 1; i < argc - 1; ++i)
     {
-      if (strcmp (argv[i], "-gimple") == 0)
+      if (strcmp (argv[i], "--gimple") == 0)
        gimple = true;
-      else if (strcmp (argv[i], "-generic") == 0)
+      else if (strcmp (argv[i], "--generic") == 0)
        gimple = false;
       else if (strcmp (argv[i], "-v") == 0)
        verbose = true;
       else
        {
-         fprintf (stderr, "Usage: genmatch [-gimple] [-generic] [-v] input\n");
+         fprintf (stderr, "Usage: genmatch "
+                  "[--gimple] [--generic] [-v] input\n");
          return 1;
        }
     }
@@ -3035,4 +3036,3 @@ add_operator (CONVERT2, "CONVERT2", "tcc
 
   return 0;
 }
-
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in     (revision 216459)
+++ gcc/Makefile.in     (working copy)
@@ -2237,9 +2237,9 @@ gimple-match.c: s-match gimple-match-hea
 generic-match.c: s-match generic-match-head.c ; @true
 
 s-match: build/genmatch$(build_exeext) $(srcdir)/match*.pd
-       $(RUN_GEN) build/genmatch$(build_exeext) -gimple $(srcdir)/match.pd \
+       $(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
            > tmp-gimple-match.c
-       $(RUN_GEN) build/genmatch$(build_exeext) -generic $(srcdir)/match.pd \
+       $(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
            > tmp-generic-match.c
        $(SHELL) $(srcdir)/../move-if-change tmp-gimple-match.c \
                                                gimple-match.c

Reply via email to