summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Config
diff options
context:
space:
mode:
authorAndre Marianiello <andremarianiello@users.noreply.github.com>2022-05-05 20:40:31 -0400
committerandremarianiello <andre.marianiello@gmail.com>2022-05-12 02:15:48 +0000
commita2dcad4e6f75c08aacc5902a20ca4c773819d7b7 (patch)
treedf82d9f998dc5c8d9454479d5e6682496d6fc813 /compiler/GHC/Driver/Config
parent2c00a8d0ba4bc37e212a723fc025f83c471986c5 (diff)
downloadhaskell-a2dcad4e6f75c08aacc5902a20ca4c773819d7b7.tar.gz
Decouple dynflags in Cmm parser (related to #17957)
Diffstat (limited to 'compiler/GHC/Driver/Config')
-rw-r--r--compiler/GHC/Driver/Config/Cmm/Parser.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Config/Cmm/Parser.hs b/compiler/GHC/Driver/Config/Cmm/Parser.hs
new file mode 100644
index 0000000000..3749bfd87c
--- /dev/null
+++ b/compiler/GHC/Driver/Config/Cmm/Parser.hs
@@ -0,0 +1,27 @@
+module GHC.Driver.Config.Cmm.Parser
+ ( initCmmParserConfig
+ ) where
+
+import GHC.Cmm.Parser
+import GHC.Cmm.Parser.Monad
+
+import GHC.Driver.Config.Parser
+import GHC.Driver.Config.StgToCmm
+import GHC.Driver.Session
+
+import GHC.Unit.Types
+
+
+initPDConfig :: DynFlags -> PDConfig
+initPDConfig dflags = PDConfig
+ { pdProfile = targetProfile dflags
+ , pdSanitizeAlignment = gopt Opt_AlignmentSanitisation dflags
+ }
+
+initCmmParserConfig :: DynFlags -> Module -> CmmParserConfig
+initCmmParserConfig dflags mod = CmmParserConfig
+ { cmmpParserOpts = initParserOpts dflags
+ , cmmpPDConfig = initPDConfig dflags
+ , cmmpStgToCmmConfig = initStgToCmmConfig dflags mod
+ }
+