- = UnfoldNever
- | UnfoldIfGoodArgs Int -- and "n" value args
-
- [Int] -- Discount if the argument is evaluated.
- -- (i.e., a simplification will definitely
- -- be possible). One elt of the list per *value* arg.
-
- Int -- The "size" of the unfolding; to be elaborated
- -- later. ToDo
-
- Int -- Scrutinee discount: the discount to substract if the thing is in
- -- a context (case (thing args) of ...),
- -- (where there are the right number of arguments.)
-
+ = UnfoldAlways -- There is /no original definition/, so you'd better unfold.
+ -- The unfolding is guaranteed to have no free variables
+ -- so no need to think about it during dependency analysis
+
+ | InlineRule { -- See Note [InlineRules]
+ -- Be very keen to inline this
+ -- The uf_tmpl is the *original* RHS; do *not* replace it on
+ -- each simlifier run. Hence, the *actual* RHS of the function
+ -- may be different by now, because it may have been optimised.
+ ug_ir_info :: InlineRuleInfo, -- Supplementary info about the InlineRule
+ ug_small :: Bool -- True <=> the RHS is so small (eg no bigger than a call)
+ -- that you should always inline a saturated call,
+ } -- regardless of how boring the context is
+ -- See Note [INLINE for small functions] in CoreUnfold]
+
+ | UnfoldIfGoodArgs { -- Arose from a normal Id; the info here is the
+ -- result of a simple analysis of the RHS
+
+ ug_args :: [Int], -- Discount if the argument is evaluated.
+ -- (i.e., a simplification will definitely
+ -- be possible). One elt of the list per *value* arg.
+
+ ug_size :: Int, -- The "size" of the unfolding.
+
+ ug_res :: Int -- Scrutinee discount: the discount to substract if the thing is in
+ } -- a context (case (thing args) of ...),
+ -- (where there are the right number of arguments.)
+
+ | UnfoldNever
+
+data InlineRuleInfo
+ = InlSat -- A user-specifed or compiler injected INLINE pragma
+ -- ONLY inline when it's applied to 'arity' arguments
+
+ | InlUnSat -- The compiler decided to "capture" the RHS into an
+ -- InlineRule, but do not require that it appears saturated
+
+ | InlWrapper Id -- This unfolding is a the wrapper in a
+ -- worker/wrapper split from the strictness analyser
+ -- Used to abbreviate the uf_tmpl in interface files
+ -- which don't need to contain the RHS;
+ -- it can be derived from the strictness info
+
+------------------------------------------------