diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2016-12-15 10:57:43 -0800 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2016-12-29 19:25:50 +0100 |
commit | aac08a0f37442a79096d7d2392f34b42ee5da2bb (patch) | |
tree | 4001ca3f68b6bb5eef8089d52633817913c47a16 /compiler/basicTypes | |
parent | a3704409acc3bd237d3e872f640686918fb51f5f (diff) | |
download | haskell-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.hs | 6 | ||||
-rw-r--r-- | compiler/basicTypes/Var.hs | 19 |
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 |