This is the mail archive of the gcc@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: Language-independent functions-as-trees representation


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.


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