summaryrefslogtreecommitdiff
path: root/compiler/simplCore/SimplCore.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-09-18 22:44:15 -0400
committerBen Gamari <ben@smart-cactus.org>2017-09-18 22:44:16 -0400
commit8929db00d79d10cedc522422d7dbb97db07bf308 (patch)
tree2244521a478d9c0eca5241b2460bca7a649853e9 /compiler/simplCore/SimplCore.hs
parent74e8cc1ff5efa57a86e94abf0c909af153b0b70b (diff)
downloadhaskell-wip/anf-core.tar.gz
[WIP] Simple ANFisation pass for Corewip/anf-core
This begins to explore the ideas described by @simonpj in #14222. Currently this is mostly just infrastructure; clearly some more thought needs to be put into when this pass should be run. Test Plan: TODO Reviewers: austin, goldfire Subscribers: rwbarton, thomie, simonpj GHC Trac Issues: #14222 Differential Revision: https://phabricator.haskell.org/D3990
Diffstat (limited to 'compiler/simplCore/SimplCore.hs')
-rw-r--r--compiler/simplCore/SimplCore.hs16
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 70d5e0f250..6ebc92e699 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -43,6 +43,7 @@ import Specialise ( specProgram)
import SpecConstr ( specConstrProgram)
import DmdAnal ( dmdAnalProgram )
import CallArity ( callArityAnalProgram )
+import AnfiseCore ( anfiseProgram )
import Exitify ( exitifyProgram )
import WorkWrap ( wwTopBinds )
import Vectorise ( vectorise )
@@ -186,7 +187,7 @@ getCoreToDo dflags
-- inlined. I found that spectral/hartel/genfft lost some useful
-- strictness in the function sumcode' if augment is not inlined
-- before strictness analysis runs
- simpl_phases = CoreDoPasses [ simpl_phase phase ["main"] max_iter
+ simpl_phases = CoreDoPasses [ CoreDoPasses [ anfise, simpl_phase phase ["main"] max_iter ]
| phase <- [phases, phases-1 .. 1] ]
@@ -212,6 +213,16 @@ getCoreToDo dflags
[simpl_phase 0 ["post-worker-wrapper"] max_iter]
))
+ anfise = CoreDoPasses
+ [ CoreDoAnfise
+ , CoreDoFloatOutwards FloatOutSwitches { floatOutLambdas = Just 0
+ , floatOutConstants = True
+ , floatOutOverSatApps = True
+ , floatToTopLevelOnly = False
+ }
+ , CoreCSE
+ ]
+
-- Static forms are moved to the top level with the FloatOut pass.
-- See Note [Grand plan for static forms] in StaticPtrTable.
static_ptrs_float_outwards =
@@ -482,6 +493,9 @@ doCorePass CoreDoStaticArgs = {-# SCC "StaticArgs" #-}
doCorePass CoreDoCallArity = {-# SCC "CallArity" #-}
doPassD callArityAnalProgram
+doCorePass CoreDoAnfise = {-# SCC "ANFise" #-}
+ doPass anfiseProgram
+
doCorePass CoreDoExitify = {-# SCC "Exitify" #-}
doPass exitifyProgram