summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Config.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-06-16 12:30:22 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-09 11:19:24 -0400
commit3f32a9c0f4ddceab14a381bfd3732bcad6be43f7 (patch)
tree8e78c5b1681bf9ffd92e4fdb6a9134bb60ac05c8 /compiler/GHC/Driver/Config.hs
parent8c892689058912c35ed36e07b5a9ed0df86abc03 (diff)
downloadhaskell-3f32a9c0f4ddceab14a381bfd3732bcad6be43f7.tar.gz
DynFlags: add UnfoldingOpts and SimpleOpts
Milestone: after this patch, we only use 'unsafeGlobalDynFlags' for the state hack and for debug in Outputable.
Diffstat (limited to 'compiler/GHC/Driver/Config.hs')
-rw-r--r--compiler/GHC/Driver/Config.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Config.hs b/compiler/GHC/Driver/Config.hs
new file mode 100644
index 0000000000..b67e74eeb4
--- /dev/null
+++ b/compiler/GHC/Driver/Config.hs
@@ -0,0 +1,25 @@
+-- | Subsystem configuration
+module GHC.Driver.Config
+ ( initOptCoercionOpts
+ , initSimpleOptOpts
+ )
+where
+
+import GHC.Prelude
+
+import GHC.Driver.Session
+import GHC.Core.SimpleOpt
+import GHC.Core.Coercion.Opt
+
+-- | Initialise coercion optimiser configuration from DynFlags
+initOptCoercionOpts :: DynFlags -> OptCoercionOpts
+initOptCoercionOpts dflags = OptCoercionOpts
+ { optCoercionEnabled = not (hasNoOptCoercion dflags)
+ }
+
+-- | Initialise Simple optimiser configuration from DynFlags
+initSimpleOptOpts :: DynFlags -> SimpleOptOpts
+initSimpleOptOpts dflags = SimpleOptOpts
+ { so_uf_opts = unfoldingOpts dflags
+ , so_co_opts = initOptCoercionOpts dflags
+ }