Forgive me for asking the classic question: "What are you really trying to do?"
Edward Excerpts from Simon Marlow's message of Tue Aug 13 09:25:51 -0400 2013: > On 13/08/13 13:03, Jan Stolarek wrote: > > I have yet another Hoopl question. One of my rewrites allocates a new > > unique local register and this register is later added as a fact. So I have > > Cmm code that looks like this: > > > > I32[(old + 4)] = complicated_expr > > > > which is rewritten to: > > > > newReg1 = complicated_expr > > I32[(old + 4)] = newReg1 > > > > and then I add { I32[(old + 4)] = newReg1 } as a fact. When Hoopl reaches > > end of the iteration it realizes it has learned some new facts, so it keeps > > the facts (including fact about a new unique register) and discards > > rewritten graph (including said new register). In the next iteration it > > performs the rewrite again, allocating a different new register and adding > > fact about this different register. At the end of this iteration same thing > > happens again: facts are kept, rewrite is discarded. And so my code falls > > into an infinite loop, because every time I'm allocating a different > > register and every time hoopl thinks it learned sth new and discards the > > rewritten graph. How can I perform this rewrite and avoid falling into a > > loop? > > Your transfer function is not monotonic, because each time you apply it > it gives a different result. > > The next question is "well how do I do this then?". I'm not quite sure, > maybe you need to use a deterministic name supply monad. > > Cheers, > Simon > _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs