public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gsoc][match-and-simplify] allow multiple patterns inside for ?
@ 2014-07-22 22:14 Prathamesh Kulkarni
  2014-07-22 22:27 ` Prathamesh Kulkarni
  2014-07-23  9:18 ` Richard Biener
  0 siblings, 2 replies; 3+ messages in thread
From: Prathamesh Kulkarni @ 2014-07-22 22:14 UTC (permalink / raw)
  To: Richard Biener, Diego Novillo, gcc-patches, Maxim Kuvyrkov

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

Would it be a good idea to allow multiple match_and_simplify within for ?

* genmatch.c (parse_for): Adjust to parse multiple patterns.

Thanks and Regards,
Prathamesh

[-- Attachment #2: multiple-patterns-for.patch --]
[-- Type: text/x-patch, Size: 1533 bytes --]

Index: genmatch.c
===================================================================
--- genmatch.c	(revision 212558)
+++ genmatch.c	(working copy)
@@ -2042,20 +2042,30 @@ parse_for (cpp_reader *r, source_locatio
       opers.safe_push (get_ident (r));
     }
 
-  vec<simplify *> for_simplifiers = vNULL;
-  parse_pattern (r, for_simplifiers);
 
-  for (unsigned i = 0; i < opers.length (); ++i)
+  while (1)
     {
-      for (unsigned j = 0; j < for_simplifiers.length (); ++j)
+      const cpp_token *token = peek (r);
+      if (token->type == CPP_CLOSE_PAREN)
+	break;
+      
+      vec<simplify *> for_simplifiers = vNULL;
+      parse_pattern (r, for_simplifiers);
+      
+      for (unsigned i = 0; i < opers.length (); ++i)
 	{
-	  simplify *s = for_simplifiers[j];
-	  operand *match_op = replace_id (s->match, user_id, opers[i]);
-	  operand *result_op = replace_id (s->result, user_id, opers[i]);
-	  simplify *ns = new simplify (s->name, match_op, s->match_location,
-				       s->ifexpr, s->ifexpr_location,
+	  for (unsigned j = 0; j < for_simplifiers.length (); ++j)
+	    {
+	      simplify *s = for_simplifiers[j];
+	      operand *match_op = replace_id (s->match, user_id, opers[i]);
+	      operand *result_op = replace_id (s->result, user_id, opers[i]);
+
+	      simplify *ns = new simplify (s->name, match_op, s->match_location,
+					   s->ifexpr, s->ifexpr_location,
 				       result_op, s->result_location);
-	  simplifiers.safe_push (ns);
+
+	      simplifiers.safe_push (ns);
+	    }
 	}
     }
 }

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

* Re: [gsoc][match-and-simplify] allow multiple patterns inside for ?
  2014-07-22 22:14 [gsoc][match-and-simplify] allow multiple patterns inside for ? Prathamesh Kulkarni
@ 2014-07-22 22:27 ` Prathamesh Kulkarni
  2014-07-23  9:18 ` Richard Biener
  1 sibling, 0 replies; 3+ messages in thread
From: Prathamesh Kulkarni @ 2014-07-22 22:27 UTC (permalink / raw)
  To: Richard Biener, Diego Novillo, gcc-patches, Maxim Kuvyrkov

On Wed, Jul 23, 2014 at 3:42 AM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> Would it be a good idea to allow multiple match_and_simplify within for ?
allow multiple patterns (match_and_simplify, for).
> * genmatch.c (parse_for): Adjust to parse multiple patterns.
>
> Thanks and Regards,
> Prathamesh

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

* Re: [gsoc][match-and-simplify] allow multiple patterns inside for ?
  2014-07-22 22:14 [gsoc][match-and-simplify] allow multiple patterns inside for ? Prathamesh Kulkarni
  2014-07-22 22:27 ` Prathamesh Kulkarni
@ 2014-07-23  9:18 ` Richard Biener
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2014-07-23  9:18 UTC (permalink / raw)
  To: Prathamesh Kulkarni; +Cc: Diego Novillo, gcc-patches, Maxim Kuvyrkov

On Wed, Jul 23, 2014 at 12:12 AM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> Would it be a good idea to allow multiple match_and_simplify within for ?

I see no good reason to disallow it.

Thus I have installed the patch.

Thanks,
Richard.

> * genmatch.c (parse_for): Adjust to parse multiple patterns.
>
> Thanks and Regards,
> Prathamesh

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

end of thread, other threads:[~2014-07-23  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-22 22:14 [gsoc][match-and-simplify] allow multiple patterns inside for ? Prathamesh Kulkarni
2014-07-22 22:27 ` Prathamesh Kulkarni
2014-07-23  9:18 ` Richard Biener

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