summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/LayoutStack.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/Cmm/LayoutStack.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/Cmm/LayoutStack.hs')
-rw-r--r--compiler/GHC/Cmm/LayoutStack.hs21
1 files changed, 12 insertions, 9 deletions
diff --git a/compiler/GHC/Cmm/LayoutStack.hs b/compiler/GHC/Cmm/LayoutStack.hs
index 689e5a0e46..f1137cf4fe 100644
--- a/compiler/GHC/Cmm/LayoutStack.hs
+++ b/compiler/GHC/Cmm/LayoutStack.hs
@@ -5,6 +5,9 @@ module GHC.Cmm.LayoutStack (
import GHC.Prelude hiding ((<*>))
+import GHC.Platform
+import GHC.Platform.Profile
+
import GHC.StgToCmm.Utils ( callerSaveVolatileRegs, newTemp ) -- XXX layering violation
import GHC.StgToCmm.Foreign ( saveThreadState, loadThreadState ) -- XXX layering violation
@@ -29,7 +32,6 @@ import GHC.Data.Maybe
import GHC.Types.Unique.FM
import GHC.Utils.Misc
-import GHC.Platform
import GHC.Driver.Session
import GHC.Data.FastString
import GHC.Utils.Outputable hiding ( isEmpty )
@@ -245,6 +247,7 @@ cmmLayoutStack dflags procpoints entry_args
-- by the sinking pass.
let liveness = cmmLocalLiveness dflags graph
blocks = revPostorder graph
+ profile = targetProfile dflags
(final_stackmaps, _final_high_sp, new_blocks) <-
mfix $ \ ~(rec_stackmaps, rec_high_sp, _new_blocks) ->
@@ -253,7 +256,7 @@ cmmLayoutStack dflags procpoints entry_args
blocks_with_reloads <-
insertReloadsAsNeeded dflags procpoints final_stackmaps entry new_blocks
- new_blocks' <- mapM (lowerSafeForeignCall dflags) blocks_with_reloads
+ new_blocks' <- mapM (lowerSafeForeignCall profile) blocks_with_reloads
return (ofBlockList entry new_blocks', final_stackmaps)
-- -----------------------------------------------------------------------------
@@ -1131,18 +1134,18 @@ expecting them (see Note [safe foreign call convention]). Note also
that safe foreign call is replace by an unsafe one in the Cmm graph.
-}
-lowerSafeForeignCall :: DynFlags -> CmmBlock -> UniqSM CmmBlock
-lowerSafeForeignCall dflags block
+lowerSafeForeignCall :: Profile -> CmmBlock -> UniqSM CmmBlock
+lowerSafeForeignCall profile block
| (entry@(CmmEntry _ tscp), middle, CmmForeignCall { .. }) <- blockSplit block
= do
- let platform = targetPlatform dflags
+ let platform = profilePlatform profile
-- Both 'id' and 'new_base' are KindNonPtr because they're
-- RTS-only objects and are not subject to garbage collection
id <- newTemp (bWord platform)
new_base <- newTemp (cmmRegType platform baseReg)
- let (caller_save, caller_load) = callerSaveVolatileRegs dflags
- save_state_code <- saveThreadState dflags
- load_state_code <- loadThreadState dflags
+ let (caller_save, caller_load) = callerSaveVolatileRegs platform
+ save_state_code <- saveThreadState profile
+ load_state_code <- loadThreadState profile
let suspend = save_state_code <*>
caller_save <*>
mkMiddle (callSuspendThread platform id intrbl)
@@ -1155,7 +1158,7 @@ lowerSafeForeignCall dflags block
load_state_code
(_, regs, copyout) =
- copyOutOflow dflags NativeReturn Jump (Young succ)
+ copyOutOflow profile NativeReturn Jump (Young succ)
(map (CmmReg . CmmLocal) res)
ret_off []