This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] fold Reorganization Plan
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Nathan Sidwell <nathan at codesourcery dot com>, Kazu Hirata <kazu at cs dot umass dot edu>, gcc at gcc dot gnu dot org, dvorakz at suse dot cz
- Date: Sat, 12 Feb 2005 16:45:59 +0100
- Subject: Re: [RFC] fold Reorganization Plan
- References: <420E0817.3040303@codesourcery.com> <Pine.LNX.4.44.0502120603090.24655-100000@www.eyesopen.com>
- Reply-to: Richard Guenther <richard dot guenther at gmail dot com>
On Sat, 12 Feb 2005 06:33:42 -0700 (MST), Roger Sayle
<roger@eyesopen.com> 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.