public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: David Malcolm <dmalcolm@redhat.com>,
	       Prasad Ghangal <prasad.ghangal@gmail.com>,
	       Diego Novillo <dnovillo@google.com>,
	       gcc Mailing List <gcc@gcc.gnu.org>,
	sandeep@gcc.gnu.org
Subject: Re: [gimplefe] [gsoc16] Gimple Front End Project
Date: Wed, 09 Mar 2016 16:40:00 -0000	[thread overview]
Message-ID: <56E051E5.4010800@redhat.com> (raw)
In-Reply-To: <CAFiYyc3x-VHZvKWeR9bfs8WvvP9GzP7sxaaF+pC+vbjfZHo_2w@mail.gmail.com>

On 03/09/2016 10:47 AM, Richard Biener wrote:
> On Wed, Mar 9, 2016 at 3:27 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
>> On 03/07/2016 11:33 AM, David Malcolm wrote:
>>>>
>>>>
>>>>
>>>>
>>>> So for testing specific passes, I'd much rather have an input format
>>>> for testing individual passes that:
>>>>     * can be easily generated by GCC from real test cases
>>>>     * ability to turn into unit tests, which implies:
>>>>       * human-readable and editable
>>>>     * compatibility and stability: can load gcc 7 test cases into gcc 8;
>>>> have e.g. gcc 6 generate test cases
>>>>     * roundtrippable: can load the format, then save out the IR, and get
>>>> the same file, for at least some subset of the format (consider e.g.
>>>> location data: explicit location data can be roundtripped, implicit
>>>> location data not so much).
>>>>
>>>> ...which suggests that we'd want to use gimple dumps as the input
>>>> format to a test framework - which leads naturally to the idea of a
>>>> gimple frontend.
>>
>>
>> We already read and write gimple IL in LTO, we just do it in binary form.  I
>> think the kind of effort you are talking about here is best placed in
>> attaching a gimple parser to LTO, thus giving LTO the ability to read and
>> write textual gimple as well as the current binary form.     The current
>> dump format could in theory be a starting point, but its clearly missing
>> hunks of stuff.  there is probably a better representation.
>>
>> LTO already knows all the bits required to reconstruct gimple. The
>> definition of the textual representation can make intelligent choices about
>> defaults so that you don't have to specify every single bit in the textual
>> form that the binary form requires.  ThIs seems far easier to me than
>> starting with the incomplete form that the current dumps generate and trying
>> to discover what other bits need to be added to properly reconstruct the IL.
>> I think its hard to get a lot of the subtle things right.    I also think
>> the scope of defining and reading/writing should be relatively manageable.
>> We can optimize the details once its working.
>>
>> It would also be very useful then  to have LTO enhanced so that it can read
>> and write before or after any pass...  Then we can unit test any pass by
>> injecting the IL immediately before the pass..  No jumping through any hoops
>> to make sure the pass you care about sees the exact IL you want..   That is
>> also a good proof that the LTO form (both binary and text) does fully
>> represent gimple.  We can also use this output as our debugging dumps and
>> archive the current dumper.
>>
>> As gimple changes and evolves the result is only one place to worry about
>> for reading and writing...  and as we progress (slowly) towards uncoupling
>> the middle/backend from the front ends, we'd have a single well defined
>> "front end" for gimple that accepts binary or text.
> So I chose to reply to this one (and will refrain from replying to other but try
> to address comments there).
>
> First, while the LTO approach works it's quite overkill in the details
> it "dumps"
> and thus it's too closely tied to our internal bits which means testcases will
> bitrot too quickly for the number one goal of having human
> maintainable testcases.
>

The binary form is clearly tied to a lot of implementation bits, but I 
would think a lot of those bits have a reasonable default value that 
wouldn't have to be explicitly expressed in textual form, but could be 
if so desired via attributes, tags, new keywords,  or whatever.

  The current dumps are C-like and could work as a decent starting point 
for textual gimple input/output.   From the LTO vantage point, you can 
see all the other bits which might need to be expressed, and can get to 
them later.   That is "merely" the follow on hard work of flushing out 
the details :-)

