Related articles |
---|
Side effects in expressions mikov@usa.net (Tzvetan Mikov) (1999-08-18) |
Re: Side effects in expressions johnmce@world.std.com (1999-08-18) |
Re: Side effects in expressions johnmce@world.std.com (1999-08-21) |
From: | johnmce@world.std.com (John McEnerney) |
Newsgroups: | comp.compilers |
Date: | 21 Aug 1999 01:55:45 -0400 |
Organization: | Metrowerks, Inc. |
References: | 99-08-078 99-08-082 |
Keywords: | analysis, optimize |
Tzvetan Mikov" <mikov@usa.net> wrote:
> > So, this expression is calculated correctly and we can even easily apply a
> > very simple common sub-expression elimination. What happens however if we
> > have sub-expressions with side effects? Examine this C code:
> > int * p = ...;
> > x = *(p = p + 1) + *(p = p + 1);
johnmce@world.std.com (John McEnerney) wrote:
> But I think that the usual understanding is that during translation
> from abstract syntax trees to IL, side-effecting expressions are
> hoisted as if they were independent statements. This is also true of
> flow-of-control operators like && and || and ?:.
>
> So all side-effects occur as the "root" of the expressions that
> contain them.
Oops. I meant to say: side-effects are hoisted so that they become roots
of their own expression trees.
--
John McEnerney (mcenerney@metrowerks.com)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.