Add new ForceSpecConstr annotation
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 3 Dec 2009 06:54:55 +0000 (06:54 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 3 Dec 2009 06:54:55 +0000 (06:54 +0000)
commit1935c449d514f12d2dea33c7d52fe11b6bc60bb2
tree2484904204dbbedd0e97f51d7b0e083c5a8754ed
parent95d4b4c552cef8a33bbfb37361e90c079d65134b
Add new ForceSpecConstr annotation

Annotating a type with {-# ANN type T ForceSpecConstr #-} makes SpecConstr
ignore -fspec-constr-threshold and -fspec-constr-count for recursive functions
that have arguments of type T. Such functions will be specialised regardless
of their size and there is no upper bound on the number of specialisations
that can be generated. This also works if T is embedded in other types such as
Maybe T (but not T -> T).

T should not be a product type because it could be eliminated by the
worker/wrapper transformation. For instance, in

data T = T Int Int

foo :: T -> Int
foo (T m n) = ... foo (T m' n') ...

SpecConstr will never see the T because w/w will get rid of it. I'm still
thinking about whether fixing this is worthwhile.
compiler/specialise/SpecConstr.lhs