public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Missed optimization in simple_cst_equal() and has_cleanups()?
@ 1998-08-24 18:48 grahams
  0 siblings, 0 replies; 3+ messages in thread
From: grahams @ 1998-08-24 18:48 UTC (permalink / raw)
  To: egcs

Hi

There are a couple of routines in tree.c (simple_cst_equal, has_cleanups)   
which try
to answer a couple of simple questions. These routine return either a   
definative
yes/no or a "don't know". They return a "don't know" if they encounter a   
language
specific tree code.

If instead of returning "don't know" the question was passed onto the   
language specific
code to supply the answer then this might open up possibilities for   
optimizations which
at present are missed (ie the language specific code might have been able   
to give
a definitive yes/no answer).

Obviously the language specific code could just return "I don't know" if   
there is no quick
and easy answer.

My question is are there any language specific tree nodes where the   
language specific code
could provide a quick and easy answer to either of these questions with a   
definitive yes/no?

Does anybody have any comments.

Graham

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Missed optimization in simple_cst_equal() and has_cleanups()?
  1998-08-25  5:21 Mike Stump
@ 1998-08-25 19:31 ` Toon Moene
  0 siblings, 0 replies; 3+ messages in thread
From: Toon Moene @ 1998-08-25 19:31 UTC (permalink / raw)
  To: Mike Stump; +Cc: egcs, grahams

>> There are a couple of routines in tree.c (simple_cst_equal,
>> has_cleanups) which try to answer a couple of simple
>> questions. These routine return either a definative yes/no or a
>> "don't know". They return a "don't know" if they encounter a
>> language specific tree code.

>> If instead of returning "don't know" the question was passed onto
>> the language specific code to supply the answer

>  In general, it was done this way because the primary
>  maintainer at the time (kenner, rms) didn't understand
>  some of the concepts of object oriented design.  I
>  consider it mostly a legacy issue now.  If one visualizes
>  the code in C++, one realizes this could just be a virtual
>  function...  :-)  I don't think the concept of a virtual
>  function is entirely without merit.

Hmmm, perhaps it's just my bias with imperative programming, but I  
don't see the need for object oriented design here.  As far as I  
know it is quite common that compiler backends "call back" routines  
in the (various) frontends to decide stuff that's language  
dependent; it's one way to implement language dependent alias  
analysis, for example: (backend):  Hey frontend, I've two items X  
and Y here, do you think that - according to your language rules -  
they can overlap (Yes/No/Dunno).

Cheers,
Toon.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Missed optimization in simple_cst_equal() and has_cleanups()?
@ 1998-08-25  5:21 Mike Stump
  1998-08-25 19:31 ` Toon Moene
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Stump @ 1998-08-25  5:21 UTC (permalink / raw)
  To: egcs, grahams

> From: grahams@rcp.co.uk
> Date: Mon, 24 Aug 1998 10:44:41 GMT
> To: egcs@cygnus.com

> There are a couple of routines in tree.c (simple_cst_equal,
> has_cleanups) which try to answer a couple of simple
> questions. These routine return either a definative yes/no or a
> "don't know". They return a "don't know" if they encounter a
> language specific tree code.

> If instead of returning "don't know" the question was passed onto
> the language specific code to supply the answer

In general, it was done this way because the primary maintainer at the
time (kenner, rms) didn't understand some of the concepts of object
oriented design.  I consider it mostly a legacy issue now.  If one
visualizes the code in C++, one realizes this could just be a virtual
function...  :-)  I don't think the concept of a virtual function is
entirely without merit.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-08-25 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-24 18:48 Missed optimization in simple_cst_equal() and has_cleanups()? grahams
1998-08-25  5:21 Mike Stump
1998-08-25 19:31 ` Toon Moene

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).