This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Language-independent functions-as-trees representation
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Richard Henderson <rth at redhat dot com>, Per Bothner <per at bothner dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 22 Jul 2002 17:20:52 -0400
- Subject: Re: Language-independent functions-as-trees representation
- Organization: Red Hat Canada
- References: <wvllm86k1m1.fsf@prospero.cambridge.redhat.com> <21910000.1027285094@warlock.codesourcery.com>
On Sun, 21 Jul 2002, Mark Mitchell wrote:
>
>
> --On Saturday, July 20, 2002 01:47:18 PM +0100 Jason Merrill
> <jason@redhat.com> wrote:
>
> >I'd like to return to the discussion of a language-independent
> >functions-as-trees representation that was going on in January.
>
> I don't have much of an opinion about this once we get to SIMPLE, at
> least not yet.
>
> My disagreement with Per is closer to the front end; I would really
> like the internal representation produced from C++ semantic analysis
> to look like C++ -- with various implicit things made explict (like
> default arguments, choice of overloaded function, choice of template
> specialization, action to take on cleanup of object, etc.)
>
> In SIMPLE, one place where I would like the statement/expression to come
> in to play is the following:
>
> If two expressions are "the same", i.e., both are "x + y", then they
> are actually the same pointer.
>
This sharing has given us no end of headaches. The problem is
that the current definition of 'same' is purely syntactic. Since
we are re-writing these expressions, the test of equality must
consider data flow:
(A) (B)
a = x + y; a = x + y;
x = 3; b = x + y;
b = x + y;
In (A), sharing "x + y" causes PRE to generate the wrong code.
The same doesn't happen in (B). Jason and Daniel had given other
examples elsewhere in this thread.
So, we can only set up the sharing after computing data flow
information. That means that the parser shouldn't be sharing
expressions because it cannot possibly determine if two
expressions are the same.
Diego.