summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/CLabel.hs
diff options
context:
space:
mode:
authordoyougnu <jeffrey.young@iohk.io>2021-12-14 13:04:17 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-22 00:12:27 -0500
commit1a596d069991255e196621d06a046f60359f3129 (patch)
tree899cf688c007b92e4d96b839f18d0579eb9793e2 /compiler/GHC/Cmm/CLabel.hs
parentff657a81ae5ebd4ea4628ca8ebc88dce3ecbe0ef (diff)
downloadhaskell-1a596d069991255e196621d06a046f60359f3129.tar.gz
Cmm: DynFlags to CmmConfig refactor
add files GHC.Cmm.Config, GHC.Driver.Config.Cmm Cmm: DynFlag references --> CmmConfig Cmm.Pipeline: reorder imports, add handshake Cmm: DynFlag references --> CmmConfig Cmm.Pipeline: DynFlag references --> CmmConfig Cmm.LayoutStack: DynFlag references -> CmmConfig Cmm.Info.Build: DynFlag references -> CmmConfig Cmm.Config: use profile to retrieve platform Cmm.CLabel: unpack NCGConfig in labelDynamic Cmm.Config: reduce CmmConfig surface area Cmm.Config: add cmmDoCmmSwitchPlans field Cmm.Config: correct cmmDoCmmSwitchPlans flag The original implementation dispatches work in cmmImplementSwitchPlans in an `otherwise` branch, hence we must add a not to correctly dispatch Cmm.Config: add cmmSplitProcPoints simplify Config remove cmmBackend, and cmmPosInd Cmm.CmmToAsm: move ncgLabelDynamic to CmmToAsm Cmm.CLabel: remove cmmLabelDynamic function Cmm.Config: rename cmmOptDoLinting -> cmmDoLinting testsuite: update CountDepsAst CountDepsParser
Diffstat (limited to 'compiler/GHC/Cmm/CLabel.hs')
-rw-r--r--compiler/GHC/Cmm/CLabel.hs25
1 files changed, 10 insertions, 15 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index fad545f662..de608bafd4 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -152,7 +152,6 @@ import GHC.Platform
import GHC.Types.Unique.Set
import GHC.Utils.Misc
import GHC.Core.Ppr ( {- instances -} )
-import GHC.CmmToAsm.Config
import GHC.Types.SrcLoc
-- -----------------------------------------------------------------------------
@@ -1177,21 +1176,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 :: NCGConfig -> CLabel -> Bool
-labelDynamic config lbl =
+labelDynamic :: Module -> Platform -> Bool -> CLabel -> Bool
+labelDynamic this_mod platform external_dynamic_refs lbl =
case lbl of
-- is the RTS in a DLL or not?
RtsLabel _ ->
- externalDynamicRefs && (this_unit /= rtsUnitId)
+ external_dynamic_refs && (this_unit /= rtsUnitId)
IdLabel n _ _ ->
- externalDynamicRefs && isDynLinkName platform this_mod n
+ external_dynamic_refs && isDynLinkName platform this_mod n
-- When compiling in the "dyn" way, each package is to be linked into
-- its own shared library.
CmmLabel lbl_unit _ _ _
- | os == OSMinGW32 -> externalDynamicRefs && (this_unit /= lbl_unit)
- | otherwise -> externalDynamicRefs
+ | os == OSMinGW32 -> external_dynamic_refs && (this_unit /= lbl_unit)
+ | otherwise -> external_dynamic_refs
LocalBlockLabel _ -> False
@@ -1209,7 +1208,7 @@ labelDynamic config lbl =
-- When compiling in the "dyn" way, each package is to be
-- linked into its own DLL.
ForeignLabelInPackage pkgId ->
- externalDynamicRefs && (this_unit /= pkgId)
+ external_dynamic_refs && (this_unit /= pkgId)
else -- On Mac OS X and on ELF platforms, false positives are OK,
-- so we claim that all foreign imports come from dynamic
@@ -1217,25 +1216,21 @@ labelDynamic config lbl =
True
CC_Label cc ->
- externalDynamicRefs && not (ccFromThisModule cc this_mod)
+ external_dynamic_refs && not (ccFromThisModule cc this_mod)
-- CCS_Label always contains a CostCentre defined in the current module
CCS_Label _ -> False
IPE_Label {} -> True
HpcTicksLabel m ->
- externalDynamicRefs && this_mod /= m
+ external_dynamic_refs && this_mod /= m
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False
where
- externalDynamicRefs = ncgExternalDynamicRefs config
- platform = ncgPlatform config
- os = platformOS platform
- this_mod = ncgThisModule config
+ os = platformOS platform
this_unit = toUnitId (moduleUnit this_mod)
-
-----------------------------------------------------------------------------
-- Printing out CLabels.