summaryrefslogtreecommitdiff
path: root/compiler/main/HscMain.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2018-11-19 17:48:44 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2018-11-19 17:48:44 +0100
commit47bbc709cb221e32310c6e28eb2f33acf78488c7 (patch)
tree07326ee259a4b547d4a568e815204b7c1f543567 /compiler/main/HscMain.hs
parentcc615c697b54e3141e7b30b975de0b07dc9b8b29 (diff)
downloadhaskell-47bbc709cb221e32310c6e28eb2f33acf78488c7.tar.gz
Don't track free variables in STG syntax by default
Summary: Currently, `CoreToStg` annotates `StgRhsClosure`s with their set of non-global free variables. This free variable information is only needed in the final code generation step (i.e. `StgCmm.codeGen`), which leads to transformations such as `StgCse` and `StgUnarise` having to maintain this information. This is tiresome and unnecessary, so this patch introduces a trees-to-grow-like approach that only introduces the free variable set into the syntax tree in the code gen pass, along with a free variable analysis on STG terms to generate that information. Fixes #15754. Reviewers: simonpj, osa1, bgamari, simonmar Reviewed By: osa1 Subscribers: rwbarton, carter GHC Trac Issues: #15754 Differential Revision: https://phabricator.haskell.org/D5324
Diffstat (limited to 'compiler/main/HscMain.hs')
-rw-r--r--compiler/main/HscMain.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 9dd750736a..837e903631 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -124,6 +124,7 @@ import CorePrep
import CoreToStg ( coreToStg )
import qualified StgCmm ( codeGen )
import StgSyn
+import StgFVs ( annTopBindingsFreeVars )
import CostCentre
import ProfInit
import TyCon
@@ -1426,10 +1427,11 @@ doCodeGen hsc_env this_mod data_tycons
cost_centre_info stg_binds hpc_info = do
let dflags = hsc_dflags hsc_env
+ let stg_binds_w_fvs = annTopBindingsFreeVars stg_binds
let cmm_stream :: Stream IO CmmGroup ()
cmm_stream = {-# SCC "StgCmm" #-}
StgCmm.codeGen dflags this_mod data_tycons
- cost_centre_info stg_binds hpc_info
+ cost_centre_info stg_binds_w_fvs hpc_info
-- codegen consumes a stream of CmmGroup, and produces a new
-- stream of CmmGroup (not necessarily synchronised: one