Ian Lance Taylor wrote on 04/10/07 13:53: > I seem to recall that at one point somebody worked on a gensimplify > program or something like that. Would it make sense to revive that > approach, and use it to generate simplifiers for trees, GIMPLE, and > RTL, to avoid triplification of these basic optimizations?
Perhaps. This would allow us to define folding/simplification using a pattern matching system. I think I like this better than the other two choices. Replicating fold-const.c for GIMPLE would involve a bit of code duplication, but since GIMPLE is a strict subset of ASTs, I think it would be a fraction of what we have today. Still, it's annoying and we should probably avoid it. > Or should we instead rewrite fold-const.c to work on GIMPLE rather > than trees, thus essentially removing constant folding from the > front-ends? If we follow that path somebody would need to think about > the effect on warnings issued by the front-end, and on > __builtin_constant_p. I don't think we want to do that. Folding and simplification needs to be done at just about every level.