summaryrefslogtreecommitdiff
path: root/compiler/stgSyn
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-12-15 10:57:43 -0800
committerJoachim Breitner <mail@joachim-breitner.de>2017-01-05 09:13:47 -0500
commit19d5c7312bf0ad9ae764168132aecf3696d5410b (patch)
tree4ca88418e91ce41b026389d75f985d0bd9a72292 /compiler/stgSyn
parentbaf9ebe55a51827c0511b3a670e60b9bb3617ab5 (diff)
downloadhaskell-19d5c7312bf0ad9ae764168132aecf3696d5410b.tar.gz
Add a CSE pass to Stg (#9291)
This CSE pass only targets data constructor applications. This is probably the best we can do, as function calls and primitive operations might have side-effects. Introduces the flag -fstg-cse, enabled by default with -O for now. It might also be a good candiate for -O2. Differential Revision: https://phabricator.haskell.org/D2871
Diffstat (limited to 'compiler/stgSyn')
-rw-r--r--compiler/stgSyn/StgSyn.hs24
1 files changed, 22 insertions, 2 deletions
diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs
index 3ec37eefff..64c8448421 100644
--- a/compiler/stgSyn/StgSyn.hs
+++ b/compiler/stgSyn/StgSyn.hs
@@ -24,8 +24,11 @@ module StgSyn (
combineStgBinderInfo,
-- a set of synonyms for the most common (only :-) parameterisation
- StgArg,
- StgBinding, StgExpr, StgRhs, StgAlt,
+ StgArg, StgBinding, StgExpr, StgRhs, StgAlt,
+
+ -- a set of synonyms to distinguish in- and out variants
+ InStgArg, InStgBinding, InStgExpr, InStgRhs, InStgAlt,
+ OutStgArg, OutStgBinding, OutStgExpr, OutStgRhs, OutStgAlt,
-- StgOp
StgOp(..),
@@ -551,7 +554,24 @@ type StgExpr = GenStgExpr Id Id
type StgRhs = GenStgRhs Id Id
type StgAlt = GenStgAlt Id Id
+{- Many passes apply a substitution, and it's very handy to have type
+ synonyms to remind us whether or not the subsitution has been applied.
+ See CoreSyn for precedence in Core land
+-}
+
+type InStgBinding = StgBinding
+type InStgArg = StgArg
+type InStgExpr = StgExpr
+type InStgRhs = StgRhs
+type InStgAlt = StgAlt
+type OutStgBinding = StgBinding
+type OutStgArg = StgArg
+type OutStgExpr = StgExpr
+type OutStgRhs = StgRhs
+type OutStgAlt = StgAlt
+
{-
+
************************************************************************
* *
\subsubsection[UpdateFlag-datatype]{@UpdateFlag@}