public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Basile Starynkevitch <basile@starynkevitch.net>
To: Michael Matz <matz@suse.de>
Cc: Diego Novillo <dnovillo@google.com>,
	Sandeep Soni <soni.sandeepb@gmail.com>,
	 GCC LIST <gcc@gcc.gnu.org>
Subject: Re: Design Considerations of GIMPLE Front End
Date: Tue, 18 May 2010 14:30:00 -0000	[thread overview]
Message-ID: <1274193009.9116.13.camel@glinka> (raw)
In-Reply-To: <Pine.LNX.4.64.1005181552080.1097@wotan.suse.de>

On Tue, 2010-05-18 at 15:59 +0200, Michael Matz wrote:
> Hi,
> 
> On Tue, 18 May 2010, Diego Novillo wrote:
> 
> > On Mon, May 17, 2010 at 16:15, Sandeep Soni <soni.sandeepb@gmail.com> wrote:
> > 
> > > 1. What should be the format of representation of the GIMPLE tuples in 
> > >    text?
> > 
> > I liked Andrew's suggestion about S-expressions.
> 
> I can see that for describing types, maybe.  But isn't that artificially 
> awkward for representing tuple instructions?  I mean most instructions 
> will look like
> 
>   (= i_1 (+ k_1 m_1))
> or
>   (= j_1 (call func arg1 arg2))
> 
> I don't see how that is much easier to parse compared to
>   i_1 = k_1 + m_1
>   j_1 = func (arg1, arg2)

My intuition might be that once a Gimple parser exists, most of its use
would be writing various translators (e.g. external front-ends) to this
syntax, so people might probably code more Gimple-syntax printers than
Gimple-syntax parsers.

Still, I prefer the Lispy S-expression syntax everywhere -including
Gimple- because it is so simple to define and to implement, and because
GCC MELT already have [almost] the infrastructure for it.

However, I tend to think that the Gimple syntax would also [at least
optionally] contain the location information, so it would be instead
   (= (@ "foo.cobol" 23 2) i_1 (+ k_1 m_1)))
or even
   (= (@ "foo.cobol" 23 3) i_1 (+ (@ "foo.cobol" 23 5) k_1 m_1)))
I am using, perhaps wrongly, @ as an "operator" giving the location
information as a file name, line number, column number. I am not sure to
have the syntax right (because I am not sure to remember what exactly
has a location information).

I believe a Gimple-syntax should provide the features (or hooks, or
syntax) to convey all the Gimple information, and this includes the
source file location. This is needed both for external (GPLv3+ or
compatibly licensed) programs producing Gimple (such as an hypothetical
Cobol frontend) and for external (GPLv3+ or compatibly licensed)
programs consuming Gimple (like sophisticated static analyzers) or for
external programs both consuming & producing Gimple (e.g. an
"optimization" implemented by an external program).

Otherwise, what is the purpose of Gimple-syntax? Why making it if it
does not contain all the information inside GCC?


BTW, is it possible today to have a GCC plugin providing a front-end to
GCC? [last time I looked, I believe the answer is no]

Cheers.


  parent reply	other threads:[~2010-05-18 14:30 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 [this message]
2010-05-18 14:32       ` Richard Guenther
2010-05-18 14:47       ` Steven Bosscher
2010-06-04  8:24 ` Sebastian Pop

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=1274193009.9116.13.camel@glinka \
    --to=basile@starynkevitch.net \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    --cc=matz@suse.de \
    --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).