On Tue, Apr 10, 2007 at 08:48:27PM -0400, Diego Novillo wrote: > Sure, but things will be different if/when the operands stop being 'tree'.
We'll burn that bridge when we come to it. It's possible to parameterize the fold-const even further. One passes in void* instead of tree, and have a set of callbacks that queries the things of interest, such as the type or sub-operands. While in the front ends, these callbacks are just wrappers around the existing macros. While operating on gimple ssa_names (for instance), these callbacks dig the type out from SSA_NAME->DECL->TYPE. When we're interested in local simplifications, we arrange for all sub-operands to return NULL. When we're interested in global simplifications (tree-combine?), we can allow "sub-operands" to mean the ssa_name's definition. r~