summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver
diff options
context:
space:
mode:
authorFendor <power.walross@gmail.com>2021-07-19 11:42:01 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-21 02:46:50 -0400
commit5b157eb2bea7fc4ad654c83258cf1ab6ad0f85f0 (patch)
tree7efac4ebf4829083e9bfe3d0882e463841b7a3be /compiler/GHC/Driver
parent06d1ca856d3374bf8dac952740cfe4cef76a350d (diff)
downloadhaskell-5b157eb2bea7fc4ad654c83258cf1ab6ad0f85f0.tar.gz
Use Ways API instead of Set specific functions
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r--compiler/GHC/Driver/Pipeline.hs6
-rw-r--r--compiler/GHC/Driver/Pipeline/Execute.hs8
-rw-r--r--compiler/GHC/Driver/Session.hs6
3 files changed, 10 insertions, 10 deletions
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index 26d2213a01..b282304a1a 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -252,8 +252,8 @@ compileOne' mHscMessage
input_fnpp = ms_hspp_file summary
mod_graph = hsc_mod_graph hsc_env0
needsLinker = needsTemplateHaskellOrQQ mod_graph
- isDynWay = any (== WayDyn) (ways lcl_dflags)
- isProfWay = any (== WayProf) (ways lcl_dflags)
+ isDynWay = hasWay (ways lcl_dflags) WayDyn
+ isProfWay = hasWay (ways lcl_dflags) WayProf
internalInterpreter = not (gopt Opt_ExternalInterpreter lcl_dflags)
pipelineOutput = case bcknd of
@@ -496,7 +496,7 @@ linkingNeeded logger dflags unit_env staticLink linkables pkg_deps = do
findHSLib :: Platform -> Ways -> [String] -> String -> IO (Maybe FilePath)
findHSLib platform ws dirs lib = do
- let batch_lib_file = if WayDyn `notElem` ws
+ let batch_lib_file = if ws `hasNotWay` WayDyn
then "lib" ++ lib <.> "a"
else platformSOName platform lib
found <- filterM doesFileExist (map (</> batch_lib_file) dirs)
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs
index 022e8ce1a1..997cddf121 100644
--- a/compiler/GHC/Driver/Pipeline/Execute.hs
+++ b/compiler/GHC/Driver/Pipeline/Execute.hs
@@ -832,10 +832,10 @@ llvmOptions dflags =
Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets $ llvmConfig dflags)
-- Relocation models
- rmodel | gopt Opt_PIC dflags = "pic"
- | positionIndependent dflags = "pic"
- | WayDyn `elem` ways dflags = "dynamic-no-pic"
- | otherwise = "static"
+ rmodel | gopt Opt_PIC dflags = "pic"
+ | positionIndependent dflags = "pic"
+ | ways dflags `hasWay` WayDyn = "dynamic-no-pic"
+ | otherwise = "static"
platform = targetPlatform dflags
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 64a1f16ebb..ffb9108723 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -4053,7 +4053,7 @@ addWay' w dflags0 =
in dflags3
removeWayDyn :: DynP ()
-removeWayDyn = upd (\dfs -> dfs { targetWays_ = Set.filter (WayDyn /=) (targetWays_ dfs) })
+removeWayDyn = upd (\dfs -> dfs { targetWays_ = removeWay WayDyn (targetWays_ dfs) })
--------------------------
setGeneralFlag, unSetGeneralFlag :: GeneralFlag -> DynP ()
@@ -4470,7 +4470,7 @@ picCCOpts dflags = pieOpts ++ picOpts
-- correctly. They need to reference data in the Haskell
-- objects, but can't without -fPIC. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/position-independent-code
- | gopt Opt_PIC dflags || WayDyn `Set.member` ways dflags ->
+ | gopt Opt_PIC dflags || ways dflags `hasWay` WayDyn ->
["-fPIC", "-U__PIC__", "-D__PIC__"]
-- gcc may be configured to have PIC on by default, let's be
-- explicit here, see #15847
@@ -4653,7 +4653,7 @@ makeDynFlagsConsistent dflags
, not (gopt Opt_ExternalInterpreter dflags)
, hostIsProfiled
, backendProducesObject (backend dflags)
- , WayProf `Set.notMember` ways dflags
+ , ways dflags `hasNotWay` WayProf
= loop dflags{targetWays_ = addWay WayProf (targetWays_ dflags)}
"Enabling -prof, because -fobject-code is enabled and GHCi is profiled"