Hi: On 09 Dec 2011, at 18:10, Lukas Renggli wrote:
I basically want to be able to automatically reduce the number of temps for the following example to one:
| t1 t2 | t1 := o1 foo. o2 bar: t1. o3 bar: t1.
t2 := o1 foo. o2 bar: t2. o3 bar: t2.
Of course it is slightly more complex than that, because the usage of the temps is not just in a sequence, but can be also in blocks, or nested expressions.
But in this simple example, I could remove t2 and use t1 instead.
No, "o1 foo", "o2 bar: t1", "o3 bar: t1" could have side-effects that influence what "o1 foo" returns. No tool on the world (without additional knowledge) can safely replace "t2" with "t1".
It is about the slot, not about the value. This is a perfectly legal transformation: | t1 | t1 := o1 foo. o2 bar: t1. o3 bar: t1. t1 := o1 foo. o2 bar: t1. o3 bar: t1. That is the same what register allocators do. t1, as a slot, is not going to be read anymore, thus, the slot can be used to hold another temporary value. Well, anyway, I just hope that I can work around the frame size limitations when I encounter them in real code. Thanks Stefan
Lukas
-- Lukas Renggli www.lukas-renggli.ch
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525