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: Using fold() in frontends



On Mar 7, 2005, at 12:40, Giovanni Bajo wrote:\
But how are you proposing to handle the fact that the C++ FE needs to fold
constant expressions (in the ISO C++ sense of 'constant expressions)? For
instance, we need to fold "1+1" into "2" much before gimplification. Should
a part of fold() be extracted and duplicated in the C++ frontend?

Yes. As we've found out over and over again, the semantics of fold in the
various front ends and the middle end is not the same. While it is nice to
share code, when we end up placing an arbitrary restriction on our selves that
the same tool must be used for both hammering nails and driving screws, any
advantage of code reuse quickly disappears.


So, even if we end up copying a lot of the code, that's better than forced sharing.
After a while, both copies will indeed diverge and you'll end up with a good hammer
and a good screwdriver. Right now we're in a situation where improvement of one
use of fold, causes problems for its other use.


-Geert


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