Re: Q: Side effect removal transformations (Source to source)

sethml@gluttony.ugcs.caltech.edu (Seth LaForge)
Tue, 18 Apr 1995 20:12:04 GMT

          From comp.compilers

Related articles
Q: Side effect removal transformations (Source to source) 11harmanm@unl.ac.uk (1995-04-12)
Re: Q: Side effect removal transformations (Source to source) sethml@gluttony.ugcs.caltech.edu (1995-04-18)
Re: Q: Side effect removal transformations (Source to source) copperma@grenoble.rxrc.xerox.com (1995-04-28)
| List of all articles for this month |

Newsgroups: comp.compilers
From: sethml@gluttony.ugcs.caltech.edu (Seth LaForge)
Keywords: optimize
Organization: California Institute of Technology, Pasadena, CA
References: 95-04-112
Date: Tue, 18 Apr 1995 20:12:04 GMT

Mark Harman <11harmanm@unl.ac.uk> wrote:
>The transformations I'm looking for would transform a C program with side
>effects in its expressions into a semantically equivelent program (in C) with
>no side effects.
>
>For example, the program fragment:-
>
>x = y++ ;
>if (z=++i>2) x++ ;
>
>could be transformed to
>
>x = y;
>y = y+1;
>i = i+1;
>z = i;
>if(z>2) x=x+1;
                  ^^^^^
Umm, x=x+1 is a side effect; it changes the value of x as a result of
evaluating x=x+1. If you want to do the above with truly no side
effects, you'd have to use recursion.


Seth


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.