summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm/Utils.hs
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/StgToCmm/Utils.hs
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/StgToCmm/Utils.hs')
-rw-r--r--compiler/GHC/StgToCmm/Utils.hs26
1 files changed, 12 insertions, 14 deletions
diff --git a/compiler/GHC/StgToCmm/Utils.hs b/compiler/GHC/StgToCmm/Utils.hs
index 27c79a8e62..8531ca2283 100644
--- a/compiler/GHC/StgToCmm/Utils.hs
+++ b/compiler/GHC/StgToCmm/Utils.hs
@@ -197,9 +197,9 @@ emitRtsCallGen
-> Bool -- True <=> CmmSafe call
-> FCode ()
emitRtsCallGen res lbl args safe
- = do { dflags <- getDynFlags
+ = do { platform <- targetPlatform <$> getDynFlags
; updfr_off <- getUpdFrameOff
- ; let (caller_save, caller_load) = callerSaveVolatileRegs dflags
+ ; let (caller_save, caller_load) = callerSaveVolatileRegs platform
; emit caller_save
; call updfr_off
; emit caller_load }
@@ -245,13 +245,11 @@ emitRtsCallGen res lbl args safe
-- "GHC.Cmm.Node". Right now the workaround is to avoid inlining across
-- unsafe foreign calls in rewriteAssignments, but this is strictly
-- temporary.
-callerSaveVolatileRegs :: DynFlags -> (CmmAGraph, CmmAGraph)
-callerSaveVolatileRegs dflags = (caller_save, caller_load)
+callerSaveVolatileRegs :: Platform -> (CmmAGraph, CmmAGraph)
+callerSaveVolatileRegs platform = (caller_save, caller_load)
where
- platform = targetPlatform dflags
-
- caller_save = catAGraphs (map (callerSaveGlobalReg dflags) regs_to_save)
- caller_load = catAGraphs (map (callerRestoreGlobalReg dflags) regs_to_save)
+ caller_save = catAGraphs (map (callerSaveGlobalReg platform) regs_to_save)
+ caller_load = catAGraphs (map (callerRestoreGlobalReg platform) regs_to_save)
system_regs = [ Sp,SpLim,Hp,HpLim,CCCS,CurrentTSO,CurrentNursery
{- ,SparkHd,SparkTl,SparkBase,SparkLim -}
@@ -259,14 +257,14 @@ callerSaveVolatileRegs dflags = (caller_save, caller_load)
regs_to_save = filter (callerSaves platform) system_regs
-callerSaveGlobalReg :: DynFlags -> GlobalReg -> CmmAGraph
-callerSaveGlobalReg dflags reg
- = mkStore (get_GlobalReg_addr dflags reg) (CmmReg (CmmGlobal reg))
+callerSaveGlobalReg :: Platform -> GlobalReg -> CmmAGraph
+callerSaveGlobalReg platform reg
+ = mkStore (get_GlobalReg_addr platform reg) (CmmReg (CmmGlobal reg))
-callerRestoreGlobalReg :: DynFlags -> GlobalReg -> CmmAGraph
-callerRestoreGlobalReg dflags reg
+callerRestoreGlobalReg :: Platform -> GlobalReg -> CmmAGraph
+callerRestoreGlobalReg platform reg
= mkAssign (CmmGlobal reg)
- (CmmLoad (get_GlobalReg_addr dflags reg) (globalRegType (targetPlatform dflags) reg))
+ (CmmLoad (get_GlobalReg_addr platform reg) (globalRegType platform reg))
-------------------------------------------------------------------------