[MLton-devel] Re: PRE in MLton
Tom Murphy
tom7@cs.cmu.edu
Tue, 15 Apr 2003 18:16:55 -0400 (EDT)
Yes, and then even global CSE will hoist invariant code. But it might grow
the code quite a bit, because the body gets duplicated.
Better is to move the test at the beginning of the loop to both the
beginning and end:
F:
case n of
0 => Ldone
_ => Lhead
Lhead:
... here is where hoisted code goes ...
GOTO Lbody
Lbody:
... body of loop ...
n = n - 1
case n of
0 => Ldone
_ => Lbody
- Tom
> Isn't the transformation to handle the while vs. do-while simply one of
> unrolling recursive functions once. I.e., all uses of f (except those in the
> body of f) are replaced with calls to f'. The definition of f' is identical
> to the definition of f.
>
[ NEW! : http://tom7.org/ ]
[ OLD! : http://fonts.tom7.com/ ]
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel