The GIMPLE and GENERIC pattern matching project match-and-simplify tries to address several issues.
To address these the project introduces a simple domain specific language to write expression simplifications from which code targeting GIMPLE and GENERIC is auto-generated. The GENERIC variant follows the fold_buildN API while for the GIMPLE variant and to address 2) new APIs are introduced.