[commit: ghc] wip/nfs-locking: Add perf flavour (6508f4b)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:46:48 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/6508f4b94dd9f0c476269191ce2a083856ef2d60/ghc

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

commit 6508f4b94dd9f0c476269191ce2a083856ef2d60
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Jan 6 00:59:26 2017 +0000

    Add perf flavour


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

6508f4b94dd9f0c476269191ce2a083856ef2d60
 hadrian.cabal                 |  1 +
 src/Settings.hs               |  3 ++-
 src/Settings/Flavours/Perf.hs | 21 +++++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/hadrian.cabal b/hadrian.cabal
index a186d7d..4f3c2f6 100644
--- a/hadrian.cabal
+++ b/hadrian.cabal
@@ -85,6 +85,7 @@ executable hadrian
                        , Settings.Builders.Make
                        , Settings.Builders.Tar
                        , Settings.Default
+                       , Settings.Flavours.Perf
                        , Settings.Flavours.Quick
                        , Settings.Flavours.Quickest
                        , Settings.Packages.Base
diff --git a/src/Settings.hs b/src/Settings.hs
index bef47f1..18dd15b 100644
--- a/src/Settings.hs
+++ b/src/Settings.hs
@@ -14,6 +14,7 @@ import GHC
 import Oracles.PackageData
 import Oracles.Path
 import {-# SOURCE #-} Settings.Default
+import Settings.Flavours.Perf
 import Settings.Flavours.Quick
 import Settings.Flavours.Quickest
 import Settings.Path
@@ -50,7 +51,7 @@ getPkgDataList :: (FilePath -> PackageDataList) -> Expr [String]
 getPkgDataList key = lift . pkgDataList . key =<< getBuildPath
 
 hadrianFlavours :: [Flavour]
-hadrianFlavours = [defaultFlavour, quickFlavour, quickestFlavour]
+hadrianFlavours = [defaultFlavour, perfFlavour, quickFlavour, quickestFlavour]
 
 flavour :: Flavour
 flavour = fromMaybe unknownFlavour $ find ((== flavourName) . name) flavours
diff --git a/src/Settings/Flavours/Perf.hs b/src/Settings/Flavours/Perf.hs
new file mode 100644
index 0000000..d246b15
--- /dev/null
+++ b/src/Settings/Flavours/Perf.hs
@@ -0,0 +1,21 @@
+module Settings.Flavours.Perf (perfFlavour) where
+
+import Context
+import Flavour
+import GHC
+import Predicate
+import {-# SOURCE #-} Settings.Default
+
+perfFlavour :: Flavour
+perfFlavour = defaultFlavour
+    { name = "perf"
+    , args = defaultArgs <> perfArgs }
+
+optimise :: Context -> Bool
+optimise Context {..} =
+    package `elem` [compiler, ghc] && stage == Stage2 || isLibrary package
+
+perfArgs :: Args
+perfArgs = builder Ghc ? do
+    context <- getContext
+    if optimise context then arg "-O2" else arg "-O"



More information about the ghc-commits mailing list