summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-26 15:05:27 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-11 03:19:59 -0500
commit6e23695e7d84aa248e7ca20bdb8d133f9b356548 (patch)
treec967ccca8144d32c56f323bb4e4ea7e524d3ad02 /compiler/GHC/Cmm
parentfcfda909fd7fcf539ff31717ce01a56292abb92f (diff)
downloadhaskell-6e23695e7d84aa248e7ca20bdb8d133f9b356548.tar.gz
Move this_module into NCGConfig
In various places in the NCG we need the Module currently being compiled. Let's move this into the environment instead of chewing threw another register.
Diffstat (limited to 'compiler/GHC/Cmm')
-rw-r--r--compiler/GHC/Cmm/CLabel.hs5
-rw-r--r--compiler/GHC/Cmm/Info/Build.hs7
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index 7a3e55dcf9..3d21855ec2 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -1082,8 +1082,8 @@ 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 :: NCGConfig -> Module -> CLabel -> Bool
-labelDynamic config this_mod lbl =
+labelDynamic :: NCGConfig -> CLabel -> Bool
+labelDynamic config lbl =
case lbl of
-- is the RTS in a DLL or not?
RtsLabel _ ->
@@ -1136,6 +1136,7 @@ labelDynamic config this_mod lbl =
externalDynamicRefs = ncgExternalDynamicRefs config
platform = ncgPlatform config
os = platformOS platform
+ this_mod = ncgThisModule config
this_unit = toUnitId (moduleUnit this_mod)
diff --git a/compiler/GHC/Cmm/Info/Build.hs b/compiler/GHC/Cmm/Info/Build.hs
index b2078ae462..b43eaa1257 100644
--- a/compiler/GHC/Cmm/Info/Build.hs
+++ b/compiler/GHC/Cmm/Info/Build.hs
@@ -946,7 +946,8 @@ oneSRT dflags staticFuns lbls caf_lbls isCAF cafs static_data = do
topSRT <- get
let
- config = initNCGConfig dflags
+ this_mod = thisModule topSRT
+ config = initNCGConfig dflags this_mod
profile = targetProfile dflags
platform = profilePlatform profile
srtMap = moduleSRTMap topSRT
@@ -1019,8 +1020,6 @@ oneSRT dflags staticFuns lbls caf_lbls isCAF cafs static_data = do
in
state{ moduleSRTMap = srt_map }
- this_mod = thisModule topSRT
-
allStaticData =
all (\(CAFLabel clbl) -> Set.member clbl static_data) caf_lbls
@@ -1048,7 +1047,7 @@ oneSRT dflags staticFuns lbls caf_lbls isCAF cafs static_data = do
-- when dynamic linking is used we cannot guarantee that the offset
-- between the SRT and the info table will fit in the offset field.
-- Consequently we build a singleton SRT in this case.
- not (labelDynamic config this_mod lbl)
+ not (labelDynamic config lbl)
-- MachO relocations can't express offsets between compilation units at
-- all, so we are always forced to build a singleton SRT in this case.