public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <sebpop@gmail.com>
To: Sandeep Soni <soni.sandeepb@gmail.com>
Cc: GCC LIST <gcc@gcc.gnu.org>, Diego Novillo <dnovillo@google.com>
Subject: Re: Design Considerations of GIMPLE Front End
Date: Fri, 04 Jun 2010 08:24:00 -0000	[thread overview]
Message-ID: <AANLkTikMf02VcKshs45dMd-K5bLVWw2o25o7dnMra2zh@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinl4LsRATSj0LtJPJIHUV02S8vSHmufYBKzld86@mail.gmail.com>

Hi,

On Mon, May 17, 2010 at 15:15, Sandeep Soni <soni.sandeepb@gmail.com> wrote:
> Hi,
>
> As part of GSoC 2010, I am developing a front end for GIMPLE.
> You can find the basic theme of the project at:
> http://gcc.gnu.org/wiki/GimpleFrontEnd
>
> One of the most important components in this GIMPLE Front End is to
> convert the GIMPLE tuples into text.
> How such a textual representation should be, will obviously dictate
> the design and complexity of the
> subsequent parsing component. So, as per Diego's suggestion, to have a
> view on some of the issues
> I have started this thread.
>
> Following are some of the issues/questions that have come  up:
>
> 1. What should be the format of representation of the GIMPLE tuples in text?
>
>   Ideally, the textual representation should be satisfying two goals:
> Easy to parse and easy for a programmer
>   to write by hand.Considering this,what is the best way in which the
> GIMPLE tuples be represented.
>
>   For example:
>   A textual GIMPLE tuple for the statement a=b+c can be like
>   <GIMPLE_ASSIGN<PLUS_EXPR,a,b,c>>  (As demonstrated by the internal
> manual also).
>   Is such a representation easy to parse?
>
>   The other alternative is to represent the tuples in a C-like syntax
> much like what -fdump-tree-gimple flag does.
>
>   Which is more better? In terms of ease in parsing, intuitiveness
> for a programmer to code by hand etc.
>   Any other alternative?
>
> 2. The most important aspect in the representation is that of types.
> Since there are many possibilities in
>   the types, mapping each in a common representation can be
> difficult. An approach suggested by Diego is to
>   read what fields are read from 'tree' structures and then lay out
> the tuples as follows:
>
>   <TREE_TYPE <name, size, ...>>
>
>   So, we make all the sub-structures into nested tuples. This seems
> to be easy to parse.
>   Again the question: Are there any ideas from anybody about the way
> the types be
>   represented so that the parsing becomes simple?
>
> 3. Finally, what could be the overall structure of such a textual
> gimple file. A possible way could be to have the
>    same structure as the sections encoded in the bytestream.So we can
> have a section for types, symbols,
>    function bodies etc. Such a simple structure will be helpful for
> any programmer and be relatively easy to parse.
>    Any other ideas? arguments against such a structure?
>
>
> So, If there are any alternative ideas to any one of these or
> arguments in favour of /against the ideas presented
> in this mail. Please add it to this thread.

Please have a look at the LLVM language specification:
http://llvm.org/docs/LangRef.html
that should give you a good intuition of what you need to represent
for GIMPLE, and how the LLVM file format is structured.

Would LLVM be acceptable to dump the GIMPLE representation?
In which case you would have an implementation of the pretty printer,
and you would need a parser of LLVM to get that representation back
to GCC.

Sebastian

      parent reply	other threads:[~2010-06-03 23:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 20:21 Sandeep Soni
2010-05-17 21:04 ` Andrew Haley
2010-05-18  3:25   ` Sandeep Soni
2010-05-18  8:39     ` Andrew Haley
2010-05-18 13:18 ` Diego Novillo
2010-05-18 14:00   ` Michael Matz
2010-05-18 14:09     ` Diego Novillo
2010-05-18 14:18       ` Steven Bosscher
2010-05-18 14:46         ` Dave Korn
2010-05-18 14:52           ` Andrew Haley
     [not found]             ` <AANLkTilQWdLDrQypzwqbzTKsUYKyPKMvHMKVClFvZJWH@mail.gmail.com>
2010-05-18 15:04               ` Diego Novillo
2010-05-18 15:24                 ` Sandeep Soni
2010-05-18 14:30     ` Basile Starynkevitch
2010-05-18 14:32       ` Richard Guenther
2010-05-18 14:47       ` Steven Bosscher
2010-06-04  8:24 ` Sebastian Pop [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=AANLkTikMf02VcKshs45dMd-K5bLVWw2o25o7dnMra2zh@mail.gmail.com \
    --to=sebpop@gmail.com \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    --cc=soni.sandeepb@gmail.com \
    /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).