summaryrefslogtreecommitdiff
path: root/compiler/GHC/Stg
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/Stg
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/Stg')
-rw-r--r--compiler/GHC/Stg/Lift/Analysis.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/GHC/Stg/Lift/Analysis.hs b/compiler/GHC/Stg/Lift/Analysis.hs
index 3eea75b21e..80883b9312 100644
--- a/compiler/GHC/Stg/Lift/Analysis.hs
+++ b/compiler/GHC/Stg/Lift/Analysis.hs
@@ -21,7 +21,9 @@ module GHC.Stg.Lift.Analysis (
) where
import GHC.Prelude
+
import GHC.Platform
+import GHC.Platform.Profile
import GHC.Types.Basic
import GHC.Types.Demand
@@ -375,7 +377,8 @@ goodToLift dflags top_lvl rec_flag expander pairs scope = decide
, ("args spill on stack", args_spill_on_stack)
, ("increases allocation", inc_allocs)
] where
- platform = targetPlatform dflags
+ profile = targetProfile dflags
+ platform = profilePlatform profile
decide deciders
| not (fancy_or deciders)
= llTrace "stgLiftLams:lifting"
@@ -472,7 +475,7 @@ goodToLift dflags top_lvl rec_flag expander pairs scope = decide
-- GHC does not currently share closure environments, and we either lift
-- the entire recursive binding group or none of it.
closuresSize = sum $ flip map rhss $ \rhs ->
- closureSize dflags
+ closureSize profile
. dVarSetElems
. expander
. flip dVarSetMinusVarSet bndrs_set
@@ -485,14 +488,14 @@ rhsLambdaBndrs (StgRhsClosure _ _ _ bndrs _) = map binderInfoBndr bndrs
-- | The size in words of a function closure closing over the given 'Id's,
-- including the header.
-closureSize :: DynFlags -> [Id] -> WordOff
-closureSize dflags ids = words + sTD_HDR_SIZE dflags
+closureSize :: Profile -> [Id] -> WordOff
+closureSize profile ids = words + pc_STD_HDR_SIZE (platformConstants (profilePlatform profile))
-- We go through sTD_HDR_SIZE rather than fixedHdrSizeW so that we don't
-- optimise differently when profiling is enabled.
where
(words, _, _)
-- Functions have a StdHeader (as opposed to ThunkHeader).
- = StgToCmm.Layout.mkVirtHeapOffsets dflags StgToCmm.Layout.StdHeader
+ = StgToCmm.Layout.mkVirtHeapOffsets profile StgToCmm.Layout.StdHeader
. StgToCmm.Closure.addIdReps
. StgToCmm.Closure.nonVoidIds
$ ids