Geert Bosch wrote:
Front ends should be responsible for doing any constant folding that their language definition requires. Otherwise, you'd get the strange situation that legality of a program depends on the strength of the optimizers, compilation flags used or even target properties.
I entirely agree. Unfortunately what we have now is not that -- fold is doing both optimization and (some) C & C++ semantic stuff.
Your proposal to have the tree folders check wether the program obeys C/C++ languages semantics seems fundamentally flowed.
That is not my proposal. I'm sorry if I gave the impression it was, but it isn't. (What I meant by a tree folders in that regard was an FE-specific folder.)
Constant folding as required by language standards has a very precise definition, and does not depend on compilation options or optimization parameters. When the FE hands of a tree to the middle end, it asserts that the program conforms to the static semantics of the programming language.
This gives the optimizers the freedom to do any transformations, as long as it conforms to the language-independent definition of GIMPLE.
Yup, you're reiterating my position :)
nathan
-- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC [EMAIL PROTECTED] :: http://www.planetfall.pwp.blueyonder.co.uk