Major improvement to SpecConstr
authorsimonpj@microsoft.com <unknown>
Fri, 9 Feb 2007 17:36:45 +0000 (17:36 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 9 Feb 2007 17:36:45 +0000 (17:36 +0000)
commitcac2aca1e1874e936f3ef15ca2a81a32c7863750
treec119a5ee110e4ff444a19d3f93e9c94c66fd3c61
parente9f23b4cc3df781f2fc84b48716a7779ecc8ab06
Major improvement to SpecConstr

This patch improves the SpecConstr pass, by
  a) making it work with join points
  b) making it generate specialisations transitively

As part of it, SpecConstr now carries a substitution with it, which
runs over the whole program as it goes.  This turned out to be
a big win; simplified the implementation quite a bit.

I have *disabled* the specialisation on lambdas; it's pretty fragile,
and sometimes generates more and more specialisations. Something to
come back to, perhaps.

I rejigged the flag-handling a bit.  Now the specification of passes
in DynFlags is a bit nicer; see
- optLevelFlags top-level data structure
- runWhen function
- CoreDoPasses constructor

There are now command-line flags
-fspec-constr
-fliberate-case
-fspec-threshold=N
which do the obvious thing.  -O2 switches on both spec-constr and liberate-case.
You can use -fno-liberate-case, -fno-spec-constr after -O2 to switch them off again.

The spec-threshold applies to both these transformations; default value 200 for now.
compiler/coreSyn/CoreSubst.lhs
compiler/coreSyn/CoreUnfold.lhs
compiler/coreSyn/CoreUtils.lhs
compiler/main/DynFlags.hs
compiler/simplCore/LiberateCase.lhs
compiler/simplCore/SimplCore.lhs
compiler/specialise/SpecConstr.lhs