[commit: ghc] supercompiler: Make use of SUPERCOMPILE pragmas when deciding what to SC (e144ebd)

Max Bolingbroke <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : supercompiler

http://hackage.haskell.org/trac/ghc/changeset/e144ebd0e31f21c7379f663d989a16ea81c62d41

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

commit e144ebd0e31f21c7379f663d989a16ea81c62d41
Author: Max Bolingbroke <[email protected]>
Date:   Mon Mar 12 12:28:38 2012 +0000

    Make use of SUPERCOMPILE pragmas when deciding what to SC

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

 compiler/supercompile/Supercompile.hs |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/compiler/supercompile/Supercompile.hs b/compiler/supercompile/Supercompile.hs
index ca7c349..41a4153 100644
--- a/compiler/supercompile/Supercompile.hs
+++ b/compiler/supercompile/Supercompile.hs
@@ -198,7 +198,9 @@ supercompile e = -- liftM (termToCoreExpr . snd) $
         e' = runParseM (coreExprToTerm e)
 
 supercompileProgram :: [CoreBind] -> IO [CoreBind]
-supercompileProgram = supercompileProgramSelective (const True)
+supercompileProgram binds = supercompileProgramSelective selector binds
+  where selector | any idSupercompilePragma (bindersOfBinds binds) = idSupercompilePragma
+                 | otherwise                                       = const True
 
 supercompileProgramSelective :: (Id -> Bool) -> [CoreBind] -> IO [CoreBind]
 supercompileProgramSelective should_sc binds = liftM (\e' -> NonRec x e' : rebuild x) (supercompile e)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.