Commit 63348155 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot
Browse files

Use a type alias for Ways

parent d2a43225
Pipeline #23064 failed with stages
in 309 minutes and 4 seconds
......@@ -534,7 +534,7 @@ data DynFlags = DynFlags {
homeUnitInstantiations:: [(ModuleName, Module)], -- ^ How to instantiate `homeUnitInstanceOfId` unit
-- ways
ways :: Set Way, -- ^ Way flags from the command line
ways :: Ways, -- ^ Way flags from the command line
-- For object splitting
splitInfo :: Maybe (String,Int),
......@@ -1433,7 +1433,7 @@ defaultDynFlags mySettings llvmConfig =
cfgWeightInfo = defaultCfgWeights
}
defaultWays :: Settings -> Set Way
defaultWays :: Settings -> Ways
defaultWays settings = if pc_DYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then Set.singleton WayDyn
else Set.empty
......
......@@ -13,8 +13,6 @@ import GHC.Prelude
import GHC.Platform
import GHC.Platform.Ways
import Data.Set
-- | A platform profile fully describes the kind of objects that are generated
-- for a platform.
--
......@@ -22,8 +20,8 @@ import Data.Set
-- (profiling, debug, dynamic) also modify the ABI.
--
data Profile = Profile
{ profilePlatform :: !Platform -- ^ Platform
, profileWays :: !(Set Way) -- ^ Ways
{ profilePlatform :: !Platform -- ^ Platform
, profileWays :: !Ways -- ^ Ways
}
-- | Get platform constants
......
......@@ -20,6 +20,7 @@
-- this compilation.
module GHC.Platform.Ways
( Way(..)
, Ways
, hasWay
, allowed_combination
, wayGeneralFlags
......@@ -61,12 +62,14 @@ data Way
| WayDyn -- ^ Dynamic linking
deriving (Eq, Ord, Show)
type Ways = Set Way
-- | Test if a ways is enabled
hasWay :: Set Way -> Way -> Bool
hasWay :: Ways -> Way -> Bool
hasWay ws w = Set.member w ws
-- | Check if a combination of ways is allowed
allowed_combination :: Set Way -> Bool
allowed_combination :: Ways -> Bool
allowed_combination ways = not disallowed
where
disallowed = or [ hasWay ways x && hasWay ways y
......@@ -76,13 +79,13 @@ allowed_combination ways = not disallowed
couples = [] -- we don't have any disallowed combination of ways nowadays
-- | Unique tag associated to a list of ways
waysTag :: Set Way -> String
waysTag :: Ways -> String
waysTag = concat . intersperse "_" . map wayTag . Set.toAscList
-- | Unique build-tag associated to a list of ways
--
-- RTS only ways are filtered out because they have no impact on the build.
waysBuildTag :: Set Way -> String
waysBuildTag :: Ways -> String
waysBuildTag ws = waysTag (Set.filter (not . wayRTSOnly) ws)
......@@ -195,7 +198,7 @@ foreign import ccall unsafe "rts_isDynamic" rtsIsDynamicIO :: IO Int
-- | Return host "full" ways (i.e. ways that have an impact on the compilation,
-- not RTS only ways). These ways must be used when compiling codes targeting
-- the internal interpreter.
hostFullWays :: Set Way
hostFullWays :: Ways
hostFullWays = Set.unions
[ if hostIsDynamic then Set.singleton WayDyn else Set.empty
, if hostIsProfiled then Set.singleton WayProf else Set.empty
......
......@@ -315,7 +315,7 @@ instance Monoid UnitVisibility where
-- | Unit configuration
data UnitConfig = UnitConfig
{ unitConfigPlatformArchOS :: !ArchOS -- ^ Platform arch and OS
, unitConfigWays :: !(Set Way) -- ^ Ways to use
, unitConfigWays :: !Ways -- ^ Ways to use
, unitConfigProgramName :: !String
-- ^ Name of the compiler (e.g. "GHC", "GHCJS"). Used to fetch environment
-- variables such as "GHC[JS]_PACKAGE_PATH".
......
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