summaryrefslogtreecommitdiff
path: root/compiler/basicTypes
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-12-15 10:57:43 -0800
committerJoachim Breitner <mail@joachim-breitner.de>2016-12-29 19:25:50 +0100
commitaac08a0f37442a79096d7d2392f34b42ee5da2bb (patch)
tree4001ca3f68b6bb5eef8089d52633817913c47a16 /compiler/basicTypes
parenta3704409acc3bd237d3e872f640686918fb51f5f (diff)
downloadhaskell-wip/T9291.tar.gz
Add a CSE pass to Stg (#9291)wip/T9291
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. Differential Revision: https://phabricator.haskell.org/D2871
Diffstat (limited to 'compiler/basicTypes')
-rw-r--r--compiler/basicTypes/Id.hs6
-rw-r--r--compiler/basicTypes/Var.hs19
2 files changed, 25 insertions, 0 deletions
diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs
index 1b84acda75..84cafa3902 100644
--- a/compiler/basicTypes/Id.hs
+++ b/compiler/basicTypes/Id.hs
@@ -28,6 +28,10 @@ module Id (
-- * The main types
Var, Id, isId,
+ -- * In and Out variants
+ InVar, InId,
+ OutVar, OutId,
+
-- ** Simple construction
mkGlobalId, mkVanillaGlobal, mkVanillaGlobalWithInfo,
mkLocalId, mkLocalCoVar, mkLocalIdOrCoVar,
@@ -114,6 +118,8 @@ import BasicTypes
-- Imported and re-exported
import Var( Id, CoVar, DictId,
+ InId, InVar,
+ OutId, OutVar,
idInfo, idDetails, globaliseId, varType,
isId, isLocalId, isGlobalId, isExportedId )
import qualified Var
diff --git a/compiler/basicTypes/Var.hs b/compiler/basicTypes/Var.hs
index e783efea0d..3f78c2800f 100644
--- a/compiler/basicTypes/Var.hs
+++ b/compiler/basicTypes/Var.hs
@@ -37,6 +37,10 @@ module Var (
Var, CoVar, Id, NcId, DictId, DFunId, EvVar, EqVar, EvId, IpId,
TyVar, TypeVar, KindVar, TKVar, TyCoVar,
+ -- * In and Out variants
+ InVar, InCoVar, InId, InTyVar,
+ OutVar, OutCoVar, OutId, OutTyVar,
+
-- ** Taking 'Var's apart
varName, varUnique, varType,
@@ -150,6 +154,21 @@ type EqVar = EvId -- Boxed equality evidence
type TyCoVar = Id -- Type, *or* coercion variable
-- predicate: isTyCoVar
+
+{- 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 -}
+
+type InVar = Var
+type InTyVar = TyVar
+type InCoVar = CoVar
+type InId = Id
+type OutVar = Var
+type OutTyVar = TyVar
+type OutCoVar = CoVar
+type OutId = Id
+
+
+
{- Note [Evidence: EvIds and CoVars]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* An EvId (evidence Id) is a term-level evidence variable