summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/CLabel.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-16 16:46:39 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-21 06:39:32 -0400
commit747093b7c23a1cf92b564eb3d9efe2adc15330df (patch)
tree06b74ab72984f98036a40fc441d37438a49a26a8 /compiler/GHC/Cmm/CLabel.hs
parentf2a98996e7792f572ab685f29742e3476be81166 (diff)
downloadhaskell-747093b7c23a1cf92b564eb3d9efe2adc15330df.tar.gz
CmmToAsm DynFlags refactoring (#17957)
* Remove `DynFlags` parameter from `isDynLinkName`: `isDynLinkName` used to test the global `ExternalDynamicRefs` flag. Now we test it outside of `isDynLinkName` * Add new fields into `NCGConfig`: current unit id, sse/bmi versions, externalDynamicRefs, etc. * Replace many uses of `DynFlags` by `NCGConfig` * Moved `BMI/SSE` datatypes into `GHC.Platform`
Diffstat (limited to 'compiler/GHC/Cmm/CLabel.hs')
-rw-r--r--compiler/GHC/Cmm/CLabel.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index bef9b0f8c7..c6969be7ca 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -132,6 +132,7 @@ import GHC.Platform
import GHC.Types.Unique.Set
import Util
import GHC.Core.Ppr ( {- instances -} )
+import GHC.CmmToAsm.Config
-- -----------------------------------------------------------------------------
-- The CLabel type
@@ -1027,23 +1028,21 @@ isLocalCLabel this_mod lbl =
-- that data resides in a DLL or not. [Win32 only.]
-- @labelDynamic@ returns @True@ if the label is located
-- in a DLL, be it a data reference or not.
-labelDynamic :: DynFlags -> Module -> CLabel -> Bool
-labelDynamic dflags this_mod lbl =
+labelDynamic :: NCGConfig -> Module -> CLabel -> Bool
+labelDynamic config this_mod lbl =
case lbl of
-- is the RTS in a DLL or not?
RtsLabel _ ->
externalDynamicRefs && (this_pkg /= rtsUnitId)
IdLabel n _ _ ->
- isDynLinkName dflags this_mod n
+ externalDynamicRefs && isDynLinkName platform this_mod n
-- When compiling in the "dyn" way, each package is to be linked into
-- its own shared library.
CmmLabel pkg _ _
- | os == OSMinGW32 ->
- externalDynamicRefs && (this_pkg /= pkg)
- | otherwise ->
- gopt Opt_ExternalDynamicRefs dflags
+ | os == OSMinGW32 -> externalDynamicRefs && (this_pkg /= pkg)
+ | otherwise -> externalDynamicRefs
LocalBlockLabel _ -> False
@@ -1080,8 +1079,9 @@ labelDynamic dflags this_mod lbl =
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False
where
- externalDynamicRefs = gopt Opt_ExternalDynamicRefs dflags
- os = platformOS (targetPlatform dflags)
+ externalDynamicRefs = ncgExternalDynamicRefs config
+ platform = ncgPlatform config
+ os = platformOS platform
this_pkg = moduleUnitId this_mod