diff options
author | doyougnu <jeffrey.young@iohk.io> | 2021-12-08 12:29:07 -0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-14 20:55:06 -0500 |
commit | ecaec722850cce498b67561708ee8e42df367dda (patch) | |
tree | 98eb6c505702858c4663bda1c3f2ec2635df853d /compiler/GHC/Driver/Config | |
parent | 0198bb1190ffc4ac4963140e81cacd72721eab07 (diff) | |
download | haskell-ecaec722850cce498b67561708ee8e42df367dda.tar.gz |
CmmToLlvm: Remove DynFlags, add LlvmCgConfig
CodeOutput: LCGConfig, add handshake initLCGConfig
Add two modules:
GHC.CmmToLlvm.Config -- to hold the Llvm code gen config
GHC.Driver.Config.CmmToLlvm -- for initialization, other utils
CmmToLlvm: remove HasDynFlags, add LlvmConfig
CmmToLlvm: add lcgContext to LCGConfig
CmmToLlvm.Base: DynFlags --> LCGConfig
Llvm: absorb LlvmOpts into LCGConfig
CmmToLlvm.Ppr: swap DynFlags --> LCGConfig
CmmToLlvm.CodeGen: swap DynFlags --> LCGConfig
CmmToLlvm.CodeGen: swap DynFlags --> LCGConfig
CmmToLlvm.Data: swap LlvmOpts --> LCGConfig
CmmToLlvm: swap DynFlags --> LCGConfig
CmmToLlvm: move LlvmVersion to CmmToLlvm.Config
Additionally:
- refactor Config and initConfig to hold LlvmVersion
- push IO needed to get LlvmVersion to boundary between Cmm and LLvm
code generation
- remove redundant imports, this is much cleaner!
CmmToLlvm.Config: store platformMisc_llvmTarget
instead of all of platformMisc
Diffstat (limited to 'compiler/GHC/Driver/Config')
-rw-r--r-- | compiler/GHC/Driver/Config/CmmToLlvm.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Config/CmmToLlvm.hs b/compiler/GHC/Driver/Config/CmmToLlvm.hs new file mode 100644 index 0000000000..fa7eb2f2c5 --- /dev/null +++ b/compiler/GHC/Driver/Config/CmmToLlvm.hs @@ -0,0 +1,30 @@ +module GHC.Driver.Config.CmmToLlvm + ( initLCGConfig + ) where + +import GHC.Prelude +import GHC.Driver.Session +import GHC.Platform +import GHC.CmmToLlvm.Config +import GHC.SysTools.Tasks +import GHC.Utils.Outputable +import GHC.Utils.Logger + +-- | Initialize the Llvm code generator configuration from DynFlags +initLCGConfig :: Logger -> DynFlags -> IO LCGConfig +initLCGConfig logger dflags = do + version <- figureLlvmVersion logger dflags + pure $! LCGConfig { + lcgPlatform = targetPlatform dflags + , lcgContext = initSDocContext dflags (PprCode CStyle) + , lcgFillUndefWithGarbage = gopt Opt_LlvmFillUndefWithGarbage dflags + , lcgSplitSections = gopt Opt_SplitSections dflags + , lcgBmiVersion = case platformArch (targetPlatform dflags) of + ArchX86_64 -> bmiVersion dflags + ArchX86 -> bmiVersion dflags + _ -> Nothing + , lcgLlvmVersion = version + , lcgDoWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags + , lcgPlatformMisc = platformMisc_llvmTarget $! platformMisc dflags + , lcgLlvmConfig = llvmConfig dflags + } |