summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-04-05 17:25:06 +0200
committerSylvain Henry <sylvain@haskus.fr>2020-04-18 20:04:14 +0200
commit3ca52151881451ce5b3a7740d003e811b586140d (patch)
tree2dda7d3796d300063111460929489e146701522c /compiler
parent15ab6cd548f284732a7f89d78c2b89b1bfc4ea1d (diff)
downloadhaskell-3ca52151881451ce5b3a7740d003e811b586140d.tar.gz
GHC.Core.Opt renaming
* GHC.Core.Op => GHC.Core.Opt * GHC.Core.Opt.Simplify.Driver => GHC.Core.Opt.Driver * GHC.Core.Opt.Tidy => GHC.Core.Tidy * GHC.Core.Opt.WorkWrap.Lib => GHC.Core.Opt.WorkWrap.Utils As discussed in: * https://mail.haskell.org/pipermail/ghc-devs/2020-April/018758.html * https://gitlab.haskell.org/ghc/ghc/issues/13009#note_264650
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Core.hs10
-rw-r--r--compiler/GHC/Core/Coercion.hs2
-rw-r--r--compiler/GHC/Core/FamInstEnv.hs2
-rw-r--r--compiler/GHC/Core/Lint.hs10
-rw-r--r--compiler/GHC/Core/Make.hs8
-rw-r--r--compiler/GHC/Core/Opt/CSE.hs (renamed from compiler/GHC/Core/Op/CSE.hs)10
-rw-r--r--compiler/GHC/Core/Opt/CallArity.hs (renamed from compiler/GHC/Core/Op/CallArity.hs)2
-rw-r--r--compiler/GHC/Core/Opt/ConstantFold.hs (renamed from compiler/GHC/Core/Op/ConstantFold.hs)14
-rw-r--r--compiler/GHC/Core/Opt/CprAnal.hs (renamed from compiler/GHC/Core/Op/CprAnal.hs)10
-rw-r--r--compiler/GHC/Core/Opt/DmdAnal.hs (renamed from compiler/GHC/Core/Op/DmdAnal.hs)8
-rw-r--r--compiler/GHC/Core/Opt/Driver.hs (renamed from compiler/GHC/Core/Op/Simplify/Driver.hs)46
-rw-r--r--compiler/GHC/Core/Opt/Exitify.hs (renamed from compiler/GHC/Core/Op/Exitify.hs)4
-rw-r--r--compiler/GHC/Core/Opt/FloatIn.hs (renamed from compiler/GHC/Core/Op/FloatIn.hs)6
-rw-r--r--compiler/GHC/Core/Opt/FloatOut.hs (renamed from compiler/GHC/Core/Op/FloatOut.hs)16
-rw-r--r--compiler/GHC/Core/Opt/LiberateCase.hs (renamed from compiler/GHC/Core/Op/LiberateCase.hs)2
-rw-r--r--compiler/GHC/Core/Opt/Monad.hs (renamed from compiler/GHC/Core/Op/Monad.hs)6
-rw-r--r--compiler/GHC/Core/Opt/Monad.hs-boot (renamed from compiler/GHC/Core/Op/Monad.hs-boot)4
-rw-r--r--compiler/GHC/Core/Opt/OccurAnal.hs (renamed from compiler/GHC/Core/Op/OccurAnal.hs)10
-rw-r--r--compiler/GHC/Core/Opt/SetLevels.hs (renamed from compiler/GHC/Core/Op/SetLevels.hs)20
-rw-r--r--compiler/GHC/Core/Opt/Simplify.hs (renamed from compiler/GHC/Core/Op/Simplify.hs)44
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Env.hs (renamed from compiler/GHC/Core/Op/Simplify/Env.hs)10
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Monad.hs (renamed from compiler/GHC/Core/Op/Simplify/Monad.hs)6
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Utils.hs (renamed from compiler/GHC/Core/Op/Simplify/Utils.hs)32
-rw-r--r--compiler/GHC/Core/Opt/SpecConstr.hs (renamed from compiler/GHC/Core/Op/SpecConstr.hs)12
-rw-r--r--compiler/GHC/Core/Opt/Specialise.hs (renamed from compiler/GHC/Core/Op/Specialise.hs)10
-rw-r--r--compiler/GHC/Core/Opt/StaticArgs.hs (renamed from compiler/GHC/Core/Op/StaticArgs.hs)2
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap.hs (renamed from compiler/GHC/Core/Op/WorkWrap.hs)12
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap/Utils.hs (renamed from compiler/GHC/Core/Op/WorkWrap/Lib.hs)8
-rw-r--r--compiler/GHC/Core/Opt/simplifier.tib (renamed from compiler/GHC/Core/Op/simplifier.tib)0
-rw-r--r--compiler/GHC/Core/Rules.hs10
-rw-r--r--compiler/GHC/Core/SimpleOpt.hs8
-rw-r--r--compiler/GHC/Core/Tidy.hs (renamed from compiler/GHC/Core/Op/Tidy.hs)4
-rw-r--r--compiler/GHC/Core/Unfold.hs8
-rw-r--r--compiler/GHC/Core/Utils.hs30
-rw-r--r--compiler/GHC/CoreToIface.hs2
-rw-r--r--compiler/GHC/CoreToStg/Prep.hs10
-rw-r--r--compiler/GHC/Driver/Flags.hs2
-rw-r--r--compiler/GHC/Driver/Main.hs4
-rw-r--r--compiler/GHC/Driver/Plugins.hs2
-rw-r--r--compiler/GHC/Driver/Session.hs2
-rw-r--r--compiler/GHC/HsToCore.hs2
-rw-r--r--compiler/GHC/HsToCore/Binds.hs2
-rw-r--r--compiler/GHC/HsToCore/Match.hs2
-rw-r--r--compiler/GHC/HsToCore/Match/Literal.hs2
-rw-r--r--compiler/GHC/HsToCore/Utils.hs2
-rw-r--r--compiler/GHC/Iface/Syntax.hs2
-rw-r--r--compiler/GHC/Iface/Tidy.hs16
-rw-r--r--compiler/GHC/IfaceToCore.hs2
-rw-r--r--compiler/GHC/Plugins.hs10
-rw-r--r--compiler/GHC/StgToCmm/Expr.hs12
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs2
-rw-r--r--compiler/GHC/Types/Cpr.hs2
-rw-r--r--compiler/GHC/Types/Demand.hs12
-rw-r--r--compiler/GHC/Types/Id.hs4
-rw-r--r--compiler/GHC/Types/Id/Make.hs14
-rw-r--r--compiler/GHC/Types/Literal.hs4
-rw-r--r--compiler/ghc.cabal.in46
-rw-r--r--compiler/main/StaticPtrTable.hs2
-rw-r--r--compiler/prelude/PrelInfo.hs2
-rw-r--r--compiler/prelude/PrimOp.hs2
60 files changed, 275 insertions, 275 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs
index af06c1043d..a45292079c 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
-GHC.Core.Op.ConstantFold for the rationale for this restriction.
+GHC.Core.Opt.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 GHC.Core.Op.ConstantFold for rationale. Checked in lintCaseExpr;
+ in GHC.Core.Opt.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 GHC.Core.Op.Simplify):
+and case-of-case] in GHC.Core.Opt.Simplify):
join
j :: Int -> Bool -> Bool -- changed!
@@ -1296,7 +1296,7 @@ Orphan-hood is computed
************************************************************************
The CoreRule type and its friends are dealt with mainly in GHC.Core.Rules, but
-GHC.Core.FVs, GHC.Core.Subst, GHC.Core.Ppr, GHC.Core.Op.Tidy also inspect the
+GHC.Core.FVs, GHC.Core.Subst, GHC.Core.Ppr, GHC.Core.Tidy also inspect the
representation.
-}
@@ -1816,7 +1816,7 @@ the occurrence info is wrong
-}
-- The Ord is needed for the FiniteMap used in the lookForConstructor
--- in GHC.Core.Op.Simplify.Env. If you declared that lookForConstructor
+-- in GHC.Core.Opt.Simplify.Env. If you declared that lookForConstructor
-- *ignores* constructor-applications with LitArg args, then you could get rid
-- of this Ord.
diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs
index 8e5e9f53ec..1fccb0a84b 100644
--- a/compiler/GHC/Core/Coercion.hs
+++ b/compiler/GHC/Core/Coercion.hs
@@ -1503,7 +1503,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 GHC.Core.Op.Simplify.Utils, where we are sure for
+ -- only used in GHC.Core.Opt.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 51ac348233..6c737b555a 100644
--- a/compiler/GHC/Core/FamInstEnv.hs
+++ b/compiler/GHC/Core/FamInstEnv.hs
@@ -316,7 +316,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 GHC.Core.Op.Simplify
+ and its call site in GHC.Core.Opt.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 fb530cb2c7..ea1ab371a7 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 GHC.Core.Op.Monad
+import GHC.Core.Opt.Monad
import Bag
import GHC.Types.Literal
import GHC.Core.DataCon
@@ -165,7 +165,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 GHC.Core.Op.WorkWrap.Lib. (Maybe there are other "clients" of this feature; I'm not sure).
+in GHC.Core.Opt.WorkWrap.Utils. (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
@@ -638,7 +638,7 @@ lintLetBind top_lvl rec_flag binder rhs rhs_ty
-- 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 GHC.Core.Op.DmdAnal
+ -- Note [idArity varies independently of dmdTypeDepth] in GHC.Core.Opt.DmdAnal
-- Check that the binder's arity is within the bounds imposed by
-- the type and the strictness signature. See Note [exprArity invariant]
@@ -1166,7 +1166,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 GHC.Core.Op.ConstantFold
+ -- See Note [Rules for floating-point comparisons] in GHC.Core.Opt.ConstantFold
; let isLitPat (LitAlt _, _ , _) = True
isLitPat _ = False
; checkL (not $ isFloatingTy scrut_ty && any isLitPat alts)
@@ -2842,7 +2842,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)) $ GHC.Core.Op.Monad.putMsg $ vcat
+ when (not (null diffs)) $ GHC.Core.Opt.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 8ae58c5948..51d706ff23 100644
--- a/compiler/GHC/Core/Make.hs
+++ b/compiler/GHC/Core/Make.hs
@@ -192,7 +192,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 GHC.Core.Op.Simplify.Env
+-- See Note [WildCard binders] in GHC.Core.Opt.Simplify.Env
mkWildValBinder :: Type -> Id
mkWildValBinder ty = mkLocalIdOrCoVar wildCardName ty
-- "OrCoVar" since a coercion can be a scrutinee with -fdefer-type-errors
@@ -575,7 +575,7 @@ data FloatBind
= FloatLet CoreBind
| FloatCase CoreExpr Id AltCon [Var]
-- case e of y { C ys -> ... }
- -- See Note [Floating single-alternative cases] in GHC.Core.Op.SetLevels
+ -- See Note [Floating single-alternative cases] in GHC.Core.Opt.SetLevels
instance Outputable FloatBind where
ppr (FloatLet b) = text "LET" <+> ppr b
@@ -879,7 +879,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 GHC.Core.Op.WorkWrap) so the template ends up like
+for INLINEABLE functions] in GHC.Core.Opt.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)
@@ -924,7 +924,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 GHC.Core.Op.WorkWrap.Lib
+ -- lifted-type things; see Note [Absent errors] in GHC.Core.Opt.WorkWrap.Utils
arity_info = vanillaIdInfo `setArityInfo` 1
-- NB: no bottoming strictness info, unlike other error-ids.
-- See Note [aBSENT_ERROR_ID]
diff --git a/compiler/GHC/Core/Op/CSE.hs b/compiler/GHC/Core/Opt/CSE.hs
index 71187e6b6e..07e243d662 100644
--- a/compiler/GHC/Core/Op/CSE.hs
+++ b/compiler/GHC/Core/Opt/CSE.hs
@@ -9,7 +9,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module GHC.Core.Op.CSE (cseProgram, cseOneExpr) where
+module GHC.Core.Opt.CSE (cseProgram, cseOneExpr) where
#include "HsVersions.h"
@@ -124,7 +124,7 @@ 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 Note [Top level and
-postInlineUnconditionally] in GHC.Core.Op.Simplify.Utils; and in any
+postInlineUnconditionally] in GHC.Core.Opt.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
@@ -231,7 +231,7 @@ 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 Note
-[Stable unfoldings and postInlineUnconditionally] in GHC.Core.Op.Simplify.Utils.
+[Stable unfoldings and postInlineUnconditionally] in GHC.Core.Opt.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 GHC.Core.Op.Simplify.Utils.prepareAlts. The basic idea is
+combineIdenticalAlts in GHC.Core.Opt.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 GHC.Core.Op.Simplify.
+alternatives; see Note [Case alternative occ info] in GHC.Core.Opt.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/GHC/Core/Op/CallArity.hs b/compiler/GHC/Core/Opt/CallArity.hs
index 2ad5f169d8..33a0e7c31d 100644
--- a/compiler/GHC/Core/Op/CallArity.hs
+++ b/compiler/GHC/Core/Opt/CallArity.hs
@@ -2,7 +2,7 @@
-- Copyright (c) 2014 Joachim Breitner
--
-module GHC.Core.Op.CallArity
+module GHC.Core.Opt.CallArity
( callArityAnalProgram
, callArityRHS -- for testing
) where
diff --git a/compiler/GHC/Core/Op/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs
index 710d9ac75b..4c291b05ba 100644
--- a/compiler/GHC/Core/Op/ConstantFold.hs
+++ b/compiler/GHC/Core/Opt/ConstantFold.hs
@@ -17,7 +17,7 @@ ToDo:
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -optc-DNON_POSIX_SOURCE -Wno-incomplete-uni-patterns #-}
-module GHC.Core.Op.ConstantFold
+module GHC.Core.Opt.ConstantFold
( primOpRules
, builtinRules
, caseRules
@@ -1112,13 +1112,13 @@ is:
the returned value.
* An application like (dataToTag# (Just x)) is optimised by
- dataToTagRule in GHC.Core.Op.ConstantFold.
+ dataToTagRule in GHC.Core.Opt.ConstantFold.
* A case expression like
case (dataToTag# e) of <alts>
gets transformed t
case e of <transformed alts>
- by GHC.Core.Op.ConstantFold.caseRules; see Note [caseRules for dataToTag]
+ by GHC.Core.Opt.ConstantFold.caseRules; see Note [caseRules for dataToTag]
See #15696 for a long saga.
-}
@@ -1193,7 +1193,7 @@ Things to note
Implementing seq#. The compiler has magic for SeqOp in
-- GHC.Core.Op.ConstantFold.seqRule: eliminate (seq# <whnf> s)
+- GHC.Core.Opt.ConstantFold.seqRule: eliminate (seq# <whnf> s)
- GHC.StgToCmm.Expr.cgExpr, and cgCase: special case for seq#
@@ -1202,7 +1202,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 GHC.Core.Op.Simplify
+ in GHC.Core.Opt.Simplify
-}
seqRule :: RuleM CoreExpr
@@ -2051,7 +2051,7 @@ wordPrimOps platform = PrimOps
--------------------------------------------------------
-- Constant folding through case-expressions
--
--- cf Scrutinee Constant Folding in simplCore/GHC.Core.Op.Simplify.Utils
+-- cf Scrutinee Constant Folding in simplCore/GHC.Core.Opt.Simplify.Utils
--------------------------------------------------------
-- | Match the scrutinee of a case and potentially return a new scrutinee and a
@@ -2212,7 +2212,7 @@ We don't want to get this!
DEFAULT -> e1
DEFAULT -> e2
-Instead, we deal with turning one branch into DEFAULT in GHC.Core.Op.Simplify.Utils
+Instead, we deal with turning one branch into DEFAULT in GHC.Core.Opt.Simplify.Utils
(add_default in mkCase3).
Note [caseRules for dataToTag]
diff --git a/compiler/GHC/Core/Op/CprAnal.hs b/compiler/GHC/Core/Opt/CprAnal.hs
index 022ce0b7f1..4bc96a81d9 100644
--- a/compiler/GHC/Core/Op/CprAnal.hs
+++ b/compiler/GHC/Core/Opt/CprAnal.hs
@@ -7,7 +7,7 @@
-- 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 GHC.Core.Op.CprAnal ( cprAnalProgram ) where
+module GHC.Core.Opt.CprAnal ( cprAnalProgram ) where
#include "HsVersions.h"
@@ -29,7 +29,7 @@ import GHC.Core.Utils ( exprIsHNF, dumpIdInfoOfProgram )
import GHC.Core.TyCon
import GHC.Core.Type
import GHC.Core.FamInstEnv
-import GHC.Core.Op.WorkWrap.Lib
+import GHC.Core.Opt.WorkWrap.Utils
import Util
import ErrUtils ( dumpIfSet_dyn, DumpFormat (..) )
import Maybes ( isJust, isNothing )
@@ -108,7 +108,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 GHC.Core.Op.DmdAnal
+ -- See Note [Stamp out space leaks in demand analysis] in GHC.Core.Opt.DmdAnal
seqBinds binds_plus_cpr `seq` return binds_plus_cpr
-- Analyse a (group of) top-level binding(s)
@@ -252,7 +252,7 @@ cprFix top_lvl env orig_pairs
= loop 1 initial_pairs
where
bot_sig = mkCprSig 0 botCpr
- -- See Note [Initialising strictness] in GHC.Core.Op.DmdAnal
+ -- See Note [Initialising strictness] in GHC.Core.Opt.DmdAnal
initial_pairs | ae_virgin env = [(setIdCprInfo id bot_sig, rhs) | (id, rhs) <- orig_pairs ]
| otherwise = orig_pairs
@@ -440,7 +440,7 @@ extendEnvForDataAlt env scrut case_bndr dc bndrs
-- to sums (yet); we lack WW for strict binders of sum type.
do_con_arg env (id, str)
| is_var scrut
- -- See Note [Add demands for strict constructors] in WorkWrap.Lib
+ -- See Note [Add demands for strict constructors] in GHC.Core.Opt.WorkWrap.Utils
, let dmd = applyWhen (isMarkedStrict str) strictifyDmd (idDemandInfo id)
= extendAnalEnvForDemand env id dmd
| otherwise
diff --git a/compiler/GHC/Core/Op/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs
index 79f8d3df61..9e46884960 100644
--- a/compiler/GHC/Core/Op/DmdAnal.hs
+++ b/compiler/GHC/Core/Opt/DmdAnal.hs
@@ -9,14 +9,14 @@
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.DmdAnal ( dmdAnalProgram ) where
+module GHC.Core.Opt.DmdAnal ( dmdAnalProgram ) where
#include "HsVersions.h"
import GhcPrelude
import GHC.Driver.Session
-import GHC.Core.Op.WorkWrap.Lib ( findTypeShape )
+import GHC.Core.Opt.WorkWrap.Utils ( findTypeShape )
import GHC.Types.Demand -- All of it
import GHC.Core
import GHC.Core.Seq ( seqBinds )
@@ -754,7 +754,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 GHC.Core.Op.WorkWrap.
+ Also see Note [Don't eta expand in w/w] in GHC.Core.Opt.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
@@ -1241,7 +1241,7 @@ generator, though. So:
* We zap the used-once info in the worker-wrapper;
see Note [Zapping Used Once info in WorkWrap] in
- GHC.Core.Op.WorkWrap.
+ GHC.Core.Opt.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,
diff --git a/compiler/GHC/Core/Op/Simplify/Driver.hs b/compiler/GHC/Core/Opt/Driver.hs
index 1b7bb0d1e3..0da360e589 100644
--- a/compiler/GHC/Core/Op/Simplify/Driver.hs
+++ b/compiler/GHC/Core/Opt/Driver.hs
@@ -6,7 +6,7 @@
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.Simplify.Driver ( core2core, simplifyExpr ) where
+module GHC.Core.Opt.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 GHC.Core.Op.CSE ( cseProgram )
+import GHC.Core.Opt.CSE ( cseProgram )
import GHC.Core.Rules ( mkRuleBase, unionRuleBase,
extendRuleBaseList, ruleCheckProgram, addRuleInfo,
getRules )
import GHC.Core.Ppr ( pprCoreBindings, pprCoreExpr )
-import GHC.Core.Op.OccurAnal ( occurAnalysePgm, occurAnalyseExpr )
+import GHC.Core.Opt.OccurAnal ( occurAnalysePgm, occurAnalyseExpr )
import GHC.Types.Id.Info
import GHC.Core.Stats ( coreBindsSize, coreBindsStats, exprSize )
import GHC.Core.Utils ( mkTicks, stripTicksTop )
import GHC.Core.Lint ( endPass, lintPassResult, dumpPassResult,
lintAnnots )
-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 GHC.Core.Opt.Simplify ( simplTopBinds, simplExpr, simplRules )
+import GHC.Core.Opt.Simplify.Utils ( simplEnvForGHCi, activeRule, activeUnfolding )
+import GHC.Core.Opt.Simplify.Env
+import GHC.Core.Opt.Simplify.Monad
+import GHC.Core.Opt.Monad
import qualified ErrUtils as Err
-import GHC.Core.Op.FloatIn ( floatInwards )
-import GHC.Core.Op.FloatOut ( floatOutwards )
+import GHC.Core.Opt.FloatIn ( floatInwards )
+import GHC.Core.Opt.FloatOut ( floatOutwards )
import GHC.Core.FamInstEnv
import GHC.Types.Id
import ErrUtils ( withTiming, withTimingD, DumpFormat (..) )
import GHC.Types.Basic ( CompilerPhase(..), isDefaultInlinePragma, defaultInlinePragma )
import GHC.Types.Var.Set
import GHC.Types.Var.Env
-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 GHC.Core.Opt.LiberateCase ( liberateCase )
+import GHC.Core.Opt.StaticArgs ( doStaticArgs )
+import GHC.Core.Opt.Specialise ( specProgram)
+import GHC.Core.Opt.SpecConstr ( specConstrProgram)
+import GHC.Core.Opt.DmdAnal ( dmdAnalProgram )
+import GHC.Core.Opt.CprAnal ( cprAnalProgram )
+import GHC.Core.Opt.CallArity ( callArityAnalProgram )
+import GHC.Core.Opt.Exitify ( exitifyProgram )
+import GHC.Core.Opt.WorkWrap ( wwTopBinds )
import GHC.Types.SrcLoc
import Util
import GHC.Types.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 GHC.Core.Op.SpecConstr
+ -- Reason: see Note [Shadowing] in GHC.Core.Opt.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 GHC.Core.Op.DmdAnal
+ -- has run at all. See Note [Final Demand Analyser run] in GHC.Core.Opt.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 GHC.Core.Op.Simplify.completeLam)
+-- simplifier does indeed do eta reduction (it's in GHC.Core.Opt.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 GHC.Core.Op.Monad
+ -- See Note [Which transformations are innocuous] in GHC.Core.Opt.Monad
if isZeroSimplCount counts1 then
return ( "Simplifier reached fixed point", iteration_no
, totalise (counts1 : counts_so_far) -- Include "free" ticks
diff --git a/compiler/GHC/Core/Op/Exitify.hs b/compiler/GHC/Core/Opt/Exitify.hs
index bc6bca21e9..088d0cb085 100644
--- a/compiler/GHC/Core/Op/Exitify.hs
+++ b/compiler/GHC/Core/Opt/Exitify.hs
@@ -1,4 +1,4 @@
-module GHC.Core.Op.Exitify ( exitifyProgram ) where
+module GHC.Core.Opt.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. GHC.Core.Op.SetLevels.abstractVars
+ -- cf. GHC.Core.Opt.SetLevels.abstractVars
zap v | isId v = setIdInfo v vanillaIdInfo
| otherwise = v
diff --git a/compiler/GHC/Core/Op/FloatIn.hs b/compiler/GHC/Core/Opt/FloatIn.hs
index 819412161a..3b25e42764 100644
--- a/compiler/GHC/Core/Op/FloatIn.hs
+++ b/compiler/GHC/Core/Opt/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 GHC.Core.Op.FloatIn ( floatInwards ) where
+module GHC.Core.Opt.FloatIn ( floatInwards ) where
#include "HsVersions.h"
@@ -28,7 +28,7 @@ import GHC.Core.Make hiding ( wrapFloats )
import GHC.Driver.Types ( ModGuts(..) )
import GHC.Core.Utils
import GHC.Core.FVs
-import GHC.Core.Op.Monad ( CoreM )
+import GHC.Core.Opt.Monad ( CoreM )
import GHC.Types.Id ( isOneShotBndr, idType, isJoinId, isJoinId_maybe )
import GHC.Types.Var
import GHC.Core.Type
@@ -93,7 +93,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
-GHC.Core.Op.SetLevels.hs module, which tags things with their level numbers.
+GHC.Core.Opt.SetLevels.hs module, which tags things with their level numbers.
\item
do the full laziness pass (floating lets outwards).
\item
diff --git a/compiler/GHC/Core/Op/FloatOut.hs b/compiler/GHC/Core/Opt/FloatOut.hs
index f4a9649f98..d9d2d4dccf 100644
--- a/compiler/GHC/Core/Op/FloatOut.hs
+++ b/compiler/GHC/Core/Opt/FloatOut.hs
@@ -8,7 +8,7 @@
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.FloatOut ( floatOutwards ) where
+module GHC.Core.Opt.FloatOut ( floatOutwards ) where
import GhcPrelude
@@ -16,13 +16,13 @@ import GHC.Core
import GHC.Core.Utils
import GHC.Core.Make
import GHC.Core.Arity ( etaExpand )
-import GHC.Core.Op.Monad ( FloatOutSwitches(..) )
+import GHC.Core.Opt.Monad ( FloatOutSwitches(..) )
import GHC.Driver.Session
import ErrUtils ( dumpIfSet_dyn, DumpFormat (..) )
import GHC.Types.Id ( Id, idArity, idType, isBottomingId,
isJoinId, isJoinId_maybe )
-import GHC.Core.Op.SetLevels
+import GHC.Core.Opt.SetLevels
import GHC.Types.Unique.Supply ( 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 GHC.Core.Op.SetLevels. For us, the significance is that a binder might be marked to be
+in GHC.Core.Opt.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 GHC.Core.Op.SetLevels
+ -- see Note [Bottoming floats: eta expansion] in GHC.Core.Opt.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 GHC.Core.Op.SetLevels. The difference between
+TODO: This can probably be solved somehow in GHC.Core.Opt.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 GHC.Core.Op.SetLevels.lvlLamBndrs
+ -- See GHC.Core.Opt.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) GHC.Core.Op.SetLevels introduces a new bindings site for every float
+ (b) GHC.Core.Opt.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/GHC/Core/Op/LiberateCase.hs b/compiler/GHC/Core/Opt/LiberateCase.hs
index e753815736..4f2bf38081 100644
--- a/compiler/GHC/Core/Op/LiberateCase.hs
+++ b/compiler/GHC/Core/Opt/LiberateCase.hs
@@ -5,7 +5,7 @@
-}
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.LiberateCase ( liberateCase ) where
+module GHC.Core.Opt.LiberateCase ( liberateCase ) where
#include "HsVersions.h"
diff --git a/compiler/GHC/Core/Op/Monad.hs b/compiler/GHC/Core/Opt/Monad.hs
index a2c12d638f..81faa53e47 100644
--- a/compiler/GHC/Core/Op/Monad.hs
+++ b/compiler/GHC/Core/Opt/Monad.hs
@@ -8,7 +8,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module GHC.Core.Op.Monad (
+module GHC.Core.Opt.Monad (
-- * Configuration of the core-to-core passes
CoreToDo(..), runWhen, runMaybe,
SimplMode(..),
@@ -153,7 +153,7 @@ pprPassDetails (CoreDoSimplify n md) = vcat [ text "Max iterations =" <+> int n
, ppr md ]
pprPassDetails _ = Outputable.empty
-data SimplMode -- See comments in GHC.Core.Op.Simplify.Monad
+data SimplMode -- See comments in GHC.Core.Opt.Simplify.Monad
= SimplMode
{ sm_names :: [String] -- Name(s) of the phase
, sm_phase :: CompilerPhase
@@ -194,7 +194,7 @@ data FloatOutSwitches = FloatOutSwitches {
-- ^ True <=> float out over-saturated applications
-- based on arity information.
-- See Note [Floating over-saturated applications]
- -- in GHC.Core.Op.SetLevels
+ -- in GHC.Core.Opt.SetLevels
floatToTopLevelOnly :: Bool -- ^ Allow floating to the top level only.
}
instance Outputable FloatOutSwitches where
diff --git a/compiler/GHC/Core/Op/Monad.hs-boot b/compiler/GHC/Core/Opt/Monad.hs-boot
index 4ca105a66c..6ea3a5b790 100644
--- a/compiler/GHC/Core/Op/Monad.hs-boot
+++ b/compiler/GHC/Core/Opt/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 GHC.Core.Op.Monad does much more than defining these, and because Plugins are
+-- However GHC.Core.Opt.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 GHC.Core.Op.Monad ( CoreToDo, CoreM ) where
+module GHC.Core.Opt.Monad ( CoreToDo, CoreM ) where
import GhcPrelude
diff --git a/compiler/GHC/Core/Op/OccurAnal.hs b/compiler/GHC/Core/Opt/OccurAnal.hs
index 98ac42271d..cbc279cefb 100644
--- a/compiler/GHC/Core/Op/OccurAnal.hs
+++ b/compiler/GHC/Core/Opt/OccurAnal.hs
@@ -14,7 +14,7 @@ core expression with (hopefully) improved usage information.
{-# LANGUAGE CPP, BangPatterns, MultiWayIf, ViewPatterns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module GHC.Core.Op.OccurAnal ( occurAnalysePgm, occurAnalyseExpr ) where
+module GHC.Core.Opt.OccurAnal ( occurAnalysePgm, occurAnalyseExpr ) where
#include "HsVersions.h"
@@ -289,7 +289,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 GHC.Core.Op.Simplify
+recursive functions] in GHC.Core.Opt.Simplify
Hence, if
f's RHS (or its INLINE template if it has one) mentions g, and
@@ -634,7 +634,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 GHC.Core.Op.Simplify
+ - the RULE is applied in f's RHS (see Note [Self-recursive rules] in GHC.Core.Opt.Simplify
- fs is inlined (say it's small)
- now there's another opportunity to apply the RULE
@@ -1689,7 +1689,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 GHC.Core.Op.Simplify.Utils.preInlineUnconditionally.
+Annoyingly, we have to approximate GHC.Core.Opt.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:
@@ -1913,7 +1913,7 @@ occAnalApp env (Var fun, args, ticks)
is_exp = isExpandableApp fun n_val_args
-- See Note [CONLIKE pragma] in GHC.Types.Basic
- -- The definition of is_exp should match that in GHC.Core.Op.Simplify.prepareRhs
+ -- The definition of is_exp should match that in GHC.Core.Opt.Simplify.prepareRhs
one_shots = argsOneShots (idStrictness fun) guaranteed_val_args
guaranteed_val_args = n_val_args + length (takeWhile isOneShotInfo
diff --git a/compiler/GHC/Core/Op/SetLevels.hs b/compiler/GHC/Core/Opt/SetLevels.hs
index 0ac49a0c1c..278370d439 100644
--- a/compiler/GHC/Core/Op/SetLevels.hs
+++ b/compiler/GHC/Core/Opt/SetLevels.hs
@@ -1,7 +1,7 @@
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-\section{GHC.Core.Op.SetLevels}
+\section{GHC.Core.Opt.SetLevels}
***************************
Overview
@@ -52,7 +52,7 @@
{-# LANGUAGE CPP, MultiWayIf #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module GHC.Core.Op.SetLevels (
+module GHC.Core.Opt.SetLevels (
setLevels,
Level(..), LevelType(..), tOP_LEVEL, isJoinCeilLvl, asJoinCeilLvl,
@@ -67,7 +67,7 @@ module GHC.Core.Op.SetLevels (
import GhcPrelude
import GHC.Core
-import GHC.Core.Op.Monad ( FloatOutSwitches(..) )
+import GHC.Core.Opt.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 GHC.Core.Op.SetLevels we do set the context to (Level 0 0) when we get to an InlineMe
+-- In GHC.Core.Opt.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 GHC.Core.Op.SetLevels rev 1.50 for a version with this approach.]
+ -- [See GHC.Core.Opt.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 "GHC.Core.Op.SetLevels.lvlExpr.left"
+ left _ _ _ = panic "GHC.Core.Opt.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 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.
+etaExpand during GHC.Core.Opt.SetLevels because it works over a decorated form of
+CoreExpr. So we do the eta expansion later, in GHC.Core.Opt.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 GHC.Core.Op.SetLevels to
+ -- (Ultimately I think we should not use GHC.Core.Opt.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 GHC.Core.Op.FloatOut
+ -- See Note [Join points] in GHC.Core.Opt.FloatOut
= if max_fv_id_level `ltLvl` join_ceiling
then join_ceiling
else max_fv_id_level
diff --git a/compiler/GHC/Core/Op/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs
index d1e4f693da..44d2eee8a6 100644
--- a/compiler/GHC/Core/Op/Simplify.hs
+++ b/compiler/GHC/Core/Opt/Simplify.hs
@@ -7,7 +7,7 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module GHC.Core.Op.Simplify ( simplTopBinds, simplExpr, simplRules ) where
+module GHC.Core.Opt.Simplify ( simplTopBinds, simplExpr, simplRules ) where
#include "HsVersions.h"
@@ -15,11 +15,11 @@ import GhcPrelude
import GHC.Platform
import GHC.Driver.Session
-import GHC.Core.Op.Simplify.Monad
+import GHC.Core.Opt.Simplify.Monad
import GHC.Core.Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst )
-import GHC.Core.Op.Simplify.Env
-import GHC.Core.Op.Simplify.Utils
-import GHC.Core.Op.OccurAnal ( occurAnalyseExpr )
+import GHC.Core.Opt.Simplify.Env
+import GHC.Core.Opt.Simplify.Utils
+import GHC.Core.Opt.OccurAnal ( occurAnalyseExpr )
import GHC.Core.FamInstEnv ( FamInstEnv )
import GHC.Types.Literal ( litIsLifted ) --, mkLitInt ) -- temporalily commented out. See #8326
import GHC.Types.Id
@@ -35,7 +35,7 @@ import GHC.Core.DataCon
( DataCon, dataConWorkId, dataConRepStrictness
, dataConRepArgTys, isUnboxedTupleCon
, StrictnessMark (..) )
-import GHC.Core.Op.Monad ( Tick(..), SimplMode(..) )
+import GHC.Core.Opt.Monad ( Tick(..), SimplMode(..) )
import GHC.Core
import GHC.Types.Demand ( StrictSig(..), dmdTypeDepth, isStrictDmd
, mkClosedStrictSig, topDmd, botDiv )
@@ -63,7 +63,7 @@ import PrimOp ( PrimOp (SeqOp) )
{-
The guts of the simplifier is in this module, but the driver loop for
-the simplifier is in GHC.Core.Op.Simplify.Driver
+the simplifier is in GHC.Core.Opt.Driver
Note [The big picture]
~~~~~~~~~~~~~~~~~~~~~~
@@ -302,7 +302,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 GHC.Core.Op.Simplify.Utils
+ -- See Note [Floating and type abstraction] in GHC.Core.Opt.Simplify.Utils
-- Simplify the RHS
; let rhs_cont = mkRhsStop (substTy body_env (exprType body))
@@ -690,7 +690,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 GHC.Core.Op.Simplify.Utils
+ -- See Note [Eta-expanding at let bindings] in GHC.Core.Opt.Simplify.Utils
; (new_arity, is_bot, final_rhs) <- tryEtaExpandRhs (getMode env)
new_bndr new_rhs
@@ -1832,7 +1832,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 GHC.Core.Op.Simplify.Utils.mkArgInfo
+ -- that the call is definitely bottom; see GHC.Core.Opt.Simplify.Utils.mkArgInfo
-- Then we want to discard the entire strict continuation. E.g.
-- * case (error "hello") of { ... }
-- * (error "Hello") arg
@@ -2252,7 +2252,7 @@ Start with a simple situation:
do this for algebraic cases, because we might turn bottom into
non-bottom!
-The code in GHC.Core.Op.Simplify.Utils.prepareAlts has the effect of generalise
+The code in GHC.Core.Opt.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:
@@ -2266,7 +2266,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 GHC.Core.Op.Simplify.Utils.mkCase combines identical RHSs. So
+Note that GHC.Core.Opt.Simplify.Utils.mkCase combines identical RHSs. So
case e of ===> case e of DEFAULT -> r
True -> r
@@ -2764,7 +2764,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 GHC.Core.Op.ConstantFold. Example (#15226):
+See Note [seq# magic] in GHC.Core.Opt.ConstantFold. Example (#15226):
case seq# v s of
(# s', v' #) -> E
@@ -2888,8 +2888,8 @@ it's also good for case-elimination -- 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 GHC.Core.Op.SpecConstr;
-see Note [Add scrutinee to ValueEnv too] in GHC.Core.Op.SpecConstr
+Exactly the same issue arises in GHC.Core.Opt.SpecConstr;
+see Note [Add scrutinee to ValueEnv too] in GHC.Core.Opt.SpecConstr
HOWEVER, given
case x of y { Just a -> r1; Nothing -> r2 }
@@ -3106,7 +3106,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 GHC.Core.Op.Simplify.Utils
+ -- See Note [StaticEnv invariant] in GHC.Core.Opt.Simplify.Utils
, sc_dup = OkToDup
, sc_cont = mkBoringStop res_ty } ) }
@@ -3146,7 +3146,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 GHC.Core.Op.Simplify.Utils
+ -- See Note [StaticEnv invariant] in GHC.Core.Opt.Simplify.Utils
, sc_dup = OkToDup, sc_cont = cont' }) }
mkDupableCont env (Select { sc_bndr = case_bndr, sc_alts = alts
@@ -3187,7 +3187,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 GHC.Core.Op.Simplify.Utils
+ -- See Note [StaticEnv invariant] in GHC.Core.Opt.Simplify.Utils
, sc_cont = mkBoringStop (contResultType cont) } ) }
mkDupableAlt :: Platform -> OutId
@@ -3250,7 +3250,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 GHC.Core.Op.WorkWrap):
+splitting] in GHC.Core.Opt.WorkWrap):
let
x* = case (case v of {pn -> rn}) of
@@ -3307,7 +3307,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 GHC.Core.Op.DmdAnal.
+ see Note [Lambda-bound unfoldings] in GHC.Core.Opt.DmdAnal.
Also note that we can still end up passing stuff that isn't used. Before
strictness analysis we have
@@ -3497,7 +3497,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 GHC.Core.Op.Exitify
+ = return noUnfolding -- See Note [Do not inline exit join points] in GHC.Core.Opt.Exitify
| otherwise
= mkLetUnfolding (seDynFlags env) top_lvl InlineRhs id new_rhs
@@ -3573,7 +3573,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 GHC.Core.Op.Simplify.Utils
+ -- See Note [Simplifying inside stable unfoldings] in GHC.Core.Opt.Simplify.Utils
{-
Note [Force bottoming field]
diff --git a/compiler/GHC/Core/Op/Simplify/Env.hs b/compiler/GHC/Core/Opt/Simplify/Env.hs
index 47b95da59e..27b846c564 100644
--- a/compiler/GHC/Core/Op/Simplify/Env.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Env.hs
@@ -1,12 +1,12 @@
{-
(c) The AQUA Project, Glasgow University, 1993-1998
-\section[GHC.Core.Op.Simplify.Monad]{The simplifier Monad}
+\section[GHC.Core.Opt.Simplify.Monad]{The simplifier Monad}
-}
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.Simplify.Env (
+module GHC.Core.Opt.Simplify.Env (
-- * The simplifier mode
setMode, getMode, updMode, seDynFlags,
@@ -47,8 +47,8 @@ module GHC.Core.Op.Simplify.Env (
import GhcPrelude
-import GHC.Core.Op.Simplify.Monad
-import GHC.Core.Op.Monad ( SimplMode(..) )
+import GHC.Core.Opt.Simplify.Monad
+import GHC.Core.Opt.Monad ( SimplMode(..) )
import GHC.Core
import GHC.Core.Utils
import GHC.Types.Var
@@ -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 GHC.Core.Op.Simplify.
+ -- See also Note [In-scope set as a substitution] in GHC.Core.Opt.Simplify.
refineFromInScope :: InScopeSet -> Var -> Var
refineFromInScope in_scope v
diff --git a/compiler/GHC/Core/Op/Simplify/Monad.hs b/compiler/GHC/Core/Opt/Simplify/Monad.hs
index d45dd13510..043ced977b 100644
--- a/compiler/GHC/Core/Op/Simplify/Monad.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Monad.hs
@@ -1,11 +1,11 @@
{-
(c) The AQUA Project, Glasgow University, 1993-1998
-\section[GHC.Core.Op.Simplify.Monad]{The simplifier Monad}
+\section[GHC.Core.Opt.Simplify.Monad]{The simplifier Monad}
-}
{-# LANGUAGE DeriveFunctor #-}
-module GHC.Core.Op.Simplify.Monad (
+module GHC.Core.Opt.Simplify.Monad (
-- The monad
SimplM,
initSmpl, traceSmpl,
@@ -31,7 +31,7 @@ import GHC.Core.FamInstEnv ( FamInstEnv )
import GHC.Core ( RuleEnv(..) )
import GHC.Types.Unique.Supply
import GHC.Driver.Session
-import GHC.Core.Op.Monad
+import GHC.Core.Opt.Monad
import Outputable
import FastString
import MonadUtils
diff --git a/compiler/GHC/Core/Op/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs
index 17f2a73416..048357321e 100644
--- a/compiler/GHC/Core/Op/Simplify/Utils.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs
@@ -6,7 +6,7 @@ The simplifier utilities
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.Simplify.Utils (
+module GHC.Core.Opt.Simplify.Utils (
-- Rebuilding
mkLam, mkCase, prepareAlts, tryEtaExpandRhs,
@@ -40,8 +40,8 @@ module GHC.Core.Op.Simplify.Utils (
import GhcPrelude
-import GHC.Core.Op.Simplify.Env
-import GHC.Core.Op.Monad ( SimplMode(..), Tick(..) )
+import GHC.Core.Opt.Simplify.Env
+import GHC.Core.Opt.Monad ( SimplMode(..), Tick(..) )
import GHC.Driver.Session
import GHC.Core
import qualified GHC.Core.Subst
@@ -59,7 +59,7 @@ import GHC.Types.Demand
import GHC.Types.Var.Set
import GHC.Types.Basic
import PrimOp
-import GHC.Core.Op.Simplify.Monad
+import GHC.Core.Opt.Simplify.Monad
import GHC.Core.Type hiding( substTy )
import GHC.Core.Coercion hiding( substCo )
import GHC.Core.DataCon ( dataConWorkId, isNullaryRepDataCon )
@@ -67,7 +67,7 @@ import Util
import OrdList ( isNilOL )
import MonadUtils
import Outputable
-import GHC.Core.Op.ConstantFold
+import GHC.Core.Opt.ConstantFold
import FastString ( fsLit )
import Control.Monad ( when )
@@ -500,7 +500,7 @@ mkArgInfo env fun rules n_val_args call_cont
-- top-level bindings for (say) strings into
-- calls to error. But now we are more careful about
-- inlining lone variables, so it's ok
- -- (see GHC.Core.Op.Simplify.Utils.analyseCont)
+ -- (see GHC.Core.Opt.Simplify.Utils.analyseCont)
-- See Note [Precise exceptions and strictness analysis] in Demand.hs
-- for the special case on raiseIO#
if isBotDiv result_info || isPrimOpId_maybe fun == Just RaiseIOOp then
@@ -777,7 +777,7 @@ interestingArg env e = go env 0 e
************************************************************************
The SimplMode controls several switches; see its definition in
-GHC.Core.Op.Monad
+GHC.Core.Opt.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
@@ -848,7 +848,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 GHC.Core.Op.Specialise), #9509.
+(see Note [Specialisation shape] in GHC.Core.Opt.Specialise), #9509.
So we disable eta-expansion in stable unfoldings.
@@ -1529,7 +1529,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 GHC.Core.Op.Simplify
+ -- Note [Arity decrease] in GHC.Core.Opt.Simplify
return (new_arity, is_bot, new_rhs) }
where
try_expand
@@ -1581,7 +1581,7 @@ Note [Do not eta-expand join points]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
+GHC.Core.Opt.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:
@@ -1673,7 +1673,7 @@ like
/\ a1..an. body
and treat them specially. The real work is done in
-GHC.Core.Op.Simplify.Utils.abstractFloats, but there is quite a bit of plumbing
+GHC.Core.Opt.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:
@@ -2053,7 +2053,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 GHC.Core.Op.ConstantFold
+ see Note [caseRules for dataToTag] in GHC.Core.Opt.ConstantFold
-}
mkCase, mkCase1, mkCase2, mkCase3
@@ -2165,7 +2165,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 GHC.Core.Op.ConstantFold
+ -- in GHC.Core.Opt.ConstantFold
; mkCase3 dflags scrut' bndr' alts_ty $
add_default (re_sort alts')
@@ -2209,7 +2209,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 GHC.Core.Op.ConstantFold
+ -- See Note [caseRules for dataToTag] in GHC.Core.Opt.ConstantFold
do { us <- getUniquesM
; let (ex_tvs, arg_ids) = dataConRepInstPat us dc
(tyConAppArgs (idType new_bndr))
@@ -2247,7 +2247,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 GHC.Core.Op.ConstantFold)
+in GHC.Core.Opt.ConstantFold)
-}
--------------------------------------------------
@@ -2257,7 +2257,7 @@ 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
--- GHC.Core.Op.Exitify
+-- GHC.Core.Opt.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/GHC/Core/Op/SpecConstr.hs b/compiler/GHC/Core/Opt/SpecConstr.hs
index ae8cd892f0..206143ab4d 100644
--- a/compiler/GHC/Core/Op/SpecConstr.hs
+++ b/compiler/GHC/Core/Opt/SpecConstr.hs
@@ -14,7 +14,7 @@ ToDo [Oct 2013]
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module GHC.Core.Op.SpecConstr(
+module GHC.Core.Opt.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 GHC.Core.Op.Monad
+import GHC.Core.Opt.Monad
import GHC.Types.Literal ( litIsLifted )
import GHC.Driver.Types ( ModGuts(..) )
-import GHC.Core.Op.WorkWrap.Lib ( isWorkerSmallEnough, mkWorkerArgs )
+import GHC.Core.Opt.WorkWrap.Utils ( 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 GHC.Core.Op.Specialise.specImports. This remains to be done (#10346).
+in GHC.Core.Opt.Specialise.specImports. This remains to be done (#10346).
Note [Top-level recursive groups]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1805,7 +1805,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 GHC.Core.Op.Specialise.
+ Note [Auto-specialisation and RULES] in GHC.Core.Opt.Specialise.
In which phase should the specialise-constructor rules be active?
Originally I made them always-active, but Manuel found that this
@@ -2000,7 +2000,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 GHC.Core.Op.WorkWrap.Lib
+ -- See Note [Limit w/w arity] in GHC.Core.Opt.WorkWrap.Utils
-- Discard specialisations if there are too many of them
trimmed_pats = trim_pats env fn spec_info small_pats
diff --git a/compiler/GHC/Core/Op/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs
index a99886d8c6..6ca48ca5ca 100644
--- a/compiler/GHC/Core/Op/Specialise.hs
+++ b/compiler/GHC/Core/Opt/Specialise.hs
@@ -9,7 +9,7 @@
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-module GHC.Core.Op.Specialise ( specProgram, specUnfolding ) where
+module GHC.Core.Opt.Specialise ( specProgram, specUnfolding ) where
#include "HsVersions.h"
@@ -21,7 +21,7 @@ import GHC.Core.Type hiding( substTy, extendTvSubstList )
import GHC.Core.Predicate
import GHC.Types.Module( Module, HasModule(..) )
import GHC.Core.Coercion( Coercion )
-import GHC.Core.Op.Monad
+import GHC.Core.Opt.Monad
import qualified GHC.Core.Subst as Core
import GHC.Core.Unfold
import GHC.Types.Var ( isLocalVar )
@@ -1405,7 +1405,7 @@ specCalls mb_mod env existing_rules calls_for_me fn rhs
-- Maybe add a void arg to the specialised function,
-- to avoid unlifted bindings
-- See Note [Specialisations Must Be Lifted]
- -- C.f. GHC.Core.Op.WorkWrap.Lib.mkWorkerArgs
+ -- C.f. GHC.Core.Opt.WorkWrap.Utils.mkWorkerArgs
add_void_arg = isUnliftedType spec_fn_ty1 && not (isJoinId fn)
(spec_rhs, spec_fn_ty, rule_rhs_args)
| add_void_arg = ( Lam voidArgId spec_rhs1
@@ -1478,7 +1478,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 GHC.Core.Op.Simplify
+ -- See Note [Arity decrease] in GHC.Core.Opt.Simplify
-- Copy InlinePragma information from the parent Id.
-- So if f has INLINE[1] so does spec_fn
spec_f_w_arity = spec_fn `setIdArity` max 0 (fn_arity - arity_decr)
@@ -1668,7 +1668,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 GHC.Core.Op.Simplify.Utils Note [Casts and
+Thing, but it's what happens now; see GHC.Core.Opt.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/GHC/Core/Op/StaticArgs.hs b/compiler/GHC/Core/Opt/StaticArgs.hs
index 835f1ffbaa..0abcc06382 100644
--- a/compiler/GHC/Core/Op/StaticArgs.hs
+++ b/compiler/GHC/Core/Opt/StaticArgs.hs
@@ -49,7 +49,7 @@ essential to make this work well!
-}
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.StaticArgs ( doStaticArgs ) where
+module GHC.Core.Opt.StaticArgs ( doStaticArgs ) where
import GhcPrelude
diff --git a/compiler/GHC/Core/Op/WorkWrap.hs b/compiler/GHC/Core/Opt/WorkWrap.hs
index 6abfb4733c..0ba6acb731 100644
--- a/compiler/GHC/Core/Op/WorkWrap.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap.hs
@@ -5,7 +5,7 @@
-}
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.WorkWrap ( wwTopBinds ) where
+module GHC.Core.Opt.WorkWrap ( wwTopBinds ) where
import GhcPrelude
@@ -23,7 +23,7 @@ import GHC.Types.Basic
import GHC.Driver.Session
import GHC.Types.Demand
import GHC.Types.Cpr
-import GHC.Core.Op.WorkWrap.Lib
+import GHC.Core.Opt.WorkWrap.Utils
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 GHC.Core.Op.Simplify.Utils
+inline into the worker's unfolding: see GHC.Core.Opt.Simplify.Utils
Note [Simplifying inside stable unfoldings].
If the original is NOINLINE, it's important that the work inherit the
@@ -477,7 +477,7 @@ 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 GHC.Core.Op.CprAnal
+ -- See Note [Arity trimming for CPR signatures] in GHC.Core.Opt.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
@@ -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 GHC.Core.Op.DmdAnal).
+Note [Final Demand Analyser run] in GHC.Core.Opt.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 GHC.Core.Op.WorkWrap.Lib.mkWorerArgs.
+in w/w-ing because we'll simply add (\y:Void#), see GHC.Core.Opt.WorkWrap.Utils.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/GHC/Core/Op/WorkWrap/Lib.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
index 19e05255f2..1964233ca7 100644
--- a/compiler/GHC/Core/Op/WorkWrap/Lib.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
@@ -6,7 +6,7 @@ A library for the ``worker\/wrapper'' back-end to the strictness analyser
{-# LANGUAGE CPP #-}
-module GHC.Core.Op.WorkWrap.Lib
+module GHC.Core.Opt.WorkWrap.Utils
( mkWwBodies, mkWWstr, mkWorkerArgs
, DataConAppContext(..), deepSplitProductType_maybe, wantToUnbox
, findTypeShape
@@ -214,7 +214,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 GHC.Core.Op.DmdAnal.
+Note [CPR for thunks] in GHC.Core.Opt.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
@@ -637,7 +637,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 GHC.Core.Op.Simplify; and see #13890
+ -- in GHC.Core.Opt.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
@@ -909,7 +909,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 GHC.Core.Op.WorkWrap),
+(see Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap),
which can still be specialised by the type-class specialiser, something like
fw :: Ord a => [a] -> Int# -> a
diff --git a/compiler/GHC/Core/Op/simplifier.tib b/compiler/GHC/Core/Opt/simplifier.tib
index e0f9dc91f2..e0f9dc91f2 100644
--- a/compiler/GHC/Core/Op/simplifier.tib
+++ b/compiler/GHC/Core/Opt/simplifier.tib
diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs
index 29953026ef..907c7104a5 100644
--- a/compiler/GHC/Core/Rules.hs
+++ b/compiler/GHC/Core/Rules.hs
@@ -46,7 +46,7 @@ import GHC.Core.Type as Type
import GHC.Tc.Utils.TcType ( tcSplitTyConApp_maybe )
import TysWiredIn ( anyTypeOfKind )
import GHC.Core.Coercion as Coercion
-import GHC.Core.Op.Tidy ( tidyRules )
+import GHC.Core.Tidy ( tidyRules )
import GHC.Types.Id
import GHC.Types.Id.Info ( RuleInfo( RuleInfo ) )
import GHC.Types.Var
@@ -115,7 +115,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 GHC.Core.Op.Monad.
+* At the moment (c) is carried in a reader-monad way by the GHC.Core.Opt.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
@@ -128,7 +128,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 GHC.Core.Op.Monad, and
+ (c) from the GHC.Core.Opt.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
@@ -326,7 +326,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 GHC.Core.Op.ConstantFold.builtinRules should be active even
+ - The rules in GHC.Core.Opt.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
@@ -1024,7 +1024,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 GHC.Core.Op.SpecConstr
+cf Note [Notes in call patterns] in GHC.Core.Opt.SpecConstr
Note [Matching lets]
~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/GHC/Core/SimpleOpt.hs b/compiler/GHC/Core/SimpleOpt.hs
index eebac97ade..419d4088d4 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 GHC.Core.Op.OccurAnal( occurAnalyseExpr, occurAnalysePgm )
+import GHC.Core.Opt.OccurAnal( occurAnalyseExpr, occurAnalysePgm )
import GHC.Types.Literal ( Literal(LitString) )
import GHC.Types.Id
import GHC.Types.Id.Info ( 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 GHC.Core.Op.Simplify.Utils
+ | not active = False -- in GHC.Core.Opt.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 GHC.Core.Op.Simplify.Utils, Note [Top level and postInlineUnconditionally], we
+In GHC.Core.Opt.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 GHC.Core.Op.Simplify
+-- C.f. simplCast in GHC.Core.Opt.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/Op/Tidy.hs b/compiler/GHC/Core/Tidy.hs
index 4759efa0e9..0b9d91af8a 100644
--- a/compiler/GHC/Core/Op/Tidy.hs
+++ b/compiler/GHC/Core/Tidy.hs
@@ -9,7 +9,7 @@ The code for *top-level* bindings is in GHC.Iface.Tidy.
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
-module GHC.Core.Op.Tidy (
+module GHC.Core.Tidy (
tidyExpr, tidyRules, tidyUnfolding
) where
@@ -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 GHC.Core.Op.WorkWrap)
+ -- (See Note [Zapping DmdEnv after Demand Analyzer] in GHC.Core.Opt.WorkWrap)
--
-- Similarly arity info for eta expansion in CorePrep
-- Don't attempt to recompute arity here; this is just tidying!
diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs
index a8e4c03b95..f307206384 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 GHC.Core.Op.OccurAnal ( occurAnalyseExpr )
+import GHC.Core.Opt.OccurAnal ( occurAnalyseExpr )
import GHC.Core.SimpleOpt
import GHC.Core.Arity ( manifestArity )
import GHC.Core.Utils
@@ -122,7 +122,7 @@ mkWwInlineRule dflags expr arity
, ug_boring_ok = boringCxtNotOk })
mkWorkerUnfolding :: DynFlags -> (CoreExpr -> CoreExpr) -> Unfolding -> Unfolding
--- See Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Op.WorkWrap
+-- See Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap
mkWorkerUnfolding dflags work_fn
(CoreUnfolding { uf_src = src, uf_tmpl = tmpl
, uf_is_top = top_lvl })
@@ -499,7 +499,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 GHC.Core.Op.SetLevels.
+and similar friends. See Note [Bottoming floats] in GHC.Core.Opt.SetLevels.
Do not re-inline them! But we *do* still inline if they are very small
(the uncondInline stuff).
@@ -552,7 +552,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 GHC.Core.Op.Simplify.Utils
+ but it doesn't fire for top-level things; see GHC.Core.Opt.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 526ba34fd0..63d269875c 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 GHC.Core.Op.SetLevels
+ go (Coercion {}) = False -- this case can happen in GHC.Core.Opt.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 GHC.Core.Op.Simplify.rebuildCase.
+filters down the matching alternatives in GHC.Core.Opt.Simplify.rebuildCase.
-}
---------------------------------
@@ -789,7 +789,7 @@ with a specific constructor is desirable.
C2 -> e0
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
+ at its one call site in GHC.Core.Opt.Simplify.Utils then the
`imposs_deflt_cons` argument is populated with constructors which
are matched elsewhere.
@@ -841,7 +841,7 @@ Note [Combine identical alternatives: wrinkles]
isDeadBinder (see #7360).
You can see this in the call to combineIdenticalAlts in
- GHC.Core.Op.Simplify.Utils.prepareAlts. Here the alternatives have type InAlt
+ GHC.Core.Opt.Simplify.Utils.prepareAlts. Here the alternatives have type InAlt
(the "In" meaning input) rather than OutAlt.
* combineIdenticalAlts does not work well for nullary constructors
@@ -849,10 +849,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 GHC.Core.Op.CSE.combineAlts, which does a better version
+ is solved in CSE, in GHC.Core.Opt.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).
+ See Note [Combine case alts: awkward corner] in GHC.Core.Opt.CSE).
Note [Care with impossible-constructors when combining alternatives]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1643,10 +1643,10 @@ isDivOp _ = False
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exprOkForSpeculation accepts very special case expressions.
Reason: (a ==# b) is ok-for-speculation, but the litEq rules
-in GHC.Core.Op.ConstantFold convert it (a ==# 3#) to
+in GHC.Core.Opt.ConstantFold convert it (a ==# 3#) to
case a of { DEFAULT -> 0#; 3# -> 1# }
for excellent reasons described in
- GHC.Core.Op.ConstantFold Note [The litEq rule: converting equality to case].
+ GHC.Core.Opt.ConstantFold Note [The litEq rule: converting equality to case].
So, annoyingly, we want that case expression to be
ok-for-speculation too. Bother.
@@ -1660,12 +1660,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 GHC.Core.Op.SetLevels would transform the inner alternative to
+ by GHC.Core.Opt.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 GHC.Core.Op.SetLevels. To avoid this awkwardness it seems simpler
+ in GHC.Core.Opt.SetLevels. To avoid this awkwardness it seems simpler
to stick to unlifted scrutinees where the issue does not
arise.
@@ -1686,7 +1686,7 @@ But we restrict it sharply:
----- Historical note: #15696: --------
- Previously GHC.Core.Op.SetLevels used exprOkForSpeculation to guide
+ Previously GHC.Core.Opt.SetLevels used exprOkForSpeculation to guide
floating of single-alternative cases; it now uses exprIsHNF
Note [Floating single-alternative cases].
@@ -1696,8 +1696,8 @@ But we restrict it sharply:
A -> ...
_ -> ...(case (case x of { B -> p; C -> p }) of
I# r -> blah)...
- If GHC.Core.Op.SetLevels considers the inner nested case as
- ok-for-speculation it can do case-floating (in GHC.Core.Op.SetLevels).
+ If GHC.Core.Opt.SetLevels considers the inner nested case as
+ ok-for-speculation it can do case-floating (in GHC.Core.Opt.SetLevels).
So we'd float to:
case e of x { DEAFULT ->
case (case x of { B -> p; C -> p }) of I# r ->
@@ -2031,7 +2031,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 GHC.Core.Op.Simplify.simplAlt
+c.f. add_evals in GHC.Core.Opt.Simplify.simplAlt
************************************************************************
* *
@@ -2300,7 +2300,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 GHC.Core.Op.Simplify.Env) so we must *not* trust the
+ Note [Arity robustness] in GHC.Core.Opt.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/CoreToIface.hs b/compiler/GHC/CoreToIface.hs
index 7b54138925..85a5e52b79 100644
--- a/compiler/GHC/CoreToIface.hs
+++ b/compiler/GHC/CoreToIface.hs
@@ -422,7 +422,7 @@ toIfaceLetBndr id = IfLetBndr (occNameFS (getOccName id))
(toIfaceType (idType id))
(toIfaceIdInfo (idInfo id))
(toIfaceJoinInfo (isJoinId_maybe id))
- -- Put into the interface file any IdInfo that GHC.Core.Op.Tidy.tidyLetBndr
+ -- Put into the interface file any IdInfo that GHC.Core.Tidy.tidyLetBndr
-- has left on the Id. See Note [IdInfo on nested let-bindings] in GHC.Iface.Syntax
toIfaceIdDetails :: IdDetails -> IfaceIdDetails
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs
index 4902498042..dd7419a89a 100644
--- a/compiler/GHC/CoreToStg/Prep.hs
+++ b/compiler/GHC/CoreToStg/Prep.hs
@@ -20,7 +20,7 @@ module GHC.CoreToStg.Prep (
import GhcPrelude
import GHC.Platform
-import GHC.Core.Op.OccurAnal
+import GHC.Core.Opt.OccurAnal
import GHC.Driver.Types
import PrelNames
@@ -28,7 +28,7 @@ import GHC.Types.Id.Make ( realWorldPrimId )
import GHC.Core.Utils
import GHC.Core.Arity
import GHC.Core.FVs
-import GHC.Core.Op.Monad ( CoreToDo(..) )
+import GHC.Core.Opt.Monad ( CoreToDo(..) )
import GHC.Core.Lint ( endPassIO )
import GHC.Core
import GHC.Core.Make hiding( FloatBind(..) ) -- We use our own FloatBind here
@@ -521,7 +521,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 GHC.Core.Op.Simplify.Utils
+-- No eta-expansion: see Note [Do not eta-expand join points] in GHC.Core.Opt.Simplify.Utils
cpeJoinPair env bndr rhs
= ASSERT(isJoinId bndr)
do { let Just join_arity = isJoinId_maybe bndr
@@ -1562,7 +1562,7 @@ cpCloneBndr env bndr
-- Drop (now-useless) rules/unfoldings
-- See Note [Drop unfoldings and rules]
- -- and Note [Preserve evaluatedness] in GHC.Core.Op.Tidy
+ -- and Note [Preserve evaluatedness] in GHC.Core.Tidy
; let unfolding' = zapUnfolding (realIdUnfolding bndr)
-- Simplifier will set the Id's unfolding
@@ -1595,7 +1595,7 @@ We want to drop the unfolding/rules on every Id:
we'd have to substitute in them
HOWEVER, we want to preserve evaluated-ness;
-see Note [Preserve evaluatedness] in GHC.Core.Op.Tidy.
+see Note [Preserve evaluatedness] in GHC.Core.Tidy.
-}
------------------------------------------------------------------------------
diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs
index 1dd54d8d4a..da19a6aa96 100644
--- a/compiler/GHC/Driver/Flags.hs
+++ b/compiler/GHC/Driver/Flags.hs
@@ -184,7 +184,7 @@ data GeneralFlag
| Opt_CmmElimCommonBlocks
| Opt_AsmShortcutting
| Opt_OmitYields
- | Opt_FunToThunk -- allow GHC.Core.Op.WorkWrap.Lib.mkWorkerArgs to remove all value lambdas
+ | Opt_FunToThunk -- allow GHC.Core.Opt.WorkWrap.Utils.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 cb441855d9..2eda36cd90 100644
--- a/compiler/GHC/Driver/Main.hs
+++ b/compiler/GHC/Driver/Main.hs
@@ -93,7 +93,7 @@ import GHC.Runtime.Interpreter ( addSptEntry )
import GHCi.RemoteTypes ( ForeignHValue )
import GHC.CoreToByteCode ( byteCodeGen, coreExprToBCOs )
import GHC.Runtime.Linker
-import GHC.Core.Op.Tidy ( tidyExpr )
+import GHC.Core.Tidy ( tidyExpr )
import GHC.Core.Type ( Type, Kind )
import GHC.Core.Lint ( lintInteractiveExpr )
import GHC.Types.Var.Env ( emptyTidyEnv )
@@ -117,7 +117,7 @@ import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Zonk ( ZonkFlexi (DefaultFlexi) )
import GHC.Types.Name.Cache ( initNameCache )
import PrelInfo
-import GHC.Core.Op.Simplify.Driver
+import GHC.Core.Opt.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 adc34373f0..d9e29d451b 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 #-} GHC.Core.Op.Monad ( CoreToDo, CoreM )
+import {-# SOURCE #-} GHC.Core.Opt.Monad ( CoreToDo, CoreM )
import qualified GHC.Tc.Types
import GHC.Tc.Types ( TcGblEnv, IfM, TcM, tcg_rn_decls, tcg_rn_exports )
import GHC.Tc.Errors.Hole.FitTypes ( HoleFitPluginR )
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index f1efeea197..2f8fb99162 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -503,7 +503,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 GHC.Core.Op.Monad.FloatOutSwitches
+ -- See GHC.Core.Opt.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 1afb0e2ff6..ea634615ed 100644
--- a/compiler/GHC/HsToCore.hs
+++ b/compiler/GHC/HsToCore.hs
@@ -54,7 +54,7 @@ import GHC.Types.Name.Set
import GHC.Types.Name.Env
import GHC.Core.Rules
import GHC.Types.Basic
-import GHC.Core.Op.Monad ( CoreToDo(..) )
+import GHC.Core.Opt.Monad ( CoreToDo(..) )
import GHC.Core.Lint ( endPassIO )
import GHC.Types.Var.Set
import FastString
diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs
index cdd73c9171..c2762d0255 100644
--- a/compiler/GHC/HsToCore/Binds.hs
+++ b/compiler/GHC/HsToCore/Binds.hs
@@ -38,7 +38,7 @@ 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 GHC.Core.Op.OccurAnal ( occurAnalyseExpr )
+import GHC.Core.Opt.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 c479586b76..02fb753597 100644
--- a/compiler/GHC/HsToCore/Match.hs
+++ b/compiler/GHC/HsToCore/Match.hs
@@ -339,7 +339,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 GHC.Core.Op.Simplify.
+See also Note [Case elimination: lifted case] in GHC.Core.Opt.Simplify.
************************************************************************
diff --git a/compiler/GHC/HsToCore/Match/Literal.hs b/compiler/GHC/HsToCore/Match/Literal.hs
index 17bf1484b2..882318b163 100644
--- a/compiler/GHC/HsToCore/Match/Literal.hs
+++ b/compiler/GHC/HsToCore/Match/Literal.hs
@@ -370,7 +370,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 GHC.Core.Op.ConstantFold
+ -- #9238 and Note [Rules for floating-point comparisons] in GHC.Core.Opt.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 5e9dc25273..2e9c5987f8 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 GHC.Core.Op.WorkWrap.)
+join points] in GHC.Core.Opt.WorkWrap.)
When we make a failure point we ensure that it
does not look like a thunk. Example:
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs
index e33a938e26..131db67141 100644
--- a/compiler/GHC/Iface/Syntax.hs
+++ b/compiler/GHC/Iface/Syntax.hs
@@ -547,7 +547,7 @@ that came up was a NOINLINE pragma on a let-binding inside an INLINE
function. The user (Duncan Coutts) really wanted the NOINLINE control
to cross the separate compilation boundary.
-In general we retain all info that is left by GHC.Core.Op.Tidy.tidyLetBndr, since
+In general we retain all info that is left by GHC.Core.Tidy.tidyLetBndr, since
that is what is seen by importing module with --make
Note [Displaying axiom incompatibilities]
diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs
index 902cf23ac0..3fc645e278 100644
--- a/compiler/GHC/Iface/Tidy.hs
+++ b/compiler/GHC/Iface/Tidy.hs
@@ -21,8 +21,8 @@ import GHC.Driver.Session
import GHC.Core
import GHC.Core.Unfold
import GHC.Core.FVs
-import GHC.Core.Op.Tidy
-import GHC.Core.Op.Monad
+import GHC.Core.Tidy
+import GHC.Core.Opt.Monad
import GHC.Core.Stats (coreBindsStats, CoreStats(..))
import GHC.Core.Seq (seqBinds)
import GHC.Core.Lint
@@ -529,7 +529,7 @@ of exceptions, and finally I gave up the battle:
Note [Injecting implicit bindings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-We inject the implicit bindings right at the end, in GHC.Core.Op.Tidy.
+We inject the implicit bindings right at the end, in GHC.Core.Tidy.
Some of these bindings, notably record selectors, are not
constructed in an optimised form. E.g. record selector for
data T = MkT { x :: {-# UNPACK #-} !Int }
@@ -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 GHC.Core.Op.Specialise).
+specialisations] in GHC.Core.Opt.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,7 +904,7 @@ 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 GHC.Core.Op.Specialise. But now it has
+[Inline specialisations] in GHC.Core.Opt.Specialise. But now it has
served its purpose, and can be discarded.)
So findExternalRules does this:
@@ -1186,12 +1186,12 @@ tidyTopIdInfo dflags rhs_tidy_env name orig_rhs tidy_rhs idinfo show_unfold
| not is_external -- For internal Ids (not externally visible)
= vanillaIdInfo -- we only need enough info for code generation
-- Arity and strictness info are enough;
- -- c.f. GHC.Core.Op.Tidy.tidyLetBndr
+ -- c.f. GHC.Core.Tidy.tidyLetBndr
`setArityInfo` arity
`setStrictnessInfo` final_sig
`setCprInfo` final_cpr
`setUnfoldingInfo` minimal_unfold_info -- See note [Preserve evaluatedness]
- -- in GHC.Core.Op.Tidy
+ -- in GHC.Core.Tidy
| otherwise -- Externally-visible Ids get the whole lot
= vanillaIdInfo
@@ -1253,7 +1253,7 @@ tidyTopIdInfo dflags rhs_tidy_env name orig_rhs tidy_rhs idinfo show_unfold
-- 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
- -- GHC.Core.Op.WorkWrap)
+ -- GHC.Core.Opt.WorkWrap)
--------- Arity ------------
diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs
index e52e1d376d..0ea420840d 100644
--- a/compiler/GHC/IfaceToCore.hs
+++ b/compiler/GHC/IfaceToCore.hs
@@ -62,7 +62,7 @@ import GHC.Types.Var.Set
import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Types.Name.Set
-import GHC.Core.Op.OccurAnal ( occurAnalyseExpr )
+import GHC.Core.Opt.OccurAnal ( occurAnalyseExpr )
import GHC.Types.Module
import GHC.Types.Unique.FM
import GHC.Types.Unique.Supply
diff --git a/compiler/GHC/Plugins.hs b/compiler/GHC/Plugins.hs
index 448b184f39..ce9d019a70 100644
--- a/compiler/GHC/Plugins.hs
+++ b/compiler/GHC/Plugins.hs
@@ -6,7 +6,7 @@
-- with saying "import GHC.Plugins".
--
-- Particularly interesting modules for plugin writers include
--- "GHC.Core" and "GHC.Core.Op.Monad".
+-- "GHC.Core" and "GHC.Core.Opt.Monad".
module GHC.Plugins
( module GHC.Driver.Plugins
, module GHC.Types.Name.Reader
@@ -15,7 +15,7 @@ module GHC.Plugins
, module GHC.Types.Var
, module GHC.Types.Id
, module GHC.Types.Id.Info
- , module GHC.Core.Op.Monad
+ , module GHC.Core.Opt.Monad
, module GHC.Core
, module GHC.Types.Literal
, module GHC.Core.DataCon
@@ -65,7 +65,7 @@ import GHC.Types.Id hiding ( lazySetIdInfo, setIdExported, setIdNotExport
import GHC.Types.Id.Info
-- Core
-import GHC.Core.Op.Monad
+import GHC.Core.Opt.Monad
import GHC.Core
import GHC.Types.Literal
import GHC.Core.DataCon
@@ -123,8 +123,8 @@ import GHC.Tc.Utils.Env ( lookupGlobal )
import qualified Language.Haskell.TH as TH
-{- This instance is defined outside GHC.Core.Op.Monad.hs so that
- GHC.Core.Op.Monad does not depend on GHC.Tc.Utils.Env -}
+{- This instance is defined outside GHC.Core.Opt.Monad.hs so that
+ GHC.Core.Opt.Monad does not depend on GHC.Tc.Utils.Env -}
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 cb06799316..05a5e7c69b 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 GHC.Core.Op.ConstantFold
+-- See Note [seq# magic] in GHC.Core.Opt.ConstantFold
cgExpr (StgOpApp (StgPrimOp SeqOp) [StgVarArg a, _] _res_ty) =
cgIdApp a []
@@ -325,8 +325,8 @@ calls to nonVoidIds in various places. So we must not look up
Note [Dead-binder optimisation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A case-binder, or data-constructor argument, may be marked as dead,
-because we preserve occurrence-info on binders in GHC.Core.Op.Tidy (see
-GHC.Core.Op.Tidy.tidyIdBndr).
+because we preserve occurrence-info on binders in GHC.Core.Tidy (see
+GHC.Core.Tidy.tidyIdBndr).
If the binder is dead, we can sometimes eliminate a load. While
CmmSink will eliminate that load, it's very easy to kill it at source
@@ -337,7 +337,7 @@ to keep it for -O0. See also Phab:D5358.
This probably also was the reason for occurrence hack in Phab:D5339 to
exist, perhaps because the occurrence information preserved by
-'GHC.Core.Op.Tidy.tidyIdBndr' was insufficient. But now that CmmSink does the
+'GHC.Core.Tidy.tidyIdBndr' was insufficient. But now that CmmSink does the
job we deleted the hacks.
-}
@@ -405,7 +405,7 @@ cgCase scrut@(StgApp v []) _ (PrimAlt _) _
{- Note [Handle seq#]
~~~~~~~~~~~~~~~~~~~~~
-See Note [seq# magic] in GHC.Core.Op.ConstantFold.
+See Note [seq# magic] in GHC.Core.Opt.ConstantFold.
The special case for seq# in cgCase does this:
case seq# a s of v
@@ -420,7 +420,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 GHC.Core.Op.ConstantFold
+ -- And see Note [seq# magic] in GHC.Core.Opt.ConstantFold
-- Use the same return convention as vanilla 'a'.
cgCase (StgApp a []) bndr alt_type alts
diff --git a/compiler/GHC/Tc/TyCl/Instance.hs b/compiler/GHC/Tc/TyCl/Instance.hs
index be247eed39..83a449461b 100644
--- a/compiler/GHC/Tc/TyCl/Instance.hs
+++ b/compiler/GHC/Tc/TyCl/Instance.hs
@@ -167,7 +167,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 GHC.Core.Op.Simplify.Utils
+ unfoldings. See Note [RULEs enabled in InitialPhase] in GHC.Core.Opt.Simplify.Utils
Note [ClassOp/DFun selection]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/GHC/Types/Cpr.hs b/compiler/GHC/Types/Cpr.hs
index 16f5f1041d..e19c86142e 100644
--- a/compiler/GHC/Types/Cpr.hs
+++ b/compiler/GHC/Types/Cpr.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
--- | Types for the Constructed Product Result lattice. "GHC.Core.Op.CprAnal" and "GHC.Core.Op.WorkWrap.Lib"
+-- | Types for the Constructed Product Result lattice. "GHC.Core.Opt.CprAnal" and "GHC.Core.Opt.WorkWrap.Utils"
-- are its primary customers via 'idCprInfo'.
module GHC.Types.Cpr (
CprResult, topCpr, botCpr, conCpr, asConCpr,
diff --git a/compiler/GHC/Types/Demand.hs b/compiler/GHC/Types/Demand.hs
index 8d736aa369..0ecb1b0b72 100644
--- a/compiler/GHC/Types/Demand.hs
+++ b/compiler/GHC/Types/Demand.hs
@@ -680,7 +680,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 GHC.Core.Op.WorkWrap
+-- See Note [Demand on the worker] in GHC.Core.Opt.WorkWrap
mkWorkerDemand :: Int -> Demand
mkWorkerDemand n = JD { sd = Lazy, ud = Use One (go n) }
where go 0 = Used
@@ -858,7 +858,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 GHC.Core.Op.DmdAnal.findBndrDmd.
+we pin a demand on a binder, in GHC.Core.Opt.DmdAnal.findBndrDmd.
Note [Threshold demands]
@@ -1100,7 +1100,7 @@ We
3 and 4 are implemented in bothDivergence.
-}
--- Equality needed for fixpoints in GHC.Core.Op.DmdAnal
+-- Equality needed for fixpoints in GHC.Core.Opt.DmdAnal
instance Eq DmdType where
(==) (DmdType fv1 ds1 div1)
(DmdType fv2 ds2 div2) = nonDetUFMToList fv1 == nonDetUFMToList fv2
@@ -1221,7 +1221,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 GHC.Core.Op.DmdAnal
+-- See Note [IO hack in the demand analyser] in GHC.Core.Opt.DmdAnal
deferAfterIO :: DmdType -> DmdType
deferAfterIO d@(DmdType _ _ res) =
case d `lubDmdType` nopDmdType of
@@ -1577,7 +1577,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 GHC.Core.Op.DmdAnal.
+demand type. See also Note [What are demand signatures?] in GHC.Core.Opt.DmdAnal.
Besides trimming argument demands, mkStrictSigForArity will also trim CPR
information if necessary.
@@ -1748,7 +1748,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 GHC.Core.Op.WorkWrap
+-- See Note [Demand on the worker] in GHC.Core.Opt.WorkWrap
saturatedByOneShots :: Int -> Demand -> Bool
saturatedByOneShots n (JD { ud = usg })
= case usg of
diff --git a/compiler/GHC/Types/Id.hs b/compiler/GHC/Types/Id.hs
index e62113390c..000221234d 100644
--- a/compiler/GHC/Types/Id.hs
+++ b/compiler/GHC/Types/Id.hs
@@ -488,7 +488,7 @@ isDataConId_maybe id = case Var.idDetails id of
_ -> Nothing
isJoinId :: Var -> Bool
--- It is convenient in GHC.Core.Op.SetLevels.lvlMFE to apply isJoinId
+-- It is convenient in GHC.Core.Opt.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)
- GHC.Core.Op.Simplify.Utils.abstractFloats (short-distance let-floating)
+ GHC.Core.Opt.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/GHC/Types/Id/Make.hs b/compiler/GHC/Types/Id/Make.hs
index ca0ba944af..e7e2c0cc8b 100644
--- a/compiler/GHC/Types/Id/Make.hs
+++ b/compiler/GHC/Types/Id/Make.hs
@@ -35,7 +35,7 @@ module GHC.Types.Id.Make (
coerceName,
-- Re-export error Ids
- module GHC.Core.Op.ConstantFold
+ module GHC.Core.Opt.ConstantFold
) where
#include "HsVersions.h"
@@ -44,7 +44,7 @@ import GhcPrelude
import TysPrim
import TysWiredIn
-import GHC.Core.Op.ConstantFold
+import GHC.Core.Opt.ConstantFold
import GHC.Core.Type
import GHC.Core.TyCo.Rep
import GHC.Core.FamInstEnv
@@ -1479,7 +1479,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 GHC.Core.Op.Simplify.trySeqRules.) As usual, the
+a RULE. (This is done in GHC.Core.Opt.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.
@@ -1491,10 +1491,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 GHC.Core.Op.Simplify.rebuildCase would need to actually supply
+ - The code in GHC.Core.Opt.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 GHC.Core.Op.Simplify.
+See also: Note [User-defined RULES for seq] in GHC.Core.Opt.Simplify.
Note [lazyId magic]
@@ -1590,7 +1590,7 @@ which is what we want.
It is only effective if the one-shot info survives as long as possible; in
particular it must make it into the interface in unfoldings. See Note [Preserve
-OneShotInfo] in GHC.Core.Op.Tidy.
+OneShotInfo] in GHC.Core.Tidy.
Also see https://gitlab.haskell.org/ghc/ghc/wikis/one-shot.
@@ -1626,7 +1626,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 GHC.Core.Op.ConstantFold),
+Next, we add a built-in Prelude rule (see GHC.Core.Opt.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/Types/Literal.hs b/compiler/GHC/Types/Literal.hs
index 9e6a8e4ede..3191f006db 100644
--- a/compiler/GHC/Types/Literal.hs
+++ b/compiler/GHC/Types/Literal.hs
@@ -675,7 +675,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 GHC.Core.Op.WorkWrap.Lib, because
+-- Rubbish literals are handled in GHC.Core.Opt.WorkWrap.Utils, 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)
@@ -830,7 +830,7 @@ Here are the moving parts:
* It is given its polymorphic type by Literal.literalType
-* GHC.Core.Op.WorkWrap.Lib.mk_absent_let introduces a LitRubbish for absent
+* GHC.Core.Opt.WorkWrap.Utils.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/ghc.cabal.in b/compiler/ghc.cabal.in
index e05d5a1617..5c828657e3 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -303,7 +303,7 @@ Library
GHC.Core.SimpleOpt
GHC.Core
TrieMap
- GHC.Core.Op.Tidy
+ GHC.Core.Tidy
GHC.Core.Unfold
GHC.Core.Utils
GHC.Core.Map
@@ -408,7 +408,7 @@ Library
KnownUniques
PrelInfo
PrelNames
- GHC.Core.Op.ConstantFold
+ GHC.Core.Opt.ConstantFold
PrimOp
ToolSettings
TysPrim
@@ -427,19 +427,19 @@ Library
GHC.Rename.Fixity
GHC.Rename.Utils
GHC.Rename.Unbound
- 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.Core.Opt.Monad
+ GHC.Core.Opt.CSE
+ GHC.Core.Opt.FloatIn
+ GHC.Core.Opt.FloatOut
+ GHC.Core.Opt.LiberateCase
+ GHC.Core.Opt.OccurAnal
+ GHC.Core.Opt.StaticArgs
+ GHC.Core.Opt.SetLevels
+ GHC.Core.Opt.Driver
+ GHC.Core.Opt.Simplify.Env
+ GHC.Core.Opt.Simplify.Monad
+ GHC.Core.Opt.Simplify.Utils
+ GHC.Core.Opt.Simplify
GHC.Stg.Pipeline
GHC.Stg.Stats
GHC.Stg.CSE
@@ -456,14 +456,14 @@ Library
GHC.CoreToStg.Prep
GHC.Types.RepType
GHC.Core.Rules
- 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
+ GHC.Core.Opt.SpecConstr
+ GHC.Core.Opt.Specialise
+ GHC.Core.Opt.CallArity
+ GHC.Core.Opt.DmdAnal
+ GHC.Core.Opt.CprAnal
+ GHC.Core.Opt.Exitify
+ GHC.Core.Opt.WorkWrap
+ GHC.Core.Opt.WorkWrap.Utils
GHC.Tc.Instance.Family
GHC.Tc.Instance.Class
GHC.Tc.Utils.Instantiate
diff --git a/compiler/main/StaticPtrTable.hs b/compiler/main/StaticPtrTable.hs
index 15214f2ad6..fd4b734433 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 GHC.Core.Op.SetLevels.newLvlVar.
+-- exported. This is done in GHC.Core.Opt.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 1a47d59e38..7cb6c6e22f 100644
--- a/compiler/prelude/PrelInfo.hs
+++ b/compiler/prelude/PrelInfo.hs
@@ -54,7 +54,7 @@ import GHC.Types.Unique ( isValidKnownKeyUnique )
import GHC.Core.ConLike ( ConLike(..) )
import THNames ( templateHaskellNames )
import PrelNames
-import GHC.Core.Op.ConstantFold
+import GHC.Core.Opt.ConstantFold
import GHC.Types.Avail
import PrimOp
import GHC.Core.DataCon
diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs
index 0774edef63..61df05840c 100644
--- a/compiler/prelude/PrimOp.hs
+++ b/compiler/prelude/PrimOp.hs
@@ -499,7 +499,7 @@ primOpOkForSideEffects op
Note [primOpIsCheap]
~~~~~~~~~~~~~~~~~~~~
-@primOpIsCheap@, as used in GHC.Core.Op.Simplify.Utils. For now (HACK
+@primOpIsCheap@, as used in GHC.Core.Opt.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