Remove optimization phases, update package.yaml-s

This commit is contained in:
TheMatten 2020-10-23 09:56:15 +02:00
parent 6b660eaadc
commit 5f14cd051d
6 changed files with 16 additions and 99 deletions

View File

@ -23,7 +23,7 @@ dependencies:
- syb >= 0.7 && < 0.8
- stm >= 2 && < 3
- template-haskell >= 2.12.0.0 && < 3
- th-abstraction >= 0.3.1.0 && < 0.4
- th-abstraction >= 0.3.1.0 && < 0.5
- transformers >= 0.5.2.0 && < 0.6
- first-class-families >= 0.5.0.0 && < 0.9
- unagi-chan >= 0.4.0.0 && < 0.5
@ -119,6 +119,8 @@ tests:
- inspection-testing >= 0.4.2 && < 0.5
- hspec >= 2.6.0 && < 3
- doctest >= 0.16.0.1 && < 0.17
generated-other-modules:
- Build_doctests
benchmarks:
polysemy-bench:

View File

@ -63,6 +63,8 @@ tests:
- should-not-typecheck >= 2.1.0 && < 3
- inspection-testing >= 0.4.2 && < 0.5
- doctest >= 0.16.0.1 && < 0.17
generated-other-modules:
- Build_doctests
default-extensions:
- DataKinds

View File

@ -1,10 +1,10 @@
cabal-version: 1.24
cabal-version: 2.0
-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 0f4635d86ee9b6424b575257afd4fc1a42b0ddbbf2270bdcb1a71b8e54f0226d
-- hash: c7e130178c5199be49659c43bf9e2d9dc5792c21c41b81b7ba50279ebea963e0
name: polysemy-plugin
version: 0.2.5.1
@ -45,7 +45,6 @@ library
Polysemy.Plugin.Fundep.Stuff
Polysemy.Plugin.Fundep.Unification
Polysemy.Plugin.Fundep.Utils
Polysemy.Plugin.Phases
other-modules:
Paths_polysemy_plugin
hs-source-dirs:
@ -74,6 +73,9 @@ test-suite polysemy-plugin-test
TypeErrors
VDQSpec
Paths_polysemy_plugin
Build_doctests
autogen-modules:
Build_doctests
hs-source-dirs:
test
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax

View File

@ -62,43 +62,14 @@ module Polysemy.Plugin
) where
import Polysemy.Plugin.Fundep
#if __GLASGOW_HASKELL__ >= 810
import Polysemy.Plugin.Phases
import Data.Bool (bool)
#endif
import GhcPlugins
------------------------------------------------------------------------------
plugin :: Plugin
plugin = defaultPlugin
{ tcPlugin = const $ Just fundepPlugin
, installCoreToDos = const installTodos
#if __GLASGOW_HASKELL__ >= 806
, pluginRecompile = purePlugin
#endif
}
------------------------------------------------------------------------------
#if __GLASGOW_HASKELL__ >= 810
polysemyInternal :: ModuleName
polysemyInternal = mkModuleName "Polysemy.Internal"
#endif
------------------------------------------------------------------------------
installTodos :: [CoreToDo] -> CoreM [CoreToDo]
installTodos todos = do
dflags <- getDynFlags
case optLevel dflags of
0 -> pure todos
_ -> do
#if __GLASGOW_HASKELL__ >= 810
mods <- moduleSetElts <$> getVisibleOrphanMods
pure $ todos ++ bool []
(extraPhases dflags)
(any ((== polysemyInternal) . moduleName) mods)
#else
pure todos
#endif

View File

@ -1,63 +0,0 @@
{-# LANGUAGE CPP #-}
module Polysemy.Plugin.Phases
( extraPhases
) where
import BasicTypes
import CoreMonad
import DynFlags
extraPhases :: DynFlags -> [CoreToDo]
extraPhases dflags =
[ CoreDoSpecialising
, simpl_phase 0 ["post-late-spec"] max_iter
, simpl_gently
, CoreDoStaticArgs
, CoreDoSpecialising
-- TODO(sandy): probably don't need this one
, simpl_phase 0 ["post-late-spec"] max_iter
, simpl_phases
, simpl_gently
]
where
option = flip gopt dflags
max_iter = maxSimplIterations dflags
rules_on = option Opt_DoLambdaEtaExpansion
phases = simplPhases dflags
base_mode = SimplMode
{ sm_phase = error "base_mode"
, sm_names = []
#if __GLASGOW_HASKELL__ >= 804
, sm_dflags = dflags
#endif
, sm_rules = option Opt_EnableRewriteRules
, sm_eta_expand = rules_on
, sm_inline = True
, sm_case_case = True
}
simpl_phase phase names iter = CoreDoPasses
[ runWhen (phase `elem` strictnessBefore dflags) CoreDoStrictness
, CoreDoSimplify iter $
base_mode { sm_phase = Phase phase
, sm_names = names
}
, runMaybe (ruleCheck dflags) $ CoreDoRuleCheck $ Phase phase
]
simpl_gently = CoreDoSimplify max_iter $ base_mode
{ sm_phase = InitialPhase
, sm_names = ["Gentle"]
, sm_rules = rules_on
, sm_inline = True
, sm_case_case = False
}
simpl_phases = CoreDoPasses
[ simpl_phase phase ["main"] max_iter
| phase <- [phases, phases-1 .. 1]
]

View File

@ -1,10 +1,10 @@
cabal-version: 1.24
cabal-version: 2.0
-- This file has been generated from package.yaml by hpack version 0.34.2.
-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 6f6080a4e65486639af03142e56fdf232ed5c7747e77c24b378b0bb8033a079d
-- hash: fa7aaa2419a7bc1c1779979b304e87f5840d10146f3f23d1b4d93ac1ddbc028f
name: polysemy
version: 1.3.0.0
@ -145,6 +145,9 @@ test-suite polysemy-test
ViewSpec
WriterSpec
Paths_polysemy
Build_doctests
autogen-modules:
Build_doctests
hs-source-dirs:
test
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax