diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-02-17 00:01:46 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-02-17 00:03:59 +0000 |
commit | e52a335d3ae2437f3705baa8c81e3a62ebdd75ab (patch) | |
tree | 000c6aa099d73ec8cebad04f00dcab2c03ff1cbe | |
parent | f4aa9984790332a908e8b1321d00a839fb42c3ea (diff) | |
download | haskell-e52a335d3ae2437f3705baa8c81e3a62ebdd75ab.tar.gz |
Comments only, about inl_inline and inl_act
-rw-r--r-- | compiler/basicTypes/BasicTypes.hs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index 5af90171d6..03e588cd93 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -1144,7 +1144,7 @@ data RuleMatchInfo = ConLike -- See Note [CONLIKE pragma] data InlinePragma -- Note [InlinePragma] = InlinePragma { inl_src :: SourceText -- Note [Pragma source text] - , inl_inline :: InlineSpec + , inl_inline :: InlineSpec -- See Note [inl_inline and inl_act] , inl_sat :: Maybe Arity -- Just n <=> Inline only when applied to n -- explicit (non-type, non-dictionary) args @@ -1154,6 +1154,7 @@ data InlinePragma -- Note [InlinePragma] -- the Unfolding, and don't look at inl_sat further , inl_act :: Activation -- Says during which phases inlining is allowed + -- See Note [inl_inline and inl_act] , inl_rule :: RuleMatchInfo -- Should the function be treated like a constructor? } deriving( Eq, Data ) @@ -1168,9 +1169,8 @@ data InlineSpec -- What the user's INLINE pragma looked like deriving( Eq, Data, Show ) -- Show needed for Lexer.x -{- -Note [InlinePragma] -~~~~~~~~~~~~~~~~~~~ +{- Note [InlinePragma] +~~~~~~~~~~~~~~~~~~~~~~ This data type mirrors what you can write in an INLINE or NOINLINE pragma in the source program. @@ -1186,6 +1186,23 @@ If inl_inline = Inline or Inlineable, then the Id should have an InlineRule unfo If you want to know where InlinePragmas take effect: Look in DsBinds.makeCorePair +Note [inl_inline and inl_act] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* inl_inline says what the user wrote: did she say INLINE, NOINLINE, + INLINABLE, or nothing at all + +* inl_act says in what phases the unfolding is active or inactive + E.g If you write INLINE[1] then inl_act will be set to ActiveAfter 1 + If you write NOINLINE[1] then inl_act will be set to ActiveBefore 1 + If you write NOINLINE[~1] then inl_act will be set to ActiveAfter 1 + So note that inl_act does not say what pragma you wrote: it just + expresses its consequences + +* inl_act just says when the unfolding is active; it doesn't say what + to inline. If you say INLINE f, then f's inl_act will be AlwaysActive, + but in addition f will get a "stable unfolding" with UnfoldingGuidance + that tells the inliner to be pretty eager about it. + Note [CONLIKE pragma] ~~~~~~~~~~~~~~~~~~~~~ The ConLike constructor of a RuleMatchInfo is aimed at the following. |