[commit: ghc] master: Support SCC pragmas in declaration context (98b2c50)

git at git.haskell.org git at git.haskell.org
Wed Jul 20 09:34:38 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/98b2c5088a6f1a3b40c6eedc69d9204ba53690d3/ghc

>---------------------------------------------------------------

commit 98b2c5088a6f1a3b40c6eedc69d9204ba53690d3
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Wed Jul 20 09:33:43 2016 +0000

    Support SCC pragmas in declaration context
    
    Not having SCCs at the top level is becoming annoying real quick. For
    simplest cases, it's possible to do this transformation:
    
        f x y = ...
        =>
        f = {-# SCC f #-} \x y -> ...
    
    However, it doesn't work when there's a `where` clause:
    
        f x y = <t is in scope>
          where t = ...
        =>
        f = {-# SCC f #-} \x y -> <t is out of scope>
          where t = ...
    
    Or when we have a "equation style" definition:
    
        f (C1 ...) = ...
        f (C2 ...) = ...
        f (C3 ...) = ...
        ...
    
    (usual solution is to rename `f` to `f'` and define a new `f` with a
    `SCC`)
    
    This patch implements support for SCC annotations in declaration
    contexts. This is now a valid program:
    
        f x y = ...
          where
            g z = ...
            {-# SCC g #-}
        {-# SCC f #-}
    
    Test Plan: This passes slow validate (no new failures added).
    
    Reviewers: goldfire, mpickering, austin, bgamari, simonmar
    
    Reviewed By: bgamari, simonmar
    
    Subscribers: simonmar, thomie, mpickering
    
    Differential Revision: https://phabricator.haskell.org/D2407


>---------------------------------------------------------------

98b2c5088a6f1a3b40c6eedc69d9204ba53690d3
 compiler/deSugar/DsMeta.hs                         |  4 +--
 compiler/hsSyn/HsBinds.hs                          | 24 +++++++++++++-
 compiler/parser/Parser.y                           | 38 +++++++++++++++-------
 compiler/rename/RnBinds.hs                         |  9 +++++
 compiler/typecheck/TcBinds.hs                      | 23 ++++++++++++-
 compiler/typecheck/TcSigs.hs                       |  3 +-
 docs/users_guide/8.2.1-notes.rst                   |  4 +++
 docs/users_guide/profiling.rst                     | 21 ++++++++++--
 testsuite/config/ghc                               |  2 ++
 testsuite/tests/profiling/should_run/all.T         |  5 +++
 .../tests/profiling/should_run/toplevel_scc_1.hs   | 23 +++++++++++++
 .../should_run/toplevel_scc_1.prof.sample          | 30 +++++++++++++++++
 .../profiling/should_run/toplevel_scc_1.stdin      |  1 +
 .../profiling/should_run/toplevel_scc_1.stdout     |  1 +
 14 files changed, 170 insertions(+), 18 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 98b2c5088a6f1a3b40c6eedc69d9204ba53690d3


More information about the ghc-commits mailing list