Implement -fexpose-all-unfoldings, and fix a non-termination bug
authorsimonpj@microsoft.com <unknown>
Thu, 19 Nov 2009 12:57:11 +0000 (12:57 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 19 Nov 2009 12:57:11 +0000 (12:57 +0000)
commit6a944ae7fe1e8e2e456c68717188463263f8978f
tree8a190b684af10b9e4fef1ed6ad397b0d346dc055
parentc93e8323ab49dd369e8b5f04027462a6fc1b8249
Implement -fexpose-all-unfoldings, and fix a non-termination bug

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.
17 files changed:
compiler/basicTypes/BasicTypes.lhs
compiler/basicTypes/Id.lhs
compiler/basicTypes/IdInfo.lhs
compiler/coreSyn/CoreFVs.lhs
compiler/coreSyn/CoreUnfold.lhs
compiler/coreSyn/CoreUtils.lhs
compiler/deSugar/DsBinds.lhs
compiler/iface/BinIface.hs
compiler/iface/IfaceSyn.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/main/DynFlags.hs
compiler/main/TidyPgm.lhs
compiler/prelude/PrelRules.lhs
compiler/simplCore/OccurAnal.lhs
compiler/simplCore/Simplify.lhs
compiler/specialise/Specialise.lhs