Commit 71b2b968 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Rename Settings.Optimisation to Settings.SourceArgs

parent 084ce3b4
......@@ -90,7 +90,7 @@ executable hadrian
, Settings.Flavours.Profiled
, Settings.Flavours.Quick
, Settings.Flavours.Quickest
, Settings.Optimisation
, Settings.SourceArgs
, Settings.Packages.Base
, Settings.Packages.Compiler
, Settings.Packages.Ghc
......
......@@ -27,7 +27,7 @@ import Settings.Builders.HsCpp
import Settings.Builders.Ld
import Settings.Builders.Make
import Settings.Builders.Tar
import Settings.Optimisation
import Settings.SourceArgs
import Settings.Packages.Base
import Settings.Packages.Compiler
import Settings.Packages.Ghc
......@@ -43,12 +43,12 @@ import Settings.Packages.RunGhc
defaultArgs :: Args
defaultArgs = mconcat
[ defaultBuilderArgs
, optimisationArgs defaultOptimisation
, sourceArgs defaultSourceArgs
, defaultPackageArgs ]
-- | Default optimisation settings.
defaultOptimisation :: Optimisation
defaultOptimisation = Optimisation
defaultSourceArgs :: SourceArgs
defaultSourceArgs = SourceArgs
{ hsDefault = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2", arg "-H32m"]
, hsLibrary = mempty
, hsCompiler = mempty
......
......@@ -3,7 +3,7 @@ module Settings.Flavours.Development (developmentFlavour) where
import Flavour
import Predicate
import {-# SOURCE #-} Settings.Default
import Settings.Optimisation
import Settings.SourceArgs
-- TODO: Implement an equivalent of LAX_DEPENDENCIES = YES setting, see #250.
developmentFlavour :: Stage -> Flavour
......@@ -14,7 +14,7 @@ developmentFlavour ghcStage = defaultFlavour
developmentArgs :: Stage -> Args
developmentArgs ghcStage = do
stage <- getStage
optimisationArgs $ Optimisation
sourceArgs $ SourceArgs
{ hsDefault = append ["-O", "-H64m"]
, hsLibrary = notStage0 ? arg "-dcore-lint"
, hsCompiler = succ stage == ghcStage ? append ["-O0", "-DDEBUG"]
......
......@@ -3,7 +3,7 @@ module Settings.Flavours.Performance (performanceFlavour) where
import Flavour
import Predicate
import {-# SOURCE #-} Settings.Default
import Settings.Optimisation
import Settings.SourceArgs
performanceFlavour :: Flavour
performanceFlavour = defaultFlavour
......@@ -11,7 +11,7 @@ performanceFlavour = defaultFlavour
, args = defaultBuilderArgs <> performanceArgs <> defaultPackageArgs }
performanceArgs :: Args
performanceArgs = optimisationArgs $ Optimisation
performanceArgs = sourceArgs $ SourceArgs
{ hsDefault = append ["-O", "-H64m"]
, hsLibrary = notStage0 ? arg "-O2"
, hsCompiler = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2"]
......
......@@ -3,7 +3,7 @@ module Settings.Flavours.Profiled (profiledFlavour) where
import Flavour
import Predicate
import {-# SOURCE #-} Settings.Default
import Settings.Optimisation
import Settings.SourceArgs
profiledFlavour :: Flavour
profiledFlavour = defaultFlavour
......@@ -12,7 +12,7 @@ profiledFlavour = defaultFlavour
, ghcProfiled = True }
profiledArgs :: Args
profiledArgs = optimisationArgs $ Optimisation
profiledArgs = sourceArgs $ SourceArgs
{ hsDefault = append ["-O0", "-H64m"]
, hsLibrary = notStage0 ? arg "-O"
, hsCompiler = arg "-O"
......
......@@ -3,7 +3,7 @@ module Settings.Flavours.Quick (quickFlavour) where
import Flavour
import Predicate
import {-# SOURCE #-} Settings.Default
import Settings.Optimisation
import Settings.SourceArgs
quickFlavour :: Flavour
quickFlavour = defaultFlavour
......@@ -13,7 +13,7 @@ quickFlavour = defaultFlavour
-- TODO: the hsLibrary setting seems wrong, but it matches mk/flavours/quick.mk
quickArgs :: Args
quickArgs = optimisationArgs $ Optimisation
quickArgs = sourceArgs $ SourceArgs
{ hsDefault = append ["-O0", "-H64m"]
, hsLibrary = notStage0 ? arg "-O"
, hsCompiler = stage0 ? arg "-O"
......
......@@ -3,7 +3,7 @@ module Settings.Flavours.Quickest (quickestFlavour) where
import Flavour
import Predicate
import {-# SOURCE #-} Settings.Default
import Settings.Optimisation
import Settings.SourceArgs
quickestFlavour :: Flavour
quickestFlavour = defaultFlavour
......@@ -13,7 +13,7 @@ quickestFlavour = defaultFlavour
, rtsWays = quickestRtsWays }
quickestArgs :: Args
quickestArgs = optimisationArgs $ Optimisation
quickestArgs = sourceArgs $ SourceArgs
{ hsDefault = append ["-O0", "-H64m"]
, hsLibrary = mempty
, hsCompiler = mempty
......
module Settings.Optimisation (Optimisation (..), optimisationArgs) where
import GHC
import Predicate
-- TODO: Move C optimisation settings here
data Optimisation = Optimisation
{ hsDefault :: Args
, hsLibrary :: Args
, hsCompiler :: Args
, hsGhc :: Args }
optimisationArgs :: Optimisation -> Args
optimisationArgs Optimisation {..} = do
hsCompile <- builder $ Ghc CompileHs
hsLink <- builder $ Ghc LinkHs
pkg <- getPackage
mconcat [ (hsCompile || hsLink) ? hsDefault
, hsCompile ? isLibrary pkg ? hsLibrary
, hsCompile ? package compiler ? hsCompiler
, (hsCompile || hsLink) ? package ghc ? hsGhc ]
module Settings.SourceArgs (SourceArgs (..), sourceArgs) where
import GHC
import Predicate
-- TODO: Move C source arguments here
data SourceArgs = SourceArgs
{ hsDefault :: Args
, hsLibrary :: Args
, hsCompiler :: Args
, hsGhc :: Args }
sourceArgs :: SourceArgs -> Args
sourceArgs SourceArgs {..} = do
hsCompile <- builder $ Ghc CompileHs
hsLink <- builder $ Ghc LinkHs
pkg <- getPackage
mconcat [ (hsCompile || hsLink) ? hsDefault
, hsCompile ? isLibrary pkg ? hsLibrary
, hsCompile ? package compiler ? hsCompiler
, (hsCompile || hsLink) ? package ghc ? hsGhc ]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment