• simonpj@microsoft.com's avatar
    Implement -fexpose-all-unfoldings, and fix a non-termination bug · 6a944ae7
    simonpj@microsoft.com authored
    The -fexpose-all-unfoldings flag arranges to put unfoldings for *everything*
    in the interface file.  Of course,  this makes the file a lot bigger, but
    it also makes it complete, and that's great for supercompilation; or indeed
    any whole-program work.
    
    Consequences:
      * Interface files need to record loop-breaker-hood.  (Previously,
        loop breakers were never exposed, so that info wasn't necessary.)
        Hence a small interface file format change. 
    
      * When inlining, must check loop-breaker-hood. (Previously, loop
        breakers didn't have an unfolding at all, so no need to check.)
    
      * Ditto in exprIsConApp_maybe.  Roman actually tripped this bug, 
        because a DFun, which had an unfolding, was also a loop breaker
    
      * TidyPgm.tidyIdInfo must be careful to preserve loop-breaker-hood
    
    So Id.idUnfolding checks for loop-breaker-hood and returns NoUnfolding
    if so. When you want the unfolding regardless of loop-breaker-hood, 
    use Id.realIdUnfolding.
    
    I have not documented the flag yet, because it's experimental.  Nor
    have I tested it thoroughly.  But with the flag off (the normal case)
    everything should work.
    6a944ae7
Simplify.lhs 89.4 KB