This is the mail archive of the gcc-patches@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: [PATCH] improve C++ code by changing fold-const.c


Andrew Pinski wrote:


On May 21, 2004, at 22:02, Mark Mitchell wrote:


Strongly agree.
There are places in the front ends, at least that assume that the tree structure is type correct, using explicit NOP_EXPRs to convert where necessary. If the optimizers are confused by NOP_EXPRs, then they should be fixed -- that should generally be an easy fix. (Note that a NOP_EXPR is a promise that the underlying bits do not change.)


Maybe it is just me but the underlying types are the same as in the second series
of patches I just check for equality instead of compatibly (which I thought would
do the right thing any ways as the C++ front-end uses same_type_p which calls comptypes
which is what the langhook does).

More fundamentally, I want to see the C++ front end represent code in a manner that is as close as possible to the original source code -- except that things like overloading should be resolved, implicit conversions should be made explicit, etc. Part of the reason for that is to that the C++ front end can be used for other things in other contexts. If it weren't necessary to fold constants in order to perform certain semantic checks in C++, I wouldn't even bother with that!


The optimizers should be capable of resolving these kinds of things themselves.

Oh by the way I notice that C++ front-end uses CONVERT_EXPR instead of NOP_EXPR
when converting between pointer and reference types anyways which is wrong as
CONVERT_EXPR is defined as creating code which this conversion does not. There
are most likely more like this.

Yes, that certainly sounds like a bug.


--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


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