diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-06-15 15:09:11 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-09 11:19:24 -0400 |
commit | 8c892689058912c35ed36e07b5a9ed0df86abc03 (patch) | |
tree | 27779b02ed8ec3f3e16daa55e9bf73b3c92bdb61 /compiler/GHC/Core/Coercion/Opt.hs | |
parent | 822f10575d207a2a47b21ac853dcf28c655041c4 (diff) | |
download | haskell-8c892689058912c35ed36e07b5a9ed0df86abc03.tar.gz |
DynFlags: add OptCoercionOpts
Use OptCoercionOpts to avoid threading DynFlags all the way down to
GHC.Core.Coercion.Opt
Diffstat (limited to 'compiler/GHC/Core/Coercion/Opt.hs')
-rw-r--r-- | compiler/GHC/Core/Coercion/Opt.hs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/compiler/GHC/Core/Coercion/Opt.hs b/compiler/GHC/Core/Coercion/Opt.hs index fb2bde23d1..b9656a45bb 100644 --- a/compiler/GHC/Core/Coercion/Opt.hs +++ b/compiler/GHC/Core/Coercion/Opt.hs @@ -2,13 +2,17 @@ {-# LANGUAGE CPP #-} -module GHC.Core.Coercion.Opt ( optCoercion, checkAxInstCo ) where +module GHC.Core.Coercion.Opt + ( optCoercion + , checkAxInstCo + , OptCoercionOpts (..) + ) +where #include "HsVersions.h" import GHC.Prelude -import GHC.Driver.Session import GHC.Driver.Ppr import GHC.Core.TyCo.Rep @@ -109,12 +113,17 @@ So we substitute the coercion variable c for the coercion (h1 ~N (n1; h2; sym n2)) in g. -} -optCoercion :: DynFlags -> TCvSubst -> Coercion -> NormalCo +-- | Coercion optimisation options +newtype OptCoercionOpts = OptCoercionOpts + { optCoercionEnabled :: Bool -- ^ Enable coercion optimisation (reduce its size) + } + +optCoercion :: OptCoercionOpts -> TCvSubst -> Coercion -> NormalCo -- ^ optCoercion applies a substitution to a coercion, -- *and* optimises it to reduce its size -optCoercion dflags env co - | hasNoOptCoercion dflags = substCo env co - | otherwise = optCoercion' env co +optCoercion opts env co + | optCoercionEnabled opts = optCoercion' env co + | otherwise = substCo env co optCoercion' :: TCvSubst -> Coercion -> NormalCo optCoercion' env co |