summaryrefslogtreecommitdiff
path: root/compiler/GHC/Platform
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-07-07 18:48:31 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-25 00:45:08 -0400
commit9dfeca6c2019fdb46613a68ccd6e650e40c7baac (patch)
tree29a2cda3faddedc7024be259011f4406b6473f45 /compiler/GHC/Platform
parent6333d7391068d8029eed3e8eff019b9e2c104c7b (diff)
downloadhaskell-9dfeca6c2019fdb46613a68ccd6e650e40c7baac.tar.gz
Remove platform constant wrappers
Platform constant wrappers took a DynFlags parameter, hence implicitly used the target platform constants. We removed them to allow support for several platforms at once (#14335) and to avoid having to pass the full DynFlags to every function (#17957). Metric Decrease: T4801
Diffstat (limited to 'compiler/GHC/Platform')
-rw-r--r--compiler/GHC/Platform/Profile.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/GHC/Platform/Profile.hs b/compiler/GHC/Platform/Profile.hs
index d484a1ebc4..5875e5d56d 100644
--- a/compiler/GHC/Platform/Profile.hs
+++ b/compiler/GHC/Platform/Profile.hs
@@ -2,6 +2,9 @@
module GHC.Platform.Profile
( Profile (..)
, profileBuildTag
+ , profileConstants
+ , profileIsProfiling
+ , profileWordSizeInBytes
)
where
@@ -23,6 +26,21 @@ data Profile = Profile
, profileWays :: !(Set Way) -- ^ Ways
}
+-- | Get platform constants
+profileConstants :: Profile -> PlatformConstants
+{-# INLINE profileConstants #-}
+profileConstants profile = platformConstants (profilePlatform profile)
+
+-- | Is profiling enabled
+profileIsProfiling :: Profile -> Bool
+{-# INLINE profileIsProfiling #-}
+profileIsProfiling profile = profileWays profile `hasWay` WayProf
+
+-- | Word size in bytes
+profileWordSizeInBytes :: Profile -> Int
+{-# INLINE profileWordSizeInBytes #-}
+profileWordSizeInBytes profile = platformWordSizeInBytes (profilePlatform profile)
+
-- | Unique build tag for the profile
profileBuildTag :: Profile -> String
profileBuildTag profile