Yet Another Hoopl Question

Jan Stolarek jan.stolarek at
Tue Aug 13 14:03:37 CEST 2013

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?


More information about the ghc-devs mailing list