diff options
82 files changed, 327 insertions, 320 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs index b4af2b2eea..79e71f9526 100644 --- a/compiler/GHC/Core.hs +++ b/compiler/GHC/Core.hs @@ -354,7 +354,7 @@ an unlifted literal, like all the others. Also, we do not permit case analysis with literal patterns on floating-point types. See #9238 and Note [Rules for floating-point comparisons] in -PrelRules for the rationale for this restriction. +GHC.Core.Op.ConstantFold for the rationale for this restriction. -------------------------- GHC.Core INVARIANTS --------------------------- @@ -508,7 +508,7 @@ checked by Core Lint. 5. Floating-point values must not be scrutinised against literals. See #9238 and Note [Rules for floating-point comparisons] - in PrelRules for rationale. Checked in lintCaseExpr; + in GHC.Core.Op.ConstantFold for rationale. Checked in lintCaseExpr; see the call to isFloatingTy. 6. The 'ty' field of (Case scrut bndr ty alts) is the type of the @@ -784,7 +784,7 @@ is crucial for understanding how case-of-case interacts with join points: _ -> False The simplifier will pull the case into the join point (see Note [Join points -and case-of-case] in Simplify): +and case-of-case] in GHC.Core.Op.Simplify): join j :: Int -> Bool -> Bool -- changed! @@ -1810,9 +1810,9 @@ the occurrence info is wrong -} -- The Ord is needed for the FiniteMap used in the lookForConstructor --- in SimplEnv. If you declared that lookForConstructor *ignores* --- constructor-applications with LitArg args, then you could get --- rid of this Ord. +-- in GHC.Core.Op.Simplify.Env. If you declared that lookForConstructor +-- *ignores* constructor-applications with LitArg args, then you could get rid +-- of this Ord. instance Outputable AltCon where ppr (DataAlt dc) = ppr dc diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs index 3e59a6ef85..626b1bbc78 100644 --- a/compiler/GHC/Core/Coercion.hs +++ b/compiler/GHC/Core/Coercion.hs @@ -1499,7 +1499,7 @@ mkPiCo r v co | isTyVar v = mkHomoForAllCos [v] co -- We didn't call mkForAllCo here because if v does not appear -- in co, the argement coercion will be nominal. But here we -- want it to be r. It is only called in 'mkPiCos', which is - -- only used in SimplUtils, where we are sure for + -- only used in GHC.Core.Op.Simplify.Utils, where we are sure for -- now (Aug 2018) v won't occur in co. mkFunCo r (mkReflCo r (varType v)) co | otherwise = mkFunCo r (mkReflCo r (varType v)) co diff --git a/compiler/GHC/Core/FamInstEnv.hs b/compiler/GHC/Core/FamInstEnv.hs index 10dc63eb50..1343544612 100644 --- a/compiler/GHC/Core/FamInstEnv.hs +++ b/compiler/GHC/Core/FamInstEnv.hs @@ -314,7 +314,7 @@ Nevertheless it is still useful to have data families in the FamInstEnv: - For finding overlaps and conflicts - For finding the representation type...see FamInstEnv.topNormaliseType - and its call site in Simplify + and its call site in GHC.Core.Op.Simplify - In standalone deriving instance Eq (T [Int]) we need to find the representation type for T [Int] diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs index 92e9a25a6f..5777940ba5 100644 --- a/compiler/GHC/Core/Lint.hs +++ b/compiler/GHC/Core/Lint.hs @@ -29,7 +29,7 @@ import GHC.Core import GHC.Core.FVs import GHC.Core.Utils import GHC.Core.Stats ( coreBindsStats ) -import CoreMonad +import GHC.Core.Op.Monad import Bag import Literal import GHC.Core.DataCon @@ -167,7 +167,7 @@ In the desugarer, it's very very convenient to be able to say (in effect) let x::a = True in <body> That is, use a type let. See Note [Type let] in CoreSyn. One place it is used is in mkWwArgs; see Note [Join points and beta-redexes] -in WwLib. (Maybe there are other "clients" of this feature; I'm not sure). +in GHC.Core.Op.WorkWrap.Lib. (Maybe there are other "clients" of this feature; I'm not sure). * Hence when linting <body> we need to remember that a=Int, else we might reject a correct program. So we carry a type substitution (in @@ -639,7 +639,7 @@ lintSingleBinding top_lvl_flag rec_flag (binder,rhs) -- We used to check that the dmdTypeDepth of a demand signature never -- exceeds idArity, but that is an unnecessary complication, see - -- Note [idArity varies independently of dmdTypeDepth] in DmdAnal + -- Note [idArity varies independently of dmdTypeDepth] in GHC.Core.Op.DmdAnal -- Check that the binder's arity is within the bounds imposed by -- the type and the strictness signature. See Note [exprArity invariant] @@ -1146,7 +1146,7 @@ lintCaseExpr scrut var alt_ty alts = -- Check that the scrutinee is not a floating-point type -- if there are any literal alternatives -- See GHC.Core Note [Case expression invariants] item (5) - -- See Note [Rules for floating-point comparisons] in PrelRules + -- See Note [Rules for floating-point comparisons] in GHC.Core.Op.ConstantFold ; let isLitPat (LitAlt _, _ , _) = True isLitPat _ = False ; checkL (not $ isFloatingTy scrut_ty && any isLitPat alts) @@ -2838,7 +2838,7 @@ lintAnnots pname pass guts = do let binds = flattenBinds $ mg_binds nguts binds' = flattenBinds $ mg_binds nguts' (diffs,_) = diffBinds True (mkRnEnv2 emptyInScopeSet) binds binds' - when (not (null diffs)) $ CoreMonad.putMsg $ vcat + when (not (null diffs)) $ GHC.Core.Op.Monad.putMsg $ vcat [ lint_banner "warning" pname , text "Core changes with annotations:" , withPprStyle (defaultDumpStyle dflags) $ nest 2 $ vcat diffs diff --git a/compiler/GHC/Core/Make.hs b/compiler/GHC/Core/Make.hs index 17fc146608..538344b946 100644 --- a/compiler/GHC/Core/Make.hs +++ b/compiler/GHC/Core/Make.hs @@ -193,7 +193,7 @@ mkWildEvBinder pred = mkWildValBinder pred -- that you expect to use only at a *binding* site. Do not use it at -- occurrence sites because it has a single, fixed unique, and it's very -- easy to get into difficulties with shadowing. That's why it is used so little. --- See Note [WildCard binders] in SimplEnv +-- See Note [WildCard binders] in GHC.Core.Op.Simplify.Env mkWildValBinder :: Type -> Id mkWildValBinder ty = mkLocalIdOrCoVar wildCardName ty -- "OrCoVar" since a coercion can be a scrutinee with -fdefer-type-errors @@ -576,7 +576,7 @@ data FloatBind = FloatLet CoreBind | FloatCase CoreExpr Id AltCon [Var] -- case e of y { C ys -> ... } - -- See Note [Floating single-alternative cases] in SetLevels + -- See Note [Floating single-alternative cases] in GHC.Core.Op.SetLevels instance Outputable FloatBind where ppr (FloatLet b) = text "LET" <+> ppr b @@ -880,7 +880,7 @@ the first. But the stable-unfolding for f looks like \x. case x of MkT a b -> g ($WMkT b a) where $WMkT is the wrapper for MkT that evaluates its arguments. We apply the same w/w split to this unfolding (see Note [Worker-wrapper -for INLINEABLE functions] in WorkWrap) so the template ends up like +for INLINEABLE functions] in GHC.Core.Op.WorkWrap) so the template ends up like \b. let a = absentError "blah" x = MkT a b in case x of MkT a b -> g ($WMkT b a) @@ -925,7 +925,7 @@ aBSENT_ERROR_ID where absent_ty = mkSpecForAllTys [alphaTyVar] (mkVisFunTy addrPrimTy alphaTy) -- Not runtime-rep polymorphic. aBSENT_ERROR_ID is only used for - -- lifted-type things; see Note [Absent errors] in WwLib + -- lifted-type things; see Note [Absent errors] in GHC.Core.Op.WorkWrap.Lib arity_info = vanillaIdInfo `setArityInfo` 1 -- NB: no bottoming strictness info, unlike other error-ids. -- See Note [aBSENT_ERROR_ID] diff --git a/compiler/simplCore/CSE.hs b/compiler/GHC/Core/Op/CSE.hs index 81cb825e68..dc93dacf07 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/GHC/Core/Op/CSE.hs @@ -9,7 +9,7 @@ {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -module CSE (cseProgram, cseOneExpr) where +module GHC.Core.Op.CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" @@ -123,12 +123,12 @@ Notice that Notice also that in the SUBSTITUTE case we leave behind a binding x = y even though we /also/ carry a substitution x -> y. Can we just drop -the binding instead? Well, not at top level! See SimplUtils -Note [Top level and postInlineUnconditionally]; and in any case CSE -applies only to the /bindings/ of the program, and we leave it to the -simplifier to propate effects to the RULES. Finally, it doesn't seem -worth the effort to discard the nested bindings because the simplifier -will do it next. +the binding instead? Well, not at top level! See Note [Top level and +postInlineUnconditionally] in GHC.Core.Op.Simplify.Utils; and in any +case CSE applies only to the /bindings/ of the program, and we leave +it to the simplifier to propate effects to the RULES. Finally, it +doesn't seem worth the effort to discard the nested bindings because +the simplifier will do it next. Note [CSE for case expressions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -230,8 +230,8 @@ Here 'foo' has a stable unfolding, but its (optimised) RHS is trivial. the Integer instance of Enum in GHC.Enum.) Suppose moreover that foo's stable unfolding originates from an INLINE or INLINEABLE pragma on foo. Then we obviously do NOT want to extend the substitution with (foo->x), -because we promised to inline foo as what the user wrote. See similar -SimplUtils Note [Stable unfoldings and postInlineUnconditionally]. +because we promised to inline foo as what the user wrote. See similar Note +[Stable unfoldings and postInlineUnconditionally] in GHC.Core.Op.Simplify.Utils. Nor do we want to change the reverse mapping. Suppose we have @@ -687,7 +687,7 @@ turning K2 into 'x' increases the number of live variables. But Note [Combine case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ combineAlts is just a more heavyweight version of the use of -combineIdenticalAlts in SimplUtils.prepareAlts. The basic idea is +combineIdenticalAlts in GHC.Core.Op.Simplify.Utils.prepareAlts. The basic idea is to transform DEFAULT -> e1 @@ -710,7 +710,7 @@ Note [Combine case alts: awkward corner] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We would really like to check isDeadBinder on the binders in the alternative. But alas, the simplifer zaps occ-info on binders in case -alternatives; see Note [Case alternative occ info] in Simplify. +alternatives; see Note [Case alternative occ info] in GHC.Core.Op.Simplify. * One alternative (perhaps a good one) would be to do OccAnal just before CSE. Then perhaps we could get rid of combineIdenticalAlts diff --git a/compiler/simplCore/CallArity.hs b/compiler/GHC/Core/Op/CallArity.hs index 84d62e4ad9..aaf3372071 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/GHC/Core/Op/CallArity.hs @@ -2,7 +2,7 @@ -- Copyright (c) 2014 Joachim Breitner -- -module CallArity +module GHC.Core.Op.CallArity ( callArityAnalProgram , callArityRHS -- for testing ) where diff --git a/compiler/prelude/PrelRules.hs b/compiler/GHC/Core/Op/ConstantFold.hs index 9b2047d521..ae9ba8f262 100644 --- a/compiler/prelude/PrelRules.hs +++ b/compiler/GHC/Core/Op/ConstantFold.hs @@ -16,7 +16,7 @@ ToDo: DeriveFunctor #-} {-# OPTIONS_GHC -optc-DNON_POSIX_SOURCE -Wno-incomplete-uni-patterns #-} -module PrelRules +module GHC.Core.Op.ConstantFold ( primOpRules , builtinRules , caseRules @@ -1117,13 +1117,13 @@ is: the returned value. * An application like (dataToTag# (Just x)) is optimised by - dataToTagRule in PrelRules. + dataToTagRule in GHC.Core.Op.ConstantFold. * A case expression like case (dataToTag# e) of <alts> gets transformed t case e of <transformed alts> - by PrelRules.caseRules; see Note [caseRules for dataToTag] + by GHC.Core.Op.ConstantFold.caseRules; see Note [caseRules for dataToTag] See #15696 for a long saga. -} @@ -1198,7 +1198,7 @@ Things to note Implementing seq#. The compiler has magic for SeqOp in -- PrelRules.seqRule: eliminate (seq# <whnf> s) +- GHC.Core.Op.ConstantFold.seqRule: eliminate (seq# <whnf> s) - GHC.StgToCmm.Expr.cgExpr, and cgCase: special case for seq# @@ -1207,7 +1207,7 @@ Implementing seq#. The compiler has magic for SeqOp in - Simplify.addEvals records evaluated-ness for the result; see Note [Adding evaluatedness info to pattern-bound variables] - in Simplify + in GHC.Core.Op.Simplify -} seqRule :: RuleM CoreExpr @@ -2054,7 +2054,7 @@ wordPrimOps dflags = PrimOps -------------------------------------------------------- -- Constant folding through case-expressions -- --- cf Scrutinee Constant Folding in simplCore/SimplUtils +-- cf Scrutinee Constant Folding in simplCore/GHC.Core.Op.Simplify.Utils -------------------------------------------------------- -- | Match the scrutinee of a case and potentially return a new scrutinee and a @@ -2215,7 +2215,7 @@ We don't want to get this! DEFAULT -> e1 DEFAULT -> e2 -Instead, we deal with turning one branch into DEFAULT in SimplUtils +Instead, we deal with turning one branch into DEFAULT in GHC.Core.Op.Simplify.Utils (add_default in mkCase3). Note [caseRules for dataToTag] diff --git a/compiler/stranal/CprAnal.hs b/compiler/GHC/Core/Op/CprAnal.hs index 008eb422f8..c8f7e314e9 100644 --- a/compiler/stranal/CprAnal.hs +++ b/compiler/GHC/Core/Op/CprAnal.hs @@ -7,13 +7,13 @@ -- See https://www.microsoft.com/en-us/research/publication/constructed-product-result-analysis-haskell/. -- CPR analysis should happen after strictness analysis. -- See Note [Phase ordering]. -module CprAnal ( cprAnalProgram ) where +module GHC.Core.Op.CprAnal ( cprAnalProgram ) where #include "HsVersions.h" import GhcPrelude -import WwLib ( deepSplitProductType_maybe ) +import GHC.Core.Op.WorkWrap.Lib ( deepSplitProductType_maybe ) import GHC.Driver.Session import Demand import Cpr @@ -107,7 +107,7 @@ cprAnalProgram dflags fam_envs binds = do let binds_plus_cpr = snd $ mapAccumL cprAnalTopBind env binds dumpIfSet_dyn dflags Opt_D_dump_cpr_signatures "Cpr signatures" FormatText $ dumpIdInfoOfProgram (ppr . cprInfo) binds_plus_cpr - -- See Note [Stamp out space leaks in demand analysis] in DmdAnal + -- See Note [Stamp out space leaks in demand analysis] in GHC.Core.Op.DmdAnal seqBinds binds_plus_cpr `seq` return binds_plus_cpr -- Analyse a (group of) top-level binding(s) @@ -251,7 +251,7 @@ cprFix top_lvl env orig_pairs = loop 1 initial_pairs where bot_sig = mkCprSig 0 botCpr - -- See Note [Initialising strictness] in DmdAnal.hs + -- See Note [Initialising strictness] in GHC.Core.Op.DmdAnal initial_pairs | ae_virgin env = [(setIdCprInfo id bot_sig, rhs) | (id, rhs) <- orig_pairs ] | otherwise = orig_pairs diff --git a/compiler/stranal/DmdAnal.hs b/compiler/GHC/Core/Op/DmdAnal.hs index 8f5cb6ddea..57544519d3 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/GHC/Core/Op/DmdAnal.hs @@ -9,14 +9,14 @@ {-# LANGUAGE CPP #-} -module DmdAnal ( dmdAnalProgram ) where +module GHC.Core.Op.DmdAnal ( dmdAnalProgram ) where #include "HsVersions.h" import GhcPrelude import GHC.Driver.Session -import WwLib ( findTypeShape ) +import GHC.Core.Op.WorkWrap.Lib ( findTypeShape ) import Demand -- All of it import GHC.Core import GHC.Core.Seq ( seqBinds ) @@ -759,7 +759,7 @@ information, but * Performing the worker/wrapper split based on this information would be implicitly eta-expanding `f`, playing fast and loose with divergence and even being unsound in the presence of newtypes, so we refrain from doing so. - Also see Note [Don't eta expand in w/w] in WorkWrap. + Also see Note [Don't eta expand in w/w] in GHC.Core.Op.WorkWrap. Since we only compute one signature, we do so for arity 1. Computing multiple signatures for different arities (i.e., polyvariance) would be entirely @@ -1246,8 +1246,9 @@ The once-used information is (currently) only used by the code generator, though. So: * We zap the used-once info in the worker-wrapper; - see Note [Zapping Used Once info in WorkWrap] in WorkWrap. If it's - not reliable, it's better not to have it at all. + see Note [Zapping Used Once info in WorkWrap] in + GHC.Core.Op.WorkWrap. + If it's not reliable, it's better not to have it at all. * Just before TidyCore, we add a pass of the demand analyser, but WITHOUT subsequent worker/wrapper and simplifier, diff --git a/compiler/simplCore/Exitify.hs b/compiler/GHC/Core/Op/Exitify.hs index cbcacfa465..45f9451787 100644 --- a/compiler/simplCore/Exitify.hs +++ b/compiler/GHC/Core/Op/Exitify.hs @@ -1,4 +1,4 @@ -module Exitify ( exitifyProgram ) where +module GHC.Core.Op.Exitify ( exitifyProgram ) where {- Note [Exitification] @@ -246,7 +246,7 @@ exitifyRec in_scope pairs -- We are going to abstract over these variables, so we must -- zap any IdInfo they have; see #15005 - -- cf. SetLevels.abstractVars + -- cf. GHC.Core.Op.SetLevels.abstractVars zap v | isId v = setIdInfo v vanillaIdInfo | otherwise = v diff --git a/compiler/simplCore/FloatIn.hs b/compiler/GHC/Core/Op/FloatIn.hs index c1121e16e2..ac4ef8088e 100644 --- a/compiler/simplCore/FloatIn.hs +++ b/compiler/GHC/Core/Op/FloatIn.hs @@ -16,7 +16,7 @@ then discover that they aren't needed in the chosen branch. {-# OPTIONS_GHC -fprof-auto #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -module FloatIn ( floatInwards ) where +module GHC.Core.Op.FloatIn ( floatInwards ) where #include "HsVersions.h" @@ -27,7 +27,7 @@ import GHC.Core.Make hiding ( wrapFloats ) import GHC.Driver.Types ( ModGuts(..) ) import GHC.Core.Utils import GHC.Core.FVs -import CoreMonad ( CoreM ) +import GHC.Core.Op.Monad ( CoreM ) import Id ( isOneShotBndr, idType, isJoinId, isJoinId_maybe ) import Var import GHC.Core.Type @@ -91,7 +91,7 @@ The fix is to let bind the algebraic case scrutinees (done, I think) and the case alternatives (except the ones with an unboxed type)(not done, I think). This is best done in the -SetLevels.hs module, which tags things with their level numbers. +GHC.Core.Op.SetLevels.hs module, which tags things with their level numbers. \item do the full laziness pass (floating lets outwards). \item diff --git a/compiler/simplCore/FloatOut.hs b/compiler/GHC/Core/Op/FloatOut.hs index 8c2b4c93e0..fb47b2b3ed 100644 --- a/compiler/simplCore/FloatOut.hs +++ b/compiler/GHC/Core/Op/FloatOut.hs @@ -8,21 +8,21 @@ {-# LANGUAGE CPP #-} -module FloatOut ( floatOutwards ) where +module GHC.Core.Op.FloatOut ( floatOutwards ) where import GhcPrelude import GHC.Core import GHC.Core.Utils import GHC.Core.Make -import GHC.Core.Arity ( etaExpand ) -import CoreMonad ( FloatOutSwitches(..) ) +import GHC.Core.Arity ( etaExpand ) +import GHC.Core.Op.Monad ( FloatOutSwitches(..) ) import GHC.Driver.Session import ErrUtils ( dumpIfSet_dyn, DumpFormat (..) ) import Id ( Id, idArity, idType, isBottomingId, isJoinId, isJoinId_maybe ) -import SetLevels +import GHC.Core.Op.SetLevels import UniqSupply ( UniqSupply ) import Bag import Util @@ -113,7 +113,7 @@ Note [Join points] Every occurrence of a join point must be a tail call (see Note [Invariants on join points] in GHC.Core), so we must be careful with how far we float them. The mechanism for doing so is the *join ceiling*, detailed in Note [Join ceiling] -in SetLevels. For us, the significance is that a binder might be marked to be +in GHC.Core.Op.SetLevels. For us, the significance is that a binder might be marked to be dropped at the nearest boundary between tail calls and non-tail calls. For example: @@ -220,7 +220,7 @@ floatBind (NonRec (TB var _) rhs) = case (floatRhs var rhs) of { (fs, rhs_floats, rhs') -> -- A tiresome hack: - -- see Note [Bottoming floats: eta expansion] in SetLevels + -- see Note [Bottoming floats: eta expansion] in GHC.Core.Op.SetLevels let rhs'' | isBottomingId var = etaExpand (idArity var) rhs' | otherwise = rhs' @@ -337,7 +337,7 @@ makes f and x' look mutually recursive when they're not. The test was shootout/k-nucleotide, as compiled using commit 47d5dd68 on the wip/join-points branch. -TODO: This can probably be solved somehow in SetLevels. The difference between +TODO: This can probably be solved somehow in GHC.Core.Op.SetLevels. The difference between "this *is at* level <2,0>" and "this *depends on* level <2,0>" is very important.) @@ -408,7 +408,7 @@ floatExpr lam@(Lam (TB _ lam_spec) _) bndrs = [b | TB b _ <- bndrs_w_lvls] bndr_lvl = asJoinCeilLvl (floatSpecLevel lam_spec) -- All the binders have the same level - -- See SetLevels.lvlLamBndrs + -- See GHC.Core.Op.SetLevels.lvlLamBndrs -- Use asJoinCeilLvl to make this the join ceiling in case (floatBody bndr_lvl body) of { (fs, floats, body') -> @@ -597,7 +597,7 @@ lifted to top level. The trouble is that (a) we partition these floating bindings *at every binding site* - (b) SetLevels introduces a new bindings site for every float + (b) GHC.Core.Op.SetLevels introduces a new bindings site for every float So we had better not look at each binding at each binding site! That is why MajorEnv is represented as a finite map. diff --git a/compiler/simplCore/LiberateCase.hs b/compiler/GHC/Core/Op/LiberateCase.hs index 1347cf37bf..399abf4c67 100644 --- a/compiler/simplCore/LiberateCase.hs +++ b/compiler/GHC/Core/Op/LiberateCase.hs @@ -5,7 +5,7 @@ -} {-# LANGUAGE CPP #-} -module LiberateCase ( liberateCase ) where +module GHC.Core.Op.LiberateCase ( liberateCase ) where #include "HsVersions.h" diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/GHC/Core/Op/Monad.hs index cb17f33b88..a0a15bba6f 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/GHC/Core/Op/Monad.hs @@ -1,7 +1,6 @@ {- (c) The AQUA Project, Glasgow University, 1993-1998 -\section[CoreMonad]{The core pipeline monad} -} {-# LANGUAGE CPP #-} @@ -9,7 +8,7 @@ {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} -module CoreMonad ( +module GHC.Core.Op.Monad ( -- * Configuration of the core-to-core passes CoreToDo(..), runWhen, runMaybe, SimplMode(..), @@ -154,7 +153,7 @@ pprPassDetails (CoreDoSimplify n md) = vcat [ text "Max iterations =" <+> int n , ppr md ] pprPassDetails _ = Outputable.empty -data SimplMode -- See comments in SimplMonad +data SimplMode -- See comments in GHC.Core.Op.Simplify.Monad = SimplMode { sm_names :: [String] -- Name(s) of the phase , sm_phase :: CompilerPhase @@ -195,7 +194,7 @@ data FloatOutSwitches = FloatOutSwitches { -- ^ True <=> float out over-saturated applications -- based on arity information. -- See Note [Floating over-saturated applications] - -- in SetLevels + -- in GHC.Core.Op.SetLevels floatToTopLevelOnly :: Bool -- ^ Allow floating to the top level only. } instance Outputable FloatOutSwitches where diff --git a/compiler/simplCore/CoreMonad.hs-boot b/compiler/GHC/Core/Op/Monad.hs-boot index 74c21e8216..4ca105a66c 100644 --- a/compiler/simplCore/CoreMonad.hs-boot +++ b/compiler/GHC/Core/Op/Monad.hs-boot @@ -1,13 +1,13 @@ -- Created this hs-boot file to remove circular dependencies from the use of -- Plugins. Plugins needs CoreToDo and CoreM types to define core-to-core -- transformations. --- However CoreMonad does much more than defining these, and because Plugins are +-- However GHC.Core.Op.Monad does much more than defining these, and because Plugins are -- activated in various modules, the imports become circular. To solve this I -- extracted CoreToDo and CoreM into this file. -- I needed to write the whole definition of these types, otherwise it created -- a data-newtype conflict. -module CoreMonad ( CoreToDo, CoreM ) where +module GHC.Core.Op.Monad ( CoreToDo, CoreM ) where import GhcPrelude diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/GHC/Core/Op/OccurAnal.hs index aa8c5730e9..b676be38ae 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/GHC/Core/Op/OccurAnal.hs @@ -15,7 +15,7 @@ core expression with (hopefully) improved usage information. {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} -module OccurAnal ( +module GHC.Core.Op.OccurAnal ( occurAnalysePgm, occurAnalyseExpr, occurAnalyseExpr_NoBinderSwap ) where @@ -302,7 +302,7 @@ But what is the graph? NOT the same graph as was used for Note 'f' that is *always* inlined if it is applicable. We do *not* disable rules for loop-breakers. It's up to whoever makes the rules to make sure that the rules themselves always terminate. See Note [Rules for -recursive functions] in Simplify.hs +recursive functions] in GHC.Core.Op.Simplify Hence, if f's RHS (or its INLINE template if it has one) mentions g, and @@ -647,7 +647,7 @@ Consider this group, which is typical of what SpecConstr builds: So 'f' and 'fs' are in the same Rec group (since f refers to fs via its RULE). But watch out! If 'fs' is not chosen as a loop breaker, we may get an infinite loop: - - the RULE is applied in f's RHS (see Note [Self-recursive rules] in Simplify + - the RULE is applied in f's RHS (see Note [Self-recursive rules] in GHC.Core.Op.Simplify - fs is inlined (say it's small) - now there's another opportunity to apply the RULE @@ -1647,7 +1647,7 @@ So, when analysing the RHS of x3 we notice that x3 will itself definitely inline the next time round, and so we analyse x3's rhs in an ordinary context, not rhsCtxt. Hence the "certainly_inline" stuff. -Annoyingly, we have to approximate SimplUtils.preInlineUnconditionally. +Annoyingly, we have to approximate GHC.Core.Op.Simplify.Utils.preInlineUnconditionally. If (a) the RHS is expandable (see isExpandableApp in occAnalApp), and (b) certainly_inline says "yes" when preInlineUnconditionally says "no" then the simplifier iterates indefinitely: @@ -1871,7 +1871,7 @@ occAnalApp env (Var fun, args, ticks) fun_uds = mkOneOcc env fun (if n_val_args > 0 then IsInteresting else NotInteresting) n_args is_exp = isExpandableApp fun n_val_args -- See Note [CONLIKE pragma] in BasicTypes - -- The definition of is_exp should match that in Simplify.prepareRhs + -- The definition of is_exp should match that in GHC.Core.Op.Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) guaranteed_val_args guaranteed_val_args = n_val_args + length (takeWhile isOneShotInfo diff --git a/compiler/simplCore/SetLevels.hs b/compiler/GHC/Core/Op/SetLevels.hs index 7132b2f596..a3b1fd75b3 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/GHC/Core/Op/SetLevels.hs @@ -1,7 +1,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section{SetLevels} +\section{GHC.Core.Op.SetLevels} *************************** Overview @@ -52,7 +52,7 @@ {-# LANGUAGE CPP, MultiWayIf #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -module SetLevels ( +module GHC.Core.Op.SetLevels ( setLevels, Level(..), LevelType(..), tOP_LEVEL, isJoinCeilLvl, asJoinCeilLvl, @@ -67,7 +67,7 @@ module SetLevels ( import GhcPrelude import GHC.Core -import CoreMonad ( FloatOutSwitches(..) ) +import GHC.Core.Op.Monad ( FloatOutSwitches(..) ) import GHC.Core.Utils ( exprType, exprIsHNF , exprOkForSpeculation , exprIsTopLevelBindable @@ -178,7 +178,7 @@ But, check this out: -- __inline (let x = e in \d. x) -- things are bad. The inliner doesn't even inline it because it doesn't look -- like a head-normal form. So it seems a lesser evil to let things float. --- In SetLevels we do set the context to (Level 0 0) when we get to an InlineMe +-- In GHC.Core.Op.SetLevels we do set the context to (Level 0 0) when we get to an InlineMe -- which discourages floating out. So the conclusion is: don't do any floating at all inside an InlineMe. @@ -375,7 +375,7 @@ lvlExpr env expr@(_, AnnLam {}) -- a lambda like this (\x -> coerce t (\s -> ...)) -- This used to happen quite a bit in state-transformer programs, -- but not nearly so much now non-recursive newtypes are transparent. - -- [See SetLevels rev 1.50 for a version with this approach.] + -- [See GHC.Core.Op.SetLevels rev 1.50 for a version with this approach.] lvlExpr env (_, AnnLet bind body) = do { (bind', new_env) <- lvlBind env bind @@ -434,7 +434,7 @@ lvlApp env orig_expr ((_,AnnVar fn), args) left n (_, AnnApp f a) rargs | isValArg (deAnnotate a) = left (n-1) f (a:rargs) | otherwise = left n f (a:rargs) - left _ _ _ = panic "SetLevels.lvlExpr.left" + left _ _ _ = panic "GHC.Core.Op.SetLevels.lvlExpr.left" is_val_arg :: CoreExprWithFVs -> Bool is_val_arg (_, AnnType {}) = False @@ -950,8 +950,8 @@ Note [Bottoming floats: eta expansion] c.f Note [Bottoming floats] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tiresomely, though, the simplifier has an invariant that the manifest arity of the RHS should be the same as the arity; but we can't call -etaExpand during SetLevels because it works over a decorated form of -CoreExpr. So we do the eta expansion later, in FloatOut. +etaExpand during GHC.Core.Op.SetLevels because it works over a decorated form of +CoreExpr. So we do the eta expansion later, in GHC.Core.Op.FloatOut. Note [Case MFEs] ~~~~~~~~~~~~~~~~ @@ -1140,7 +1140,7 @@ lvlBind env (AnnRec pairs) -- This mightBeUnliftedType stuff is the same test as in the non-rec case -- You might wonder whether we can have a recursive binding for -- an unlifted value -- but we can if it's a /join binding/ (#16978) - -- (Ultimately I think we should not use SetLevels to + -- (Ultimately I think we should not use GHC.Core.Op.SetLevels to -- float join bindings at all, but that's another story.) = -- No float do { let bind_lvl = incMinorLvl (le_ctxt_lvl env) @@ -1399,7 +1399,7 @@ destLevel env fvs fvs_ty is_function is_bot is_join = tOP_LEVEL | is_join -- Never float a join point past the join ceiling - -- See Note [Join points] in FloatOut + -- See Note [Join points] in GHC.Core.Op.FloatOut = if max_fv_id_level `ltLvl` join_ceiling then join_ceiling else max_fv_id_level diff --git a/compiler/simplCore/Simplify.hs b/compiler/GHC/Core/Op/Simplify.hs index fc8c861480..448edd21f6 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/GHC/Core/Op/Simplify.hs @@ -7,18 +7,18 @@ {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} -module Simplify ( simplTopBinds, simplExpr, simplRules ) where +module GHC.Core.Op.Simplify ( simplTopBinds, simplExpr, simplRules ) where #include "HsVersions.h" import GhcPrelude import GHC.Driver.Session -import SimplMonad +import GHC.Core.Op.Simplify.Monad import GHC.Core.Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst ) -import SimplEnv -import SimplUtils -import OccurAnal ( occurAnalyseExpr ) +import GHC.Core.Op.Simplify.Env +import GHC.Core.Op.Simplify.Utils +import GHC.Core.Op.OccurAnal ( occurAnalyseExpr ) import GHC.Core.FamInstEnv ( FamInstEnv ) import Literal ( litIsLifted ) --, mkLitInt ) -- temporalily commented out. See #8326 import Id @@ -34,7 +34,7 @@ import GHC.Core.DataCon ( DataCon, dataConWorkId, dataConRepStrictness , dataConRepArgTys, isUnboxedTupleCon , StrictnessMark (..) ) -import CoreMonad ( Tick(..), SimplMode(..) ) +import GHC.Core.Op.Monad ( Tick(..), SimplMode(..) ) import GHC.Core import Demand ( StrictSig(..), dmdTypeDepth, isStrictDmd , mkClosedStrictSig, topDmd, botDiv ) @@ -61,7 +61,7 @@ import PrimOp ( PrimOp (SeqOp) ) {- The guts of the simplifier is in this module, but the driver loop for -the simplifier is in SimplCore.hs. +the simplifier is in GHC.Core.Op.Simplify.Driver Note [The big picture] ~~~~~~~~~~~~~~~~~~~~~~ @@ -300,7 +300,7 @@ simplLazyBind env top_lvl is_rec bndr bndr1 rhs rhs_se ; (body_env, tvs') <- {-#SCC "simplBinders" #-} simplBinders rhs_env tvs - -- See Note [Floating and type abstraction] in SimplUtils + -- See Note [Floating and type abstraction] in GHC.Core.Op.Simplify.Utils -- Simplify the RHS ; let rhs_cont = mkRhsStop (substTy body_env (exprType body)) @@ -688,7 +688,7 @@ completeBind env top_lvl mb_cont old_bndr new_bndr new_rhs occ_info = occInfo old_info -- Do eta-expansion on the RHS of the binding - -- See Note [Eta-expanding at let bindings] in SimplUtils + -- See Note [Eta-expanding at let bindings] in GHC.Core.Op.Simplify.Utils ; (new_arity, is_bot, final_rhs) <- tryEtaExpandRhs (getMode env) new_bndr new_rhs @@ -1830,7 +1830,7 @@ rebuildCall :: SimplEnv ---------- Bottoming applications -------------- rebuildCall env (ArgInfo { ai_fun = fun, ai_args = rev_args, ai_strs = [] }) cont -- When we run out of strictness args, it means - -- that the call is definitely bottom; see SimplUtils.mkArgInfo + -- that the call is definitely bottom; see GHC.Core.Op.Simplify.Utils.mkArgInfo -- Then we want to discard the entire strict continuation. E.g. -- * case (error "hello") of { ... } -- * (error "Hello") arg @@ -2250,9 +2250,9 @@ Start with a simple situation: do this for algebraic cases, because we might turn bottom into non-bottom! -The code in SimplUtils.prepareAlts has the effect of generalise this -idea to look for a case where we're scrutinising a variable, and we -know that only the default case can match. For example: +The code in GHC.Core.Op.Simplify.Utils.prepareAlts has the effect of generalise +this idea to look for a case where we're scrutinising a variable, and we know +that only the default case can match. For example: case x of 0# -> ... @@ -2264,7 +2264,7 @@ Here the inner case is first trimmed to have only one alternative, the DEFAULT, after which it's an instance of the previous case. This really only shows up in eliminating error-checking code. -Note that SimplUtils.mkCase combines identical RHSs. So +Note that GHC.Core.Op.Simplify.Utils.mkCase combines identical RHSs. So case e of ===> case e of DEFAULT -> r True -> r @@ -2762,7 +2762,7 @@ NB: simplLamBndrs preserves this eval info In addition to handling data constructor fields with !s, addEvals also records the fact that the result of seq# is always in WHNF. -See Note [seq# magic] in PrelRules. Example (#15226): +See Note [seq# magic] in GHC.Core.Op.ConstantFold. Example (#15226): case seq# v s of (# s', v' #) -> E @@ -2886,8 +2886,8 @@ it's also good for case-elimintation -- suppose that 'f' was inlined and did multi-level case analysis, then we'd solve it in one simplifier sweep instead of two. -Exactly the same issue arises in SpecConstr; -see Note [Add scrutinee to ValueEnv too] in SpecConstr +Exactly the same issue arises in GHC.Core.Op.SpecConstr; +see Note [Add scrutinee to ValueEnv too] in GHC.Core.Op.SpecConstr HOWEVER, given case x of y { Just a -> r1; Nothing -> r2 } @@ -3104,7 +3104,7 @@ mkDupableCont env (StrictBind { sc_bndr = bndr, sc_bndrs = bndrs , StrictBind { sc_bndr = bndr', sc_bndrs = [] , sc_body = body2 , sc_env = zapSubstEnv se `setInScopeFromF` floats2 - -- See Note [StaticEnv invariant] in SimplUtils + -- See Note [StaticEnv invariant] in GHC.Core.Op.Simplify.Utils , sc_dup = OkToDup , sc_cont = mkBoringStop res_ty } ) } @@ -3144,7 +3144,7 @@ mkDupableCont env (ApplyToVal { sc_arg = arg, sc_dup = dup -- Ensure that sc_env includes the free vars of -- arg'' in its in-scope set, even if makeTrivial -- has turned arg'' into a fresh variable - -- See Note [StaticEnv invariant] in SimplUtils + -- See Note [StaticEnv invariant] in GHC.Core.Op.Simplify.Utils , sc_dup = OkToDup, sc_cont = cont' }) } mkDupableCont env (Select { sc_bndr = case_bndr, sc_alts = alts @@ -3185,7 +3185,7 @@ mkDupableCont env (Select { sc_bndr = case_bndr, sc_alts = alts , sc_bndr = case_bndr' , sc_alts = alts'' , sc_env = zapSubstEnv se `setInScopeFromF` all_floats - -- See Note [StaticEnv invariant] in SimplUtils + -- See Note [StaticEnv invariant] in GHC.Core.Op.Simplify.Utils , sc_cont = mkBoringStop (contResultType cont) } ) } mkDupableAlt :: DynFlags -> OutId @@ -3248,7 +3248,7 @@ Note [Fusing case continuations] It's important to fuse two successive case continuations when the first has one alternative. That's why we call prepareCaseCont here. Consider this, which arises from thunk splitting (see Note [Thunk -splitting] in WorkWrap): +splitting] in GHC.Core.Op.WorkWrap): let x* = case (case v of {pn -> rn}) of @@ -3305,7 +3305,7 @@ So instead we do both: we pass 'c' and 'c#' , and record in c's inlining Absence analysis may later discard 'c'. NB: take great care when doing strictness analysis; - see Note [Lambda-bound unfoldings] in DmdAnal. + see Note [Lambda-bound unfoldings] in GHC.Core.Op.DmdAnal. Also note that we can still end up passing stuff that isn't used. Before strictness analysis we have @@ -3495,7 +3495,7 @@ simplLetUnfolding env top_lvl cont_mb id new_rhs rhs_ty unf | isStableUnfolding unf = simplStableUnfolding env top_lvl cont_mb id unf rhs_ty | isExitJoinId id - = return noUnfolding -- See Note [Do not inline exit join points] in Exitify + = return noUnfolding -- See Note [Do not inline exit join points] in GHC.Core.Op.Exitify | otherwise = mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs @@ -3571,7 +3571,7 @@ simplStableUnfolding env top_lvl mb_cont id unf rhs_ty is_top_lvl = isTopLevel top_lvl act = idInlineActivation id unf_env = updMode (updModeForStableUnfoldings act) env - -- See Note [Simplifying inside stable unfoldings] in SimplUtils + -- See Note [Simplifying inside stable unfoldings] in GHC.Core.Op.Simplify.Utils {- Note [Force bottoming field] diff --git a/compiler/simplCore/SimplCore.hs b/compiler/GHC/Core/Op/Simplify/Driver.hs index faeb3c5811..b6ec392599 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/GHC/Core/Op/Simplify/Driver.hs @@ -6,7 +6,7 @@ {-# LANGUAGE CPP #-} -module SimplCore ( core2core, simplifyExpr ) where +module GHC.Core.Op.Simplify.Driver ( core2core, simplifyExpr ) where #include "HsVersions.h" @@ -15,40 +15,40 @@ import GhcPrelude import GHC.Driver.Session import GHC.Core import GHC.Driver.Types -import CSE ( cseProgram ) +import GHC.Core.Op.CSE ( cseProgram ) import GHC.Core.Rules ( mkRuleBase, unionRuleBase, extendRuleBaseList, ruleCheckProgram, addRuleInfo, getRules ) import GHC.Core.Ppr ( pprCoreBindings, pprCoreExpr ) -import OccurAnal ( occurAnalysePgm, occurAnalyseExpr ) +import GHC.Core.Op.OccurAnal ( occurAnalysePgm, occurAnalyseExpr ) import IdInfo import GHC.Core.Stats ( coreBindsSize, coreBindsStats, exprSize ) import GHC.Core.Utils ( mkTicks, stripTicksTop ) import GHC.Core.Lint ( endPass, lintPassResult, dumpPassResult, lintAnnots ) -import Simplify ( simplTopBinds, simplExpr, simplRules ) -import SimplUtils ( simplEnvForGHCi, activeRule, activeUnfolding ) -import SimplEnv -import SimplMonad -import CoreMonad +import GHC.Core.Op.Simplify ( simplTopBinds, simplExpr, simplRules ) +import GHC.Core.Op.Simplify.Utils ( simplEnvForGHCi, activeRule, activeUnfolding ) +import GHC.Core.Op.Simplify.Env +import GHC.Core.Op.Simplify.Monad +import GHC.Core.Op.Monad import qualified ErrUtils as Err -import FloatIn ( floatInwards ) -import FloatOut ( floatOutwards ) +import GHC.Core.Op.FloatIn ( floatInwards ) +import GHC.Core.Op.FloatOut ( floatOutwards ) import GHC.Core.FamInstEnv import Id import ErrUtils ( withTiming, withTimingD, DumpFormat (..) ) import BasicTypes ( CompilerPhase(..), isDefaultInlinePragma, defaultInlinePragma ) import VarSet import VarEnv -import LiberateCase ( liberateCase ) -import SAT ( doStaticArgs ) -import Specialise ( specProgram) -import SpecConstr ( specConstrProgram) -import DmdAnal ( dmdAnalProgram ) -import CprAnal ( cprAnalProgram ) -import CallArity ( callArityAnalProgram ) -import Exitify ( exitifyProgram ) -import WorkWrap ( wwTopBinds ) +import GHC.Core.Op.LiberateCase ( liberateCase ) +import GHC.Core.Op.StaticArgs ( doStaticArgs ) +import GHC.Core.Op.Specialise ( specProgram) +import GHC.Core.Op.SpecConstr ( specConstrProgram) +import GHC.Core.Op.DmdAnal ( dmdAnalProgram ) +import GHC.Core.Op.CprAnal ( cprAnalProgram ) +import GHC.Core.Op.CallArity ( callArityAnalProgram ) +import GHC.Core.Op.Exitify ( exitifyProgram ) +import GHC.Core.Op.WorkWrap ( wwTopBinds ) import SrcLoc import Util import Module @@ -311,7 +311,7 @@ getCoreToDo dflags simpl_phase 0 ["post-liberate-case"] max_iter ]), -- Run the simplifier after LiberateCase to vastly -- reduce the possibility of shadowing - -- Reason: see Note [Shadowing] in SpecConstr.hs + -- Reason: see Note [Shadowing] in GHC.Core.Op.SpecConstr runWhen spec_constr CoreDoSpecConstr, @@ -337,7 +337,7 @@ getCoreToDo dflags -- Final run of the demand_analyser, ensures that one-shot thunks are -- really really one-shot thunks. Only needed if the demand analyser - -- has run at all. See Note [Final Demand Analyser run] in DmdAnal + -- has run at all. See Note [Final Demand Analyser run] in GHC.Core.Op.DmdAnal -- It is EXTREMELY IMPORTANT to run this pass, otherwise execution -- can become /exponentially/ more expensive. See #11731, #12996. runWhen (strictness || late_dmd_anal) CoreDoDemand, @@ -605,7 +605,7 @@ simplExprGently :: SimplEnv -> CoreExpr -> SimplM CoreExpr -- It's important that simplExprGently does eta reduction; see -- Note [Simplifying the left-hand side of a RULE] above. The --- simplifier does indeed do eta reduction (it's in Simplify.completeLam) +-- simplifier does indeed do eta reduction (it's in GHC.Core.Op.Simplify.completeLam) -- but only if -O is on. simplExprGently env expr = do @@ -727,7 +727,7 @@ simplifyPgmIO pass@(CoreDoSimplify max_iterations mode) ; return (getTopFloatBinds floats, rules1) } ; -- Stop if nothing happened; don't dump output - -- See Note [Which transformations are innocuous] in CoreMonad + -- See Note [Which transformations are innocuous] in GHC.Core.Op.Monad if isZeroSimplCount counts1 then return ( "Simplifier reached fixed point", iteration_no , totalise (counts1 : counts_so_far) -- Include "free" ticks diff --git a/compiler/simplCore/SimplEnv.hs b/compiler/GHC/Core/Op/Simplify/Env.hs index e19b9a19c8..0e94f734af 100644 --- a/compiler/simplCore/SimplEnv.hs +++ b/compiler/GHC/Core/Op/Simplify/Env.hs @@ -1,19 +1,19 @@ {- (c) The AQUA Project, Glasgow University, 1993-1998 -\section[SimplMonad]{The simplifier Monad} +\section[GHC.Core.Op.Simplify.Monad]{The simplifier Monad} -} {-# LANGUAGE CPP #-} -module SimplEnv ( +module GHC.Core.Op.Simplify.Env ( -- * The simplifier mode setMode, getMode, updMode, seDynFlags, -- * Environments SimplEnv(..), pprSimplEnv, -- Temp not abstract mkSimplEnv, extendIdSubst, - SimplEnv.extendTvSubst, SimplEnv.extendCvSubst, + extendTvSubst, extendCvSubst, zapSubstEnv, setSubstEnv, getInScope, setInScopeFromE, setInScopeFromF, setInScopeSet, modifyInScope, addNewInScopeIds, @@ -47,8 +47,8 @@ module SimplEnv ( import GhcPrelude -import SimplMonad -import CoreMonad ( SimplMode(..) ) +import GHC.Core.Op.Simplify.Monad +import GHC.Core.Op.Monad ( SimplMode(..) ) import GHC.Core import GHC.Core.Utils import Var @@ -60,7 +60,7 @@ import GHC.Core.Make ( mkWildValBinder ) import GHC.Driver.Session ( DynFlags ) import TysWiredIn import qualified GHC.Core.Type as Type -import GHC.Core.Type hiding ( substTy, substTyVar, substTyVarBndr ) +import GHC.Core.Type hiding ( substTy, substTyVar, substTyVarBndr, extendTvSubst, extendCvSubst ) import qualified GHC.Core.Coercion as Coercion import GHC.Core.Coercion hiding ( substCo, substCoVar, substCoVarBndr ) import BasicTypes @@ -669,7 +669,7 @@ substId (SimplEnv { seInScope = in_scope, seIdSubst = ids }) v -- Even though it isn't in the substitution, it may be in -- the in-scope set with better IdInfo. -- - -- See also Note [In-scope set as a substitution] in Simplify. + -- See also Note [In-scope set as a substitution] in GHC.Core.Op.Simplify. refineFromInScope :: InScopeSet -> Var -> Var refineFromInScope in_scope v diff --git a/compiler/simplCore/SimplMonad.hs b/compiler/GHC/Core/Op/Simplify/Monad.hs index f26fd18e92..e6b23734c4 100644 --- a/compiler/simplCore/SimplMonad.hs +++ b/compiler/GHC/Core/Op/Simplify/Monad.hs @@ -1,11 +1,11 @@ {- (c) The AQUA Project, Glasgow University, 1993-1998 -\section[SimplMonad]{The simplifier Monad} +\section[GHC.Core.Op.Simplify.Monad]{The simplifier Monad} -} {-# LANGUAGE DeriveFunctor #-} -module SimplMonad ( +module GHC.Core.Op.Simplify.Monad ( -- The monad SimplM, initSmpl, traceSmpl, @@ -31,7 +31,7 @@ import GHC.Core.FamInstEnv ( FamInstEnv ) import GHC.Core ( RuleEnv(..) ) import UniqSupply import GHC.Driver.Session -import CoreMonad +import GHC.Core.Op.Monad import Outputable import FastString import MonadUtils diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/GHC/Core/Op/Simplify/Utils.hs index faf1131d36..e62c256354 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/GHC/Core/Op/Simplify/Utils.hs @@ -1,12 +1,12 @@ {- (c) The AQUA Project, Glasgow University, 1993-1998 -\section[SimplUtils]{The simplifier utilities} +The simplifier utilities -} {-# LANGUAGE CPP #-} -module SimplUtils ( +module GHC.Core.Op.Simplify.Utils ( -- Rebuilding mkLam, mkCase, prepareAlts, tryEtaExpandRhs, @@ -40,8 +40,8 @@ module SimplUtils ( import GhcPrelude -import SimplEnv -import CoreMonad ( SimplMode(..), Tick(..) ) +import GHC.Core.Op.Simplify.Env +import GHC.Core.Op.Monad ( SimplMode(..), Tick(..) ) import GHC.Driver.Session import GHC.Core import qualified GHC.Core.Subst @@ -56,7 +56,7 @@ import Id import IdInfo import Var import Demand -import SimplMonad +import GHC.Core.Op.Simplify.Monad import GHC.Core.Type hiding( substTy ) import GHC.Core.Coercion hiding( substCo ) import GHC.Core.DataCon ( dataConWorkId, isNullaryRepDataCon ) @@ -66,7 +66,7 @@ import Util import OrdList ( isNilOL ) import MonadUtils import Outputable -import PrelRules +import GHC.Core.Op.ConstantFold import FastString ( fsLit ) import Control.Monad ( when ) @@ -498,7 +498,8 @@ mkArgInfo env fun rules n_val_args call_cont -- interesting context. This avoids substituting -- top-level bindings for (say) strings into -- calls to error. But now we are more careful about - -- inlining lone variables, so its ok (see SimplUtils.analyseCont) + -- inlining lone variables, so it's ok + -- (see GHC.Core.Op.Simplify.Utils.analyseCont) if isBotDiv result_info then map isStrictDmd demands -- Finite => result is bottom else @@ -773,7 +774,7 @@ interestingArg env e = go env 0 e ************************************************************************ The SimplMode controls several switches; see its definition in -CoreMonad +GHC.Core.Op.Monad sm_rules :: Bool -- Whether RULES are enabled sm_inline :: Bool -- Whether inlining is enabled sm_case_case :: Bool -- Whether case-of-case is enabled @@ -844,7 +845,7 @@ we do not want to eta-expand to -- = (/\a \(d:Ord a) (x:a) (eta:State#). bla eta) |> co because not specialisation of the overloading doesn't work properly -(see Note [Specialisation shape] in Specialise), #9509. +(see Note [Specialisation shape] in GHC.Core.Op.Specialise), #9509. So we disable eta-expansion in stable unfoldings. @@ -1525,7 +1526,7 @@ tryEtaExpandRhs mode bndr rhs ; WARN( new_arity < old_id_arity, (text "Arity decrease:" <+> (ppr bndr <+> ppr old_id_arity <+> ppr old_arity <+> ppr new_arity) $$ ppr new_rhs) ) - -- Note [Arity decrease] in Simplify + -- Note [Arity decrease] in GHC.Core.Op.Simplify return (new_arity, is_bot, new_rhs) } where try_expand @@ -1575,9 +1576,11 @@ arguments! Note [Do not eta-expand join points] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Similarly to CPR (see Note [Don't w/w join points for CPR] in WorkWrap), a join point -stands well to gain from its outer binding's eta-expansion, and eta-expanding a -join point is fraught with issues like how to deal with a cast: + +Similarly to CPR (see Note [Don't w/w join points for CPR] in +GHC.Core.Op.WorkWrap), a join point stands well to gain from its outer binding's +eta-expansion, and eta-expanding a join point is fraught with issues like how to +deal with a cast: let join $j1 :: IO () $j1 = ... @@ -1666,8 +1669,9 @@ So I have elaborated simplLazyBind to understand right-hand sides that look like /\ a1..an. body -and treat them specially. The real work is done in SimplUtils.abstractFloats, -but there is quite a bit of plumbing in simplLazyBind as well. +and treat them specially. The real work is done in +GHC.Core.Op.Simplify.Utils.abstractFloats, but there is quite a bit of plumbing +in simplLazyBind as well. The same transformation is good when there are lets in the body: @@ -2042,7 +2046,7 @@ There are some wrinkles But NB: we use b'; we do not duplicate 'e'. * In dataToTag we might need to make up some fake binders; - see Note [caseRules for dataToTag] in PrelRules + see Note [caseRules for dataToTag] in GHC.Core.Op.ConstantFold -} mkCase, mkCase1, mkCase2, mkCase3 @@ -2154,7 +2158,7 @@ mkCase2 dflags scrut bndr alts_ty alts ; alts' <- mapMaybeM (tx_alt tx_con mk_orig bndr') alts -- mapMaybeM: discard unreachable alternatives -- See Note [Unreachable caseRules alternatives] - -- in PrelRules + -- in GHC.Core.Op.ConstantFold ; mkCase3 dflags scrut' bndr' alts_ty $ add_default (re_sort alts') @@ -2198,7 +2202,7 @@ mkCase2 dflags scrut bndr alts_ty alts mk_new_bndrs new_bndr (DataAlt dc) | not (isNullaryRepDataCon dc) = -- For non-nullary data cons we must invent some fake binders - -- See Note [caseRules for dataToTag] in PrelRules + -- See Note [caseRules for dataToTag] in GHC.Core.Op.ConstantFold do { us <- getUniquesM ; let (ex_tvs, arg_ids) = dataConRepInstPat us dc (tyConAppArgs (idType new_bndr)) @@ -2236,7 +2240,7 @@ This may generate sligthtly better code (although it should not, since all cases are exhaustive) and/or optimise better. I'm not certain that it's necessary, but currently we do make this change. We do it here, NOT in the TagToEnum rules (see "Beware" in Note [caseRules for tagToEnum] -in PrelRules) +in GHC.Core.Op.ConstantFold) -} -------------------------------------------------- @@ -2245,7 +2249,8 @@ in PrelRules) mkCase3 _dflags scrut bndr alts_ty alts = return (Case scrut bndr alts_ty alts) --- See Note [Exitification] and Note [Do not inline exit join points] in Exitify.hs +-- See Note [Exitification] and Note [Do not inline exit join points] in +-- GHC.Core.Op.Exitify -- This lives here (and not in Id) because occurrence info is only valid on -- InIds, so it's crucial that isExitJoinId is only called on freshly -- occ-analysed code. It's not a generic function you can call anywhere. diff --git a/compiler/specialise/SpecConstr.hs b/compiler/GHC/Core/Op/SpecConstr.hs index 7ab207afc5..4522e2d23c 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/GHC/Core/Op/SpecConstr.hs @@ -14,7 +14,7 @@ ToDo [Oct 2013] {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -module SpecConstr( +module GHC.Core.Op.SpecConstr( specConstrProgram, SpecConstrAnnotation(..) ) where @@ -28,10 +28,10 @@ import GHC.Core.Subst import GHC.Core.Utils import GHC.Core.Unfold ( couldBeSmallEnoughToInline ) import GHC.Core.FVs ( exprsFreeVarsList ) -import CoreMonad +import GHC.Core.Op.Monad import Literal ( litIsLifted ) import GHC.Driver.Types ( ModGuts(..) ) -import WwLib ( isWorkerSmallEnough, mkWorkerArgs ) +import GHC.Core.Op.WorkWrap.Lib ( isWorkerSmallEnough, mkWorkerArgs ) import GHC.Core.DataCon import GHC.Core.Coercion hiding( substCo ) import GHC.Core.Rules @@ -420,7 +420,7 @@ Actually in case (2), instead of using the calls from the RHS, it would be better to specialise in the importing module. We'd need to add an INLINABLE pragma to the function, and then it can be specialised in the importing scope, just as is done for type classes -in Specialise.specImports. This remains to be done (#10346). +in GHC.Core.Op.Specialise.specImports. This remains to be done (#10346). Note [Top-level recursive groups] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1803,7 +1803,7 @@ Note [Transfer activation] ~~~~~~~~~~~~~~~~~~~~~~~~~~ This note is for SpecConstr, but exactly the same thing happens in the overloading specialiser; see - Note [Auto-specialisation and RULES] in Specialise. + Note [Auto-specialisation and RULES] in GHC.Core.Op.Specialise. In which phase should the specialise-constructor rules be active? Originally I made them always-active, but Manuel found that this @@ -1998,7 +1998,7 @@ callsToNewPats env fn spec_info@(SI { si_specs = done_specs }) bndr_occs calls too_big (vars,_) = not (isWorkerSmallEnough (sc_dflags env) vars) -- We are about to construct w/w pair in 'spec_one'. -- Omit specialisation leading to high arity workers. - -- See Note [Limit w/w arity] in WwLib + -- See Note [Limit w/w arity] in GHC.Core.Op.WorkWrap.Lib -- Discard specialisations if there are too many of them trimmed_pats = trim_pats env fn spec_info small_pats diff --git a/compiler/specialise/Specialise.hs b/compiler/GHC/Core/Op/Specialise.hs index 5292512e1d..250a0f7313 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/GHC/Core/Op/Specialise.hs @@ -9,7 +9,7 @@ {-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -module Specialise ( specProgram, specUnfolding ) where +module GHC.Core.Op.Specialise ( specProgram, specUnfolding ) where #include "HsVersions.h" @@ -21,7 +21,7 @@ import GHC.Core.Type hiding( substTy, extendTvSubstList ) import GHC.Core.Predicate import Module( Module, HasModule(..) ) import GHC.Core.Coercion( Coercion ) -import CoreMonad +import GHC.Core.Op.Monad import qualified GHC.Core.Subst import GHC.Core.Unfold import Var ( isLocalVar ) @@ -1436,7 +1436,7 @@ specCalls mb_mod env existing_rules calls_for_me fn rhs let body = mkLams unspec_bndrs rhs_body' body_ty = substTy rhs_env2 $ exprType body (lam_extra_args, app_args) -- See Note [Specialisations Must Be Lifted] - | isUnliftedType body_ty -- C.f. WwLib.mkWorkerArgs + | isUnliftedType body_ty -- C.f. GHC.Core.Op.WorkWrap.Lib.mkWorkerArgs , not (isJoinId fn) = ([voidArgId], voidPrimId : unspec_bndrs) | otherwise = ([], unspec_bndrs) @@ -1507,7 +1507,7 @@ specCalls mb_mod env existing_rules calls_for_me fn rhs -------------------------------------- -- Adding arity information just propagates it a bit faster - -- See Note [Arity decrease] in Simplify + -- See Note [Arity decrease] in GHC.Core.Op.Simplify -- Copy InlinePragma information from the parent Id. -- So if f has INLINE[1] so does spec_f spec_f_w_arity = spec_f `setIdArity` max 0 (fn_arity - n_dicts) @@ -1634,7 +1634,7 @@ Consider In f's stable unfolding we have done some modest simplification which has pushed the cast to the outside. (I wonder if this is the Right -Thing, but it's what happens now; see SimplUtils Note [Casts and +Thing, but it's what happens now; see GHC.Core.Op.Simplify.Utils Note [Casts and lambdas].) Now that stable unfolding must be specialised, so we want to push the cast back inside. It would be terrible if the cast defeated specialisation! Hence the use of collectBindersPushingCo. diff --git a/compiler/simplCore/SAT.hs b/compiler/GHC/Core/Op/StaticArgs.hs index 23fdff540b..e550fabfd9 100644 --- a/compiler/simplCore/SAT.hs +++ b/compiler/GHC/Core/Op/StaticArgs.hs @@ -49,7 +49,7 @@ essential to make this work well! -} {-# LANGUAGE CPP #-} -module SAT ( doStaticArgs ) where +module GHC.Core.Op.StaticArgs ( doStaticArgs ) where import GhcPrelude diff --git a/compiler/GHC/Core/Op/Tidy.hs b/compiler/GHC/Core/Op/Tidy.hs index 60db2c8fea..758c1daf6c 100644 --- a/compiler/GHC/Core/Op/Tidy.hs +++ b/compiler/GHC/Core/Op/Tidy.hs @@ -191,7 +191,7 @@ tidyLetBndr rec_tidy_env env@(tidy_env, var_env) id -- Similarly for the demand info - on a let binder, this tells -- CorePrep to turn the let into a case. -- But: Remove the usage demand here - -- (See Note [Zapping DmdEnv after Demand Analyzer] in WorkWrap) + -- (See Note [Zapping DmdEnv after Demand Analyzer] in GHC.Core.Op.WorkWrap) -- -- Similarly arity info for eta expansion in CorePrep -- Don't attempt to recompute arity here; this is just tidying! diff --git a/compiler/stranal/WorkWrap.hs b/compiler/GHC/Core/Op/WorkWrap.hs index 26554d0a7a..241a295899 100644 --- a/compiler/stranal/WorkWrap.hs +++ b/compiler/GHC/Core/Op/WorkWrap.hs @@ -5,7 +5,7 @@ -} {-# LANGUAGE CPP #-} -module WorkWrap ( wwTopBinds ) where +module GHC.Core.Op.WorkWrap ( wwTopBinds ) where import GhcPrelude @@ -23,7 +23,7 @@ import BasicTypes import GHC.Driver.Session import Demand import Cpr -import WwLib +import GHC.Core.Op.WorkWrap.Lib import Util import Outputable import GHC.Core.FamInstEnv @@ -282,7 +282,7 @@ Follows on from Note [Worker-wrapper for INLINABLE functions] It is *vital* that if the worker gets an INLINABLE pragma (from the original function), then the worker has the same phase activation as the wrapper (or later). That is necessary to allow the wrapper to -inline into the worker's unfolding: see SimplUtils +inline into the worker's unfolding: see GHC.Core.Op.Simplify.Utils Note [Simplifying inside stable unfoldings]. If the original is NOINLINE, it's important that the work inherit the @@ -477,14 +477,14 @@ tryWW dflags fam_envs is_rec fn_id rhs cpr_ty = getCprSig (cprInfo fn_info) -- Arity of the CPR sig should match idArity when it's not a join point. - -- See Note [Arity trimming for CPR signatures] in CprAnal + -- See Note [Arity trimming for CPR signatures] in GHC.Core.Op.CprAnal cpr = ASSERT2( isJoinId fn_id || cpr_ty == topCprType || ct_arty cpr_ty == arityInfo fn_info , ppr fn_id <> colon <+> text "ct_arty:" <+> int (ct_arty cpr_ty) <+> text "arityInfo:" <+> ppr (arityInfo fn_info)) ct_cpr cpr_ty new_fn_id = zapIdUsedOnceInfo (zapIdUsageEnvInfo fn_id) -- See Note [Zapping DmdEnv after Demand Analyzer] and - -- See Note [Zapping Used Once info in WorkWrap] + -- See Note [Zapping Used Once info WorkWrap] is_fun = notNull wrap_dmds || isJoinId fn_id -- See Note [Don't eta expand in w/w] @@ -511,7 +511,7 @@ Why here? We also need to do it in TidyCore.tidyLetBndr to clean up after the final, worker/wrapper-less run of the demand analyser (see -Note [Final Demand Analyser run] in DmdAnal). +Note [Final Demand Analyser run] in GHC.Core.Op.DmdAnal). Note [Zapping Used Once info in WorkWrap] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -712,7 +712,7 @@ Consider this rather common form of binding: $j = \x:Void# -> ...no use of x... Since x is not used it'll be marked as absent. But there is no point -in w/w-ing because we'll simply add (\y:Void#), see WwLib.mkWorerArgs. +in w/w-ing because we'll simply add (\y:Void#), see GHC.Core.Op.WorkWrap.Lib.mkWorerArgs. If x has a more interesting type (eg Int, or Int#), there *is* a point in w/w so that we don't pass the argument at all. diff --git a/compiler/stranal/WwLib.hs b/compiler/GHC/Core/Op/WorkWrap/Lib.hs index 1102ee52f3..3ce454e7a2 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/GHC/Core/Op/WorkWrap/Lib.hs @@ -1,15 +1,17 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 -\section[WwLib]{A library for the ``worker\/wrapper'' back-end to the strictness analyser} +A library for the ``worker\/wrapper'' back-end to the strictness analyser -} {-# LANGUAGE CPP #-} -module WwLib ( mkWwBodies, mkWWstr, mkWorkerArgs - , deepSplitProductType_maybe, findTypeShape - , isWorkerSmallEnough - ) where +module GHC.Core.Op.WorkWrap.Lib + ( mkWwBodies, mkWWstr, mkWorkerArgs + , deepSplitProductType_maybe, findTypeShape + , isWorkerSmallEnough + ) +where #include "HsVersions.h" @@ -211,7 +213,7 @@ Note [Always do CPR w/w] At one time we refrained from doing CPR w/w for thunks, on the grounds that we might duplicate work. But that is already handled by the demand analyser, which doesn't give the CPR property if w/w might waste work: see -Note [CPR for thunks] in DmdAnal. +Note [CPR for thunks] in GHC.Core.Op.DmdAnal. And if something *has* been given the CPR property and we don't w/w, it's a disaster, because then the enclosing function might say it has the CPR @@ -623,7 +625,7 @@ unbox_one dflags fam_envs arg cs data_con unpk_args arg_no_unf = zapStableUnfolding arg -- See Note [Zap unfolding when beta-reducing] - -- in Simplify.hs; and see #13890 + -- in GHC.Core.Op.Simplify; and see #13890 rebox_fn = Let (NonRec arg_no_unf con_app) con_app = mkConApp2 data_con inst_tys unpk_args `mkCast` mkSymCo co ; (_, worker_args, wrap_fn, work_fn) <- mkWWstr dflags fam_envs False unpk_args @@ -896,7 +898,7 @@ If we have f :: Ord a => [a] -> Int -> a {-# INLINABLE f #-} and we worker/wrapper f, we'll get a worker with an INLINABLE pragma -(see Note [Worker-wrapper for INLINABLE functions] in WorkWrap), which +(see Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Op.WorkWrap), which can still be specialised by the type-class specialiser, something like fw :: Ord a => [a] -> Int# -> a diff --git a/compiler/simplCore/simplifier.tib b/compiler/GHC/Core/Op/simplifier.tib index e0f9dc91f2..e0f9dc91f2 100644 --- a/compiler/simplCore/simplifier.tib +++ b/compiler/GHC/Core/Op/simplifier.tib diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs index 31b27b03e6..bb58d25927 100644 --- a/compiler/GHC/Core/Rules.hs +++ b/compiler/GHC/Core/Rules.hs @@ -114,7 +114,7 @@ Note [Overall plumbing for rules] (d) Rules in the ExternalPackageTable. These can grow in response to lazy demand-loading of interfaces. -* At the moment (c) is carried in a reader-monad way by the CoreMonad. +* At the moment (c) is carried in a reader-monad way by the GHC.Core.Op.Monad. The HomePackageTable doesn't have a single RuleBase because technically we should only be able to "see" rules "below" this module; so we generate a RuleBase for (c) by combing rules from all the modules @@ -127,7 +127,7 @@ Note [Overall plumbing for rules] * So in the outer simplifier loop, we combine (b-d) into a single RuleBase, reading (b) from the ModGuts, - (c) from the CoreMonad, and + (c) from the GHC.Core.Op.Monad, and (d) from its mutable variable [Of course this means that we won't see new EPS rules that come in during a single simplifier iteration, but that probably does not @@ -330,7 +330,7 @@ but that isn't quite right: - PrimOps and ClassOps are born with a bunch of rules inside the Id, even when they are imported - - The rules in PrelRules.builtinRules should be active even + - The rules in GHC.Core.Op.ConstantFold.builtinRules should be active even in the module defining the Id (when it's a LocalId), but the rules are kept in the global RuleBase @@ -1023,7 +1023,7 @@ these cases. On the other hand, where we are allowed to insert new cost into the tick scope, we can float them upwards to the rule application site. -cf Note [Notes in call patterns] in SpecConstr +cf Note [Notes in call patterns] in GHC.Core.Op.SpecConstr Note [Matching lets] ~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/GHC/Core/SimpleOpt.hs b/compiler/GHC/Core/SimpleOpt.hs index 829e746498..3510fcc3ae 100644 --- a/compiler/GHC/Core/SimpleOpt.hs +++ b/compiler/GHC/Core/SimpleOpt.hs @@ -31,7 +31,7 @@ import GHC.Core.FVs import {-# SOURCE #-} GHC.Core.Unfold( mkUnfolding ) import GHC.Core.Make ( FloatBind(..) ) import GHC.Core.Ppr ( pprCoreBindings, pprRules ) -import OccurAnal( occurAnalyseExpr, occurAnalysePgm ) +import GHC.Core.Op.OccurAnal( occurAnalyseExpr, occurAnalysePgm ) import Literal ( Literal(LitString) ) import Id import IdInfo ( unfoldingInfo, setUnfoldingInfo, setRuleInfo, IdInfo (..) ) @@ -469,7 +469,7 @@ simple_out_bind_pair env in_bndr mb_out_bndr out_rhs post_inline_unconditionally | isExportedId in_bndr = False -- Note [Exported Ids and trivial RHSs] | stable_unf = False -- Note [Stable unfoldings and postInlineUnconditionally] - | not active = False -- in SimplUtils + | not active = False -- in GHC.Core.Op.Simplify.Utils | is_loop_breaker = False -- If it's a loop-breaker of any kind, don't inline -- because it might be referred to "earlier" | exprIsTrivial out_rhs = True @@ -489,7 +489,7 @@ simple_out_bind_pair env in_bndr mb_out_bndr out_rhs {- Note [Exported Ids and trivial RHSs] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We obviously do not want to unconditionally inline an Id that is exported. -In SimplUtils, Note [Top level and postInlineUnconditionally], we +In GHC.Core.Op.Simplify.Utils, Note [Top level and postInlineUnconditionally], we explain why we don't inline /any/ top-level things unconditionally, even trivial ones. But we do here! Why? In the simple optimiser @@ -1247,7 +1247,7 @@ pushCoArg :: CoercionR -> CoreArg -> Maybe (CoreArg, MCoercion) -- We have (fun |> co) arg, and we want to transform it to -- (fun arg) |> co -- This may fail, e.g. if (fun :: N) where N is a newtype --- C.f. simplCast in Simplify.hs +-- C.f. simplCast in GHC.Core.Op.Simplify -- 'co' is always Representational -- If the returned coercion is Nothing, then it would have been reflexive pushCoArg co (Type ty) = do { (ty', m_co') <- pushCoTyArg co ty diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs index b6e507a7b0..49006c66b6 100644 --- a/compiler/GHC/Core/Unfold.hs +++ b/compiler/GHC/Core/Unfold.hs @@ -48,7 +48,7 @@ import GhcPrelude import GHC.Driver.Session import GHC.Core -import OccurAnal ( occurAnalyseExpr_NoBinderSwap ) +import GHC.Core.Op.OccurAnal ( occurAnalyseExpr_NoBinderSwap ) import GHC.Core.SimpleOpt import GHC.Core.Arity ( manifestArity ) import GHC.Core.Utils @@ -121,7 +121,7 @@ mkCompulsoryUnfolding expr -- Used for things that absolutely must be un , ug_unsat_ok = unSaturatedOk, ug_boring_ok = boringCxtOk }) mkWorkerUnfolding :: DynFlags -> (CoreExpr -> CoreExpr) -> Unfolding -> Unfolding --- See Note [Worker-wrapper for INLINABLE functions] in WorkWrap +-- See Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Op.WorkWrap mkWorkerUnfolding dflags work_fn (CoreUnfolding { uf_src = src, uf_tmpl = tmpl , uf_is_top = top_lvl }) @@ -537,7 +537,7 @@ result of #4978. Note [Do not inline top-level bottoming functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The FloatOut pass has gone to some trouble to float out calls to 'error' -and similar friends. See Note [Bottoming floats] in SetLevels. +and similar friends. See Note [Bottoming floats] in GHC.Core.Op.SetLevels. Do not re-inline them! But we *do* still inline if they are very small (the uncondInline stuff). @@ -590,7 +590,7 @@ Things to note: unconditional-inline thing for *trivial* expressions. NB: you might think that PostInlineUnconditionally would do this - but it doesn't fire for top-level things; see SimplUtils + but it doesn't fire for top-level things; see GHC.Core.Op.Simplify.Utils Note [Top level and postInlineUnconditionally] Note [Count coercion arguments in boring contexts] diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs index d84bcdd774..fb22885f47 100644 --- a/compiler/GHC/Core/Utils.hs +++ b/compiler/GHC/Core/Utils.hs @@ -162,7 +162,7 @@ isExprLevPoly = go go e@(Cast {}) = check_type e go (Tick _ e) = go e go e@(Type {}) = pprPanic "isExprLevPoly ty" (ppr e) - go (Coercion {}) = False -- this case can happen in SetLevels + go (Coercion {}) = False -- this case can happen in GHC.Core.Op.SetLevels check_type = isTypeLevPoly . exprType -- slow approach @@ -625,7 +625,7 @@ for 'Red'. That's because 'lvl' is unreachable. So rather than crashing we generate (error "Inaccessible alternative"). Similar things can happen (augmented by GADTs) when the Simplifier -filters down the matching alternatives in Simplify.rebuildCase. +filters down the matching alternatives in GHC.Core.Op.Simplify.rebuildCase. -} --------------------------------- @@ -817,9 +817,9 @@ case e of C2 -> e0 ``` -It isn't obvious that refineDefaultAlt does this but if you look at its one -call site in SimplUtils then the `imposs_deflt_cons` argument is populated with -constructors which are matched elsewhere. +It isn't obvious that refineDefaultAlt does this but if you look at its one call +site in GHC.Core.Op.Simplify.Utils then the `imposs_deflt_cons` argument is +populated with constructors which are matched elsewhere. -} @@ -874,7 +874,7 @@ Note [Combine identical alternatives: wrinkles] isDeadBinder (see #7360). You can see this in the call to combineIdenticalAlts in - SimplUtils.prepareAlts. Here the alternatives have type InAlt + GHC.Core.Op.Simplify.Utils.prepareAlts. Here the alternatives have type InAlt (the "In" meaning input) rather than OutAlt. * combineIdenticalAlts does not work well for nullary constructors @@ -882,9 +882,10 @@ Note [Combine identical alternatives: wrinkles] [] -> f [] (_:_) -> f y Here we won't see that [] and y are the same. Sigh! This problem - is solved in CSE, in CSE.combineAlts, which does a better version of - combineIdenticalAlts. But sadly it doesn't have the occurrence info - we have here. See Note [Combine case alts: awkward corner] in CSE). + is solved in CSE, in GHC.Core.Op.CSE.combineAlts, which does a better version + of combineIdenticalAlts. But sadly it doesn't have the occurrence info we have + here. + See Note [Combine case alts: awkward corner] in GHC.Core.Op.CSE). Note [Care with impossible-constructors when combining alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1675,10 +1676,10 @@ isDivOp _ = False ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ exprOkForSpeculation accepts very special case expressions. Reason: (a ==# b) is ok-for-speculation, but the litEq rules -in PrelRules convert it (a ==# 3#) to +in GHC.Core.Op.ConstantFold convert it (a ==# 3#) to case a of { DEFAULT -> 0#; 3# -> 1# } for excellent reasons described in - PrelRules Note [The litEq rule: converting equality to case]. + GHC.Core.Op.ConstantFold Note [The litEq rule: converting equality to case]. So, annoyingly, we want that case expression to be ok-for-speculation too. Bother. @@ -1692,12 +1693,12 @@ But we restrict it sharply: Does the RHS of v satisfy the let/app invariant? Previously we said yes, on the grounds that y is evaluated. But the binder-swap done - by SetLevels would transform the inner alternative to + by GHC.Core.Op.SetLevels would transform the inner alternative to DEFAULT -> ... (let v::Int# = case x of { ... } in ...) .... which does /not/ satisfy the let/app invariant, because x is not evaluated. See Note [Binder-swap during float-out] - in SetLevels. To avoid this awkwardness it seems simpler + in GHC.Core.Op.SetLevels. To avoid this awkwardness it seems simpler to stick to unlifted scrutinees where the issue does not arise. @@ -1718,7 +1719,7 @@ But we restrict it sharply: ----- Historical note: #15696: -------- - Previously SetLevels used exprOkForSpeculation to guide + Previously GHC.Core.Op.SetLevels used exprOkForSpeculation to guide floating of single-alternative cases; it now uses exprIsHNF Note [Floating single-alternative cases]. @@ -1728,8 +1729,8 @@ But we restrict it sharply: A -> ... _ -> ...(case (case x of { B -> p; C -> p }) of I# r -> blah)... - If SetLevels considers the inner nested case as - ok-for-speculation it can do case-floating (in SetLevels). + If GHC.Core.Op.SetLevels considers the inner nested case as + ok-for-speculation it can do case-floating (in GHC.Core.Op.SetLevels). So we'd float to: case e of x { DEAFULT -> case (case x of { B -> p; C -> p }) of I# r -> @@ -2063,7 +2064,7 @@ we don't want Lint to complain. The 'y' is evaluated, so the case in the RHS of the binding for 'v' is fine. But only if we *know* that 'y' is evaluated. -c.f. add_evals in Simplify.simplAlt +c.f. add_evals in GHC.Core.Op.Simplify.simplAlt ************************************************************************ * * @@ -2332,7 +2333,7 @@ There are some particularly delicate points here: * Note [Arity care]: we need to be careful if we just look at f's arity. Currently (Dec07), f's arity is visible in its own RHS (see - Note [Arity robustness] in SimplEnv) so we must *not* trust the + Note [Arity robustness] in GHC.Core.Op.Simplify.Env) so we must *not* trust the arity when checking that 'f' is a value. Otherwise we will eta-reduce f = \x. f x diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index 3ec35595e0..39f137d657 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -19,7 +19,7 @@ module GHC.CoreToStg.Prep ( import GhcPrelude -import OccurAnal +import GHC.Core.Op.OccurAnal import GHC.Driver.Types import PrelNames @@ -27,7 +27,7 @@ import MkId ( realWorldPrimId ) import GHC.Core.Utils import GHC.Core.Arity import GHC.Core.FVs -import CoreMonad ( CoreToDo(..) ) +import GHC.Core.Op.Monad ( CoreToDo(..) ) import GHC.Core.Lint ( endPassIO ) import GHC.Core import GHC.Core.Make hiding( FloatBind(..) ) -- We use our own FloatBind here @@ -523,7 +523,7 @@ it seems good for CorePrep to be robust. cpeJoinPair :: CorePrepEnv -> JoinId -> CoreExpr -> UniqSM (JoinId, CpeRhs) -- Used for all join bindings --- No eta-expansion: see Note [Do not eta-expand join points] in SimplUtils +-- No eta-expansion: see Note [Do not eta-expand join points] in GHC.Core.Op.Simplify.Utils cpeJoinPair env bndr rhs = ASSERT(isJoinId bndr) do { let Just join_arity = isJoinId_maybe bndr diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index ec3de7a14a..57c06ae7a3 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -183,7 +183,7 @@ data GeneralFlag | Opt_CmmElimCommonBlocks | Opt_AsmShortcutting | Opt_OmitYields - | Opt_FunToThunk -- allow WwLib.mkWorkerArgs to remove all value lambdas + | Opt_FunToThunk -- allow GHC.Core.Op.WorkWrap.Lib.mkWorkerArgs to remove all value lambdas | Opt_DictsStrict -- be strict in argument dictionaries | Opt_DmdTxDictSel -- use a special demand transformer for dictionary selectors | Opt_Loopification -- See Note [Self-recursive tail calls] diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index ed47655982..083bfd279a 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -117,7 +117,7 @@ import TcRnMonad import TcHsSyn ( ZonkFlexi (DefaultFlexi) ) import NameCache ( initNameCache ) import PrelInfo -import SimplCore +import GHC.Core.Op.Simplify.Driver import GHC.HsToCore import GHC.Iface.Load ( ifaceStats, initExternalPackageState, writeIface ) import GHC.Iface.Make diff --git a/compiler/GHC/Driver/Plugins.hs b/compiler/GHC/Driver/Plugins.hs index baa27a0b36..437e68af71 100644 --- a/compiler/GHC/Driver/Plugins.hs +++ b/compiler/GHC/Driver/Plugins.hs @@ -49,7 +49,7 @@ module GHC.Driver.Plugins ( import GhcPrelude -import {-# SOURCE #-} CoreMonad ( CoreToDo, CoreM ) +import {-# SOURCE #-} GHC.Core.Op.Monad ( CoreToDo, CoreM ) import qualified TcRnTypes import TcRnTypes ( TcGblEnv, IfM, TcM, tcg_rn_decls, tcg_rn_exports ) import TcHoleFitTypes ( HoleFitPluginR ) diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index b0db896439..5b56e381ed 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -507,7 +507,7 @@ data DynFlags = DynFlags { -- by the assembler code generator (0 to disable) liberateCaseThreshold :: Maybe Int, -- ^ Threshold for LiberateCase floatLamArgs :: Maybe Int, -- ^ Arg count for lambda floating - -- See CoreMonad.FloatOutSwitches + -- See GHC.Core.Op.Monad.FloatOutSwitches liftLamsRecArgs :: Maybe Int, -- ^ Maximum number of arguments after lambda lifting a -- recursive function. diff --git a/compiler/GHC/HsToCore.hs b/compiler/GHC/HsToCore.hs index e006b20de6..145b7ade55 100644 --- a/compiler/GHC/HsToCore.hs +++ b/compiler/GHC/HsToCore.hs @@ -54,8 +54,8 @@ import NameSet import NameEnv import GHC.Core.Rules import BasicTypes -import CoreMonad ( CoreToDo(..) ) -import GHC.Core.Lint ( endPassIO ) +import GHC.Core.Op.Monad ( CoreToDo(..) ) +import GHC.Core.Lint ( endPassIO ) import VarSet import FastString import ErrUtils diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs index 950cabed37..3becf64ca4 100644 --- a/compiler/GHC/HsToCore/Binds.hs +++ b/compiler/GHC/HsToCore/Binds.hs @@ -37,8 +37,8 @@ import GHC.HsToCore.PmCheck ( needToRunPmCheck, addTyCsDs, checkGuardMatches ) import GHC.Hs -- lots of things import GHC.Core -- lots of things -import GHC.Core.SimpleOpt ( simpleOptExpr ) -import OccurAnal ( occurAnalyseExpr ) +import GHC.Core.SimpleOpt ( simpleOptExpr ) +import GHC.Core.Op.OccurAnal ( occurAnalyseExpr ) import GHC.Core.Make import GHC.Core.Utils import GHC.Core.Arity ( etaExpand ) diff --git a/compiler/GHC/HsToCore/Match.hs b/compiler/GHC/HsToCore/Match.hs index f456323ccb..48cfe6fa7a 100644 --- a/compiler/GHC/HsToCore/Match.hs +++ b/compiler/GHC/HsToCore/Match.hs @@ -337,7 +337,7 @@ We do *not* desugar simply to error "empty case" or some such, because 'x' might be bound to (error "hello"), in which case we want to see that "hello" exception, not (error "empty case"). -See also Note [Case elimination: lifted case] in Simplify. +See also Note [Case elimination: lifted case] in GHC.Core.Op.Simplify. ************************************************************************ diff --git a/compiler/GHC/HsToCore/Match/Literal.hs b/compiler/GHC/HsToCore/Match/Literal.hs index c25785d064..090227bf32 100644 --- a/compiler/GHC/HsToCore/Match/Literal.hs +++ b/compiler/GHC/HsToCore/Match/Literal.hs @@ -369,7 +369,7 @@ tidyNPat (OverLit (OverLitTc False ty) val _) mb_neg _eq outer_ty -- NB: do /not/ convert Float or Double literals to F# 3.8 or D# 5.3 -- If we do convert to the constructor form, we'll generate a case -- expression on a Float# or Double# and that's not allowed in Core; see - -- #9238 and Note [Rules for floating-point comparisons] in PrelRules + -- #9238 and Note [Rules for floating-point comparisons] in GHC.Core.Op.ConstantFold where -- Sometimes (like in test case -- overloadedlists/should_run/overloadedlistsrun04), the SyntaxExprs include diff --git a/compiler/GHC/HsToCore/Utils.hs b/compiler/GHC/HsToCore/Utils.hs index eccd37b719..0b80959f09 100644 --- a/compiler/GHC/HsToCore/Utils.hs +++ b/compiler/GHC/HsToCore/Utils.hs @@ -863,7 +863,7 @@ Note [Failure thunks and CPR] (This note predates join points as formal entities (hence the quotation marks). We can't use actual join points here (see above); if we did, this would also solve the CPR problem, since join points don't get CPR'd. See Note [Don't CPR -join points] in WorkWrap.) +join points] in GHC.Core.Op.WorkWrap.) When we make a failure point we ensure that it does not look like a thunk. Example: diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs index 0472dee50b..b3fd56c4d2 100644 --- a/compiler/GHC/Iface/Tidy.hs +++ b/compiler/GHC/Iface/Tidy.hs @@ -22,7 +22,7 @@ import GHC.Core import GHC.Core.Unfold import GHC.Core.FVs import GHC.Core.Op.Tidy -import CoreMonad +import GHC.Core.Op.Monad import GHC.Core.Stats (coreBindsStats, CoreStats(..)) import GHC.Core.Seq (seqBinds) import GHC.Core.Lint @@ -896,7 +896,7 @@ Now that RULE *might* be useful to an importing module, but that is purely speculative, and meanwhile the code is taking up space and codegen time. I found that binary sizes jumped by 6-10% when I started to specialise INLINE functions (again, Note [Inline -specialisations] in Specialise). +specialisations] in GHC.Core.Op.Specialise). So it seems better to drop the binding for f_spec, and the rule itself, if the auto-generated rule is the *only* reason that it is @@ -904,8 +904,8 @@ being kept alive. (The RULE still might have been useful in the past; that is, it was the right thing to have generated it in the first place. See Note -[Inline specialisations] in Specialise. But now it has served its -purpose, and can be discarded.) +[Inline specialisations] in GHC.Core.Op.Specialise. But now it has +served its purpose, and can be discarded.) So findExternalRules does this: * Remove all bindings that are kept alive *only* by isAutoRule rules @@ -1253,7 +1253,8 @@ tidyTopIdInfo dflags rhs_tidy_env name orig_rhs tidy_rhs idinfo show_unfold -- the function returns bottom -- In this case, show_unfold will be false (we don't expose unfoldings -- for bottoming functions), but we might still have a worker/wrapper - -- split (see Note [Worker-wrapper for bottoming functions] in WorkWrap.hs + -- split (see Note [Worker-wrapper for bottoming functions] in + -- GHC.Core.Op.WorkWrap) --------- Arity ------------ diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs index ebf3aa588d..df2457cd62 100644 --- a/compiler/GHC/IfaceToCore.hs +++ b/compiler/GHC/IfaceToCore.hs @@ -62,7 +62,7 @@ import VarSet import Name import NameEnv import NameSet -import OccurAnal ( occurAnalyseExpr ) +import GHC.Core.Op.OccurAnal ( occurAnalyseExpr ) import Demand import Module import UniqFM diff --git a/compiler/GHC/Plugins.hs b/compiler/GHC/Plugins.hs index ee6a946cbb..05278f7da1 100644 --- a/compiler/GHC/Plugins.hs +++ b/compiler/GHC/Plugins.hs @@ -6,11 +6,11 @@ -- with saying "import GHC.Plugins". -- -- Particularly interesting modules for plugin writers include --- "GHC.Core" and "CoreMonad". +-- "GHC.Core" and "GHC.Core.Op.Monad". module GHC.Plugins( module GHC.Driver.Plugins, module RdrName, module OccName, module Name, module Var, module Id, module IdInfo, - module CoreMonad, module GHC.Core, module Literal, module GHC.Core.DataCon, + module GHC.Core.Op.Monad, module GHC.Core, module Literal, module GHC.Core.DataCon, module GHC.Core.Utils, module GHC.Core.Make, module GHC.Core.FVs, module GHC.Core.Subst, module GHC.Core.Rules, module Annotations, module GHC.Driver.Session, module GHC.Driver.Packages, @@ -37,7 +37,7 @@ import Id hiding ( lazySetIdInfo, setIdExported, setIdNotExported {- all import IdInfo -- Core -import CoreMonad +import GHC.Core.Op.Monad import GHC.Core import Literal import GHC.Core.DataCon @@ -95,8 +95,8 @@ import TcEnv ( lookupGlobal ) import qualified Language.Haskell.TH as TH -{- This instance is defined outside CoreMonad.hs so that - CoreMonad does not depend on TcEnv -} +{- This instance is defined outside GHC.Core.Op.Monad.hs so that + GHC.Core.Op.Monad does not depend on TcEnv -} instance MonadThings CoreM where lookupThing name = do { hsc_env <- getHscEnv ; liftIO $ lookupGlobal hsc_env name } diff --git a/compiler/GHC/StgToCmm/Expr.hs b/compiler/GHC/StgToCmm/Expr.hs index f8e2cbd73d..7f62c6dec1 100644 --- a/compiler/GHC/StgToCmm/Expr.hs +++ b/compiler/GHC/StgToCmm/Expr.hs @@ -64,7 +64,7 @@ cgExpr :: CgStgExpr -> FCode ReturnKind cgExpr (StgApp fun args) = cgIdApp fun args -- seq# a s ==> a --- See Note [seq# magic] in PrelRules +-- See Note [seq# magic] in GHC.Core.Op.ConstantFold cgExpr (StgOpApp (StgPrimOp SeqOp) [StgVarArg a, _] _res_ty) = cgIdApp a [] @@ -404,7 +404,7 @@ cgCase scrut@(StgApp v []) _ (PrimAlt _) _ {- Note [Handle seq#] ~~~~~~~~~~~~~~~~~~~~~ -See Note [seq# magic] in PrelRules. +See Note [seq# magic] in GHC.Core.Op.ConstantFold. The special case for seq# in cgCase does this: case seq# a s of v @@ -419,7 +419,7 @@ is the same as the return convention for just 'a') cgCase (StgOpApp (StgPrimOp SeqOp) [StgVarArg a, _] _) bndr alt_type alts = -- Note [Handle seq#] - -- And see Note [seq# magic] in PrelRules + -- And see Note [seq# magic] in GHC.Core.Op.ConstantFold -- Use the same return convention as vanilla 'a'. cgCase (StgApp a []) bndr alt_type alts diff --git a/compiler/basicTypes/Cpr.hs b/compiler/basicTypes/Cpr.hs index a83b16b61c..3a987fe2b5 100644 --- a/compiler/basicTypes/Cpr.hs +++ b/compiler/basicTypes/Cpr.hs @@ -1,5 +1,5 @@ {-# LANGUAGE GeneralisedNewtypeDeriving #-} --- | Types for the Constructed Product Result lattice. "CprAnal" and "WwLib" +-- | Types for the Constructed Product Result lattice. "GHC.Core.Op.CprAnal" and "GHC.Core.Op.WorkWrap.Lib" -- are its primary customers via 'idCprInfo'. module Cpr ( CprResult, topCpr, botCpr, conCpr, asConCpr, diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 26452721b2..196bedb8ee 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -681,7 +681,7 @@ mkCallDmd (JD {sd = d, ud = u}) mkCallDmds :: Arity -> CleanDemand -> CleanDemand mkCallDmds arity cd = iterate mkCallDmd cd !! arity --- See Note [Demand on the worker] in WorkWrap +-- See Note [Demand on the worker] in GHC.Core.Op.WorkWrap mkWorkerDemand :: Int -> Demand mkWorkerDemand n = JD { sd = Lazy, ud = Use One (go n) } where go 0 = Used @@ -859,7 +859,7 @@ Bottom line: we really don't want to have a binder whose demand is more deeply-nested than its type. There are various ways to tackle this. When processing (x |> g1), we could "trim" the incoming demand U(U,U) to match x's type. But I'm currently doing so just at the moment when -we pin a demand on a binder, in DmdAnal.findBndrDmd. +we pin a demand on a binder, in GHC.Core.Op.DmdAnal.findBndrDmd. Note [Threshold demands] @@ -1053,7 +1053,7 @@ We 3 and 4 are implemented in bothDivergence. -} --- Equality needed for fixpoints in DmdAnal +-- Equality needed for fixpoints in GHC.Core.Op.DmdAnal instance Eq DmdType where (==) (DmdType fv1 ds1 div1) (DmdType fv2 ds2 div2) = nonDetUFMToList fv1 == nonDetUFMToList fv2 @@ -1174,7 +1174,7 @@ splitDmdTy ty@(DmdType _ [] res_ty) = (resTypeArgDmd res_ty, ty) -- * We can keep usage information (i.e. lub with an absent demand) -- * We have to kill definite divergence -- * We can keep CPR information. --- See Note [IO hack in the demand analyser] in DmdAnal +-- See Note [IO hack in the demand analyser] in GHC.Core.Op.DmdAnal deferAfterIO :: DmdType -> DmdType deferAfterIO d@(DmdType _ _ res) = case d `lubDmdType` nopDmdType of @@ -1530,7 +1530,7 @@ Here comes the subtle part: The threshold is encoded in the wrapped demand type's depth! So in mkStrictSigForArity we make sure to trim the list of argument demands to the given threshold arity. Call sites will make sure that this corresponds to the arity of the call demand that elicited the wrapped -demand type. See also Note [What are demand signatures?] in DmdAnal. +demand type. See also Note [What are demand signatures?] in GHC.Core.Op.DmdAnal. Besides trimming argument demands, mkStrictSigForArity will also trim CPR information if necessary. @@ -1703,7 +1703,7 @@ argsOneShots (StrictSig (DmdType _ arg_ds _)) n_val_args -- saturatedByOneShots n C1(C1(...)) = True, -- <=> -- there are at least n nested C1(..) calls --- See Note [Demand on the worker] in WorkWrap +-- See Note [Demand on the worker] in GHC.Core.Op.WorkWrap saturatedByOneShots :: Int -> Demand -> Bool saturatedByOneShots n (JD { ud = usg }) = case usg of diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 8eafcdee2f..67cde9a0fc 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -488,7 +488,7 @@ isDataConId_maybe id = case Var.idDetails id of _ -> Nothing isJoinId :: Var -> Bool --- It is convenient in SetLevels.lvlMFE to apply isJoinId +-- It is convenient in GHC.Core.Op.SetLevels.lvlMFE to apply isJoinId -- to the free vars of an expression, so it's convenient -- if it returns False for type variables isJoinId id @@ -894,7 +894,7 @@ Note [transferPolyIdInfo] ~~~~~~~~~~~~~~~~~~~~~~~~~ This transfer is used in three places: FloatOut (long-distance let-floating) - SimplUtils.abstractFloats (short-distance let-floating) + GHC.Core.Op.Simplify.Utils.abstractFloats (short-distance let-floating) StgLiftLams (selectively lambda-lift local functions to top-level) Consider the short-distance let-floating: diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs index db03f9481e..41b453a9fa 100644 --- a/compiler/basicTypes/Literal.hs +++ b/compiler/basicTypes/Literal.hs @@ -679,7 +679,7 @@ literalType (LitRubbish) = mkForAllTy a Inferred (mkTyVarTy a) absentLiteralOf :: TyCon -> Maybe Literal -- Return a literal of the appropriate primitive -- TyCon, to use as a placeholder when it doesn't matter --- Rubbish literals are handled in WwLib, because +-- Rubbish literals are handled in GHC.Core.Op.WorkWrap.Lib, because -- 1. Looking at the TyCon is not enough, we need the actual type -- 2. This would need to return a type application to a literal absentLiteralOf tc = lookupUFM absent_lits (tyConName tc) @@ -834,7 +834,7 @@ Here are the moving parts: * It is given its polymorphic type by Literal.literalType -* WwLib.mk_absent_let introduces a LitRubbish for absent +* GHC.Core.Op.WorkWrap.Lib.mk_absent_let introduces a LitRubbish for absent arguments of boxed, unlifted type. * In CoreToSTG we convert (RubishLit @t) to just (). STG is diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 3b73882fb1..d785642524 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -35,7 +35,7 @@ module MkId ( coerceName, -- Re-export error Ids - module PrelRules + module GHC.Core.Op.ConstantFold ) where #include "HsVersions.h" @@ -45,7 +45,7 @@ import GhcPrelude import GHC.Core.Rules import TysPrim import TysWiredIn -import PrelRules +import GHC.Core.Op.ConstantFold import GHC.Core.Type import GHC.Core.TyCo.Rep import GHC.Core.FamInstEnv @@ -1500,7 +1500,7 @@ enough support that you can do this using a rewrite rule: You write that rule. When GHC sees a case expression that discards its result, it mentally transforms it to a call to 'seq' and looks for -a RULE. (This is done in Simplify.trySeqRules.) As usual, the +a RULE. (This is done in GHC.Core.Op.Simplify.trySeqRules.) As usual, the correctness of the rule is up to you. VERY IMPORTANT: to make this work, we give the RULE an arity of 1, not 2. @@ -1512,10 +1512,10 @@ with rule arity 2, then two bad things would happen: for saturated application of 'seq' would turn the LHS into a case expression! - - The code in Simplify.rebuildCase would need to actually supply + - The code in GHC.Core.Op.Simplify.rebuildCase would need to actually supply the value argument, which turns out to be awkward. -See also: Note [User-defined RULES for seq] in Simplify. +See also: Note [User-defined RULES for seq] in GHC.Core.Op.Simplify. Note [lazyId magic] @@ -1647,7 +1647,7 @@ cannot be instantiated with a forall. The field of `WrapC` contains a `Proxy` parameter which is used to link the type of the constraint, `C a`, with the type of the `Wrap` value being made. -Next, we add a built-in Prelude rule (see prelude/PrelRules.hs), +Next, we add a built-in Prelude rule (see GHC.Core.Op.ConstantFold), which will replace the RHS of this definition with the appropriate definition in Core. The rewrite rule works as follows: diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 2dcd462d69..f40a0ce14f 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -167,9 +167,6 @@ Library parser prelude profiling - simplCore - specialise - stranal typecheck utils @@ -414,7 +411,7 @@ Library KnownUniques PrelInfo PrelNames - PrelRules + GHC.Core.Op.ConstantFold PrimOp ToolSettings TysPrim @@ -434,19 +431,19 @@ Library GHC.Rename.Fixity GHC.Rename.Utils GHC.Rename.Unbound - CoreMonad - CSE - FloatIn - FloatOut - LiberateCase - OccurAnal - SAT - SetLevels - SimplCore - SimplEnv - SimplMonad - SimplUtils - Simplify + GHC.Core.Op.Monad + GHC.Core.Op.CSE + GHC.Core.Op.FloatIn + GHC.Core.Op.FloatOut + GHC.Core.Op.LiberateCase + GHC.Core.Op.OccurAnal + GHC.Core.Op.StaticArgs + GHC.Core.Op.SetLevels + GHC.Core.Op.Simplify.Driver + GHC.Core.Op.Simplify.Env + GHC.Core.Op.Simplify.Monad + GHC.Core.Op.Simplify.Utils + GHC.Core.Op.Simplify GHC.Stg.Pipeline GHC.Stg.Stats GHC.Stg.CSE @@ -463,14 +460,14 @@ Library GHC.CoreToStg.Prep GHC.Types.RepType GHC.Core.Rules - SpecConstr - Specialise - CallArity - DmdAnal - CprAnal - Exitify - WorkWrap - WwLib + GHC.Core.Op.SpecConstr + GHC.Core.Op.Specialise + GHC.Core.Op.CallArity + GHC.Core.Op.DmdAnal + GHC.Core.Op.CprAnal + GHC.Core.Op.Exitify + GHC.Core.Op.WorkWrap + GHC.Core.Op.WorkWrap.Lib FamInst ClsInst Inst diff --git a/compiler/main/StaticPtrTable.hs b/compiler/main/StaticPtrTable.hs index cb909cc627..ecc937665a 100644 --- a/compiler/main/StaticPtrTable.hs +++ b/compiler/main/StaticPtrTable.hs @@ -28,7 +28,7 @@ -- -- The linker must find the definitions matching the @extern StgPtr <name>@ -- declarations. For this to work, the identifiers of static pointers need to be --- exported. This is done in SetLevels.newLvlVar. +-- exported. This is done in GHC.Core.Op.SetLevels.newLvlVar. -- -- There is also a finalization function for the time when the module is -- unloaded. diff --git a/compiler/prelude/PrelInfo.hs b/compiler/prelude/PrelInfo.hs index 6ecb106efa..0b7a962f3f 100644 --- a/compiler/prelude/PrelInfo.hs +++ b/compiler/prelude/PrelInfo.hs @@ -54,7 +54,7 @@ import Unique ( isValidKnownKeyUnique ) import GHC.Core.ConLike ( ConLike(..) ) import THNames ( templateHaskellNames ) import PrelNames -import PrelRules +import GHC.Core.Op.ConstantFold import Avail import PrimOp import GHC.Core.DataCon diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs index 4d0bbcee66..96160a27f3 100644 --- a/compiler/prelude/PrimOp.hs +++ b/compiler/prelude/PrimOp.hs @@ -498,7 +498,8 @@ primOpOkForSideEffects op {- Note [primOpIsCheap] ~~~~~~~~~~~~~~~~~~~~ -@primOpIsCheap@, as used in \tr{SimplUtils.hs}. For now (HACK + +@primOpIsCheap@, as used in GHC.Core.Op.Simplify.Utils. For now (HACK WARNING), we just borrow some other predicates for a what-should-be-good-enough test. "Cheap" means willing to call it more than once, and/or push it inside a lambda. The latter could change the diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 7361c4bea8..e5ad02d01b 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -3252,7 +3252,7 @@ primop SparkOp "spark#" GenPrimOp primop SeqOp "seq#" GenPrimOp a -> State# s -> (# State# s, a #) - -- See Note [seq# magic] in PrelRules + -- See Note [seq# magic] in GHC.Core.Op.ConstantFold primop GetSparkOp "getSpark#" GenPrimOp State# s -> (# State# s, Int#, a #) @@ -3277,7 +3277,7 @@ primop DataToTagOp "dataToTag#" GenPrimOp a -> Int# -- Zero-indexed; the first constructor has tag zero with strictness = { \ _arity -> mkClosedStrictSig [evalDmd] topDiv } - -- See Note [dataToTag# magic] in PrelRules + -- See Note [dataToTag# magic] in GHC.Core.Op.ConstantFold primop TagToEnumOp "tagToEnum#" GenPrimOp Int# -> a diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index e5c805a275..386f9b1646 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -163,7 +163,7 @@ Note [Instances and loop breakers] loop-breaker because df_i isn't), op1_i will ironically never be inlined. But this is OK: the recursion breaking happens by way of a RULE (the magic ClassOp rule above), and RULES work inside InlineRule - unfoldings. See Note [RULEs enabled in InitialPhase] in SimplUtils + unfoldings. See Note [RULEs enabled in InitialPhase] in GHC.Core.Op.Simplify.Utils Note [ClassOp/DFun selection] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs index 82bb3d9077..3624a36b15 100644 --- a/libraries/base/Data/Foldable.hs +++ b/libraries/base/Data/Foldable.hs @@ -740,7 +740,7 @@ Now we get Notice that `f` does not inline into the RHS of `c`, because the INLINE pragma stops it; see -Note [Simplifying inside stable unfoldings] in SimplUtils. +Note [Simplifying inside stable unfoldings] in GHC.Core.Op.Simplify.Utils. Continuing: = { foldr/build rule } diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 65ec3ea1b7..498964b86d 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -1358,7 +1358,7 @@ eqString (c1:cs1) (c2:cs2) = c1 == c2 && cs1 `eqString` cs2 eqString _ _ = False {-# RULES "eqString" (==) = eqString #-} --- eqString also has a BuiltInRule in PrelRules.hs: +-- eqString also has a BuiltInRule in GHC.Core.Op.ConstantFold: -- eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2)) = s1==s2 @@ -1624,7 +1624,7 @@ a `iShiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0# "unpack-list" [1] forall a . unpackFoldrCString# a (:) [] = unpackCString# a "unpack-append" forall a n . unpackFoldrCString# a (:) n = unpackAppendCString# a n --- There's a built-in rule (in PrelRules.hs) for +-- There's a built-in rule (in GHC.Core.Op.ConstantFold) for -- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n #-} diff --git a/libraries/base/GHC/Real.hs b/libraries/base/GHC/Real.hs index b0f419896d..295b0131bb 100644 --- a/libraries/base/GHC/Real.hs +++ b/libraries/base/GHC/Real.hs @@ -417,7 +417,7 @@ instance Real Natural where -- -- Constant folding of quot, rem, div, mod, divMod and quotRem for -- Integer arguments depends crucially on inlining. Constant folding --- rules defined in compiler/prelude/PrelRules.hs trigger for +-- rules defined in GHC.Core.Op.ConstantFold trigger for -- quotInteger, remInteger and so on. So if calls to quot, rem and so on -- were not inlined the rules would not fire. The rules would also not -- fire if calls to quotInteger and so on were inlined, but this does not diff --git a/libraries/ghc-prim/GHC/CString.hs b/libraries/ghc-prim/GHC/CString.hs index 5c9dcf95db..3ae4d50532 100644 --- a/libraries/ghc-prim/GHC/CString.hs +++ b/libraries/ghc-prim/GHC/CString.hs @@ -46,7 +46,7 @@ is a waste. Moreover, inlining early may interfere with a variety of rules that are supposed to match unpackCString#, - * BuiltInRules in PrelRules.hs; e.g. + * BuiltInRules in GHC.Core.Op.ConstantFold; e.g. eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2) = s1 == s2 @@ -60,8 +60,8 @@ to match unpackCString#, Moreover, we want to make it CONLIKE, so that: -* the rules in PrelRules will fire when the string is let-bound. - E.g. the eqString rule in PrelRules +* the rules in GHC.Core.Op.ConstantFold will fire when the string is let-bound. + E.g. the eqString rule in GHC.Core.Op.ConstantFold eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2) = s1==s2 * exprIsConApp_maybe will see the string when we have @@ -115,7 +115,7 @@ unpackFoldrCString# :: Addr# -> (Char -> a -> a) -> a -> a -- Usually the unpack-list rule turns unpackFoldrCString# into unpackCString# --- It also has a BuiltInRule in PrelRules.hs: +-- It also has a BuiltInRule in GHC.Core.Op.ConstantFold: -- unpackFoldrCString# "foo" c (unpackFoldrCString# "baz" c n) -- = unpackFoldrCString# "foobaz" c n diff --git a/testsuite/tests/callarity/unittest/CallArity1.hs b/testsuite/tests/callarity/unittest/CallArity1.hs index e39ba63dd6..60afe5be05 100644 --- a/testsuite/tests/callarity/unittest/CallArity1.hs +++ b/testsuite/tests/callarity/unittest/CallArity1.hs @@ -4,7 +4,7 @@ import GHC.Core.Utils import Id import GHC.Core.Type import GHC.Core.Make -import CallArity (callArityRHS) +import GHC.Core.Op.CallArity (callArityRHS) import MkId import SysTools import GHC.Driver.Session diff --git a/testsuite/tests/codeGen/should_run/T16449_2.hs b/testsuite/tests/codeGen/should_run/T16449_2.hs index acb885369c..0a08ffde23 100644 --- a/testsuite/tests/codeGen/should_run/T16449_2.hs +++ b/testsuite/tests/codeGen/should_run/T16449_2.hs @@ -7,7 +7,7 @@ import GHC.Int -- Test that large unchecked shifts, which constitute undefined behavior, do -- not crash the compiler and instead evaluate to 0. --- See Note [Guarding against silly shifts] in PrelRules. +-- See Note [Guarding against silly shifts] in GHC.Core.Op.ConstantFold. -- Shift should be larger than the word size (e.g. 64 on 64-bit) for this test. main = print (I# (uncheckedIShiftL# 1# 1000#)) diff --git a/testsuite/tests/determinism/determ014/A.hs b/testsuite/tests/determinism/determ014/A.hs index 35ea20f225..91d874cde7 100644 --- a/testsuite/tests/determinism/determ014/A.hs +++ b/testsuite/tests/determinism/determ014/A.hs @@ -7,7 +7,7 @@ , PolyKinds -- Comment out PolyKinds and the bug goes away. #-} {-# OPTIONS_GHC -O #-} - -- The bug is in SimplUtils.abstractFloats, so we need -O to trigger it + -- The bug is in GHC.Core.Op.Simplify.Utils.abstractFloats, so we need -O to trigger it module KeyValue where diff --git a/testsuite/tests/eyeball/inline4.hs b/testsuite/tests/eyeball/inline4.hs index a673de9b2a..bf7cf7382c 100644 --- a/testsuite/tests/eyeball/inline4.hs +++ b/testsuite/tests/eyeball/inline4.hs @@ -15,7 +15,7 @@ Reason: 'a' is inline (not pre/post unconditionally; just ordinary inlining) Then, since ($dm>>) has arity 3, the rhs of (>>) is a PAP, so the arg is floated out, past the big lambdas. -See Note [Unsaturated functions] in SimplUtils +See Note [Unsaturated functions] in GHC.Core.Op.Simplify.Utils ------------------------------------------------------------ a_s9f{v} [lid] = diff --git a/testsuite/tests/ghc-api/T4891/T4891.hs b/testsuite/tests/ghc-api/T4891/T4891.hs index 000a8726d1..7ef32aae02 100644 --- a/testsuite/tests/ghc-api/T4891/T4891.hs +++ b/testsuite/tests/ghc-api/T4891/T4891.hs @@ -2,7 +2,7 @@ module Main where import GHC.ByteCode.Linker -import CoreMonad +import GHC.Core.Op.Monad import Data.Array import GHC.Core.DataCon import GHC diff --git a/testsuite/tests/perf/join_points/join005.hs b/testsuite/tests/perf/join_points/join005.hs index 7feec98c28..de8a50b967 100644 --- a/testsuite/tests/perf/join_points/join005.hs +++ b/testsuite/tests/perf/join_points/join005.hs @@ -17,7 +17,7 @@ It's hard to test for this, but what should happen is that go gets W/W'd and the worker is a join point (else Core Lint will complain). Interestingly, go is *not* CPR'd, because then the worker couldn't be a join point, but once the simplifier runs, the worker ends up returning Int# anyway. See Note [Don't CPR -join points] in WorkWrap.hs. +join points] in GHC.Core.Op.WorkWrap. -} main = print $ sumOfMultiplesOf 2 [1..10] diff --git a/testsuite/tests/perf/should_run/MethSharing.hs b/testsuite/tests/perf/should_run/MethSharing.hs index 17276a5fed..2c6b0857bd 100644 --- a/testsuite/tests/perf/should_run/MethSharing.hs +++ b/testsuite/tests/perf/should_run/MethSharing.hs @@ -91,7 +91,7 @@ Main.loop [InlPrag=NOINLINE (sat-args=2), Occ=LoopBreaker] This is a bit disappointing. I would have expected GHC to float out the application of (^) to the two dictionaries during full laziness (note that (^) has arity 2 so the application is oversaturated). Why -doesn't that happen? SetLevels (if this is the right place to look) +doesn't that happen? GHC.Core.Op.SetLevels (if this is the right place to look) has this: -} diff --git a/testsuite/tests/perf/should_run/T15226.hs b/testsuite/tests/perf/should_run/T15226.hs index 4c09114b89..0704b77284 100644 --- a/testsuite/tests/perf/should_run/T15226.hs +++ b/testsuite/tests/perf/should_run/T15226.hs @@ -6,7 +6,7 @@ import Prelude hiding (repeat) -- We want to be sure that the compiler *doesn't* know that -- all the elements of the list are in WHNF, because if it --- does, PrelRules may erase the seq#'s altogether. +-- does, GHC.Core.Op.ConstantFold may erase the seq#'s altogether. repeat :: a -> [a] repeat a = res where res = a : res diff --git a/testsuite/tests/perf/should_run/T15226a.hs b/testsuite/tests/perf/should_run/T15226a.hs index 6e9a1dbdbb..3f1937627f 100644 --- a/testsuite/tests/perf/should_run/T15226a.hs +++ b/testsuite/tests/perf/should_run/T15226a.hs @@ -7,7 +7,7 @@ import Data.Coerce -- We want to be sure that the compiler *doesn't* know that -- all the elements of the list are in WHNF, because if it --- does, PrelRules may erase the seq#'s altogether. +-- does, GHC.Core.Op.ConstantFold may erase the seq#'s altogether. repeat :: a -> [a] repeat a = res where res = a : res diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index d0dec5b2a6..70bd0fa48c 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -273,7 +273,7 @@ test('T9339', only_ways(['normal'])], compile_and_run, ['-O2 -fspec-constr-keen']) - # For the -fspec-constr-keen see Note [Making SpecConstr keener] in SpecConstr + # For the -fspec-constr-keen see Note [Making SpecConstr keener] in GHC.Core.Op.SpecConstr test('T8472', diff --git a/testsuite/tests/polykinds/T10934.hs b/testsuite/tests/polykinds/T10934.hs index 35ea20f225..91d874cde7 100644 --- a/testsuite/tests/polykinds/T10934.hs +++ b/testsuite/tests/polykinds/T10934.hs @@ -7,7 +7,7 @@ , PolyKinds -- Comment out PolyKinds and the bug goes away. #-} {-# OPTIONS_GHC -O #-} - -- The bug is in SimplUtils.abstractFloats, so we need -O to trigger it + -- The bug is in GHC.Core.Op.Simplify.Utils.abstractFloats, so we need -O to trigger it module KeyValue where diff --git a/testsuite/tests/simplCore/should_compile/T14270a.hs b/testsuite/tests/simplCore/should_compile/T14270a.hs index d8cc497f62..1f90993d5d 100644 --- a/testsuite/tests/simplCore/should_compile/T14270a.hs +++ b/testsuite/tests/simplCore/should_compile/T14270a.hs @@ -1,6 +1,6 @@ {-# LANGUAGE TypeApplications, ScopedTypeVariables, GADTs, RankNTypes, PolyKinds, KindSignatures #-} -{-# OPTIONS_GHC -O2 #-} -- We are provoking a bug in SpecConstr +{-# OPTIONS_GHC -O2 #-} -- We are provoking a bug in GHC.Core.Op.SpecConstr module T14270a where @@ -25,4 +25,4 @@ g kv x = case kv of -- The point here is that the call to f looks like -- f @(a |> co) (T2 @(a |> co)) -- where 'co' is bound by the pattern match on K1 --- See Note [SpecConstr and casts] in SpecConstr +-- See Note [SpecConstr and casts] in GHC.Core.Op.SpecConstr diff --git a/testsuite/tests/simplCore/should_compile/T3831.hs b/testsuite/tests/simplCore/should_compile/T3831.hs index 9eeb0a20c4..163f610a2e 100644 --- a/testsuite/tests/simplCore/should_compile/T3831.hs +++ b/testsuite/tests/simplCore/should_compile/T3831.hs @@ -2,7 +2,7 @@ {-# LANGUAGE ScopedTypeVariables, FlexibleInstances #-} -- This test has a deep nest of join points, which led to --- an exponential blow-up in SpecConstr +-- an exponential blow-up in GHC.Core.Op.SpecConstr module T3831(setAttributes) where diff --git a/testsuite/tests/simplCore/should_compile/simpl018.hs b/testsuite/tests/simplCore/should_compile/simpl018.hs index 613c612c25..75d19b9d8c 100644 --- a/testsuite/tests/simplCore/should_compile/simpl018.hs +++ b/testsuite/tests/simplCore/should_compile/simpl018.hs @@ -1,6 +1,6 @@ {-# LANGUAGE UnboxedTuples #-} --- See Note [Float coercions (unlifted)] in Simplify +-- See Note [Float coercions (unlifted)] in GHC.Core.Op.Simplify -- This one gave a CoreLint error when compiled optimised -- -- See also #1718, of which this is a simplified version diff --git a/testsuite/tests/simplCore/should_compile/spec002.hs b/testsuite/tests/simplCore/should_compile/spec002.hs index 106debc0c1..619bf274c7 100644 --- a/testsuite/tests/simplCore/should_compile/spec002.hs +++ b/testsuite/tests/simplCore/should_compile/spec002.hs @@ -1,6 +1,6 @@ {-# OPTIONS_GHC -O2 #-} --- Ths one fooled the rule-matching in SpecConstr, and gave a CoreLint error +-- Ths one fooled the rule-matching in GHC.Core.Op.SpecConstr, and gave a CoreLint error module Foo where diff --git a/testsuite/tests/simplCore/should_run/simplrun007.hs b/testsuite/tests/simplCore/should_run/simplrun007.hs index 9cf3760adf..6940e8d546 100644 --- a/testsuite/tests/simplCore/should_run/simplrun007.hs +++ b/testsuite/tests/simplCore/should_run/simplrun007.hs @@ -1,6 +1,6 @@ {-# LANGUAGE MagicHash #-} --- Actually, this exercises prelude/PrelRules, but this is the closest +-- Actually, this exercises GHC.Core.Op.ConstantFold, but this is the closest -- place I could find to put it... import GHC.Exts diff --git a/testsuite/tests/simplCore/should_run/simplrun009.hs b/testsuite/tests/simplCore/should_run/simplrun009.hs index 0e94012b2b..4ae0d2f255 100644 --- a/testsuite/tests/simplCore/should_run/simplrun009.hs +++ b/testsuite/tests/simplCore/should_run/simplrun009.hs @@ -6,7 +6,7 @@ -- It produces a nested unfold that should look something -- like the code below. Note the 'lvl1_shW'. It is BAD -- if this is a lambda instead; you get a lot more allocation --- See Note [Escaping a value lambda] in SetLevels +-- See Note [Escaping a value lambda] in GHC.Core.Op.SetLevels {- diff --git a/testsuite/tests/stranal/should_compile/T10482a.hs b/testsuite/tests/stranal/should_compile/T10482a.hs index 2f5a0e0665..b9e5351587 100644 --- a/testsuite/tests/stranal/should_compile/T10482a.hs +++ b/testsuite/tests/stranal/should_compile/T10482a.hs @@ -2,7 +2,7 @@ {-# OPTIONS_GHC -fno-unbox-small-strict-fields #-} -- Makes f2 a bit more challenging --- Tests inspired by Note [CPR examples] in DmdAnal, and #10482 +-- Tests inspired by Note [CPR examples] in GHC.Core.Op.DmdAnal, and #10482 module Foo where diff --git a/testsuite/tests/stranal/should_run/strun003.hs b/testsuite/tests/stranal/should_run/strun003.hs index 3240ab272a..90594a5c40 100644 --- a/testsuite/tests/stranal/should_run/strun003.hs +++ b/testsuite/tests/stranal/should_run/strun003.hs @@ -2,7 +2,7 @@ -- But it won't if the strictness analyser thinks that 'len' is use -- strictly, which was the case in GHC 6.0 --- See the io_hack_reqd in DmdAnal.lhs +-- See the io_hack_reqd in GHC.Core.Op.DmdAnal module Main where |