I'd just hate to see a lot of work go into it and have it made 
completely redundant in a  few years by the presence of a new lto 
reader/writer than can do the same job.  Of course that's still blue-sky 
stuff and could never happen.

No matter what approach is taken, it would be good to keep in mind the 
possibility of enhancing it to be the LTO text reader so that decisions 
aren't made which make that impractical..    I don't think its on my hit 
list for a while yet... but it would be really  nice to be able to 
leverage any work that is done in this direction.  It would be ideal to 
be able to simply add enhancements to whatever we have to provide the 
rest of what LTO requires to be a complete reader/writer.

Andrew

      parent reply	other threads:[~2016-03-09 16:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 21:31 Prasad Ghangal
2016-03-06 11:03 ` Prasad Ghangal
2016-03-06 14:03   ` Trevor Saunders
2016-03-06 14:45   ` Diego Novillo
2016-03-06 15:43     ` Richard Biener
2016-03-07  6:27       ` Prasad Ghangal
2016-03-07 12:26         ` Richard Biener
2016-03-07 16:34           ` David Malcolm
2016-03-08  0:20             ` Trevor Saunders
2016-03-08 15:43               ` Manuel López-Ibáñez
2016-03-08 15:56                 ` Richard Biener
2016-03-08 16:48                   ` David Malcolm
2016-03-08 20:54                     ` Trevor Saunders
2016-03-08 21:01                     ` Manuel López-Ibáñez
2016-03-08 21:37                       ` Manuel López-Ibáñez
2016-03-08 22:00                       ` David Malcolm
2016-03-08 22:13                         ` Diego Novillo
2016-03-09  2:46                           ` Trevor Saunders
2016-03-09 19:47                             ` Manuel López-Ibáñez
2016-03-09 20:26                               ` Eric Botcazou
2016-03-09 23:57                               ` Trevor Saunders
2016-03-10  9:43                                 ` Prasad Ghangal
2016-03-10 10:46                               ` Richard Biener
2016-03-10 10:50                                 ` Richard Biener
2016-03-10 20:22                                   ` [PATCH] Hack to make gimple dump parseable as C (was Re: [gimplefe] [gsoc16] Gimple Front End Project) David Malcolm
2016-03-14 18:28                                 ` [gimplefe] [gsoc16] Gimple Front End Project Michael Matz
2016-03-15 15:16                                   ` Richard Biener
2016-03-15 16:46                                     ` Michael Matz
2016-03-18  5:55                                     ` Prathamesh Kulkarni
2016-03-18  9:23                                       ` Richard Biener
2016-03-20 23:13                                         ` Prasad Ghangal
2016-03-21  3:31                                           ` Trevor Saunders
2016-03-21 23:08                                             ` Prasad Ghangal
2016-03-22 10:57                                               ` Richard Biener
2016-03-22 13:45                                                 ` Prathamesh Kulkarni
2016-03-22 13:53                                                   ` Richard Biener
2016-03-23 23:45                                                     ` Prasad Ghangal
     [not found]                                                     ` <CAE+uiWae7zc_UFkbLBq6jQkOPj8VXaqVpa62ELYLUMX4=2uO5w@mail.gmail.com>
2016-03-24 13:31                                                       ` Richard Biener
2016-03-24 17:30                                                         ` David Malcolm
2016-03-24 18:04                                                           ` Richard Biener
2016-03-24 19:46                                                         ` Prasad Ghangal
2016-03-25  3:16                                                           ` Prathamesh Kulkarni
2016-03-25 10:24                                                             ` Prasad Ghangal
2016-03-22 10:53                                             ` Richard Biener
2016-03-09  1:05                         ` Jeff Law
2016-03-08 17:44                   ` Mikhail Maltsev
2016-03-09 14:27             ` Andrew MacLeod
2016-03-09 15:47               ` Richard Biener
2016-03-09 16:07                 ` Diego Novillo
2016-03-09 16:36                   ` Richard Biener
2016-03-09 16:40                 ` Andrew MacLeod [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E051E5.4010800@redhat.com \
    --to=amacleod@redhat.com \
    --cc=dmalcolm@redhat.com \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    --cc=prasad.ghangal@gmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=sandeep@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).