diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2015-12-08 11:11:11 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2015-12-08 11:15:49 +0100 |
commit | fd3b845c01aa26b6e5cd12c00af59e5468e21b1b (patch) | |
tree | a6048cc545e9db073a1213aaa03ad02c8ef66531 /compiler/llvmGen/LlvmCodeGen/CodeGen.hs | |
parent | 9f4ca5afaccc8a397d8ee91b5423a9c2fcd151ce (diff) | |
download | haskell-fd3b845c01aa26b6e5cd12c00af59e5468e21b1b.tar.gz |
Make HasDynFlags more transformers friendly
Ideally, we'd have the more general
instance (MonadTrans t, Monad m, HasDynFlags m) => HasDynFlags (t m) where
getDynFlags = lift getDynFlags
definition. However, that one would overlap with the `HasDynFlags (GhcT m)`
instance. Instead we define instances for a couple of common Monad
transformers explicitly in order to avoid nasty overlapping instances.
This is a preparatory refactoring for #10874
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D1581
Diffstat (limited to 'compiler/llvmGen/LlvmCodeGen/CodeGen.hs')
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index 539e2220b7..0aec7ad2a3 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -275,7 +275,7 @@ genCall (PrimTarget (MO_AtomicWrite _width)) [] [addr, val] = runStmtsDecls $ do -- some extra parameters. genCall t@(PrimTarget op) [] args | Just align <- machOpMemcpyishAlign op = runStmtsDecls $ do - dflags <- lift $ getDynFlags + dflags <- getDynFlags let isVolTy = [i1] isVolVal = [mkIntLit i1 0] argTy | MO_Memset _ <- op = [i8Ptr, i8, llvmWord dflags, i32] ++ isVolTy @@ -377,7 +377,7 @@ genCall t@(PrimTarget (MO_SubWordC w)) [dstV, dstO] [lhs, rhs] = -- Handle all other foreign calls and prim ops. genCall target res args = runStmtsDecls $ do - dflags <- lift $ getDynFlags + dflags <- getDynFlags -- parameter types let arg_type (_, AddrHint) = i8Ptr @@ -1378,7 +1378,7 @@ genMachOp_slow opt op [x, y] = case op of else do -- Error. Continue anyway so we can debug the generated ll file. - dflags <- lift getDynFlags + dflags <- getDynFlags let style = mkCodeStyle CStyle toString doc = renderWithStyle dflags doc style cmmToStr = (lines . toString . PprCmm.pprExpr) @@ -1422,7 +1422,7 @@ genMachOp_slow opt op [x, y] = case op of vx <- exprToVarW x vy <- exprToVarW y - dflags <- lift getDynFlags + dflags <- getDynFlags let word = getVarType vx let word2 = LMInt $ 2 * (llvmWidthInBits dflags $ getVarType vx) let shift = llvmWidthInBits dflags word @@ -1522,7 +1522,7 @@ genLoad_fast atomic e r n ty = do genLoad_slow :: Atomic -> CmmExpr -> CmmType -> [MetaAnnot] -> LlvmM ExprData genLoad_slow atomic e ty meta = runExprData $ do iptr <- exprToVarW e - dflags <- lift getDynFlags + dflags <- getDynFlags case getVarType iptr of LMPointer _ -> do doExprW (cmmToLlvmType ty) (MExpr meta $ loadInstr iptr) |