This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Cilk Plus Array Notation for C++
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "Jason Merrill (jason at redhat dot com)" <jason at redhat dot com>, "rth at redhat dot com" <rth at redhat dot com>
- Date: Wed, 12 Jun 2013 18:02:14 +0000
- Subject: RE: [PATCH] Cilk Plus Array Notation for C++
- References: <BF230D13CA30DD48930C31D4099330003A42D85F at FMSMSX101 dot amr dot corp dot intel dot com> <51B8A2FA dot 2020404 at redhat dot com> <BF230D13CA30DD48930C31D4099330003A42E340 at FMSMSX101 dot amr dot corp dot intel dot com> <51B8B276 dot 5070404 at redhat dot com>
> -----Original Message-----
> From: Aldy Hernandez [mailto:aldyh@redhat.com]
> Sent: Wednesday, June 12, 2013 1:40 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org; Jason Merrill (jason@redhat.com);
> rth@redhat.com
> Subject: Re: [PATCH] Cilk Plus Array Notation for C++
>
>
> >> Overall, a lot of the stuff in cp-array-notation.c looks familiar
> >> from the C front- end changes. Can't you reuse a lot of it?
> >
> > I looked into trying to combine many functionality. The issue that
> > prohibited me was templates and extra trees. For example, IF_STMT,
> > FOR_STMT, MODOP_EXPR, etc are not available in C but are in C++. So, I
> > had to add this additional check for those. Also, if we are processing
> > templates we have to create different kind of trees (e.g MODOP_EXPR
> > intead of MODIFY_EXPR).
>
> I see.
>
> >
> > One way to do it is to break up the places where I am using C++
> > specific code and add a language hook to handle those. I tried doing
> > that a while back and the whole thing looked a lot messy and I would
> > imagine it would be hard to debug them in future (...atleast for me).
> > This looked organized for me, even though a few code looks repeated.
>
> That's what I had in mind, but if you tried it and it looks worse, I guess I can live
> with it.
>
> >> You do all this type checking here, but aren't you doing the same
> >> type checking in build_array_notation_ref() which you're going to
> >> call anyway? It looks like there is some code duplication going on.
> >
> > The reason why we do this second type checking here is because we
> > don't know what they could be when we are parsing it. For example,
> > in:
>
> Couldn't you abstract the type checking out into a helper function shared by
> both routines?
Yes, that I could do. I will fix it in the new upcoming Array Notation for C++ patch.
Thanks,
Balaji V. Iyer.