Hmm,  this all reminds me about the approach Andrew Pinski and I came
up with two years ago.  All in all I think it might be worth to
express folding-patterns in a more abstract way.  So the md-like Lisp
syntax for this seems to be just stringent.  We make use of such a
script-language already for machine-description.

Nevertheless I doubt that we really want to have same facility for
fold-const and gimple.  Instead I got the impression that we would
prefer to have all folding-optimizations instead in Middle-end
(GIMPLE).  We need folding in front-end (AST) mostly for determination
of constant-expression detection. Otherwise we want to keep maximum of
original AST to have best results for debugging (and even to think
about having alternative FE on our middle/backend) and code-analyzers.

So I doubt that we want to keep fold-const patterns similar to gimple
(forward-prop) ones.
Wouldn't it make more sense to move fold-const patterns completely
into gimple, and having a facility in FE to ask gimple to *pre*-fold a
given tree to see if a constant-expression can be achieved?

Regards,
Kai

Reply via email to