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/CodeOutput.hs | |
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/CodeOutput.hs')
-rw-r--r-- | compiler/GHC/Driver/CodeOutput.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/GHC/Driver/CodeOutput.hs b/compiler/GHC/Driver/CodeOutput.hs index 87b3af42df..1fcce17021 100644 --- a/compiler/GHC/Driver/CodeOutput.hs +++ b/compiler/GHC/Driver/CodeOutput.hs @@ -27,8 +27,9 @@ import GHC.Cmm ( RawCmmGroup ) import GHC.Cmm.CLabel import GHC.Driver.Session -import GHC.Driver.Config.Finder (initFinderOpts) -import GHC.Driver.Config.CmmToAsm (initNCGConfig) +import GHC.Driver.Config.Finder (initFinderOpts) +import GHC.Driver.Config.CmmToAsm (initNCGConfig) +import GHC.Driver.Config.CmmToLlvm (initLCGConfig) import GHC.Driver.Ppr import GHC.Driver.Backend @@ -187,10 +188,11 @@ outputAsm logger dflags this_mod location filenm cmm_stream = do -} outputLlvm :: Logger -> DynFlags -> FilePath -> Stream IO RawCmmGroup a -> IO a -outputLlvm logger dflags filenm cmm_stream = +outputLlvm logger dflags filenm cmm_stream = do + lcg_config <- initLCGConfig logger dflags {-# SCC "llvm_output" #-} doOutput filenm $ \f -> {-# SCC "llvm_CodeGen" #-} - llvmCodeGen logger dflags f cmm_stream + llvmCodeGen logger lcg_config f cmm_stream {- ************************************************************************ |