summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToLlvm.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-26 15:10:03 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:01 -0400
commit2517a51c0f949c1021de9f7c16f67345c6ab78a9 (patch)
tree82c806209b25125a428a6415ade64d6c95de9328 /compiler/GHC/CmmToLlvm.hs
parent3445b9652671280920755ee3d2b49780eeb3a991 (diff)
downloadhaskell-2517a51c0f949c1021de9f7c16f67345c6ab78a9.tar.gz
DynFlags refactoring VIII (#17957)
* Remove several uses of `sdocWithDynFlags`, especially in GHC.Llvm.* * Add LlvmOpts datatype to store Llvm backend options * Remove Outputable instances (for LlvmVar, LlvmLit, LlvmStatic and Llvm.MetaExpr) which require LlvmOpts. * Rename ppMetaExpr into ppMetaAnnotExpr (pprMetaExpr is now used in place of `ppr :: MetaExpr -> SDoc`)
Diffstat (limited to 'compiler/GHC/CmmToLlvm.hs')
-rw-r--r--compiler/GHC/CmmToLlvm.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs
index f91f3578e6..ac8e9718e4 100644
--- a/compiler/GHC/CmmToLlvm.hs
+++ b/compiler/GHC/CmmToLlvm.hs
@@ -92,7 +92,8 @@ llvmCodeGen' dflags cmm_stream
a <- Stream.consume cmm_stream llvmGroupLlvmGens
-- Declare aliases for forward references
- renderLlvm . pprLlvmData =<< generateExternDecls
+ opts <- getLlvmOpts
+ renderLlvm . pprLlvmData opts =<< generateExternDecls
-- Postamble
cmmUsedLlvmGens
@@ -150,14 +151,15 @@ cmmDataLlvmGens statics
mapM_ regGlobal gs
gss' <- mapM aliasify $ gs
- renderLlvm $ pprLlvmData (concat gss', concat tss)
+ opts <- getLlvmOpts
+ renderLlvm $ pprLlvmData opts (concat gss', concat tss)
-- | Complete LLVM code generation phase for a single top-level chunk of Cmm.
cmmLlvmGen ::RawCmmDecl -> LlvmM ()
cmmLlvmGen cmm@CmmProc{} = do
-- rewrite assignments to global regs
- dflags <- getDynFlag id
+ dflags <- getDynFlags
let fixed_cmm = {-# SCC "llvm_fix_regs" #-} fixStgRegisters dflags cmm
dumpIfSetLlvm Opt_D_dump_opt_cmm "Optimised Cmm"
@@ -194,7 +196,8 @@ cmmMetaLlvmPrelude = do
-- just a name on its own. Previously `null` was accepted as the
-- name.
Nothing -> [ MetaStr name ]
- renderLlvm $ ppLlvmMetas metas
+ opts <- getLlvmOpts
+ renderLlvm $ ppLlvmMetas opts metas
-- -----------------------------------------------------------------------------
-- | Marks variables as used where necessary
@@ -217,6 +220,7 @@ cmmUsedLlvmGens = do
sectName = Just $ fsLit "llvm.metadata"
lmUsedVar = LMGlobalVar (fsLit "llvm.used") ty Appending sectName Nothing Constant
lmUsed = LMGlobal lmUsedVar (Just usedArray)
+ opts <- getLlvmOpts
if null ivars
then return ()
- else renderLlvm $ pprLlvmData ([lmUsed], [])
+ else renderLlvm $ pprLlvmData opts ([lmUsed], [])