This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RFC] Automatized pattern matching


Hello,

> > as someone mentioned on gcc summit, quite a lot of big conditions in gcc
> > is in fact a pattern matching on rtl expressions, that probably cannot
> > be expressed in a more clear way in c directly.
> > 
> > What we could however do is to use a language more suited to this task
> > to describe the patterns and to translate them into c automatically.
> > The patch below shows a simple implementation of this idea (for
> > technical details see comments in pattern.c); it for example allows you
> > to write
> > 
> >   if (MATCH_RTX ("(const (plus $base const_int@1))", addr))
> >     offset = INTVAL (_match1);
> 
> You didn't seem to get any comments on this, and at the time I was too
> busy, but now that I look at it this seems like a really good idea.
> I'm particularly thinking of code like this example in rs6000.c:
> 
>   /* We must recognize output that we have already generated ourselves.  */
>   if (GET_CODE (x) == PLUS
>       && GET_CODE (XEXP (x, 0)) == PLUS
>       && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
>       && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
>       && GET_CODE (XEXP (x, 1)) == CONST_INT)
>     {
>       push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
>                    BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
>                    opnum, (enum reload_type)type);
>       *win = 1;
>       return x;
>     }
> 
> which ought to be much more readable using a MATCH_RTX-like
> functionality.  So, I'd encourage to update your patch, fix the few
> details (like allowing line breaks) and I'll review it.

there is the updated and extended version that integrates some of the
suggestions (and allows line breaks):

http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02132.html

In

http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02776.html

Richard had the objections about the new language and suggested not
including this into 3.4.

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]