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

copperma@grenoble.rxrc.xerox.com (Max Copperman)
Fri, 28 Apr 1995 18:58:02 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: copperma@grenoble.rxrc.xerox.com (Max Copperman)
Keywords: optimize
Organization: Rank Xerox Research Centre - Grenoble Laboratory
References: 95-04-112
Date: Fri, 28 Apr 1995 18:58:02 GMT

11harmanm@unl.ac.uk (Mark Harman) writes:
>
> 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.


In the general case you can't do it, because the order of evaluation is not
fixed. There are sequence points, but in between two sequence points the
language does not define evaluation order. Consider foo(i++) where i is
global and used within foo().


A program with evaluation order dependencies has is semantically ambiguous
between the semantics of each possible evaluation order. You can't
represent more than one evaluation order in a program with no side
effects, thus it would take multiple no-side-effect programs to
represent the semantics of an evaluation-order-dependent program.


Chances are a program with evaluation order dependencies is buggy, unless
it is an example for a programming language class.


As far as how to do the transformations, you might try looking for
papers on Single Assignment (or Static Single Assignment) languages.


Max Copperman
--


Post a followup to this message

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