diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-05-14 13:48:27 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-24 01:55:24 -0400 |
commit | 37430251c3f684c46e893552dba78653d80e5243 (patch) | |
tree | 3650a4cf7c6696c90fa2741029ddc254e4c1dbb9 | |
parent | a0ea59d641d400543e9e803007500da01eedf48a (diff) | |
download | haskell-37430251c3f684c46e893552dba78653d80e5243.tar.gz |
Rename GHC.Core.Arity into GHC.Core.Opt.Arity
-rw-r--r-- | compiler/GHC/Core/Lint.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Arity.hs (renamed from compiler/GHC/Core/Arity.hs) | 4 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/CallArity.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/DmdAnal.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/FloatOut.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/OccurAnal.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/SetLevels.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Simplify.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Simplify/Utils.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Specialise.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/WorkWrap.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Core/SimpleOpt.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Unfold.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Utils.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CoreToStg.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CoreToStg/Prep.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/HsToCore/Binds.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Iface/Tidy.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Types/Basic.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Types/Id.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Types/Id/Info.hs | 2 | ||||
-rw-r--r-- | compiler/ghc.cabal.in | 2 |
22 files changed, 33 insertions, 33 deletions
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs index f0222ec632..fe3bec8a48 100644 --- a/compiler/GHC/Core/Lint.hs +++ b/compiler/GHC/Core/Lint.hs @@ -63,8 +63,8 @@ import GHC.Data.FastString import GHC.Utils.Misc import GHC.Core.InstEnv ( instanceDFunId ) import GHC.Core.Coercion.Opt ( checkAxInstCo ) -import GHC.Core.Arity ( typeArity ) -import GHC.Types.Demand ( splitStrictSig, isDeadEndDiv ) +import GHC.Core.Opt.Arity ( typeArity ) +import GHC.Types.Demand ( splitStrictSig, isDeadEndDiv ) import GHC.Driver.Types import GHC.Driver.Session @@ -1735,7 +1735,7 @@ argument to be made for allowing a situation like this: Applying this rule can't turn a well-typed program into an ill-typed one, so conceivably we could allow it. But we can always eta-expand such an -"undersaturated" rule (see 'GHC.Core.Arity.etaExpandToJoinPointRule'), and in fact +"undersaturated" rule (see 'GHC.Core.Opt.Arity.etaExpandToJoinPointRule'), and in fact the simplifier would have to in order to deal with the RHS. So we take a conservative view and don't allow undersaturated rules for join points. See Note [Rules and join points] in OccurAnal for further discussion. diff --git a/compiler/GHC/Core/Arity.hs b/compiler/GHC/Core/Opt/Arity.hs index 935fd7a67b..17acd5dbfe 100644 --- a/compiler/GHC/Core/Arity.hs +++ b/compiler/GHC/Core/Opt/Arity.hs @@ -11,7 +11,7 @@ {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} -- | Arity and eta expansion -module GHC.Core.Arity +module GHC.Core.Opt.Arity ( manifestArity, joinRhsArity, exprArity, typeArity , exprEtaExpandArity, findRhsArity, etaExpand , etaExpandToJoinPoint, etaExpandToJoinPointRule @@ -1136,7 +1136,7 @@ mkEtaWW orig_n ppr_orig_expr in_scope orig_ty -- TODO Check if we actually *are* changing any join points' types subst_expr :: Subst -> CoreExpr -> CoreExpr -subst_expr = substExpr (text "GHC.Core.Arity:substExpr") +subst_expr = substExpr (text "GHC.Core.Opt.Arity:substExpr") -------------- diff --git a/compiler/GHC/Core/Opt/CallArity.hs b/compiler/GHC/Core/Opt/CallArity.hs index 250942e0f6..4df70ed176 100644 --- a/compiler/GHC/Core/Opt/CallArity.hs +++ b/compiler/GHC/Core/Opt/CallArity.hs @@ -16,7 +16,7 @@ import GHC.Driver.Session ( DynFlags ) import GHC.Types.Basic import GHC.Core import GHC.Types.Id -import GHC.Core.Arity ( typeArity ) +import GHC.Core.Opt.Arity ( typeArity ) import GHC.Core.Utils ( exprIsCheap, exprIsTrivial ) import GHC.Data.Graph.UnVar import GHC.Types.Demand @@ -384,7 +384,7 @@ the case for Core! 1. We need to ensure the invariant callArity e <= typeArity (exprType e) for the same reasons that exprArity needs this invariant (see Note - [exprArity invariant] in GHC.Core.Arity). + [exprArity invariant] in GHC.Core.Opt.Arity). If we are not doing that, a too-high arity annotation will be stored with the id, confusing the simplifier later on. diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs index b1fcc227ef..97c7e29622 100644 --- a/compiler/GHC/Core/Opt/DmdAnal.hs +++ b/compiler/GHC/Core/Opt/DmdAnal.hs @@ -880,9 +880,9 @@ we want plusInt's strictness to propagate to foo! But because it has no manifest lambdas, it won't do so automatically, and indeed 'co' might have type (Int->Int->Int) ~ T. -Fortunately, GHC.Core.Arity gives 'foo' arity 2, which is enough for LetDown to +Fortunately, GHC.Core.Opt.Arity gives 'foo' arity 2, which is enough for LetDown to forward plusInt's demand signature, and all is well (see Note [Newtype arity] in -GHC.Core.Arity)! A small example is the test case NewtypeArity. +GHC.Core.Opt.Arity)! A small example is the test case NewtypeArity. Historical Note [Product demands for function body] diff --git a/compiler/GHC/Core/Opt/FloatOut.hs b/compiler/GHC/Core/Opt/FloatOut.hs index 7bb7acafb0..caed80936d 100644 --- a/compiler/GHC/Core/Opt/FloatOut.hs +++ b/compiler/GHC/Core/Opt/FloatOut.hs @@ -15,7 +15,7 @@ import GHC.Prelude import GHC.Core import GHC.Core.Utils import GHC.Core.Make -import GHC.Core.Arity ( etaExpand ) +import GHC.Core.Opt.Arity ( etaExpand ) import GHC.Core.Opt.Monad ( FloatOutSwitches(..) ) import GHC.Driver.Session diff --git a/compiler/GHC/Core/Opt/OccurAnal.hs b/compiler/GHC/Core/Opt/OccurAnal.hs index c4f714eef1..c2c2dc9cef 100644 --- a/compiler/GHC/Core/Opt/OccurAnal.hs +++ b/compiler/GHC/Core/Opt/OccurAnal.hs @@ -24,7 +24,7 @@ import GHC.Core import GHC.Core.FVs import GHC.Core.Utils ( exprIsTrivial, isDefaultAlt, isExpandableApp, stripTicksTopE, mkTicks ) -import GHC.Core.Arity ( joinRhsArity ) +import GHC.Core.Opt.Arity ( joinRhsArity ) import GHC.Types.Id import GHC.Types.Id.Info import GHC.Types.Basic diff --git a/compiler/GHC/Core/Opt/SetLevels.hs b/compiler/GHC/Core/Opt/SetLevels.hs index 0a1395a432..b40471bf2c 100644 --- a/compiler/GHC/Core/Opt/SetLevels.hs +++ b/compiler/GHC/Core/Opt/SetLevels.hs @@ -74,7 +74,7 @@ import GHC.Core.Utils ( exprType, exprIsHNF , isExprLevPoly , collectMakeStaticArgs ) -import GHC.Core.Arity ( exprBotStrictness_maybe ) +import GHC.Core.Opt.Arity ( exprBotStrictness_maybe ) import GHC.Core.FVs -- all of it import GHC.Core.Subst import GHC.Core.Make ( sortQuantVars ) diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs index 154b15e9d8..23b26abcf8 100644 --- a/compiler/GHC/Core/Opt/Simplify.hs +++ b/compiler/GHC/Core/Opt/Simplify.hs @@ -785,7 +785,7 @@ propagate the info that x's RHS is bottom to x's IdInfo as rapidly as possible. We use tryEtaExpandRhs on every binding, and it turns ou that the -arity computation it performs (via GHC.Core.Arity.findRhsArity) already +arity computation it performs (via GHC.Core.Opt.Arity.findRhsArity) already does a simple bottoming-expression analysis. So all we need to do is propagate that info to the binder's IdInfo. diff --git a/compiler/GHC/Core/Opt/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs index e0e9cd798d..f26fdf9840 100644 --- a/compiler/GHC/Core/Opt/Simplify/Utils.hs +++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs @@ -49,7 +49,7 @@ import GHC.Core.Ppr import GHC.Core.TyCo.Ppr ( pprParendType ) import GHC.Core.FVs import GHC.Core.Utils -import GHC.Core.Arity +import GHC.Core.Opt.Arity import GHC.Core.Unfold import GHC.Types.Name import GHC.Types.Id @@ -1573,7 +1573,7 @@ Note [Eta-expanding at let bindings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We now eta expand at let-bindings, which is where the payoff comes. The most significant thing is that we can do a simple arity analysis -(in GHC.Core.Arity.findRhsArity), which we can't do for free-floating lambdas +(in GHC.Core.Opt.Arity.findRhsArity), which we can't do for free-floating lambdas One useful consequence of not eta-expanding lambdas is this example: genMap :: C a => ... diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs index ce646abd7f..d3f185605f 100644 --- a/compiler/GHC/Core/Opt/Specialise.hs +++ b/compiler/GHC/Core/Opt/Specialise.hs @@ -33,7 +33,7 @@ import GHC.Core.SimpleOpt ( collectBindersPushingCo ) import GHC.Core.Utils ( exprIsTrivial, getIdFromTrivialExpr_maybe , mkCast, exprType ) import GHC.Core.FVs -import GHC.Core.Arity ( etaExpandToJoinPointRule ) +import GHC.Core.Opt.Arity ( etaExpandToJoinPointRule ) import GHC.Types.Unique.Supply import GHC.Types.Name import GHC.Types.Id.Make ( voidArgId, voidPrimId ) diff --git a/compiler/GHC/Core/Opt/WorkWrap.hs b/compiler/GHC/Core/Opt/WorkWrap.hs index 52cdf04edf..df71f103a8 100644 --- a/compiler/GHC/Core/Opt/WorkWrap.hs +++ b/compiler/GHC/Core/Opt/WorkWrap.hs @@ -9,7 +9,7 @@ module GHC.Core.Opt.WorkWrap ( wwTopBinds ) where import GHC.Prelude -import GHC.Core.Arity ( manifestArity ) +import GHC.Core.Opt.Arity ( manifestArity ) import GHC.Core import GHC.Core.Unfold ( certainlyWillInline, mkWwInlineRule, mkWorkerUnfolding ) import GHC.Core.Utils ( exprType, exprIsHNF ) @@ -534,12 +534,12 @@ Note [Zapping DmdEnv after Demand Analyzer] above. Note [Don't eta expand in w/w] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A binding where the manifestArity of the RHS is less than idArity of the binder -means GHC.Core.Arity didn't eta expand that binding. When this happens, it does so -for a reason (see Note [exprArity invariant] in GHC.Core.Arity) and we probably have +means GHC.Core.Opt.Arity didn't eta expand that binding. When this happens, it does so +for a reason (see Note [exprArity invariant] in GHC.Core.Opt.Arity) and we probably have a PAP, cast or trivial expression as RHS. Performing the worker/wrapper split will implicitly eta-expand the binding to -idArity, overriding GHC.Core.Arity's decision. Other than playing fast and loose with +idArity, overriding GHC.Core.Opt.Arity's decision. Other than playing fast and loose with divergence, it's also broken for newtypes: f = (\xy.blah) |> co diff --git a/compiler/GHC/Core/SimpleOpt.hs b/compiler/GHC/Core/SimpleOpt.hs index e8a4e86af1..b14b421e49 100644 --- a/compiler/GHC/Core/SimpleOpt.hs +++ b/compiler/GHC/Core/SimpleOpt.hs @@ -22,7 +22,7 @@ module GHC.Core.SimpleOpt ( import GHC.Prelude -import GHC.Core.Arity( etaExpandToJoinPoint ) +import GHC.Core.Opt.Arity( etaExpandToJoinPoint ) import GHC.Core import GHC.Core.Subst diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs index bf281e7246..78cda980cc 100644 --- a/compiler/GHC/Core/Unfold.hs +++ b/compiler/GHC/Core/Unfold.hs @@ -50,7 +50,7 @@ import GHC.Driver.Session import GHC.Core import GHC.Core.Opt.OccurAnal ( occurAnalyseExpr ) import GHC.Core.SimpleOpt -import GHC.Core.Arity ( manifestArity ) +import GHC.Core.Opt.Arity ( manifestArity ) import GHC.Core.Utils import GHC.Types.Id import GHC.Types.Demand ( StrictSig, isDeadEndSig ) diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs index b9f4a63eb5..d6ff419c10 100644 --- a/compiler/GHC/Core/Utils.hs +++ b/compiler/GHC/Core/Utils.hs @@ -1033,7 +1033,7 @@ getIdFromTrivialExpr_maybe e {- exprIsDeadEnd is a very cheap and cheerful function; it may return False for bottoming expressions, but it never costs much to ask. See -also GHC.Core.Arity.exprBotStrictness_maybe, but that's a bit more +also GHC.Core.Opt.Arity.exprBotStrictness_maybe, but that's a bit more expensive. -} diff --git a/compiler/GHC/CoreToStg.hs b/compiler/GHC/CoreToStg.hs index 24e21b1901..9aae47bedb 100644 --- a/compiler/GHC/CoreToStg.hs +++ b/compiler/GHC/CoreToStg.hs @@ -20,7 +20,7 @@ import GHC.Prelude import GHC.Core import GHC.Core.Utils ( exprType, findDefault, isJoinBind , exprIsTickedString_maybe ) -import GHC.Core.Arity ( manifestArity ) +import GHC.Core.Opt.Arity ( manifestArity ) import GHC.Stg.Syntax import GHC.Core.Type diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index 8d4750c9e4..62fd46ff4c 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -26,7 +26,7 @@ import GHC.Driver.Types import GHC.Builtin.Names import GHC.Types.Id.Make ( realWorldPrimId ) import GHC.Core.Utils -import GHC.Core.Arity +import GHC.Core.Opt.Arity import GHC.Core.FVs import GHC.Core.Opt.Monad ( CoreToDo(..) ) import GHC.Core.Lint ( endPassIO ) @@ -1136,7 +1136,7 @@ After ANFing we get and now we do NOT want eta expansion to give f = /\a -> \ y -> (let s = h 3 in g s) y -Instead GHC.Core.Arity.etaExpand gives +Instead GHC.Core.Opt.Arity.etaExpand gives f = /\a -> \y -> let s = h 3 in g s y -} diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs index 7bd9506ca1..e24eb50d51 100644 --- a/compiler/GHC/HsToCore/Binds.hs +++ b/compiler/GHC/HsToCore/Binds.hs @@ -41,7 +41,7 @@ import GHC.Core.SimpleOpt ( simpleOptExpr ) import GHC.Core.Opt.OccurAnal ( occurAnalyseExpr ) import GHC.Core.Make import GHC.Core.Utils -import GHC.Core.Arity ( etaExpand ) +import GHC.Core.Opt.Arity ( etaExpand ) import GHC.Core.Unfold import GHC.Core.FVs import GHC.Data.Graph.Directed diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs index 455b0824e1..b2701bb383 100644 --- a/compiler/GHC/Iface/Tidy.hs +++ b/compiler/GHC/Iface/Tidy.hs @@ -29,7 +29,7 @@ import GHC.Core.Lint import GHC.Core.Rules import GHC.Core.PatSyn import GHC.Core.ConLike -import GHC.Core.Arity ( exprArity, exprBotStrictness_maybe ) +import GHC.Core.Opt.Arity ( exprArity, exprBotStrictness_maybe ) import GHC.Iface.Tidy.StaticPtrTable import GHC.Types.Var.Env import GHC.Types.Var.Set diff --git a/compiler/GHC/Types/Basic.hs b/compiler/GHC/Types/Basic.hs index 799e6950c7..0d34902b45 100644 --- a/compiler/GHC/Types/Basic.hs +++ b/compiler/GHC/Types/Basic.hs @@ -152,7 +152,7 @@ instance Outputable LeftOrRight where -- "real work". So: -- fib 100 has arity 0 -- \x -> fib x has arity 1 --- See also Note [Definition of arity] in GHC.Core.Arity +-- See also Note [Definition of arity] in GHC.Core.Opt.Arity type Arity = Int -- | Representation Arity diff --git a/compiler/GHC/Types/Id.hs b/compiler/GHC/Types/Id.hs index 3d9d9c3f40..62dd70eba5 100644 --- a/compiler/GHC/Types/Id.hs +++ b/compiler/GHC/Types/Id.hs @@ -780,7 +780,7 @@ idOneShotInfo :: Id -> OneShotInfo idOneShotInfo id = oneShotInfo (idInfo id) -- | Like 'idOneShotInfo', but taking the Horrible State Hack in to account --- See Note [The state-transformer hack] in GHC.Core.Arity +-- See Note [The state-transformer hack] in GHC.Core.Opt.Arity idStateHackOneShotInfo :: Id -> OneShotInfo idStateHackOneShotInfo id | isStateHackType (idType id) = stateHackOneShot @@ -790,7 +790,7 @@ idStateHackOneShotInfo id -- This one is the "business end", called externally. -- It works on type variables as well as Ids, returning True -- Its main purpose is to encapsulate the Horrible State Hack --- See Note [The state-transformer hack] in GHC.Core.Arity +-- See Note [The state-transformer hack] in GHC.Core.Opt.Arity isOneShotBndr :: Var -> Bool isOneShotBndr var | isTyVar var = True diff --git a/compiler/GHC/Types/Id/Info.hs b/compiler/GHC/Types/Id/Info.hs index 3eda9abe11..82ab98bc09 100644 --- a/compiler/GHC/Types/Id/Info.hs +++ b/compiler/GHC/Types/Id/Info.hs @@ -345,7 +345,7 @@ levityInfo = bitfieldGetLevityInfo . bitfield oneShotInfo :: IdInfo -> OneShotInfo oneShotInfo = bitfieldGetOneShotInfo . bitfield --- | 'Id' arity, as computed by 'GHC.Core.Arity'. Specifies how many arguments +-- | 'Id' arity, as computed by 'GHC.Core.Opt.Arity'. Specifies how many arguments -- this 'Id' has to be applied to before it doesn any meaningful work. arityInfo :: IdInfo -> ArityInfo arityInfo = bitfieldGetArityInfo . bitfield diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 260f231098..d08b08df96 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -297,7 +297,7 @@ Library GHC.StgToCmm.Utils GHC.StgToCmm.ExtCode GHC.Runtime.Heap.Layout - GHC.Core.Arity + GHC.Core.Opt.Arity GHC.Core.FVs GHC.Core.Lint GHC.Core.Subst |