Mike Stump <[EMAIL PROTECTED]> writes: > On Apr 10, 2007, at 10:53 AM, Ian Lance Taylor wrote: > > 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? > > Hum... Almost sounds like a job for a template... [ takes step > backwards ]
I think making this work as a template would be kind of tough, actually, if you think about the details (e.g., PLUS_EXPR vs. PLUS vs. GS_PLUS_EXPR). Doable but rather awkward. I guess you could use dozens of template parameters, most of them integers providing the code values. Virtual functions and a table of operator codes would probably work just as well, and be slightly more comprehensible. Ian