diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2018-11-19 17:48:44 +0100 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2018-11-19 17:48:44 +0100 |
commit | 47bbc709cb221e32310c6e28eb2f33acf78488c7 (patch) | |
tree | 07326ee259a4b547d4a568e815204b7c1f543567 /compiler/utils | |
parent | cc615c697b54e3141e7b30b975de0b07dc9b8b29 (diff) | |
download | haskell-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/utils')
-rw-r--r-- | compiler/utils/UniqDSet.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/utils/UniqDSet.hs b/compiler/utils/UniqDSet.hs index 92d924ee37..c2ace5787f 100644 --- a/compiler/utils/UniqDSet.hs +++ b/compiler/utils/UniqDSet.hs @@ -33,7 +33,8 @@ module UniqDSet ( isEmptyUniqDSet, lookupUniqDSet, uniqDSetToList, - partitionUniqDSet + partitionUniqDSet, + mapUniqDSet ) where import GhcPrelude @@ -121,6 +122,10 @@ uniqDSetToList = eltsUDFM . getUniqDSet partitionUniqDSet :: (a -> Bool) -> UniqDSet a -> (UniqDSet a, UniqDSet a) partitionUniqDSet p = coerce . partitionUDFM p . getUniqDSet +-- See Note [UniqSet invariant] in UniqSet.hs +mapUniqDSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b +mapUniqDSet f = mkUniqDSet . map f . uniqDSetToList + -- Two 'UniqDSet's are considered equal if they contain the same -- uniques. instance Eq (UniqDSet a) where |