On Sat, 12 Feb 2005 06:33:42 -0700 (MST), Roger Sayle
<[EMAIL PROTECTED]> wrote:
> 
> On Sat, 12 Feb 2005, Nathan Sidwell wrote:
> > I question if it is better to fold early.  As I've said before, I think
> > the optimizations that fold performs should be turned into a proper SSA
> > optimization phase% -- that can be repeatedly applied as necessary.
> 
> As for a proper tree-ssa optimization pass, I believe Andrew Pinski's
> proposed tree-combiner pass which attempts to merge/combine consecutive
> tree statements and check whether the result can be folded, would fit
> your description.
> 
> However, the utility of early fold to the GCC compiler is much greater
> than simply compile-time evaluating expressions with constant operands.
> One of the reasons that fold is so fast, is that it can rely on the fact
> that all of a trees operands have already been folded.  In fact, much
> of the middle-end makes or can make use of the assumptions that constant
> operands to binary operators appear second, that a NOP_EXPRs only appear
> where needed, that NEGATE_EXPR never wraps another NEGATE_EXPR and that
> "x+x" and "2*x" are represented the same way.

And, for example, one problem I'm facing continuously is the lack
of a canonical way of representing array accesses - both the C and C++
frontend emit different initial trees for that.  And even the (maybe
nonexistant) semantic differences of the middle-end ARRAY_REF vs.
INDIRECT_REF/ADDR_EXPR is not clear to me.

Richard.

Reply via email to