ghc-lib-parser 0.20220801 → 0.20220901
raw patch · 81 files changed
+3255/−2661 lines, 81 filesdep ~base
Dependency ranges changed: base
Files
- compiler/CodeGen.Platform.h +8/−0
- compiler/GHC/Cmm.hs +1/−10
- compiler/GHC/Cmm/CLabel.hs +15/−15
- compiler/GHC/Cmm/Node.hs +2/−2
- compiler/GHC/Core.hs +30/−15
- compiler/GHC/Core.hs-boot +8/−0
- compiler/GHC/Core/Coercion.hs +36/−48
- compiler/GHC/Core/Coercion/Opt.hs +3/−3
- compiler/GHC/Core/DataCon.hs +1/−1
- compiler/GHC/Core/Lint.hs +40/−38
- compiler/GHC/Core/Opt/Arity.hs +556/−281
- compiler/GHC/Core/Opt/ConstantFold.hs +2/−2
- compiler/GHC/Core/Opt/Simplify.hs +6/−3
- compiler/GHC/Core/Opt/Simplify/Env.hs +15/−14
- compiler/GHC/Core/Opt/Simplify/Iteration.hs +66/−35
- compiler/GHC/Core/Opt/Simplify/Utils.hs +23/−67
- compiler/GHC/Core/PatSyn.hs +2/−0
- compiler/GHC/Core/Ppr.hs +6/−2
- compiler/GHC/Core/Ppr.hs-boot +11/−0
- compiler/GHC/Core/Predicate.hs +0/−1
- compiler/GHC/Core/Rules.hs +4/−4
- compiler/GHC/Core/SimpleOpt.hs +12/−12
- compiler/GHC/Core/Subst.hs +33/−165
- compiler/GHC/Core/Tidy.hs +60/−42
- compiler/GHC/Core/TyCo/Subst.hs +282/−234
- compiler/GHC/Core/TyCon.hs +4/−2
- compiler/GHC/Core/Type.hs +17/−24
- compiler/GHC/Core/Unfold.hs +3/−4
- compiler/GHC/Core/Unify.hs +37/−37
- compiler/GHC/Core/Utils.hs +8/−59
- compiler/GHC/CoreToIface.hs +2/−3
- compiler/GHC/Driver/Env.hs +9/−1
- compiler/GHC/Driver/Flags.hs +5/−1
- compiler/GHC/Driver/Pipeline/Monad.hs +1/−0
- compiler/GHC/Driver/Plugins.hs +94/−5
- compiler/GHC/Driver/Plugins/External.hs +79/−0
- compiler/GHC/Driver/Session.hs +22/−4
- compiler/GHC/Hs/Expr.hs +10/−4
- compiler/GHC/Iface/Syntax.hs +3/−1
- compiler/GHC/Parser.y +18/−16
- compiler/GHC/Parser/PostProcess.hs +3/−1
- compiler/GHC/Runtime/Context.hs +1/−1
- compiler/GHC/Settings.hs +0/−4
- compiler/GHC/SysTools/BaseDir.hs +8/−25
- compiler/GHC/Tc/Errors/Ppr.hs +61/−2
- compiler/GHC/Tc/Errors/Types.hs +99/−3
- compiler/GHC/Tc/Types/Origin.hs +3/−1
- compiler/GHC/Tc/Utils/TcType.hs +6/−7
- compiler/GHC/Types/CostCentre.hs +11/−2
- compiler/GHC/Types/FieldLabel.hs +18/−9
- compiler/GHC/Types/Id/Info.hs +1/−1
- compiler/GHC/Types/Id/Make.hs +5/−3
- compiler/GHC/Types/Name/Occurrence.hs +1/−17
- compiler/GHC/Types/Name/Reader.hs +3/−1
- compiler/GHC/Types/RepType.hs +19/−0
- compiler/GHC/Types/Unique/DFM.hs +7/−0
- compiler/GHC/Types/Var.hs +1/−6
- compiler/GHC/Types/Var/Env.hs +5/−4
- compiler/GHC/Unit/Env.hs +22/−2
- compiler/GHC/Unit/Module/Graph.hs +5/−0
- compiler/GHC/Unit/Types.hs +1/−1
- compiler/GHC/Utils/Logger.hs +1/−1
- compiler/GHC/Utils/Misc.hs +1/−1
- compiler/GHC/Utils/Outputable.hs +8/−12
- compiler/Language/Haskell/Syntax/Basic.hs +2/−2
- compiler/Language/Haskell/Syntax/Expr.hs +0/−1
- ghc-lib-parser.cabal +3/−2
- ghc-lib/stage0/compiler/build/primop-data-decl.hs-incl +2/−0
- ghc-lib/stage0/compiler/build/primop-docs.hs-incl +4/−0
- ghc-lib/stage0/compiler/build/primop-has-side-effects.hs-incl +1/−0
- ghc-lib/stage0/compiler/build/primop-list.hs-incl +2/−0
- ghc-lib/stage0/compiler/build/primop-out-of-line.hs-incl +2/−0
- ghc-lib/stage0/compiler/build/primop-primop-info.hs-incl +3/−1
- ghc-lib/stage0/compiler/build/primop-tag.hs-incl +1308/−1306
- ghc-lib/stage0/lib/settings +0/−1
- ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs +4/−4
- ghc-lib/stage0/rts/build/include/GhclibDerivedConstants.h +8/−5
- libraries/ghc-heap/GHC/Exts/Heap.hs +6/−2
- libraries/ghc-heap/GHC/Exts/Heap/Closures.hs +1/−0
- libraries/ghci/GHCi/Message.hs +1/−1
- libraries/template-haskell/Language/Haskell/TH/Ppr.hs +84/−77
compiler/CodeGen.Platform.h view
@@ -926,6 +926,14 @@ -- ip0 -- used for spill offset computations freeReg 16 = False +#if defined(darwin_HOST_OS) || defined(ios_HOST_OS)+-- x18 is reserved by the platform on Darwin/iOS, and can not be used+-- More about ARM64 ABI that Apple platforms support:+-- https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms+-- https://github.com/Siguza/ios-resources/blob/master/bits/arm64.md+freeReg 18 = False+#endif+ # if defined(REG_Base) freeReg REG_Base = False # endif
compiler/GHC/Cmm.hs view
@@ -33,7 +33,7 @@ module GHC.Cmm.Expr, -- * Pretty-printing- pprCmms, pprCmmGroup, pprSection, pprStatic+ pprCmmGroup, pprSection, pprStatic ) where import GHC.Prelude@@ -237,7 +237,6 @@ | ReadOnlyData | RelocatableReadOnlyData | UninitialisedData- | ReadOnlyData16 -- .rodata.cst16 on x86_64, 16-byte aligned -- See Note [Initializers and finalizers in Cmm] in GHC.Cmm.InitFini | InitArray -- .init_array on ELF, .ctor on Windows | FiniArray -- .fini_array on ELF, .dtor on Windows@@ -257,7 +256,6 @@ Text -> ReadOnlySection ReadOnlyData -> ReadOnlySection RelocatableReadOnlyData -> WriteProtectedSection- ReadOnlyData16 -> ReadOnlySection InitArray -> ReadOnlySection FiniArray -> ReadOnlySection CString -> ReadOnlySection@@ -381,12 +379,6 @@ -- -- These conventions produce much more readable Cmm output. -pprCmms :: (OutputableP Platform info, OutputableP Platform g)- => Platform -> [GenCmmGroup RawCmmStatics info g] -> SDoc-pprCmms platform cmms = pprCode CStyle (vcat (intersperse separator $ map (pdoc platform) cmms))- where- separator = space $$ text "-------------------" $$ space- pprCmmGroup :: (OutputableP Platform d, OutputableP Platform info, OutputableP Platform g) => Platform -> GenCmmGroup d info g -> SDoc pprCmmGroup platform tops@@ -465,7 +457,6 @@ Text -> text "text" Data -> text "data" ReadOnlyData -> text "readonly"- ReadOnlyData16 -> text "readonly16" RelocatableReadOnlyData -> text "relreadonly" UninitialisedData -> text "uninitialised" InitArray -> text "initarray"
compiler/GHC/Cmm/CLabel.hs view
@@ -128,6 +128,7 @@ LabelStyle (..), pprDebugCLabel, pprCLabel,+ pprAsmLabel, ppInternalProcLabel, -- * Others@@ -294,9 +295,6 @@ instance Show CLabel where show = showPprUnsafe . pprDebugCLabel genericPlatform -instance Outputable CLabel where- ppr = text . show- data ModuleLabelKind = MLK_Initializer String | MLK_InitializerArray@@ -1392,13 +1390,15 @@ -} +pprAsmLabel :: Platform -> CLabel -> SDoc+pprAsmLabel platform lbl = pprCLabel platform AsmStyle lbl+ instance OutputableP Platform CLabel where {-# INLINE pdoc #-} -- see Note [Bangs in CLabel] pdoc !platform lbl = getPprStyle $ \pp_sty ->- let !sty = case pp_sty of- PprCode sty -> sty- _ -> CStyle- in pprCLabel platform sty lbl+ case pp_sty of+ PprDump{} -> pprCLabel platform CStyle lbl+ _ -> pprPanic "Labels in code should be printed with pprCLabel" (pprCLabel platform CStyle lbl) pprCLabel :: Platform -> LabelStyle -> CLabel -> SDoc pprCLabel !platform !sty lbl = -- see Note [Bangs in CLabel]@@ -1412,19 +1412,19 @@ AsmStyle | use_leading_underscores -> pp_cSEP <> doc _ -> doc - tempLabelPrefixOrUnderscore :: Platform -> SDoc- tempLabelPrefixOrUnderscore platform = case sty of+ tempLabelPrefixOrUnderscore :: SDoc+ tempLabelPrefixOrUnderscore = case sty of AsmStyle -> asmTempLabelPrefix platform CStyle -> char '_' in case lbl of LocalBlockLabel u -> case sty of- AsmStyle -> tempLabelPrefixOrUnderscore platform <> pprUniqueAlways u- CStyle -> tempLabelPrefixOrUnderscore platform <> text "blk_" <> pprUniqueAlways u+ AsmStyle -> tempLabelPrefixOrUnderscore <> pprUniqueAlways u+ CStyle -> tempLabelPrefixOrUnderscore <> text "blk_" <> pprUniqueAlways u AsmTempLabel u- -> tempLabelPrefixOrUnderscore platform <> pprUniqueAlways u+ -> tempLabelPrefixOrUnderscore <> pprUniqueAlways u AsmTempDerivedLabel l suf -> asmTempLabelPrefix platform@@ -1474,7 +1474,7 @@ CStyle -> ppr name <> ppIdFlavor flavor SRTLabel u- -> maybe_underscore $ tempLabelPrefixOrUnderscore platform <> pprUniqueAlways u <> pp_cSEP <> text "srt"+ -> maybe_underscore $ tempLabelPrefixOrUnderscore <> pprUniqueAlways u <> pp_cSEP <> text "srt" RtsLabel (RtsApFast (NonDetFastString str)) -> maybe_underscore $ ftext str <> text "_fast"@@ -1514,7 +1514,7 @@ -> maybe_underscore $ text "SLOW_CALL_fast_" <> text pat <> text "_ctr" LargeBitmapLabel u- -> maybe_underscore $ tempLabelPrefixOrUnderscore platform+ -> maybe_underscore $ tempLabelPrefixOrUnderscore <> char 'b' <> pprUniqueAlways u <> pp_cSEP <> text "btm" -- Some bitmaps for tuple constructors have a numeric tag (e.g. '7') -- until that gets resolved we'll just force them to start@@ -1525,7 +1525,7 @@ CC_Label cc -> maybe_underscore $ ppr cc CCS_Label ccs -> maybe_underscore $ ppr ccs- IPE_Label (InfoProvEnt l _ _ m _) -> maybe_underscore $ (pprCode CStyle (pdoc platform l) <> text "_" <> ppr m <> text "_ipe")+ IPE_Label (InfoProvEnt l _ _ m _) -> maybe_underscore $ (pprCLabel platform CStyle l <> text "_" <> ppr m <> text "_ipe") ModuleLabel mod kind -> maybe_underscore $ ppr mod <> text "_" <> ppr kind CmmLabel _ _ fs CmmCode -> maybe_underscore $ ftext fs
compiler/GHC/Cmm/Node.hs view
@@ -508,9 +508,9 @@ -- HACK: We're just using a ForeignLabel to get this printed, the label -- might not really be foreign. = pdoc platform- (CmmLabel (mkForeignLabel+ (mkForeignLabel (mkFastString (show op))- Nothing ForeignLabelInThisPackage IsFunction))+ Nothing ForeignLabelInThisPackage IsFunction) instance Outputable Convention where ppr = pprConvention
compiler/GHC/Core.hs view
@@ -43,7 +43,7 @@ -- ** Simple 'Expr' access functions and predicates bindersOf, bindersOfBinds, rhssOfBind, rhssOfAlts, collectBinders, collectTyBinders, collectTyAndValBinders,- collectNBinders,+ collectNBinders, collectNValBinders_maybe, collectArgs, stripNArgs, collectArgsTicks, flattenBinds, collectFunSimple, @@ -746,17 +746,18 @@ the binder. Reason: if we want to push a continuation into the RHS we must push it into the unfolding as well. - 2b. The Arity (in the IdInfo) of a join point is the number of value- binders in the top n lambdas, where n is the join arity.+ 2b. The Arity (in the IdInfo) of a join point varies independently of the+ join-arity. For example, we could have+ j x = case x of { T -> \y.y; F -> \y.3 }+ Its join-arity is 1, but its idArity is 2; and we do not eta-expand+ join points: see Note [Do not eta-expand join points] in+ GHC.Core.Opt.Simplify.Utils. - So arity <= join arity; the former counts only value binders- while the latter counts all binders.- e.g. Suppose $j has join arity 1- let j = \x y. e in case x of { A -> j 1; B -> j 2 }- Then its ordinary arity is also 1, not 2.+ Allowing the idArity to be bigger than the join-arity is+ important in arityType; see GHC.Core.Opt.Arity+ Note [Arity for recursive join bindings] - The arity of a join point isn't very important; but short of setting- it to zero, it is helpful to have an invariant. E.g. #17294.+ Historical note: see #17294. 3. If the binding is recursive, then all other bindings in the recursive group must also be join points.@@ -771,7 +772,7 @@ e.g. let j :: Int# = factorial x in ... 6. The RHS of join point is not required to have a fixed runtime representation,- e.g. let j :: r :: TYPE l = fail void# in ...+ e.g. let j :: r :: TYPE l = fail (##) in ... This happened in an intermediate program #13394 Examples:@@ -1151,7 +1152,7 @@ -- Rough-matching stuff -- see comments with InstEnv.ClsInst( is_cls, is_rough )- ru_fn :: Name, -- ^ Name of the 'GHC.Types.Id.Id' at the head of this rule+ ru_fn :: !Name, -- ^ Name of the 'GHC.Types.Id.Id' at the head of this rule ru_rough :: [Maybe Name], -- ^ Name at the head of each argument to the left hand side -- Proper-matching stuff@@ -1973,10 +1974,12 @@ collectTyBinders :: CoreExpr -> ([TyVar], CoreExpr) collectValBinders :: CoreExpr -> ([Id], CoreExpr) collectTyAndValBinders :: CoreExpr -> ([TyVar], [Id], CoreExpr)--- | Strip off exactly N leading lambdas (type or value). Good for use with--- join points.-collectNBinders :: Int -> Expr b -> ([b], Expr b) +-- | Strip off exactly N leading lambdas (type or value).+-- Good for use with join points.+-- Panic if there aren't enough+collectNBinders :: JoinArity -> Expr b -> ([b], Expr b)+ collectBinders expr = go [] expr where@@ -2007,6 +2010,18 @@ go 0 bs expr = (reverse bs, expr) go n bs (Lam b e) = go (n-1) (b:bs) e go _ _ _ = pprPanic "collectNBinders" $ int orig_n++-- | Strip off exactly N leading value lambdas+-- returning all the binders found up to that point+-- Return Nothing if there aren't enough+collectNValBinders_maybe :: Arity -> CoreExpr -> Maybe ([Var], CoreExpr)+collectNValBinders_maybe orig_n orig_expr+ = go orig_n [] orig_expr+ where+ go 0 bs expr = Just (reverse bs, expr)+ go n bs (Lam b e) | isId b = go (n-1) (b:bs) e+ | otherwise = go n (b:bs) e+ go _ _ _ = Nothing -- | Takes a nested application expression and returns the function -- being applied and the arguments to which it is applied
+ compiler/GHC/Core.hs-boot view
@@ -0,0 +1,8 @@+module GHC.Core where+import {-# SOURCE #-} GHC.Types.Var++data Expr a++type CoreBndr = Var++type CoreExpr = Expr CoreBndr
compiler/GHC/Core/Coercion.hs view
@@ -45,7 +45,6 @@ mkKindCo, castCoercionKind, castCoercionKind1, castCoercionKind2, - mkHeteroCoercionType, mkPrimEqPred, mkReprPrimEqPred, mkPrimEqPredRole, mkHeteroPrimEqPred, mkHeteroReprPrimEqPred, @@ -77,7 +76,6 @@ -- ** Coercion variables mkCoVar, isCoVar, coVarName, setCoVarName, setCoVarUnique,- isCoVar_maybe, -- ** Free variables tyCoVarsOfCo, tyCoVarsOfCos, coVarsOfCo,@@ -97,7 +95,7 @@ liftCoSubstVarBndrUsing, isMappedByLC, mkSubstLiftingContext, zapLiftingContext,- substForAllCoBndrUsingLC, lcTCvSubst, lcInScopeSet,+ substForAllCoBndrUsingLC, lcSubst, lcInScopeSet, LiftCoEnv, LiftingContext(..), liftEnvSubstLeft, liftEnvSubstRight, substRightCo, substLeftCo, swapLiftCoEnv, lcSubstLeft, lcSubstRight,@@ -469,13 +467,13 @@ decomposePiCos orig_co (Pair orig_k1 orig_k2) orig_args = go [] (orig_subst,orig_k1) orig_co (orig_subst,orig_k2) orig_args where- orig_subst = mkEmptyTCvSubst $ mkInScopeSet $+ orig_subst = mkEmptySubst $ mkInScopeSet $ tyCoVarsOfTypes orig_args `unionVarSet` tyCoVarsOfCo orig_co go :: [CoercionN] -- accumulator for argument coercions, reversed- -> (TCvSubst,Kind) -- Lhs kind of coercion+ -> (Subst,Kind) -- Lhs kind of coercion -> CoercionN -- coercion originally applied to the function- -> (TCvSubst,Kind) -- Rhs kind of coercion+ -> (Subst,Kind) -- Rhs kind of coercion -> [Type] -- Arguments to that function -> ([CoercionN], Coercion) -- Invariant: co :: subst1(k1) ~ subst2(k2)@@ -512,16 +510,18 @@ go (arg_co : acc_arg_cos) (subst1,t1) res_co (subst2,t2) tys | not (isEmptyTCvSubst subst1) || not (isEmptyTCvSubst subst2)- = go acc_arg_cos (zapTCvSubst subst1, substTy subst1 k1)+ = go acc_arg_cos (zapSubst subst1, substTy subst1 k1) co- (zapTCvSubst subst2, substTy subst1 k2)+ (zapSubst subst2, substTy subst1 k2) (ty:tys) -- tys might not be empty, if the left-hand type of the original coercion -- didn't have enough binders go acc_arg_cos _ki1 co _ki2 _tys = (reverse acc_arg_cos, co) --- | Attempts to obtain the type variable underlying a 'Coercion'+-- | Extract a covar, if possible. This check is dirty. Be ashamed+-- of yourself. (It's dirty because it cares about the structure of+-- a coercion, which is morally reprehensible.) getCoVar_maybe :: Coercion -> Maybe CoVar getCoVar_maybe (CoVarCo cv) = Just cv getCoVar_maybe _ = Nothing@@ -953,13 +953,6 @@ optCoercion. Not a big deal either way. -} --- | Extract a covar, if possible. This check is dirty. Be ashamed--- of yourself. (It's dirty because it cares about the structure of--- a coercion, which is morally reprehensible.)-isCoVar_maybe :: Coercion -> Maybe CoVar-isCoVar_maybe (CoVarCo cv) = Just cv-isCoVar_maybe _ = Nothing- mkAxInstCo :: Role -> CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Coercion -- mkAxInstCo can legitimately be called over-staturated;@@ -1900,7 +1893,7 @@ -- See Note [Lifting coercions over types: liftCoSubst] -- ---------------------------------------------------- -data LiftingContext = LC TCvSubst LiftCoEnv+data LiftingContext = LC Subst LiftCoEnv -- in optCoercion, we need to lift when optimizing InstCo. -- See Note [Optimising InstCo] in GHC.Core.Coercion.Opt -- We thus propagate the substitution from GHC.Core.Coercion.Opt here.@@ -1941,14 +1934,14 @@ | otherwise = ty_co_subst lc r ty emptyLiftingContext :: InScopeSet -> LiftingContext-emptyLiftingContext in_scope = LC (mkEmptyTCvSubst in_scope) emptyVarEnv+emptyLiftingContext in_scope = LC (mkEmptySubst in_scope) emptyVarEnv mkLiftingContext :: [(TyCoVar,Coercion)] -> LiftingContext mkLiftingContext pairs- = LC (mkEmptyTCvSubst $ mkInScopeSet $ tyCoVarsOfCos (map snd pairs))+ = LC (mkEmptySubst $ mkInScopeSet $ tyCoVarsOfCos (map snd pairs)) (mkVarEnv pairs) -mkSubstLiftingContext :: TCvSubst -> LiftingContext+mkSubstLiftingContext :: Subst -> LiftingContext mkSubstLiftingContext subst = LC subst emptyVarEnv -- | Extend a lifting context with a new mapping.@@ -1969,7 +1962,7 @@ -> Coercion -- ^ to this coercion -> LiftingContext extendLiftingContextAndInScope (LC subst env) tv co- = extendLiftingContext (LC (extendTCvInScopeSet subst (tyCoVarsOfCo co)) env) tv co+ = extendLiftingContext (LC (extendSubstInScopeSet subst (tyCoVarsOfCo co)) env) tv co -- | Extend a lifting context with existential-variable bindings. -- See Note [extendLiftingContextEx]@@ -1985,7 +1978,7 @@ -- works with existentially bound variables, which are considered to have -- nominal roles. | isTyVar v- = let lc' = LC (subst `extendTCvInScopeSet` tyCoVarsOfType ty)+ = let lc' = LC (subst `extendSubstInScopeSet` tyCoVarsOfType ty) (extendVarEnv env v $ mkGReflRightCo Nominal ty@@ -2003,7 +1996,7 @@ kco = mkTyConAppCo Nominal (equalityTyCon r) [ mkKindCo lift_s1, mkKindCo lift_s2 , lift_s1 , lift_s2 ]- lc' = LC (subst `extendTCvInScopeSet` tyCoVarsOfCo co)+ lc' = LC (subst `extendSubstInScopeSet` tyCoVarsOfCo co) (extendVarEnv env v (mkProofIrrelCo Nominal kco co $ (mkSymCo lift_s1) `mkTransCo` co `mkTransCo` lift_s2))@@ -2014,7 +2007,7 @@ -- | Erase the environments in a lifting context zapLiftingContext :: LiftingContext -> LiftingContext-zapLiftingContext (LC subst _) = LC (zapTCvSubst subst) emptyVarEnv+zapLiftingContext (LC subst _) = LC (zapSubst subst) emptyVarEnv -- | Like 'substForAllCoBndr', but works on a lifting context substForAllCoBndrUsingLC :: Bool@@ -2165,14 +2158,14 @@ -> (LiftingContext, TyVar, r) liftCoSubstTyVarBndrUsing view_co fun lc@(LC subst cenv) old_var = assert (isTyVar old_var) $- ( LC (subst `extendTCvInScope` new_var) new_cenv+ ( LC (subst `extendSubstInScope` new_var) new_cenv , new_var, stuff ) where old_kind = tyVarKind old_var stuff = fun lc old_kind eta = view_co stuff k1 = coercionLKind eta- new_var = uniqAway (getTCvInScope subst) (setVarType old_var k1)+ new_var = uniqAway (getSubstInScope subst) (setVarType old_var k1) lifted = mkGReflRightCo Nominal (TyVarTy new_var) eta -- :: new_var ~ new_var |> eta@@ -2185,14 +2178,14 @@ -> (LiftingContext, CoVar, r) liftCoSubstCoVarBndrUsing view_co fun lc@(LC subst cenv) old_var = assert (isCoVar old_var) $- ( LC (subst `extendTCvInScope` new_var) new_cenv+ ( LC (subst `extendSubstInScope` new_var) new_cenv , new_var, stuff ) where old_kind = coVarKind old_var stuff = fun lc old_kind eta = view_co stuff k1 = coercionLKind eta- new_var = uniqAway (getTCvInScope subst) (setVarType old_var k1)+ new_var = uniqAway (getSubstInScope subst) (setVarType old_var k1) -- old_var :: s1 ~r s2 -- eta :: (s1' ~r s2') ~N (t1 ~r t2)@@ -2232,21 +2225,21 @@ swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv swapLiftCoEnv = mapVarEnv mkSymCo -lcSubstLeft :: LiftingContext -> TCvSubst+lcSubstLeft :: LiftingContext -> Subst lcSubstLeft (LC subst lc_env) = liftEnvSubstLeft subst lc_env -lcSubstRight :: LiftingContext -> TCvSubst+lcSubstRight :: LiftingContext -> Subst lcSubstRight (LC subst lc_env) = liftEnvSubstRight subst lc_env -liftEnvSubstLeft :: TCvSubst -> LiftCoEnv -> TCvSubst+liftEnvSubstLeft :: Subst -> LiftCoEnv -> Subst liftEnvSubstLeft = liftEnvSubst pFst -liftEnvSubstRight :: TCvSubst -> LiftCoEnv -> TCvSubst+liftEnvSubstRight :: Subst -> LiftCoEnv -> Subst liftEnvSubstRight = liftEnvSubst pSnd -liftEnvSubst :: (forall a. Pair a -> a) -> TCvSubst -> LiftCoEnv -> TCvSubst+liftEnvSubst :: (forall a. Pair a -> a) -> Subst -> LiftCoEnv -> Subst liftEnvSubst selector subst lc_env- = composeTCvSubst (TCvSubst emptyInScopeSet tenv cenv) subst+ = composeTCvSubst (Subst emptyInScopeSet emptyIdSubstEnv tenv cenv) subst where pairs = nonDetUFMToList lc_env -- It's OK to use nonDetUFMToList here because we@@ -2266,12 +2259,12 @@ equality_ty = selector (coercionKind co) -- | Extract the underlying substitution from the LiftingContext-lcTCvSubst :: LiftingContext -> TCvSubst-lcTCvSubst (LC subst _) = subst+lcSubst :: LiftingContext -> Subst+lcSubst (LC subst _) = subst -- | Get the 'InScopeSet' from a 'LiftingContext' lcInScopeSet :: LiftingContext -> InScopeSet-lcInScopeSet (LC subst _) = getTCvInScope subst+lcInScopeSet (LC subst _) = getSubstInScope subst {- %************************************************************************@@ -2431,7 +2424,7 @@ -- kind_co always has kind @Type@, thus @isGReflCo@ | otherwise = go_forall empty_subst co where- empty_subst = mkEmptyTCvSubst (mkInScopeSet $ tyCoVarsOfCo co)+ empty_subst = mkEmptySubst (mkInScopeSet $ tyCoVarsOfCo co) go_ax_inst ax ind tys | CoAxBranch { cab_tvs = tvs, cab_cvs = cvs@@ -2457,9 +2450,9 @@ where k2 = coercionRKind k_co tv2 = setTyVarKind tv1 (substTy subst k2)- subst' | isGReflCo k_co = extendTCvInScope subst tv1+ subst' | isGReflCo k_co = extendSubstInScope subst tv1 -- kind_co always has kind @Type@, thus @isGReflCo@- | otherwise = extendTvSubst (extendTCvInScope subst tv2) tv1 $+ | otherwise = extendTvSubst (extendSubstInScope subst tv2) tv1 $ TyVarTy tv2 `mkCastTy` mkSymCo k_co go_forall subst (ForAllCo cv1 k_co co)@@ -2482,8 +2475,8 @@ cv2 = setVarType cv1 (substTy subst k2) n_subst = eta1 `mkTransCo` (mkCoVarCo cv2) `mkTransCo` (mkSymCo eta2)- subst' | isReflCo k_co = extendTCvInScope subst cv1- | otherwise = extendCvSubst (extendTCvInScope subst cv2)+ subst' | isReflCo k_co = extendSubstInScope subst cv1+ | otherwise = extendCvSubst (extendSubstInScope subst cv2) cv1 n_subst go_forall subst other_co@@ -2558,11 +2551,6 @@ in TyConApp eqPhantPrimTyCon [ki1, ki2, ty1, ty2] -mkHeteroCoercionType :: Role -> Kind -> Kind -> Type -> Type -> Type-mkHeteroCoercionType Nominal = mkHeteroPrimEqPred-mkHeteroCoercionType Representational = mkHeteroReprPrimEqPred-mkHeteroCoercionType Phantom = panic "mkHeteroCoercionType"- -- | Creates a primitive type equality predicate. -- Invariant: the types are not Coercions mkPrimEqPred :: Type -> Type -> Type@@ -2666,7 +2654,7 @@ eta1 = mkNthCo r 2 kind_co' eta2 = mkNthCo r 3 kind_co' - subst = mkEmptyTCvSubst $ mkInScopeSet $+ subst = mkEmptySubst $ mkInScopeSet $ tyCoVarsOfType ty2 `unionVarSet` tyCoVarsOfCo kind_co ty2' = substTy (extendCvSubst subst cv2 $ mkSymCo eta1 `mkTransCo` mkCoVarCo cv1 `mkTransCo`
compiler/GHC/Core/Coercion/Opt.hs view
@@ -119,14 +119,14 @@ { optCoercionEnabled :: Bool -- ^ Enable coercion optimisation (reduce its size) } -optCoercion :: OptCoercionOpts -> TCvSubst -> Coercion -> NormalCo+optCoercion :: OptCoercionOpts -> Subst -> Coercion -> NormalCo -- ^ optCoercion applies a substitution to a coercion, -- *and* optimises it to reduce its size optCoercion opts env co | optCoercionEnabled opts = optCoercion' env co | otherwise = substCo env co -optCoercion' :: TCvSubst -> Coercion -> NormalCo+optCoercion' :: Subst -> Coercion -> NormalCo optCoercion' env co | debugIsOn = let out_co = opt_co1 lc False co@@ -280,7 +280,7 @@ cow' = opt_co1 env sym cow opt_co4 env sym rep r (CoVarCo cv)- | Just co <- lookupCoVar (lcTCvSubst env) cv+ | Just co <- lookupCoVar (lcSubst env) cv = opt_co4_wrap (zapLiftingContext env) sym rep r co | ty1 `eqType` ty2 -- See Note [Optimise CoVarCo to Refl]
compiler/GHC/Core/DataCon.hs view
@@ -789,7 +789,7 @@ -- | Substitute in an 'EqSpec'. Precondition: if the LHS of the EqSpec -- is mapped in the substitution, it is mapped to a type variable, not -- a full type.-substEqSpec :: TCvSubst -> EqSpec -> EqSpec+substEqSpec :: Subst -> EqSpec -> EqSpec substEqSpec subst (EqSpec tv ty) = EqSpec tv' (substTy subst ty) where
compiler/GHC/Core/Lint.hs view
@@ -54,7 +54,7 @@ import GHC.Core.Coercion.Axiom import GHC.Core.Unify import GHC.Core.Coercion.Opt ( checkAxInstCo )-import GHC.Core.Opt.Arity ( typeArity )+import GHC.Core.Opt.Arity ( typeArity, exprIsDeadEnd ) import GHC.Core.Opt.Monad @@ -895,8 +895,8 @@ -- N.B. we may have an over-saturated application of the form: -- runRW (\s -> \x -> ...) y , ty_arg1 : ty_arg2 : arg3 : rest <- args- = do { fun_pair1 <- lintCoreArg (idType fun, zeroUE) ty_arg1- ; (fun_ty2, ue2) <- lintCoreArg fun_pair1 ty_arg2+ = do { fun_pair1 <- lintCoreArg (idType fun, zeroUE) ty_arg1+ ; (fun_ty2, ue2) <- lintCoreArg fun_pair1 ty_arg2 -- See Note [Linting of runRW#] ; let lintRunRWCont :: CoreArg -> LintM (LintedType, UsageEnv) lintRunRWCont expr@(Lam _ _) =@@ -1437,7 +1437,7 @@ -- Don't use lintIdBndr on var, because unboxed tuple is legitimate - ; subst <- getTCvSubst+ ; subst <- getSubst ; ensureEqTys var_ty scrut_ty (mkScrutMsg var var_ty scrut_ty subst) -- See GHC.Core Note [Case expression invariants] item (7) @@ -1602,15 +1602,15 @@ lintTyCoBndr :: TyCoVar -> (LintedTyCoVar -> LintM a) -> LintM a lintTyCoBndr tcv thing_inside- = do { subst <- getTCvSubst+ = do { subst <- getSubst ; kind' <- lintType (varType tcv)- ; let tcv' = uniqAway (getTCvInScope subst) $+ ; let tcv' = uniqAway (getSubstInScope subst) $ setVarType tcv kind' subst' = extendTCvSubstWithClone subst tcv tcv' ; when (isCoVar tcv) $ lintL (isCoVarType kind') (text "CoVar with non-coercion type:" <+> pprTyVar tcv)- ; updateTCvSubst subst' (thing_inside tcv') }+ ; updateSubst subst' (thing_inside tcv') } lintIdBndrs :: forall a. TopLevelFlag -> [Id] -> ([LintedId] -> LintM a) -> LintM a lintIdBndrs top_lvl ids thing_inside@@ -1710,7 +1710,7 @@ = failWithL (mkBadTyVarMsg tv) | otherwise- = do { subst <- getTCvSubst+ = do { subst <- getSubst ; case lookupTyVar subst tv of Just linted_ty -> return linted_ty @@ -1926,7 +1926,7 @@ ; unless (ka `eqType` kv_kind) $ addErrL (fail_msg (text "Forall:" <+> (ppr kv $$ ppr kv_kind $$ ppr ta <+> dcolon <+> ppr ka)))- ; return $ substTy (extendTCvSubst (mkEmptyTCvSubst in_scope) kv ta) kfn }+ ; return $ substTy (extendTCvSubst (mkEmptySubst in_scope) kv ta) kfn } go_app _ kfn ta = failWithL (fail_msg (text "Not a fun:" <+> (ppr kfn $$ ppr ta)))@@ -2071,7 +2071,7 @@ 2 (text "With offending type:" <+> ppr (varType cv))) | otherwise- = do { subst <- getTCvSubst+ = do { subst <- getSubst ; case lookupCoVar subst cv of Just linted_co -> return linted_co ; Nothing@@ -2371,8 +2371,8 @@ ; unless (cos `equalLength` (ktvs ++ cvs)) $ bad_ax (text "lengths") ; cos' <- mapM lintCoercion cos- ; subst <- getTCvSubst- ; let empty_subst = zapTCvSubst subst+ ; subst <- getSubst+ ; let empty_subst = zapSubst subst ; _ <- foldlM check_ki (empty_subst, empty_subst) (zip3 (ktvs ++ cvs) roles cos') ; let fam_tc = coAxiomTyCon con@@ -2601,7 +2601,7 @@ = -- we need to freshen ax2 w.r.t. ax1 -- do this by pretending tvs1 are in scope when processing tvs2 let in_scope = mkInScopeSetList tvs1- subst0 = mkEmptyTCvSubst in_scope+ subst0 = mkEmptySubst in_scope (subst, _) = substTyVarBndrs subst0 tvs2 lhs2' = substTys subst lhs2 rhs2' = substTy subst rhs2@@ -2625,13 +2625,13 @@ = LE { le_flags :: LintFlags -- Linting the result of this pass , le_loc :: [LintLocInfo] -- Locations - , le_subst :: TCvSubst -- Current TyCo substitution+ , le_subst :: Subst -- Current TyCo substitution -- See Note [Linting type lets] -- /Only/ substitutes for type variables; -- but might clone CoVars -- We also use le_subst to keep track of -- in-scope TyVars and CoVars (but not Ids)- -- Range of the TCvSubst is LintedType/LintedCo+ -- Range of the Subst is LintedType/LintedCo , le_ids :: VarEnv (Id, LintedType) -- In-scope Ids -- Used to check that occurrences have an enclosing binder.@@ -2858,7 +2858,7 @@ where (tcvs, ids) = partition isTyCoVar $ l_vars cfg env = LE { le_flags = l_flags cfg- , le_subst = mkEmptyTCvSubst (mkInScopeSetList tcvs)+ , le_subst = mkEmptySubst (mkInScopeSetList tcvs) , le_ids = mkVarEnv [(id, (id,idType id)) | id <- ids] , le_joins = emptyVarSet , le_loc = []@@ -2961,8 +2961,8 @@ = LintM $ \ env errs -> unLintM m (env { le_subst = Type.extendTvSubst (le_subst env) tv ty }) errs -updateTCvSubst :: TCvSubst -> LintM a -> LintM a-updateTCvSubst subst' m+updateSubst :: Subst -> LintM a -> LintM a+updateSubst subst' m = LintM $ \ env errs -> unLintM m (env { le_subst = subst' }) errs markAllJoinsBad :: LintM a -> LintM a@@ -2976,14 +2976,14 @@ getValidJoins :: LintM IdSet getValidJoins = LintM (\ env errs -> (Just (le_joins env), errs)) -getTCvSubst :: LintM TCvSubst-getTCvSubst = LintM (\ env errs -> (Just (le_subst env), errs))+getSubst :: LintM Subst+getSubst = LintM (\ env errs -> (Just (le_subst env), errs)) getUEAliases :: LintM (NameEnv UsageEnv) getUEAliases = LintM (\ env errs -> (Just (le_ue_aliases env), errs)) getInScope :: LintM InScopeSet-getInScope = LintM (\ env errs -> (Just (getTCvInScope $ le_subst env), errs))+getInScope = LintM (\ env errs -> (Just (getSubstInScope $ le_subst env), errs)) lookupIdInScope :: Id -> LintM (Id, LintedType) lookupIdInScope id_occ@@ -3183,7 +3183,7 @@ text "Annotation on case:" <+> ppr ty2, text "Alt Rhs:" <+> ppr e ]) -mkScrutMsg :: Id -> Type -> Type -> TCvSubst -> SDoc+mkScrutMsg :: Id -> Type -> Type -> Subst -> SDoc mkScrutMsg var var_ty scrut_ty subst = vcat [text "Result binder in case doesn't match scrutinee:" <+> ppr var, text "Result binder type:" <+> ppr var_ty,--(idType var),@@ -3437,24 +3437,26 @@ logger <- getLogger when (gopt Opt_DoAnnotationLinting dflags) $ liftIO $ Err.showPass logger "Annotation linting - first run"- nguts <- pass guts -- If appropriate re-run it without debug annotations to make sure -- that they made no difference.- when (gopt Opt_DoAnnotationLinting dflags) $ do- liftIO $ Err.showPass logger "Annotation linting - second run"- nguts' <- withoutAnnots pass guts- -- Finally compare the resulting bindings- liftIO $ Err.showPass logger "Annotation linting - comparison"- let binds = flattenBinds $ mg_binds nguts- binds' = flattenBinds $ mg_binds nguts'- (diffs,_) = diffBinds True (mkRnEnv2 emptyInScopeSet) binds binds'- when (not (null diffs)) $ GHC.Core.Opt.Monad.putMsg $ vcat- [ lint_banner "warning" pname- , text "Core changes with annotations:"- , withPprStyle defaultDumpStyle $ nest 2 $ vcat diffs- ]- -- Return actual new guts- return nguts+ if gopt Opt_DoAnnotationLinting dflags+ then do+ nguts <- pass guts+ liftIO $ Err.showPass logger "Annotation linting - second run"+ nguts' <- withoutAnnots pass guts+ -- Finally compare the resulting bindings+ liftIO $ Err.showPass logger "Annotation linting - comparison"+ let binds = flattenBinds $ mg_binds nguts+ binds' = flattenBinds $ mg_binds nguts'+ (diffs,_) = diffBinds True (mkRnEnv2 emptyInScopeSet) binds binds'+ when (not (null diffs)) $ GHC.Core.Opt.Monad.putMsg $ vcat+ [ lint_banner "warning" pname+ , text "Core changes with annotations:"+ , withPprStyle defaultDumpStyle $ nest 2 $ vcat diffs+ ]+ return nguts+ else+ pass guts -- | Run the given pass without annotations. This means that we both -- set the debugLevel setting to 0 in the environment as well as all
compiler/GHC/Core/Opt/Arity.hs view
@@ -13,7 +13,7 @@ module GHC.Core.Opt.Arity ( -- Finding arity manifestArity, joinRhsArity, exprArity- , findRhsArity, exprBotStrictness_maybe+ , findRhsArity, cheapArityType , ArityOpts(..) -- ** Eta expansion@@ -23,9 +23,12 @@ , tryEtaReduce -- ** ArityType- , ArityType, mkBotArityType, mkManifestArityType- , arityTypeArity, idArityType, getBotArity+ , ArityType, mkBotArityType+ , arityTypeArity, idArityType + -- ** Bottoming things+ , exprIsDeadEnd, exprBotStrictness_maybe, arityTypeBotSigs_maybe+ -- ** typeArity and the state hack , typeArity, typeOneShots, typeOneShot , isOneShotBndr@@ -56,13 +59,14 @@ import GHC.Core.Multiplicity -- We have two sorts of substitution:--- GHC.Core.Subst.Subst, and GHC.Core.TyCo.TCvSubst+-- GHC.Core.Subst.Subst, and GHC.Core.TyCo.Subst -- Both have substTy, substCo Hence need for qualification import GHC.Core.Subst as Core import GHC.Core.Type as Type import GHC.Core.Coercion as Type import GHC.Types.Demand+import GHC.Types.Cpr( CprSig, mkCprSig, botCpr ) import GHC.Types.Id import GHC.Types.Var.Env import GHC.Types.Var.Set@@ -134,37 +138,23 @@ ----------------exprArity :: CoreExpr -> Arity--- ^ An approximate, fast, version of 'exprEtaExpandArity'--- We do /not/ guarantee that exprArity e <= typeArity e--- You may need to do arity trimming after calling exprArity--- See Note [Arity trimming]--- Reason: if we do arity trimming here we have take exprType--- and that can be expensive if there is a large cast-exprArity e = go e+exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, DmdSig, CprSig)+-- A cheap and cheerful function that identifies bottoming functions+-- and gives them a suitable strictness and CPR signatures.+-- It's used during float-out+exprBotStrictness_maybe e = arityTypeBotSigs_maybe (cheapArityType e)++arityTypeBotSigs_maybe :: ArityType -> Maybe (Arity, DmdSig, CprSig)+-- Arity of a divergent function+arityTypeBotSigs_maybe (AT lams div)+ | isDeadEndDiv div = Just ( arity+ , mkVanillaDmdSig arity botDiv+ , mkCprSig arity botCpr)+ | otherwise = Nothing where- go (Var v) = idArity v- go (Lam x e) | isId x = go e + 1- | otherwise = go e- go (Tick t e) | not (tickishIsCode t) = go e- go (Cast e _) = go e- go (App e (Type _)) = go e- go (App f a) | exprIsTrivial a = (go f - 1) `max` 0- -- See Note [exprArity for applications]- -- NB: coercions count as a value argument+ arity = length lams - go _ = 0 -----------------exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, DmdSig)--- A cheap and cheerful function that identifies bottoming functions--- and gives them a suitable strictness signatures. It's used during--- float-out-exprBotStrictness_maybe e- = case getBotArity (arityType botStrictnessArityEnv e) of- Nothing -> Nothing- Just ar -> Just (ar, mkVanillaDmdSig ar botDiv)- {- Note [exprArity for applications] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When we come to an application we check that the arg is trivial.@@ -467,8 +457,15 @@ Note [Dealing with bottom] ~~~~~~~~~~~~~~~~~~~~~~~~~~-A Big Deal with computing arities is expressions like+GHC does some transformations that are technically unsound wrt+bottom, because doing so improves arities... a lot! We describe+them in this Note. +The flag -fpedantic-bottoms (off by default) restore technically+correct behaviour at the cots of efficiency.++It's mostly to do with eta-expansion. Consider+ f = \x -> case x of True -> \s -> e1 False -> \s -> e2@@ -487,7 +484,7 @@ Consider also f = \x -> error "foo"-Here, arity 1 is fine. But if it is+Here, arity 1 is fine. But if it looks like this (see #22068) f = \x -> case x of True -> error "foo" False -> \y -> x+y@@ -752,7 +749,8 @@ -- where the @at@ fields of @ALam@ are inductively subject to the same order. -- That is, @ALam os at1 < ALam os at2@ iff @at1 < at2@. ----- Why the strange Top element? See Note [Combining case branches].+-- Why the strange Top element?+-- See Note [Combining case branches: optimistic one-shot-ness] -- -- We rely on this lattice structure for fixed-point iteration in -- 'findRhsArity'. For the semantics of 'ArityType', see Note [ArityType].@@ -812,9 +810,6 @@ botArityType :: ArityType botArityType = mkBotArityType [] -mkManifestArityType :: [OneShotInfo] -> ArityType-mkManifestArityType oss = AT [(IsCheap,os) | os <- oss] topDiv- topArityType :: ArityType topArityType = AT [] topDiv @@ -850,7 +845,7 @@ -- they end in 'ABot'. See Note [Arity trimming] trimArityType max_arity at@(AT lams _) | lams `lengthAtMost` max_arity = at- | otherwise = AT (take max_arity lams) topDiv+ | otherwise = AT (take max_arity lams) topDiv data ArityOpts = ArityOpts { ao_ped_bot :: !Bool -- See Note [Dealing with bottom]@@ -869,13 +864,7 @@ | otherwise = Just arity_type where- arity_type = safeArityType (arityType (etaExpandArityEnv opts) e)--getBotArity :: ArityType -> Maybe Arity--- Arity of a divergent function-getBotArity (AT oss div)- | isDeadEndDiv div = Just $ length oss- | otherwise = Nothing+ arity_type = safeArityType (arityType (findRhsArityEnv opts False) e) {- *********************************************************************@@ -884,24 +873,49 @@ * * ********************************************************************* -} -findRhsArity :: ArityOpts -> RecFlag -> Id -> CoreExpr -> Arity -> SafeArityType+findRhsArity :: ArityOpts -> RecFlag -> Id -> CoreExpr+ -> (Bool, SafeArityType) -- This implements the fixpoint loop for arity analysis -- See Note [Arity analysis]--- If findRhsArity e = (n, is_bot) then--- (a) any application of e to <n arguments will not do much work,--- so it is safe to expand e ==> (\x1..xn. e x1 .. xn)--- (b) if is_bot=True, then e applied to n args is guaranteed bottom ----- Returns an ArityType that is guaranteed trimmed to typeArity of 'bndr'+-- The Bool is True if the returned arity is greater than (exprArity rhs)+-- so the caller should do eta-expansion+-- That Bool is never True for join points, which are never eta-expanded+--+-- Returns an SafeArityType that is guaranteed trimmed to typeArity of 'bndr' -- See Note [Arity trimming]-findRhsArity opts is_rec bndr rhs old_arity- = case is_rec of- Recursive -> go 0 botArityType- NonRecursive -> step init_env++findRhsArity opts is_rec bndr rhs+ | isJoinId bndr+ = (False, join_arity_type)+ -- False: see Note [Do not eta-expand join points]+ -- But do return the correct arity and bottom-ness, because+ -- these are used to set the bndr's IdInfo (#15517)+ -- Note [Invariants on join points] invariant 2b, in GHC.Core++ | otherwise+ = (arity_increased, non_join_arity_type)+ -- arity_increased: eta-expand if we'll get more lambdas+ -- to the top of the RHS where+ old_arity = exprArity rhs+ init_env :: ArityEnv- init_env = findRhsArityEnv opts+ init_env = findRhsArityEnv opts (isJoinId bndr) + -- Non-join-points only+ non_join_arity_type = case is_rec of+ Recursive -> go 0 botArityType+ NonRecursive -> step init_env+ arity_increased = arityTypeArity non_join_arity_type > old_arity++ -- Join-points only+ -- See Note [Arity for non-recursive join bindings]+ -- and Note [Arity for recursive join bindings]+ join_arity_type = case is_rec of+ Recursive -> go 0 botArityType+ NonRecursive -> trimArityType ty_arity (cheapArityType rhs)+ ty_arity = typeArity (idType bndr) id_one_shots = idDemandOneShots bndr @@ -925,13 +939,13 @@ go !n cur_at@(AT lams div) | not (isDeadEndDiv div) -- the "stop right away" case , length lams <= old_arity = cur_at -- from above- | next_at == cur_at = cur_at- | otherwise =+ | next_at == cur_at = cur_at+ | otherwise -- Warn if more than 2 iterations. Why 2? See Note [Exciting arity]- warnPprTrace (debugIsOn && n > 2)+ = warnPprTrace (debugIsOn && n > 2) "Exciting arity" (nest 2 (ppr bndr <+> ppr cur_at <+> ppr next_at $$ ppr rhs)) $- go (n+1) next_at+ go (n+1) next_at where next_at = step (extendSigEnv init_env bndr cur_at) @@ -945,8 +959,9 @@ where zip_lams :: [ATLamInfo] -> [OneShotInfo] -> [ATLamInfo] zip_lams lams [] = lams- zip_lams [] oss = [ (IsExpensive,OneShotLam)- | _ <- takeWhile isOneShotInfo oss]+ zip_lams [] oss | isDeadEndDiv div = []+ | otherwise = [ (IsExpensive,OneShotLam)+ | _ <- takeWhile isOneShotInfo oss] zip_lams ((ch,os1):lams) (os2:oss) = (ch, os1 `bestOneShot` os2) : zip_lams lams oss @@ -1086,6 +1101,117 @@ Now we don't want to eta-expand f1 to have 3 args; only two. Nor, in the case of f2, do we want to push that error call under a lambda. Hence the takeWhile in combineWithDemandDoneShots.++Note [Do not eta-expand join points]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+Similarly to CPR (see Note [Don't w/w join points for CPR] in+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:++ let join $j1 :: IO ()+ $j1 = ...+ $j2 :: Int -> IO ()+ $j2 n = if n > 0 then $j1+ else ...++ =>++ let join $j1 :: IO ()+ $j1 = (\eta -> ...)+ `cast` N:IO :: State# RealWorld -> (# State# RealWorld, ())+ ~ IO ()+ $j2 :: Int -> IO ()+ $j2 n = (\eta -> if n > 0 then $j1+ else ...)+ `cast` N:IO :: State# RealWorld -> (# State# RealWorld, ())+ ~ IO ()++The cast here can't be pushed inside the lambda (since it's not casting to a+function type), so the lambda has to stay, but it can't because it contains a+reference to a join point. In fact, $j2 can't be eta-expanded at all. Rather+than try and detect this situation (and whatever other situations crop up!), we+don't bother; again, any surrounding eta-expansion will improve these join+points anyway, since an outer cast can *always* be pushed inside. By the time+CorePrep comes around, the code is very likely to look more like this:++ let join $j1 :: State# RealWorld -> (# State# RealWorld, ())+ $j1 = (...) eta+ $j2 :: Int -> State# RealWorld -> (# State# RealWorld, ())+ $j2 = if n > 0 then $j1+ else (...) eta++Note [Arity for recursive join bindings]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+Consider+ f x = joinrec j 0 = \ a b c -> (a,x,b)+ j n = j (n-1)+ in j 20++Obviously `f` should get arity 4. But it's a bit tricky:++1. Remember, we don't eta-expand join points; see+ Note [Do not eta-expand join points].++2. But even though we aren't going to eta-expand it, we still want `j` to get+ idArity=4, via the findRhsArity fixpoint. Then when we are doing findRhsArity+ for `f`, we'll call arityType on f's RHS:+ - At the letrec-binding for `j` we'll whiz up an arity-4 ArityType+ for `j` (See Note [arityType for non-recursive let-bindings]+ in GHC.Core.Opt.Arity)b+ - At the occurrence (j 20) that arity-4 ArityType will leave an arity-3+ result.++3. All this, even though j's /join-arity/ (stored in the JoinId) is 1.+ This is is the Main Reason that we want the idArity to sometimes be+ larger than the join-arity c.f. Note [Invariants on join points] item 2b+ in GHC.Core.++4. Be very careful of things like this (#21755):+ g x = let j 0 = \y -> (x,y)+ j n = expensive n `seq` j (n-1)+ in j x+ Here we do /not/ want eta-expand `g`, lest we duplicate all those+ (expensive n) calls.++ But it's fine: the findRhsArity fixpoint calculation will compute arity-1+ for `j` (not arity 2); and that's just what we want. But we do need that+ fixpoint.++ Historical note: an earlier version of GHC did a hack in which we gave+ join points an ArityType of ABot, but that did not work with this #21755+ case.++5. arityType does not usually expect to encounter free join points;+ see GHC.Core.Opt.Arity Note [No free join points in arityType].+ But consider+ f x = join j1 y = .... in+ joinrec j2 z = ...j1 y... in+ j2 v++ When doing findRhsArity on `j2` we'll encounter the free `j1`.+ But that is fine, because we aren't going to eta-expand `j2`;+ we just want to know its arity. So we have a flag am_no_eta,+ switched on when doing findRhsArity on a join point RHS. If+ the flag is on, we allow free join points, but not otherwise.+++Note [Arity for non-recursive join bindings]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+Note [Arity for recursive join bindings] deals with recursive join+bindings. But what about /non-recursive/ones? If we just call+findRhsArity, it will call arityType. And that can be expensive when+we have deeply nested join points:+ join j1 x1 = join j2 x2 = join j3 x3 = blah3+ in blah2+ in blah1+(e.g. test T18698b).++So we call cheapArityType instead. It's good enough for practical+purposes.++(Side note: maybe we should use cheapArity for the RHS of let bindings+in the main arityType function.) -} @@ -1112,14 +1238,15 @@ floatIn IsExpensive at = addWork at addWork :: ArityType -> ArityType+-- Add work to the outermost level of the arity type addWork at@(AT lams div) = case lams of [] -> at lam:lams' -> AT (add_work lam : lams') div- where- add_work :: ATLamInfo -> ATLamInfo- add_work (_,os) = (IsExpensive,os) +add_work :: ATLamInfo -> ATLamInfo+add_work (_,os) = (IsExpensive,os)+ arityApp :: ArityType -> Cost -> ArityType -- Processing (fun arg) where at is the ArityType of fun, -- Knock off an argument and behave like 'let'@@ -1130,56 +1257,97 @@ -- See the haddocks on 'ArityType' for the lattice. -- -- Used for branches of a @case@.-andArityType :: ArityType -> ArityType -> ArityType-andArityType (AT (lam1:lams1) div1) (AT (lam2:lams2) div2)- | AT lams' div' <- andArityType (AT lams1 div1) (AT lams2 div2)- = AT ((lam1 `and_lam` lam2) : lams') div' -- See Note [Combining case branches]+andArityType :: ArityEnv -> ArityType -> ArityType -> ArityType+andArityType env (AT (lam1:lams1) div1) (AT (lam2:lams2) div2)+ | AT lams' div' <- andArityType env (AT lams1 div1) (AT lams2 div2)+ = AT ((lam1 `and_lam` lam2) : lams') div' where (ch1,os1) `and_lam` (ch2,os2) = ( ch1 `addCost` ch2, os1 `bestOneShot` os2)+ -- bestOneShot: see Note [Combining case branches: optimistic one-shot-ness] -andArityType (AT [] div1) at2 = andWithTail div1 at2-andArityType at1 (AT [] div2) = andWithTail div2 at1+andArityType env (AT [] div1) at2 = andWithTail env div1 at2+andArityType env at1 (AT [] div2) = andWithTail env div2 at1 -andWithTail :: Divergence -> ArityType -> ArityType-andWithTail div1 at2@(AT oss2 _)- | isDeadEndDiv div1 -- case x of { T -> error; F -> \y.e }- = at2+andWithTail :: ArityEnv -> Divergence -> ArityType -> ArityType+andWithTail env div1 at2@(AT lams2 _)+ | isDeadEndDiv div1 -- case x of { T -> error; F -> \y.e }+ = at2 -- See Note+ | pedanticBottoms env -- [Combining case branches: andWithTail]+ = AT [] topDiv+ | otherwise -- case x of { T -> plusInt <expensive>; F -> \y.e }- = addWork (AT oss2 topDiv) -- We know div1 = topDiv- -- Note [ABot branches: max arity wins]- -- See Note [Combining case branches]+ = AT (map add_work lams2) topDiv -- We know div1 = topDiv+ -- See Note [Combining case branches: andWithTail] -{- Note [ABot branches: max arity wins]-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Consider case x of- True -> \x. error "urk"- False -> \xy. error "urk2"+{- Note [Combining case branches: optimistic one-shot-ness]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+When combining the ArityTypes for two case branches (with+andArityType) and both ArityTypes have ATLamInfo, then we just combine+their expensive-ness and one-shot info. The tricky point is when we+have -Remember: \o1..on.⊥ means "if you apply to n args, it'll definitely diverge".-So we need \??.⊥ for the whole thing, the /max/ of both arities.+ case x of True -> \x{one-shot). blah1+ Fale -> \y. blah2 -Note [Combining case branches]-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Consider+Since one-shot-ness is about the /consumer/ not the /producer/, we+optimistically assume that if either branch is one-shot, we combine+the best of the two branches, on the (slightly dodgy) basis that if we+know one branch is one-shot, then they all must be. Surprisingly,+this means that the one-shot arity type is effectively the top element+of the lattice.++Hence the call to `bestOneShot` in `andArityType`.++Here's an example: go = \x. let z = go e0 go2 = \x. case x of True -> z False -> \s(one-shot). e1 in go2 x+ We *really* want to respect the one-shot annotation provided by the-user and eta-expand go and go2.-When combining the branches of the case we have- T `andAT` \1.T-and we want to get \1.T.-But if the inner lambda wasn't one-shot (\?.T) we don't want to do this.-(We need a usage analysis to justify that.)+user and eta-expand go and go2. In the first fixpoint iteration of+'go' we'll bind 'go' to botArityType (written \.⊥, see Note+[ArityType]). So 'z' will get arityType \.⊥; so we end up combining+the True and False branches: -So we combine the best of the two branches, on the (slightly dodgy)-basis that if we know one branch is one-shot, then they all must be.-Surprisingly, this means that the one-shot arity type is effectively the top-element of the lattice.+ \.⊥ `andArityType` \1.T +That gives \1.T (see Note [Combining case branches: andWithTail],+first bullet). So 'go2' gets an arityType of \(C?)(C1).T, which is+what we want.++Note [Combining case branches: andWithTail]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+When combining the ArityTypes for two case branches (with andArityType)+and one side or the other has run out of ATLamInfo; then we get+into `andWithTail`.++* If one branch is guaranteed bottom (isDeadEndDiv), we just take+ the other. Consider case x of+ True -> \x. error "urk"+ False -> \xy. error "urk2"++ Remember: \o1..on.⊥ means "if you apply to n args, it'll definitely+ diverge". So we need \??.⊥ for the whole thing, the /max/ of both+ arities.++* Otherwise, if pedantic-bottoms is on, we just have to return+ AT [] topDiv. E.g. if we have+ f x z = case x of True -> \y. blah+ False -> z+ then we can't eta-expand, because that would change the behaviour+ of (f False bottom().++* But if pedantic-bottoms is not on, we allow ourselves to push+ `z` under a lambda (much as we allow ourselves to put the `case x`+ under a lambda). However we know nothing about the expensiveness+ or one-shot-ness of `z`, so we'd better assume it looks like+ (Expensive, NoOneShotInfo) all the way. Remembering+ Note [Combining case branches: optimistic one-shot-ness],+ we just add work to ever ATLamInfo, keeping the one-shot-ness.+ Note [Eta expanding through CallStacks] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Just as it's good to eta-expand through dictionaries, so it is good to@@ -1213,71 +1381,37 @@ --------------------------- --- | Each of the entry-points of the analyser ('arityType') has different--- requirements. The entry-points are------ 1. 'exprBotStrictness_maybe'--- 2. 'exprEtaExpandArity'--- 3. 'findRhsArity'------ For each of the entry-points, there is a separate mode that governs------ 1. How pedantic we are wrt. ⊥, in 'pedanticBottoms'.--- 2. Whether we store arity signatures for non-recursive let-bindings,--- accessed in 'extendSigEnv'/'lookupSigEnv'.--- See Note [Arity analysis] why that's important.--- 3. Which expressions we consider cheap to float inside a lambda,--- in 'myExprIsCheap'.-data AnalysisMode- = BotStrictness- -- ^ Used during 'exprBotStrictness_maybe'.-- | EtaExpandArity { am_opts :: !ArityOpts }- -- ^ Used for finding an expression's eta-expanding arity quickly,- -- without fixed-point iteration ('exprEtaExpandArity').-- | FindRhsArity { am_opts :: !ArityOpts- , am_sigs :: !(IdEnv SafeArityType) }- -- ^ Used for regular, fixed-point arity analysis ('findRhsArity').- -- See Note [Arity analysis] for details about fixed-point iteration.- -- am_dicts_cheap: see Note [Eta expanding through dictionaries]- -- am_sigs: note `SafeArityType` so we can use this in myIsCheapApp- -- INVARIANT: am_sigs is disjoint with 'ae_joins'.- data ArityEnv- = AE- { ae_mode :: !AnalysisMode- -- ^ The analysis mode. See 'AnalysisMode'.- , ae_joins :: !IdSet- -- ^ In-scope join points. See Note [Eta-expansion and join points]- -- INVARIANT: Disjoint with the domain of 'am_sigs' (if present).- }+ = AE { am_opts :: !ArityOpts --- | The @ArityEnv@ used by 'exprBotStrictness_maybe'. Pedantic about bottoms--- and no application is ever considered cheap.-botStrictnessArityEnv :: ArityEnv-botStrictnessArityEnv = AE { ae_mode = BotStrictness, ae_joins = emptyVarSet }+ , am_sigs :: !(IdEnv SafeArityType)+ -- NB `SafeArityType` so we can use this in myIsCheapApp+ -- See Note [Arity analysis] for details about fixed-point iteration. --- | The @ArityEnv@ used by 'exprEtaExpandArity'.-etaExpandArityEnv :: ArityOpts -> ArityEnv-etaExpandArityEnv opts- = AE { ae_mode = EtaExpandArity { am_opts = opts }- , ae_joins = emptyVarSet }+ , am_free_joins :: !Bool -- True <=> free join points allowed+ -- Used /only/ to support assertion checks+ } +instance Outputable ArityEnv where+ ppr (AE { am_sigs = sigs, am_free_joins = free_joins })+ = text "AE" <+> braces (sep [ text "free joins:" <+> ppr free_joins+ , text "sigs:" <+> ppr sigs ])+ -- | The @ArityEnv@ used by 'findRhsArity'.-findRhsArityEnv :: ArityOpts -> ArityEnv-findRhsArityEnv opts- = AE { ae_mode = FindRhsArity { am_opts = opts- , am_sigs = emptyVarEnv }- , ae_joins = emptyVarSet }+findRhsArityEnv :: ArityOpts -> Bool -> ArityEnv+findRhsArityEnv opts free_joins+ = AE { am_opts = opts+ , am_free_joins = free_joins+ , am_sigs = emptyVarEnv } +freeJoinsOK :: ArityEnv -> Bool+freeJoinsOK (AE { am_free_joins = free_joins }) = free_joins+ -- First some internal functions in snake_case for deleting in certain VarEnvs -- of the ArityType. Don't call these; call delInScope* instead! modifySigEnv :: (IdEnv ArityType -> IdEnv ArityType) -> ArityEnv -> ArityEnv-modifySigEnv f env@AE { ae_mode = am@FindRhsArity{am_sigs = sigs} } =- env { ae_mode = am { am_sigs = f sigs } }-modifySigEnv _ env = env+modifySigEnv f env@(AE { am_sigs = sigs }) = env { am_sigs = f sigs } {-# INLINE modifySigEnv #-} del_sig_env :: Id -> ArityEnv -> ArityEnv -- internal!@@ -1288,48 +1422,26 @@ del_sig_env_list ids = modifySigEnv (\sigs -> delVarEnvList sigs ids) {-# INLINE del_sig_env_list #-} -del_join_env :: JoinId -> ArityEnv -> ArityEnv -- internal!-del_join_env id env@(AE { ae_joins = joins })- = env { ae_joins = delVarSet joins id }-{-# INLINE del_join_env #-}--del_join_env_list :: [JoinId] -> ArityEnv -> ArityEnv -- internal!-del_join_env_list ids env@(AE { ae_joins = joins })- = env { ae_joins = delVarSetList joins ids }-{-# INLINE del_join_env_list #-}- -- end of internal deletion functions -extendJoinEnv :: ArityEnv -> [JoinId] -> ArityEnv-extendJoinEnv env@(AE { ae_joins = joins }) join_ids- = del_sig_env_list join_ids- $ env { ae_joins = joins `extendVarSetList` join_ids }- extendSigEnv :: ArityEnv -> Id -> SafeArityType -> ArityEnv extendSigEnv env id ar_ty- = del_join_env id $- modifySigEnv (\sigs -> extendVarEnv sigs id ar_ty) $+ = modifySigEnv (\sigs -> extendVarEnv sigs id ar_ty) $ env delInScope :: ArityEnv -> Id -> ArityEnv-delInScope env id = del_join_env id $ del_sig_env id env+delInScope env id = del_sig_env id env delInScopeList :: ArityEnv -> [Id] -> ArityEnv-delInScopeList env ids = del_join_env_list ids $ del_sig_env_list ids env+delInScopeList env ids = del_sig_env_list ids env lookupSigEnv :: ArityEnv -> Id -> Maybe SafeArityType-lookupSigEnv AE{ ae_mode = mode } id = case mode of- BotStrictness -> Nothing- EtaExpandArity{} -> Nothing- FindRhsArity{ am_sigs = sigs } -> lookupVarEnv sigs id+lookupSigEnv (AE { am_sigs = sigs }) id = lookupVarEnv sigs id -- | Whether the analysis should be pedantic about bottoms. -- 'exprBotStrictness_maybe' always is. pedanticBottoms :: ArityEnv -> Bool-pedanticBottoms AE{ ae_mode = mode } = case mode of- BotStrictness -> True- EtaExpandArity{ am_opts = ArityOpts{ ao_ped_bot = ped_bot } } -> ped_bot- FindRhsArity{ am_opts = ArityOpts{ ao_ped_bot = ped_bot } } -> ped_bot+pedanticBottoms (AE { am_opts = ArityOpts{ ao_ped_bot = ped_bot }}) = ped_bot exprCost :: ArityEnv -> CoreExpr -> Maybe Type -> Cost exprCost env e mb_ty@@ -1340,23 +1452,17 @@ -- and optionally the expression's type. -- Under 'exprBotStrictness_maybe', no expressions are cheap. myExprIsCheap :: ArityEnv -> CoreExpr -> Maybe Type -> Bool-myExprIsCheap AE{ae_mode = mode} e mb_ty = case mode of- BotStrictness -> False- _ -> cheap_dict || cheap_fun e- where- cheap_dict = case mb_ty of+myExprIsCheap (AE { am_opts = opts, am_sigs = sigs }) e mb_ty+ = cheap_dict || cheap_fun e+ where+ cheap_dict = case mb_ty of Nothing -> False- Just ty -> (ao_dicts_cheap (am_opts mode) && isDictTy ty)+ Just ty -> (ao_dicts_cheap opts && isDictTy ty) || isCallStackPredTy ty -- See Note [Eta expanding through dictionaries] -- See Note [Eta expanding through CallStacks] - cheap_fun e = case mode of-#if __GLASGOW_HASKELL__ <= 900- BotStrictness -> panic "impossible"-#endif- EtaExpandArity{} -> exprIsCheap e- FindRhsArity{am_sigs = sigs} -> exprIsCheapX (myIsCheapApp sigs) e+ cheap_fun e = exprIsCheapX (myIsCheapApp sigs) e -- | A version of 'isCheapApp' that considers results from arity analysis. -- See Note [Arity analysis] for what's in the signature environment and why@@ -1369,6 +1475,8 @@ Nothing -> isCheapApp fn n_val_args -- `Just at` means local function with `at` as current SafeArityType.+ -- NB the SafeArityType bit: that means we can ignore the cost flags+ -- in 'lams', and just consider the length -- Roughly approximate what 'isCheapApp' is doing. Just (AT lams div) | isDeadEndDiv div -> True -- See Note [isCheapApp: bottoming functions] in GHC.Core.Utils@@ -1377,15 +1485,21 @@ | otherwise -> False -----------------arityType :: ArityEnv -> CoreExpr -> ArityType-+arityType :: HasDebugCallStack => ArityEnv -> CoreExpr -> ArityType+-- Precondition: all the free join points of the expression+-- are bound by the ArityEnv+-- See Note [No free join points in arityType]+--+-- Returns ArityType, not SafeArityType. The caller must do+-- trimArityType if necessary. arityType env (Var v)- | v `elemVarSet` ae_joins env- = botArityType -- See Note [Eta-expansion and join points] | Just at <- lookupSigEnv env v -- Local binding = at | otherwise- = idArityType v+ = assertPpr (freeJoinsOK env || not (isJoinId v)) (ppr v) $+ -- All join-point should be in the ae_sigs+ -- See Note [No free join points in arityType]+ idArityType v arityType env (Cast e _) = arityType env e@@ -1430,51 +1544,238 @@ where env' = delInScope env bndr arity_type_alt (Alt _con bndrs rhs) = arityType (delInScopeList env' bndrs) rhs- alts_type = foldr1 andArityType (map arity_type_alt alts)--arityType env (Let (NonRec j rhs) body)- | Just join_arity <- isJoinId_maybe j- , (_, rhs_body) <- collectNBinders join_arity rhs- = -- See Note [Eta-expansion and join points]- andArityType (arityType env rhs_body)- (arityType env' body)- where- env' = extendJoinEnv env [j]--arityType env (Let (Rec pairs) body)- | ((j,_):_) <- pairs- , isJoinId j- = -- See Note [Eta-expansion and join points]- foldr (andArityType . do_one) (arityType env' body) pairs- where- env' = extendJoinEnv env (map fst pairs)- do_one (j,rhs)- | Just arity <- isJoinId_maybe j- = arityType env' $ snd $ collectNBinders arity rhs- | otherwise- = pprPanic "arityType:joinrec" (ppr pairs)+ alts_type = foldr1 (andArityType env) (map arity_type_alt alts) arityType env (Let (NonRec b rhs) e)- = floatIn rhs_cost (arityType env' e)+ = -- See Note [arityType for non-recursive let-bindings]+ floatIn rhs_cost (arityType env' e) where rhs_cost = exprCost env rhs (Just (idType b)) env' = extendSigEnv env b (safeArityType (arityType env rhs)) arityType env (Let (Rec prs) e)- = floatIn (allCosts bind_cost prs) (arityType env' e)+ = -- See Note [arityType for recursive let-bindings]+ floatIn (allCosts bind_cost prs) (arityType env' e) where- env' = delInScopeList env (map fst prs) bind_cost (b,e) = exprCost env' e (Just (idType b))+ env' = foldl extend_rec env prs+ extend_rec :: ArityEnv -> (Id,CoreExpr) -> ArityEnv+ extend_rec env (b,_) = extendSigEnv env b $+ idArityType b+ -- See Note [arityType for recursive let-bindings] arityType env (Tick t e) | not (tickishIsCode t) = arityType env e arityType _ _ = topArityType -{- Note [Eta-expansion and join points]+--------------------+idArityType :: Id -> ArityType+idArityType v+ | strict_sig <- idDmdSig v+ , (ds, div) <- splitDmdSig strict_sig+ , isDeadEndDiv div+ = AT (takeList ds one_shots) div++ | isEmptyTy id_ty+ = botArityType++ | otherwise+ = AT (take (idArity v) one_shots) topDiv+ where+ id_ty = idType v++ one_shots :: [(Cost,OneShotInfo)] -- One-shot-ness derived from the type+ one_shots = repeat IsCheap `zip` typeOneShots id_ty++--------------------+cheapArityType :: HasDebugCallStack => CoreExpr -> ArityType+-- A fast and cheap version of arityType.+-- Returns an ArityType with IsCheap everywhere+-- c.f. GHC.Core.Utils.exprIsDeadEnd+--+-- /Can/ encounter a free join-point Id; e.g. via the call+-- in exprBotStrictness_maybe, which is called in lots+-- of places+--+-- Returns ArityType, not SafeArityType. The caller must do+-- trimArityType if necessary.+cheapArityType e = go e+ where+ go (Var v) = idArityType v+ go (Cast e _) = go e+ go (Lam x e) | isId x = arityLam x (go e)+ | otherwise = go e+ go (App e a) | isTypeArg a = go e+ | otherwise = arity_app a (go e)++ go (Tick t e) | not (tickishIsCode t) = go e++ -- Null alts: see Note [Empty case alternatives] in GHC.Core+ go (Case _ _ _ alts) | null alts = botArityType++ -- Give up on let, case. In particular, unlike arityType,+ -- we make no attempt to look inside let's.+ go _ = topArityType++ -- Specialised version of arityApp; all costs in ArityType are IsCheap+ -- See Note [exprArity for applications]+ -- NB: (1) coercions count as a value argument+ -- (2) we use the super-cheap exprIsTrivial rather than the+ -- more complicated and expensive exprIsCheap+ arity_app _ at@(AT [] _) = at+ arity_app arg at@(AT ((cost,_):lams) div)+ | assertPpr (cost == IsCheap) (ppr at $$ ppr arg) $+ isDeadEndDiv div = AT lams div+ | exprIsTrivial arg = AT lams topDiv+ | otherwise = topArityType++---------------+exprArity :: CoreExpr -> Arity+-- ^ An approximate, even faster, version of 'cheapArityType'+-- Roughly exprArity e = arityTypeArity (cheapArityType e)+-- But it's a bit less clever about bottoms+--+-- We do /not/ guarantee that exprArity e <= typeArity e+-- You may need to do arity trimming after calling exprArity+-- See Note [Arity trimming]+-- Reason: if we do arity trimming here we have take exprType+-- and that can be expensive if there is a large cast+exprArity e = go e+ where+ go (Var v) = idArity v+ go (Lam x e) | isId x = go e + 1+ | otherwise = go e+ go (Tick t e) | not (tickishIsCode t) = go e+ go (Cast e _) = go e+ go (App e (Type _)) = go e+ go (App f a) | exprIsTrivial a = (go f - 1) `max` 0+ -- See Note [exprArity for applications]+ -- NB: coercions count as a value argument++ go _ = 0++---------------+exprIsDeadEnd :: CoreExpr -> Bool+-- See Note [Bottoming expressions]+-- This function is, in effect, just a specialised (and hence cheap)+-- version of cheapArityType:+-- exprIsDeadEnd e = case cheapArityType e of+-- AT lams div -> null lams && isDeadEndDiv div+-- See also exprBotStrictness_maybe, which uses cheapArityType+exprIsDeadEnd e+ = go 0 e+ where+ go :: Arity -> CoreExpr -> Bool+ -- (go n e) = True <=> expr applied to n value args is bottom+ go _ (Lit {}) = False+ go _ (Type {}) = False+ go _ (Coercion {}) = False+ go n (App e a) | isTypeArg a = go n e+ | otherwise = go (n+1) e+ go n (Tick _ e) = go n e+ go n (Cast e _) = go n e+ go n (Let _ e) = go n e+ go n (Lam v e) | isTyVar v = go n e+ | otherwise = False++ go _ (Case _ _ _ alts) = null alts+ -- See Note [Empty case alternatives] in GHC.Core++ go n (Var v) | isDeadEndAppSig (idDmdSig v) n = True+ | isEmptyTy (idType v) = True+ | otherwise = False++{- Note [Bottoming expressions]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+A bottoming expression is guaranteed to diverge, or raise an+exception. We can test for it in two different ways, and exprIsDeadEnd+checks for both of these situations:++* Visibly-bottom computations. For example+ (error Int "Hello")+ is visibly bottom. The strictness analyser also finds out if+ a function diverges or raises an exception, and puts that info+ in its strictness signature.++* Empty types. If a type is empty, its only inhabitant is bottom.+ For example:+ data T+ f :: T -> Bool+ f = \(x:t). case x of Bool {}+ Since T has no data constructors, the case alternatives are of course+ empty. However note that 'x' is not bound to a visibly-bottom value;+ it's the *type* that tells us it's going to diverge.++A GADT may also be empty even though it has constructors:+ data T a where+ T1 :: a -> T Bool+ T2 :: T Int+ ...(case (x::T Char) of {})...+Here (T Char) is uninhabited. A more realistic case is (Int ~ Bool),+which is likewise uninhabited.++Note [No free join points in arityType] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Consider this (#18328)+Suppose we call arityType on this expression (EX1)+ \x . case x of True -> \y. e+ False -> $j 3+where $j is a join point. It really makes no sense to talk of the arity+of this expression, because it has a free join point. In particular, we+can't eta-expand the expression because we'd have do the same thing to the+binding of $j, and we can't see that binding. +If we had (EX2)+ \x. join $j y = blah+ case x of True -> \y. e+ False -> $j 3+then it would make perfect sense: we can determine $j's ArityType, and+propagate it to the usage site as usual.++But how can we get (EX1)? It doesn't make much sense, because $j can't+be a join point under the \x anyway. So we make it a precondition of+arityType that the argument has no free join-point Ids. (This is checked+with an assert in the Var case of arityType.)++Wrinkles++* We /do/ allow free join point when doing findRhsArity for join-point+ right-hand sides. See Note [Arity for recursive join bindings]+ point (5) in GHC.Core.Opt.Simplify.Utils.++* The invariant (no free join point in arityType) risks being+ invalidated by one very narrow special case: runRW#++ join $j y = blah+ runRW# (\s. case x of True -> \y. e+ False -> $j x)++ We have special magic in OccurAnal, and Simplify to allow continuations to+ move into the body of a runRW# call.++ So we are careful never to attempt to eta-expand the (\s.blah) in the+ argument to runRW#, at least not when there is a literal lambda there,+ so that OccurAnal has seen it and allowed join points bound outside.+ See Note [No eta-expansion in runRW#] in GHC.Core.Opt.Simplify.Iteration.++Note [arityType for non-recursive let-bindings]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+For non-recursive let-bindings, we just get the arityType of the RHS,+and extend the environment. That works nicely for things like this+(#18793):+ go = \ ds. case ds_a2CF of {+ [] -> id+ : y ys -> case y of { GHC.Types.I# x ->+ let acc = go ys in+ case x ># 42# of {+ __DEFAULT -> acc+ 1# -> \x1. acc (negate x2)++Here we want to get a good arity for `acc`, based on the ArityType+of `go`.++All this is particularly important for join points. Consider this (#18328)+ f x = join j y = case y of True -> \a. blah False -> \b. blah@@ -1486,58 +1787,32 @@ and suppose the join point is too big to inline. Now, what is the arity of f? If we inlined the join point, we'd definitely say "arity 2" because we are prepared to push case-scrutinisation inside a-lambda. But currently the join point totally messes all that up,-because (thought of as a vanilla let-binding) the arity pinned on 'j'-is just 1.--Why don't we eta-expand j? Because of-Note [Do not eta-expand join points] in GHC.Core.Opt.Simplify.Utils--Even if we don't eta-expand j, why is its arity only 1?-See invariant 2b in Note [Invariants on join points] in GHC.Core.--So we do this:--* Treat the RHS of a join-point binding, /after/ stripping off- join-arity lambda-binders, as very like the body of the let.- More precisely, do andArityType with the arityType from the- body of the let.--* Dually, when we come to a /call/ of a join point, just no-op- by returning ABot, the bottom element of ArityType,- which so that: bot `andArityType` x = x+lambda. It's important that we extend the envt with j's ArityType, so+that we can use that information in the A/C branch of the case. -* This works if the join point is bound in the expression we are- taking the arityType of. But if it's bound further out, it makes- no sense to say that (say) the arityType of (j False) is ABot.- Bad things happen. So we keep track of the in-scope join-point Ids- in ae_join.+Note [arityType for recursive let-bindings]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+For /recursive/ bindings it's more difficult, to call arityType+(as we do in Note [arityType for non-recursive let-bindings])+because we don't have an ArityType to put in the envt for the+recursively bound Ids. So for we satisfy ourselves with whizzing up+up an ArityType from the idArity of the function, via idArityType. -This will make f, above, have arity 2. Then, we'll eta-expand it thus:+That is nearly equivalent to deleting the binder from the envt, at+which point we'll call idArityType at the occurrences. But doing it+here means - f x eta = (join j y = ... in case x of ...) eta+ (a) we only call idArityType once, no matter how many+ occurrences, and -and the Simplify will automatically push that application of eta into-the join points.+ (b) we can check (in the arityType (Var v) case) that+ we don't mention free join-point Ids. See+ Note [No free join points in arityType]. -An alternative (roughly equivalent) idea would be to carry an-environment mapping let-bound Ids to their ArityType.+But see Note [Arity for recursive join bindings] in+GHC.Core.Opt.Simplify.Utils for dark corners. -} -idArityType :: Id -> ArityType-idArityType v- | strict_sig <- idDmdSig v- , not $ isNopSig strict_sig- , (ds, div) <- splitDmdSig strict_sig- , let arity = length ds- -- Every strictness signature admits an arity signature!- = AT (take arity one_shots) div- | otherwise- = AT (take (idArity v) one_shots) topDiv- where- one_shots :: [(Cost,OneShotInfo)] -- One-shot-ness derived from the type- one_shots = repeat IsCheap `zip` typeOneShots (idType v)- {- %************************************************************************ %* *@@ -1782,7 +2057,7 @@ Note [Check for reflexive casts in eta expansion] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-It turns out that the casts created by teh above mechanism are often Refl.+It turns out that the casts created by the above mechanism are often Refl. When casts are very deeply nested (as happens in #18223), the repetition of types can make the overall term very large. So there is a big payoff in cancelling out casts aggressively wherever possible.@@ -1877,7 +2152,7 @@ where (subst1, b1) = Core.substBndr subst b alts' = map subst_alt alts- ty' = etaInfoAppTy (Core.substTy subst ty) eis+ ty' = etaInfoAppTy (substTyUnchecked subst ty) eis subst_alt (Alt con bs rhs) = Alt con bs' (go subst2 rhs eis) where (subst2,bs') = Core.substBndrs subst1 bs@@ -1940,18 +2215,18 @@ mkEtaWW orig_oss ppr_orig_expr in_scope orig_ty = go 0 orig_oss empty_subst orig_ty where- empty_subst = mkEmptyTCvSubst in_scope+ empty_subst = mkEmptySubst in_scope go :: Int -- For fresh names -> [OneShotInfo] -- Number of value args to expand to- -> TCvSubst -> Type -- We are really looking at subst(ty)+ -> Subst -> Type -- We are really looking at subst(ty) -> (InScopeSet, EtaInfo) -- (go [o1,..,on] subst ty) = (in_scope, EI [b1,..,bn] co) -- co :: subst(ty) ~ b1_ty -> ... -> bn_ty -> tr go _ [] subst _ ----------- Done! No more expansion needed- = (getTCvInScope subst, EI [] MRefl)+ = (getSubstInScope subst, EI [] MRefl) go n oss@(one_shot:oss1) subst ty ----------- Forall types (forall a. ty)@@ -1998,7 +2273,7 @@ -- but its type isn't a function, or a binder -- does not have a fixed runtime representation = warnPprTrace True "mkEtaWW" ((ppr orig_oss <+> ppr orig_ty) $$ ppr_orig_expr)- (getTCvInScope subst, EI [] MRefl)+ (getSubstInScope subst, EI [] MRefl) -- This *can* legitimately happen: -- e.g. coerce Int (\x. x) Essentially the programmer is -- playing fast and loose with types (Happy does this a lot).@@ -2846,12 +3121,12 @@ = pprPanic "etaBodyForJoinPoint" $ int need_args $$ ppr body $$ ppr (exprType body) - init_subst e = mkEmptyTCvSubst (mkInScopeSet (exprFreeVars e))+ init_subst e = mkEmptySubst (mkInScopeSet (exprFreeVars e)) ---------------freshEtaId :: Int -> TCvSubst -> Scaled Type -> (TCvSubst, Id)+freshEtaId :: Int -> Subst -> Scaled Type -> (Subst, Id) -- Make a fresh Id, with specified type (after applying substitution) -- It should be "fresh" in the sense that it's not in the in-scope set -- of the TvSubstEnv; and it should itself then be added to the in-scope@@ -2863,8 +3138,8 @@ = (subst', eta_id') where Scaled mult' ty' = Type.substScaledTyUnchecked subst ty- eta_id' = uniqAway (getTCvInScope subst) $+ eta_id' = uniqAway (getSubstInScope subst) $ mkSysLocalOrCoVar (fsLit "eta") (mkBuiltinUnique n) mult' ty' -- "OrCoVar" since this can be used to eta-expand -- coercion abstractions- subst' = extendTCvInScope subst eta_id'+ subst' = extendSubstInScope subst eta_id'
compiler/GHC/Core/Opt/ConstantFold.hs view
@@ -34,7 +34,7 @@ import GHC.Platform -import GHC.Types.Id.Make ( voidPrimId )+import GHC.Types.Id.Make ( unboxedUnitExpr ) import GHC.Types.Id import GHC.Types.Literal import GHC.Types.Name.Occurrence ( occNameFS )@@ -2107,7 +2107,7 @@ let ret n v = pure $ mkCoreUbxSum 2 n [unboxedUnitTy,naturalTy] v platform <- getPlatform if x < y- then ret 1 $ Var voidPrimId+ then ret 1 unboxedUnitExpr else ret 2 $ mkNaturalExpr platform (x - y) -- unary operations
compiler/GHC/Core/Opt/Simplify.hs view
@@ -153,7 +153,7 @@ , mg_binds = binds, mg_rules = rules , mg_fam_inst_env = fam_inst_env }) = do { (termination_msg, it_count, counts_out, guts')- <- do_iteration 1 [] binds rules+ <- do_iteration 1 [] binds rules ; when (logHasDumpFlag logger Opt_D_verbose_core2core && logHasDumpFlag logger Opt_D_dump_simpl_stats) $@@ -175,6 +175,9 @@ print_unqual = mkPrintUnqualified unit_env rdr_env active_rule = activeRule mode active_unf = activeUnfolding mode+ -- Note the bang in !guts_no_binds. If you don't force `guts_no_binds`+ -- the old bindings are retained until the end of all simplifier iterations+ !guts_no_binds = guts { mg_binds = [], mg_rules = [] } do_iteration :: Int -- Counts iterations -> [SimplCount] -- Counts from earlier iterations, reversed@@ -198,7 +201,7 @@ -- number of iterations we actually completed return ( "Simplifier baled out", iteration_no - 1 , totalise counts_so_far- , guts { mg_binds = binds, mg_rules = rules } )+ , guts_no_binds { mg_binds = binds, mg_rules = rules } ) -- Try and force thunks off the binds; significantly reduces -- space usage, especially with -O. JRS, 000620.@@ -253,7 +256,7 @@ if isZeroSimplCount counts1 then return ( "Simplifier reached fixed point", iteration_no , totalise (counts1 : counts_so_far) -- Include "free" ticks- , guts { mg_binds = binds1, mg_rules = rules1 } )+ , guts_no_binds { mg_binds = binds1, mg_rules = rules1 } ) else do { -- Short out indirections -- We do this *after* at least one run of the simplifier
compiler/GHC/Core/Opt/Simplify/Env.hs view
@@ -30,7 +30,7 @@ -- * Simplifying 'Id' binders simplNonRecBndr, simplNonRecJoinBndr, simplRecBndrs, simplRecJoinBndrs, simplBinder, simplBinders,- substTy, substTyVar, getTCvSubst,+ substTy, substTyVar, getSubst, substCo, substCoVar, -- * Floats@@ -60,6 +60,7 @@ import GHC.Core.Utils import GHC.Core.Multiplicity ( scaleScaled ) import GHC.Core.Unfold+import GHC.Core.TyCo.Subst (emptyIdSubstEnv) import GHC.Types.Var import GHC.Types.Var.Env import GHC.Types.Var.Set@@ -368,7 +369,7 @@ | otherwise = ppr v type SimplIdSubst = IdEnv SimplSR -- IdId |--> OutExpr- -- See Note [Extending the Subst] in GHC.Core.Subst+ -- See Note [Extending the IdSubstEnv] in GHC.Core.Subst -- | A substitution result. data SimplSR@@ -1223,34 +1224,34 @@ ************************************************************************ -} -getTCvSubst :: SimplEnv -> TCvSubst-getTCvSubst (SimplEnv { seInScope = in_scope, seTvSubst = tv_env+getSubst :: SimplEnv -> Subst+getSubst (SimplEnv { seInScope = in_scope, seTvSubst = tv_env , seCvSubst = cv_env })- = mkTCvSubst in_scope (tv_env, cv_env)+ = mkSubst in_scope tv_env cv_env emptyIdSubstEnv substTy :: HasDebugCallStack => SimplEnv -> Type -> Type-substTy env ty = Type.substTy (getTCvSubst env) ty+substTy env ty = Type.substTy (getSubst env) ty substTyVar :: SimplEnv -> TyVar -> Type-substTyVar env tv = Type.substTyVar (getTCvSubst env) tv+substTyVar env tv = Type.substTyVar (getSubst env) tv substTyVarBndr :: SimplEnv -> TyVar -> (SimplEnv, TyVar) substTyVarBndr env tv- = case Type.substTyVarBndr (getTCvSubst env) tv of- (TCvSubst in_scope' tv_env' cv_env', tv')+ = case Type.substTyVarBndr (getSubst env) tv of+ (Subst in_scope' _ tv_env' cv_env', tv') -> (env { seInScope = in_scope', seTvSubst = tv_env', seCvSubst = cv_env' }, tv') substCoVar :: SimplEnv -> CoVar -> Coercion-substCoVar env tv = Coercion.substCoVar (getTCvSubst env) tv+substCoVar env tv = Coercion.substCoVar (getSubst env) tv substCoVarBndr :: SimplEnv -> CoVar -> (SimplEnv, CoVar) substCoVarBndr env cv- = case Coercion.substCoVarBndr (getTCvSubst env) cv of- (TCvSubst in_scope' tv_env' cv_env', cv')+ = case Coercion.substCoVarBndr (getSubst env) cv of+ (Subst in_scope' _ tv_env' cv_env', cv') -> (env { seInScope = in_scope', seTvSubst = tv_env', seCvSubst = cv_env' }, cv') substCo :: SimplEnv -> Coercion -> Coercion-substCo env co = Coercion.substCo (getTCvSubst env) co+substCo env co = Coercion.substCo (getSubst env) co ------------------ substIdType :: SimplEnv -> Id -> Id@@ -1264,6 +1265,6 @@ -- in a Note in the id's type itself where no_free_vars = noFreeVarsOfType old_ty && noFreeVarsOfType old_w- subst = TCvSubst in_scope tv_env cv_env+ subst = Subst in_scope emptyIdSubstEnv tv_env cv_env old_ty = idType id old_w = varMult id
compiler/GHC/Core/Opt/Simplify/Iteration.hs view
@@ -38,8 +38,8 @@ import GHC.Core.Unfold import GHC.Core.Unfold.Make import GHC.Core.Utils-import GHC.Core.Opt.Arity ( ArityType, exprArity, getBotArity- , pushCoTyArg, pushCoValArg+import GHC.Core.Opt.Arity ( ArityType, exprArity, arityTypeBotSigs_maybe+ , pushCoTyArg, pushCoValArg, exprIsDeadEnd , typeArity, arityTypeArity, etaExpandAT ) import GHC.Core.SimpleOpt ( exprIsConApp_maybe, joinPointBinding_maybe, joinPointBindings_maybe ) import GHC.Core.FVs ( mkRuleInfo )@@ -53,7 +53,6 @@ import GHC.Types.Id.Info import GHC.Types.Name ( mkSystemVarName, isExternalName, getOccFS ) import GHC.Types.Demand-import GHC.Types.Cpr ( mkCprSig, botCpr ) import GHC.Types.Unique ( hasKey ) import GHC.Types.Basic import GHC.Types.Tickish@@ -301,8 +300,8 @@ | otherwise = case bind_cxt of- BC_Join cont -> simplTrace "SimplBind:join" (ppr old_bndr) $- simplJoinBind env cont old_bndr new_bndr rhs env+ BC_Join is_rec cont -> simplTrace "SimplBind:join" (ppr old_bndr) $+ simplJoinBind env is_rec cont old_bndr new_bndr rhs env BC_Let top_lvl is_rec -> simplTrace "SimplBind:normal" (ppr old_bndr) $ simplLazyBind env top_lvl is_rec old_bndr new_bndr rhs env@@ -385,16 +384,17 @@ -------------------------- simplJoinBind :: SimplEnv+ -> RecFlag -> SimplCont -> InId -> OutId -- Binder, both pre-and post simpl -- The OutId has IdInfo, except arity, -- unfolding -> InExpr -> SimplEnv -- The right hand side and its env -> SimplM (SimplFloats, SimplEnv)-simplJoinBind env cont old_bndr new_bndr rhs rhs_se+simplJoinBind env is_rec cont old_bndr new_bndr rhs rhs_se = do { let rhs_env = rhs_se `setInScopeFromE` env ; rhs' <- simplJoinRhs rhs_env old_bndr rhs cont- ; completeBind env (BC_Join cont) old_bndr new_bndr rhs' }+ ; completeBind env (BC_Join is_rec cont) old_bndr new_bndr rhs' } -------------------------- simplNonRecX :: SimplEnv@@ -634,7 +634,8 @@ floats' = floats `extendFloats` NonRec bndr' triv_rhs ; return ( floats', setInScopeFromF env floats' ) } } where- occ_fs = getOccFS bndr+ -- Force the occ_fs so that the old Id is not retained in the new Id.+ !occ_fs = getOccFS bndr uf_opts = seUnfoldingOpts env work_ty = coercionLKind co info = idInfo bndr@@ -711,9 +712,11 @@ -- rhs_env: add to in-scope set the binders from rhs_floats -- so that prepareRhs knows what is in scope in rhs ; let rhs_env = env `setInScopeFromF` rhs_floats1+ -- Force the occ_fs so that the old Id is not retained in the new Id.+ !occ_fs = getOccFS bndr -- Now ANF-ise the remaining rhs- ; (anf_floats, rhs2) <- prepareRhs rhs_env top_lvl (getOccFS bndr) rhs1+ ; (anf_floats, rhs2) <- prepareRhs rhs_env top_lvl occ_fs rhs1 -- Finally, decide whether or not to float ; let all_floats = rhs_floats1 `addLetFloats` anf_floats@@ -979,11 +982,11 @@ = info2 -- Bottoming bindings: see Note [Bottoming bindings]- info4 = case getBotArity new_arity_type of+ info4 = case arityTypeBotSigs_maybe new_arity_type of Nothing -> info3- Just ar -> assert (ar == new_arity) $- info3 `setDmdSigInfo` mkVanillaDmdSig new_arity botDiv- `setCprSigInfo` mkCprSig new_arity botCpr+ Just (ar, str_sig, cpr_sig) -> assert (ar == new_arity) $+ info3 `setDmdSigInfo` str_sig+ `setCprSigInfo` cpr_sig -- Zap call arity info. We have used it by now (via -- `tryEtaExpandRhs`), and the simplifier can invalidate this@@ -1312,7 +1315,7 @@ simplCoercion :: SimplEnv -> InCoercion -> SimplM OutCoercion simplCoercion env co- = do { let opt_co = optCoercion opts (getTCvSubst env) co+ = do { let opt_co = optCoercion opts (getSubst env) co ; seqCo opt_co `seq` return opt_co } where opts = seOptCoercionOpts env@@ -1869,8 +1872,8 @@ ; let mult = contHoleScaling cont res_ty = contResultType cont ; (env1, bndr1) <- simplNonRecJoinBndr env bndr mult res_ty- ; (env2, bndr2) <- addBndrRules env1 bndr bndr1 (BC_Join cont)- ; (floats1, env3) <- simplJoinBind env2 cont bndr bndr2 rhs env+ ; (env2, bndr2) <- addBndrRules env1 bndr bndr1 (BC_Join NonRecursive cont)+ ; (floats1, env3) <- simplJoinBind env2 NonRecursive cont bndr bndr2 rhs env ; (floats2, body') <- simplExprF env3 body cont ; return (floats1 `addFloats` floats2, body') } @@ -1887,7 +1890,7 @@ ; env1 <- simplRecJoinBndrs env bndrs mult res_ty -- NB: bndrs' don't have unfoldings or rules -- We add them as we go down- ; (floats1, env2) <- simplRecBind env1 (BC_Join cont) pairs+ ; (floats1, env2) <- simplRecBind env1 (BC_Join Recursive cont) pairs ; (floats2, body') <- simplExprF env2 body cont ; return (floats1 `addFloats` floats2, body') } @@ -2170,19 +2173,32 @@ (ApplyToVal { sc_arg = arg, sc_env = arg_se , sc_cont = cont, sc_hole_ty = fun_ty }) | fun_id `hasKey` runRWKey- , not (contIsStop cont) -- Don't fiddle around if the continuation is boring , [ TyArg {}, TyArg {} ] <- rev_args- = do { s <- newId (fsLit "s") Many realWorldStatePrimTy- ; let (m,_,_) = splitFunTy fun_ty- env' = (arg_se `setInScopeFromE` env) `addNewInScopeIds` [s]+ -- Do this even if (contIsStop cont)+ -- See Note [No eta-expansion in runRW#]+ = do { let arg_env = arg_se `setInScopeFromE` env ty' = contResultType cont- cont' = ApplyToVal { sc_dup = Simplified, sc_arg = Var s- , sc_env = env', sc_cont = cont- , sc_hole_ty = mkVisFunTy m realWorldStatePrimTy ty' }- -- cont' applies to s, then K- ; body' <- simplExprC env' arg cont'- ; let arg' = Lam s body'- rr' = getRuntimeRep ty'++ -- If the argument is a literal lambda already, take a short cut+ -- This isn't just efficiency; if we don't do this we get a beta-redex+ -- every time, so the simplifier keeps doing more iterations.+ ; arg' <- case arg of+ Lam s body -> do { (env', s') <- simplBinder arg_env s+ ; body' <- simplExprC env' body cont+ ; return (Lam s' body') }+ -- Important: do not try to eta-expand this lambda+ -- See Note [No eta-expansion in runRW#]+ _ -> do { s' <- newId (fsLit "s") Many realWorldStatePrimTy+ ; let (m,_,_) = splitFunTy fun_ty+ env' = arg_env `addNewInScopeIds` [s']+ cont' = ApplyToVal { sc_dup = Simplified, sc_arg = Var s'+ , sc_env = env', sc_cont = cont+ , sc_hole_ty = mkVisFunTy m realWorldStatePrimTy ty' }+ -- cont' applies to s', then K+ ; body' <- simplExprC env' arg cont'+ ; return (Lam s' body') }++ ; let rr' = getRuntimeRep ty' call' = mkApps (Var fun_id) [mkTyArg rr', mkTyArg ty', arg'] ; return (emptyFloats env, call') } @@ -2289,7 +2305,20 @@ discard the entire application and replace it with (error "foo"). Getting all this at once is TOO HARD! +Note [No eta-expansion in runRW#]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+When we see `runRW# (\s. blah)` we must not attempt to eta-expand that+lambda. Why not? Because+* `blah` can mention join points bound outside the runRW#+* eta-expansion uses arityType, and+* `arityType` cannot cope with free join Ids: +So the simplifier spots the literal lambda, and simplifies inside it.+It's a very special lambda, because it is the one the OccAnal spots and+allows join points bound /outside/ to be called /inside/.++See Note [No free join points in arityType] in GHC.Core.Opt.Arity+ ************************************************************************ * * Rewrite rules@@ -4123,9 +4152,9 @@ CoreUnfolding { uf_tmpl = expr, uf_src = src, uf_guidance = guide } | isStableSource src -> do { expr' <- case bind_cxt of- BC_Join cont -> -- Binder is a join point- -- See Note [Rules and unfolding for join points]- simplJoinRhs unf_env id expr cont+ BC_Join _ cont -> -- Binder is a join point+ -- See Note [Rules and unfolding for join points]+ simplJoinRhs unf_env id expr cont BC_Let _ is_rec -> -- Binder is not a join point do { let cont = mkRhsStop rhs_ty is_rec topDmd -- mkRhsStop: switch off eta-expansion at the top level@@ -4178,6 +4207,7 @@ -- See Note [Eta-expand stable unfoldings] -- Use the arity from the main Id (in id_arity), rather than computing it from rhs+ -- Not used for join points eta_expand expr | seEtaExpand env , exprArity expr < arityTypeArity id_arity , wantEtaExpansion expr@@ -4216,7 +4246,7 @@ * Don't eta-expand join points; see Note [Do not eta-expand join points] in GHC.Core.Opt.Simplify.Utils. We uphold this because the join-point- case (bind_cxt = BC_Join _) doesn't use eta_expand.+ case (bind_cxt = BC_Join {}) doesn't use eta_expand. Note [Force bottoming field] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~@@ -4289,12 +4319,13 @@ = do { (env', bndrs') <- simplBinders env bndrs ; let rhs_ty = substTy env' (exprType rhs) rhs_cont = case bind_cxt of -- See Note [Rules and unfolding for join points]- BC_Let {} -> mkBoringStop rhs_ty- BC_Join cont -> assertPpr join_ok bad_join_msg cont+ BC_Let {} -> mkBoringStop rhs_ty+ BC_Join _ cont -> assertPpr join_ok bad_join_msg cont lhs_env = updMode updModeForRules env' rhs_env = updMode (updModeForStableUnfoldings act) env' -- See Note [Simplifying the RHS of a RULE]- fn_name' = case mb_new_id of+ -- Force this to avoid retaining reference to old Id+ !fn_name' = case mb_new_id of Just id -> idName id Nothing -> fn_name
compiler/GHC/Core/Opt/Simplify/Utils.hs view
@@ -95,14 +95,22 @@ TopLevelFlag RecFlag | BC_Join -- A join point with continuation k- SimplCont -- See Note [Rules and unfolding for join points]- -- in GHC.Core.Opt.Simplify+ RecFlag -- See Note [Rules and unfolding for join points]+ SimplCont -- in GHC.Core.Opt.Simplify bindContextLevel :: BindContext -> TopLevelFlag bindContextLevel (BC_Let top_lvl _) = top_lvl bindContextLevel (BC_Join {}) = NotTopLevel +bindContextRec :: BindContext -> RecFlag+bindContextRec (BC_Let _ rec_flag) = rec_flag+bindContextRec (BC_Join rec_flag _) = rec_flag +isJoinBC :: BindContext -> Bool+isJoinBC (BC_Let {}) = False+isJoinBC (BC_Join {}) = True++ {- ********************************************************************* * * The SimplCont and DupFlag types@@ -1776,39 +1784,26 @@ tryEtaExpandRhs :: SimplEnv -> BindContext -> OutId -> OutExpr -> SimplM (ArityType, OutExpr) -- See Note [Eta-expanding at let bindings]--- If tryEtaExpandRhs rhs = (n, is_bot, rhs') then--- (a) rhs' has manifest arity n--- (b) if is_bot is True then rhs' applied to n args is guaranteed bottom-tryEtaExpandRhs _env (BC_Join {}) bndr rhs- | Just join_arity <- isJoinId_maybe bndr- = do { let (join_bndrs, join_body) = collectNBinders join_arity rhs- oss = [idOneShotInfo id | id <- join_bndrs, isId id]- arity_type | exprIsDeadEnd join_body = mkBotArityType oss- | otherwise = mkManifestArityType oss- ; return (arity_type, rhs) }- -- Note [Do not eta-expand join points]- -- But do return the correct arity and bottom-ness, because- -- these are used to set the bndr's IdInfo (#15517)- -- Note [Invariants on join points] invariant 2b, in GHC.Core-- | otherwise- = pprPanic "tryEtaExpandRhs" (ppr bndr)--tryEtaExpandRhs env (BC_Let _ is_rec) bndr rhs- | seEtaExpand env -- Provided eta-expansion is on- , new_arity > old_arity -- And the current manifest arity isn't enough+tryEtaExpandRhs env bind_cxt bndr rhs+ | do_eta_expand -- If the current manifest arity isn't enough+ -- (never true for join points)+ , seEtaExpand env -- and eta-expansion is on , wantEtaExpansion rhs- = do { tick (EtaExpansion bndr)+ = -- Do eta-expansion.+ assertPpr( not (isJoinBC bind_cxt) ) (ppr bndr) $+ -- assert: this never happens for join points; see GHC.Core.Opt.Arity+ -- Note [Do not eta-expand join points]+ do { tick (EtaExpansion bndr) ; return (arity_type, etaExpandAT in_scope arity_type rhs) } | otherwise = return (arity_type, rhs)+ where in_scope = getInScope env arity_opts = seArityOpts env- old_arity = exprArity rhs- arity_type = findRhsArity arity_opts is_rec bndr rhs old_arity- new_arity = arityTypeArity arity_type+ is_rec = bindContextRec bind_cxt+ (do_eta_expand, arity_type) = findRhsArity arity_opts is_rec bndr rhs wantEtaExpansion :: CoreExpr -> Bool -- Mostly True; but False of PAPs which will immediately eta-reduce again@@ -1894,46 +1889,7 @@ Does it matter not eta-expanding such functions? I'm not sure. Perhaps strictness analysis will have less to bite on? -Note [Do not eta-expand join points]-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Similarly to CPR (see Note [Don't w/w join points for CPR] in-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: - let join $j1 :: IO ()- $j1 = ...- $j2 :: Int -> IO ()- $j2 n = if n > 0 then $j1- else ...-- =>-- let join $j1 :: IO ()- $j1 = (\eta -> ...)- `cast` N:IO :: State# RealWorld -> (# State# RealWorld, ())- ~ IO ()- $j2 :: Int -> IO ()- $j2 n = (\eta -> if n > 0 then $j1- else ...)- `cast` N:IO :: State# RealWorld -> (# State# RealWorld, ())- ~ IO ()--The cast here can't be pushed inside the lambda (since it's not casting to a-function type), so the lambda has to stay, but it can't because it contains a-reference to a join point. In fact, $j2 can't be eta-expanded at all. Rather-than try and detect this situation (and whatever other situations crop up!), we-don't bother; again, any surrounding eta-expansion will improve these join-points anyway, since an outer cast can *always* be pushed inside. By the time-CorePrep comes around, the code is very likely to look more like this:-- let join $j1 :: State# RealWorld -> (# State# RealWorld, ())- $j1 = (...) eta- $j2 :: Int -> State# RealWorld -> (# State# RealWorld, ())- $j2 = if n > 0 then $j1- else (...) eta-- ************************************************************************ * * \subsection{Floating lets out of big lambdas}@@ -2185,7 +2141,7 @@ case e of x { (a,b) -> rhs } where the type is a single constructor type. This gives better code when rhs also scrutinises x or e.- See CoreUtils Note [Refine DEFAULT case alternatives]+ See GHC.Core.Utils Note [Refine DEFAULT case alternatives] 3. combineIdenticalAlts: combine identical alternatives into a DEFAULT. See CoreUtils Note [Combine identical alternatives], which also
compiler/GHC/Core/PatSyn.hs view
@@ -38,6 +38,8 @@ import GHC.Utils.Outputable import GHC.Utils.Panic +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import qualified Data.Data as Data import Data.Function import Data.List (find)
compiler/GHC/Core/Ppr.hs view
@@ -172,8 +172,12 @@ pprOptCo :: Coercion -> SDoc -- Print a coercion optionally; i.e. honouring -dsuppress-coercions pprOptCo co = sdocOption sdocSuppressCoercions $ \case- True -> angleBrackets (text "Co:" <> int (coercionSize co)) <+> dcolon <+> ppr (coercionType co)- False -> parens $ sep [ppr co, dcolon <+> ppr (coercionType co)]+ True -> angleBrackets (text "Co:" <> int (coercionSize co)) <+> dcolon <+> co_type+ False -> parens $ sep [ppr co, dcolon <+> co_type]+ where+ co_type = sdocOption sdocSuppressCoercionTypes $ \case+ True -> text "..."+ False -> ppr (coercionType co) ppr_id_occ :: (SDoc -> SDoc) -> Id -> SDoc ppr_id_occ add_par id
+ compiler/GHC/Core/Ppr.hs-boot view
@@ -0,0 +1,11 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}++module GHC.Core.Ppr where++import {-# SOURCE #-} GHC.Core+import {-# SOURCE #-} GHC.Types.Var (Var)+import GHC.Utils.Outputable (OutputableBndr, Outputable)++instance OutputableBndr b => Outputable (Expr b)++instance OutputableBndr Var
compiler/GHC/Core/Predicate.hs view
@@ -243,7 +243,6 @@ isCTupleClass :: Class -> Bool isCTupleClass cls = isTupleTyCon (classTyCon cls) - {- ********************************************************************* * * Implicit parameters
compiler/GHC/Core/Rules.hs view
@@ -49,8 +49,8 @@ import GHC.Core.Ppr ( pprRules ) import GHC.Core.Unify as Unify ( ruleMatchTyKiX ) import GHC.Core.Type as Type- ( Type, TCvSubst, extendTvSubst, extendCvSubst- , mkEmptyTCvSubst, substTy, getTyVar_maybe )+ ( Type, extendTvSubst, extendCvSubst+ , substTy, getTyVar_maybe ) import GHC.Core.TyCo.Ppr( pprParendType ) import GHC.Core.Coercion as Coercion import GHC.Core.Tidy ( tidyRules )@@ -600,7 +600,7 @@ matchN (in_scope, id_unf) rule_name tmpl_vars tmpl_es target_es rhs = do { rule_subst <- match_exprs init_menv emptyRuleSubst tmpl_es target_es ; let (_, matched_es) = mapAccumL (lookup_tmpl rule_subst)- (mkEmptyTCvSubst in_scope) $+ (mkEmptySubst in_scope) $ tmpl_vars `zip` tmpl_vars1 bind_wrapper = rs_binds rule_subst -- Floated bindings; see Note [Matching lets]@@ -615,7 +615,7 @@ , rv_fltR = mkEmptySubst (rnInScopeSet init_rn_env) , rv_unf = id_unf } - lookup_tmpl :: RuleSubst -> TCvSubst -> (InVar,OutVar) -> (TCvSubst, CoreExpr)+ lookup_tmpl :: RuleSubst -> Subst -> (InVar,OutVar) -> (Subst, CoreExpr) -- Need to return a RuleSubst solely for the benefit of mk_fake_ty lookup_tmpl (RS { rs_tv_subst = tv_subst, rs_id_subst = id_subst }) tcv_subst (tmpl_var, tmpl_var1)
compiler/GHC/Core/SimpleOpt.hs view
@@ -212,10 +212,10 @@ soeZapSubst :: SimpleOptEnv -> SimpleOptEnv soeZapSubst env@(SOE { soe_subst = subst })- = env { soe_inl = emptyVarEnv, soe_subst = zapSubstEnv subst }+ = env { soe_inl = emptyVarEnv, soe_subst = zapSubst subst } soeInScope :: SimpleOptEnv -> InScopeSet-soeInScope (SOE { soe_subst = subst }) = substInScope subst+soeInScope (SOE { soe_subst = subst }) = getSubstInScope subst soeSetInScope :: InScopeSet -> SimpleOptEnv -> SimpleOptEnv soeSetInScope in_scope env2@(SOE { soe_subst = subst2 })@@ -241,7 +241,7 @@ where rec_ids = soe_rec_ids env subst = soe_subst env- in_scope = substInScope subst+ in_scope = getSubstInScope subst in_scope_env = (in_scope, simpleUnfoldingFun) ---------------@@ -252,7 +252,7 @@ = lookupIdSubst (soe_subst env) v go (App e1 e2) = simple_app env e1 [(env,e2)]- go (Type ty) = Type (substTy subst ty)+ go (Type ty) = Type (substTyUnchecked subst ty) go (Coercion co) = Coercion (go_co co) go (Lit lit) = Lit lit go (Tick tickish e) = mkTick (substTickish subst tickish) (go e)@@ -285,14 +285,14 @@ = go rhs | otherwise- = Case e' b' (substTy subst ty)+ = Case e' b' (substTyUnchecked subst ty) (map (go_alt env') as) where e' = go e (env', b') = subst_opt_bndr env b ----------------------- go_co co = optCoercion (so_co_opts (soe_opts env)) (getTCvSubst subst) co+ go_co co = optCoercion (so_co_opts (soe_opts env)) subst co ---------------------- go_alt env (Alt con bndrs rhs)@@ -452,12 +452,12 @@ in_bndr mb_out_bndr clo@(rhs_env, in_rhs) top_level | Type ty <- in_rhs -- let a::* = TYPE ty in <body>- , let out_ty = substTy (soe_subst rhs_env) ty+ , let out_ty = substTyUnchecked (soe_subst rhs_env) ty = assertPpr (isTyVar in_bndr) (ppr in_bndr $$ ppr in_rhs) $ (env { soe_subst = extendTvSubst subst in_bndr out_ty }, Nothing) | Coercion co <- in_rhs- , let out_co = optCoercion (so_co_opts (soe_opts env)) (getTCvSubst (soe_subst rhs_env)) co+ , let out_co = optCoercion (so_co_opts (soe_opts env)) (soe_subst rhs_env) co = assert (isCoVar in_bndr) (env { soe_subst = extendCvSubst subst in_bndr out_co }, Nothing) @@ -474,7 +474,7 @@ stable_unf = isStableUnfolding (idUnfolding in_bndr) active = isAlwaysActive (idInlineActivation in_bndr) occ = idOccInfo in_bndr- in_scope = substInScope subst+ in_scope = getSubstInScope subst out_rhs | Just join_arity <- isJoinId_maybe in_bndr = simple_join_rhs join_arity@@ -712,7 +712,7 @@ Subst in_scope id_subst tv_subst cv_subst = subst id1 = uniqAway in_scope old_id- id2 = updateIdTypeAndMult (substTy subst) id1+ id2 = updateIdTypeAndMult (substTyUnchecked subst) id1 new_id = zapFragileIdInfo id2 -- Zaps rules, unfolding, and fragile OccInfo -- The unfolding and rules will get added back later, by add_info@@ -1258,7 +1258,7 @@ go subst'' (float:floats) expr cont go (Right sub) floats (Var v) cont- = go (Left (substInScope sub))+ = go (Left (getSubstInScope sub)) floats (lookupIdSubst sub v) cont@@ -1330,7 +1330,7 @@ -- The Left case is wildly dominant subst_in_scope (Left in_scope) = in_scope- subst_in_scope (Right s) = substInScope s+ subst_in_scope (Right s) = getSubstInScope s subst_extend_in_scope (Left in_scope) v = Left (in_scope `extendInScopeSet` v) subst_extend_in_scope (Right s) v = Right (s `extendSubstInScope` v)
compiler/GHC/Core/Subst.hs view
@@ -15,18 +15,19 @@ -- ** Substituting into expressions and related types deShadowBinds, substRuleInfo, substRulesForImportedIds,- substTy, substCo, substExpr, substExprSC, substBind, substBindSC,+ substTyUnchecked, substCo, substExpr, substExprSC, substBind, substBindSC, substUnfolding, substUnfoldingSC, lookupIdSubst, substIdType, substIdOcc, substTickish, substDVarSet, substIdInfo, -- ** Operations on substitutions- emptySubst, mkEmptySubst, mkSubst, mkOpenSubst, substInScope, isEmptySubst,+ emptySubst, mkEmptySubst, mkSubst, mkOpenSubst, isEmptySubst, extendIdSubst, extendIdSubstList, extendTCvSubst, extendTvSubstList,- extendSubst, extendSubstList, extendSubstWithVar, zapSubstEnv,+ extendIdSubstWithClone,+ extendSubst, extendSubstList, extendSubstWithVar, extendSubstInScope, extendSubstInScopeList, extendSubstInScopeSet,- isInScope, setInScope, getTCvSubst, extendTvSubst, extendCvSubst,- delBndr, delBndrs,+ isInScope, setInScope, extendTvSubst, extendCvSubst,+ delBndr, delBndrs, zapSubst, -- ** Substituting and cloning binders substBndr, substBndrs, substRecBndrs, substTyVarBndr, substCoVarBndr,@@ -40,14 +41,12 @@ import GHC.Core.FVs import GHC.Core.Seq import GHC.Core.Utils-import qualified GHC.Core.Type as Type-import qualified GHC.Core.Coercion as Coercion+import GHC.Core.TyCo.Subst ( substCo ) -- We are defining local versions-import GHC.Core.Type hiding- ( substTy, extendTvSubst, extendCvSubst, extendTvSubstList- , isInScope, substTyVarBndr, cloneTyVarBndr )-import GHC.Core.Coercion hiding ( substCo, substCoVarBndr )+import GHC.Core.Type hiding ( substTy )+import GHC.Core.Coercion+ ( tyCoFVsOfCo, mkCoVarCo, substCoVarBndr ) import GHC.Types.Var.Set import GHC.Types.Var.Env as InScopeSet@@ -68,8 +67,6 @@ import Data.List (mapAccumL) -- {- ************************************************************************ * *@@ -78,37 +75,12 @@ ************************************************************************ -} --- | A substitution environment, containing 'Id', 'TyVar', and 'CoVar'--- substitutions.------ Some invariants apply to how you use the substitution:------ 1. Note [The substitution invariant] in "GHC.Core.TyCo.Subst"------ 2. Note [Substitutions apply only once] in "GHC.Core.TyCo.Subst"-data Subst- = Subst InScopeSet -- Variables in scope (both Ids and TyVars) /after/- -- applying the substitution- IdSubstEnv -- Substitution from NcIds to CoreExprs- TvSubstEnv -- Substitution from TyVars to Types- CvSubstEnv -- Substitution from CoVars to Coercions-- -- INVARIANT 1: See TyCoSubst Note [The substitution invariant]- -- This is what lets us deal with name capture properly- -- It's a hard invariant to check...- --- -- INVARIANT 2: The substitution is apply-once;- -- see Note [Substitutions apply only once] in GHC.Core.TyCo.Subst- --- -- INVARIANT 3: See Note [Extending the Subst]- {--Note [Extending the Subst]+Note [Extending the IdSubstEnv] ~~~~~~~~~~~~~~~~~~~~~~~~~~-For a core Subst, which binds Ids as well, we make a different choice for Ids-than we do for TyVars.+We make a different choice for Ids than we do for TyVars. -For TyVars, see Note [Extending the TCvSubstEnv] in GHC.Core.TyCo.Subst.+For TyVars, see Note [Extending the TvSubstEnv and CvSubstEnv] in GHC.Core.TyCo.Subst. For Ids, we have a different invariant The IdSubstEnv is extended *only* when the Unique on an Id changes@@ -158,31 +130,13 @@ easy to spot -} --- | An environment for substituting for 'Id's-type IdSubstEnv = IdEnv CoreExpr -- Domain is NcIds, i.e. not coercions- -----------------------------isEmptySubst :: Subst -> Bool-isEmptySubst (Subst _ id_env tv_env cv_env)- = isEmptyVarEnv id_env && isEmptyVarEnv tv_env && isEmptyVarEnv cv_env -emptySubst :: Subst-emptySubst = Subst emptyInScopeSet emptyVarEnv emptyVarEnv emptyVarEnv--mkEmptySubst :: InScopeSet -> Subst-mkEmptySubst in_scope = Subst in_scope emptyVarEnv emptyVarEnv emptyVarEnv--mkSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> IdSubstEnv -> Subst-mkSubst in_scope tvs cvs ids = Subst in_scope ids tvs cvs---- | Find the in-scope set: see "GHC.Core.TyCo.Subst" Note [The substitution invariant]-substInScope :: Subst -> InScopeSet-substInScope (Subst in_scope _ _ _) = in_scope---- | Remove all substitutions for 'Id's and 'Var's that might have been built up--- while preserving the in-scope set-zapSubstEnv :: Subst -> Subst-zapSubstEnv (Subst in_scope _ _ _) = Subst in_scope emptyVarEnv emptyVarEnv emptyVarEnv+-- We keep GHC.Core.Subst separate from GHC.Core.TyCo.Subst to avoid creating+-- circular dependencies. Functions in this file that don't depend on+-- the definition of CoreExpr can be moved to GHC.Core.TyCo.Subst, as long+-- as it does not require importing too many additional hs-boot files and+-- cause a significant drop in performance. -- | Add a substitution for an 'Id' to the 'Subst': you must ensure that the in-scope set is -- such that TyCoSubst Note [The substitution invariant]@@ -193,38 +147,20 @@ = assertPpr (isNonCoVarId v) (ppr v $$ ppr r) $ Subst in_scope (extendVarEnv ids v r) tvs cvs +extendIdSubstWithClone :: Subst -> Id -> Id -> Subst+extendIdSubstWithClone (Subst in_scope ids tvs cvs) v v'+ = assertPpr (isNonCoVarId v) (ppr v $$ ppr v') $+ Subst (extendInScopeSetSet in_scope new_in_scope)+ (extendVarEnv ids v (varToCoreExpr v')) tvs cvs+ where+ new_in_scope = tyCoVarsOfType (varType v') `extendVarSet` v'+ -- | Adds multiple 'Id' substitutions to the 'Subst': see also 'extendIdSubst' extendIdSubstList :: Subst -> [(Id, CoreExpr)] -> Subst extendIdSubstList (Subst in_scope ids tvs cvs) prs = assert (all (isNonCoVarId . fst) prs) $ Subst in_scope (extendVarEnvList ids prs) tvs cvs --- | Add a substitution for a 'TyVar' to the 'Subst'--- The 'TyVar' *must* be a real TyVar, and not a CoVar--- You must ensure that the in-scope set is such that--- "GHC.Core.TyCo.Subst" Note [The substitution invariant] holds--- after extending the substitution like this.-extendTvSubst :: Subst -> TyVar -> Type -> Subst-extendTvSubst (Subst in_scope ids tvs cvs) tv ty- = assert (isTyVar tv) $- Subst in_scope ids (extendVarEnv tvs tv ty) cvs---- | Adds multiple 'TyVar' substitutions to the 'Subst': see also 'extendTvSubst'-extendTvSubstList :: Subst -> [(TyVar,Type)] -> Subst-extendTvSubstList subst vrs- = foldl' extend subst vrs- where- extend subst (v, r) = extendTvSubst subst v r---- | Add a substitution from a 'CoVar' to a 'Coercion' to the 'Subst':--- you must ensure that the in-scope set satisfies--- "GHC.Core.TyCo.Subst" Note [The substitution invariant]--- after extending the substitution like this-extendCvSubst :: Subst -> CoVar -> Coercion -> Subst-extendCvSubst (Subst in_scope ids tvs cvs) v r- = assert (isCoVar v) $- Subst in_scope ids tvs (extendVarEnv cvs v r)- -- | Add a substitution appropriate to the thing being substituted -- (whether an expression, type, or coercion). See also -- 'extendIdSubst', 'extendTvSubst', 'extendCvSubst'@@ -254,7 +190,7 @@ | not (isLocalId v) = Var v | Just e <- lookupVarEnv ids v = e | Just v' <- lookupInScope in_scope v = Var v'- -- Vital! See Note [Extending the Subst]+ -- Vital! See Note [Extending the IdSubstEnv] -- If v isn't in the InScopeSet, we panic, because -- it's a bad bug and we reallly want to know | otherwise = pprPanic "lookupIdSubst" (ppr v $$ ppr in_scope)@@ -281,42 +217,7 @@ (mkVarEnv [(v,co) | (v, Coercion co) <- pairs]) -------------------------------isInScope :: Var -> Subst -> Bool-isInScope v (Subst in_scope _ _ _) = v `elemInScopeSet` in_scope --- | Add the 'Var' to the in-scope set-extendSubstInScope :: Subst -> Var -> Subst-extendSubstInScope (Subst in_scope ids tvs cvs) v- = Subst (in_scope `InScopeSet.extendInScopeSet` v)- ids tvs cvs---- | Add the 'Var's to the in-scope set: see also 'extendInScope'-extendSubstInScopeList :: Subst -> [Var] -> Subst-extendSubstInScopeList (Subst in_scope ids tvs cvs) vs- = Subst (in_scope `extendInScopeSetList` vs)- ids tvs cvs---- | Add the 'Var's to the in-scope set: see also 'extendInScope'-extendSubstInScopeSet :: Subst -> VarSet -> Subst-extendSubstInScopeSet (Subst in_scope ids tvs cvs) vs- = Subst (in_scope `extendInScopeSetSet` vs)- ids tvs cvs--setInScope :: Subst -> InScopeSet -> Subst-setInScope (Subst _ ids tvs cvs) in_scope = Subst in_scope ids tvs cvs---- Pretty printing, for debugging only--instance Outputable Subst where- ppr (Subst in_scope ids tvs cvs)- = text "<InScope =" <+> in_scope_doc- $$ text " IdSubst =" <+> ppr ids- $$ text " TvSubst =" <+> ppr tvs- $$ text " CvSubst =" <+> ppr cvs- <> char '>'- where- in_scope_doc = pprVarSet (getInScopeVars in_scope) (braces . fsep . map ppr)- {- ************************************************************************ * *@@ -339,14 +240,14 @@ -- See Note [Substitutions apply only once] in "GHC.Core.TyCo.Subst" -- -- Do *not* attempt to short-cut in the case of an empty substitution!--- See Note [Extending the Subst]+-- See Note [Extending the IdSubstEnv] substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr -- HasDebugCallStack so we can track failures in lookupIdSubst substExpr subst expr = go expr where go (Var v) = lookupIdSubst subst v- go (Type ty) = Type (substTy subst ty)+ go (Type ty) = Type (substTyUnchecked subst ty) go (Coercion co) = Coercion (substCo subst co) go (Lit lit) = Lit lit go (App fun arg) = App (go fun) (go arg)@@ -366,7 +267,7 @@ where (subst', bind') = substBind subst bind - go (Case scrut bndr ty alts) = Case (go scrut) bndr' (substTy subst ty) (map (go_alt subst') alts)+ go (Case scrut bndr ty alts) = Case (go scrut) bndr' (substTyUnchecked subst ty) (map (go_alt subst') alts) where (subst', bndr') = substBndr subst bndr @@ -464,7 +365,7 @@ where id1 = uniqAway in_scope old_id -- id1 is cloned if necessary id2 | no_type_change = id1- | otherwise = updateIdTypeAndMult (substTy subst) id1+ | otherwise = updateIdTypeAndMult (substTyUnchecked subst) id1 old_ty = idType old_id old_w = idMult old_id@@ -484,7 +385,7 @@ | otherwise = extendVarEnv env old_id (Var new_id) no_change = id1 == old_id- -- See Note [Extending the Subst]+ -- See Note [Extending the IdSubstEnv] -- it's /not/ necessary to check mb_new_info and no_type_change {-@@ -547,41 +448,8 @@ Types and Coercions * * ************************************************************************--For types and coercions we just call the corresponding functions in-Type and Coercion, but we have to repackage the substitution, from a-Subst to a TCvSubst. -} -substTyVarBndr :: Subst -> TyVar -> (Subst, TyVar)-substTyVarBndr (Subst in_scope id_env tv_env cv_env) tv- = case Type.substTyVarBndr (TCvSubst in_scope tv_env cv_env) tv of- (TCvSubst in_scope' tv_env' cv_env', tv')- -> (Subst in_scope' id_env tv_env' cv_env', tv')--cloneTyVarBndr :: Subst -> TyVar -> Unique -> (Subst, TyVar)-cloneTyVarBndr (Subst in_scope id_env tv_env cv_env) tv uniq- = case Type.cloneTyVarBndr (TCvSubst in_scope tv_env cv_env) tv uniq of- (TCvSubst in_scope' tv_env' cv_env', tv')- -> (Subst in_scope' id_env tv_env' cv_env', tv')--substCoVarBndr :: Subst -> CoVar -> (Subst, CoVar)-substCoVarBndr (Subst in_scope id_env tv_env cv_env) cv- = case Coercion.substCoVarBndr (TCvSubst in_scope tv_env cv_env) cv of- (TCvSubst in_scope' tv_env' cv_env', cv')- -> (Subst in_scope' id_env tv_env' cv_env', cv')---- | See 'GHC.Core.Type.substTy'.-substTy :: Subst -> Type -> Type-substTy subst ty = Type.substTyUnchecked (getTCvSubst subst) ty--getTCvSubst :: Subst -> TCvSubst-getTCvSubst (Subst in_scope _ tenv cenv) = TCvSubst in_scope tenv cenv---- | See 'Coercion.substCo'-substCo :: HasCallStack => Subst -> Coercion -> Coercion-substCo subst co = Coercion.substCo (getTCvSubst subst) co- {- ************************************************************************ * *@@ -595,7 +463,7 @@ | (isEmptyVarEnv tv_env && isEmptyVarEnv cv_env) || (noFreeVarsOfType old_ty && noFreeVarsOfType old_w) = id | otherwise =- updateIdTypeAndMult (substTy subst) id+ updateIdTypeAndMult (substTyUnchecked subst) id -- The tyCoVarsOfType is cheaper than it looks -- because we cache the free tyvars of the type -- in a Note in the id's type itself
compiler/GHC/Core/Tidy.hs view
@@ -10,7 +10,7 @@ {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} module GHC.Core.Tidy (- tidyExpr, tidyRules, tidyUnfolding, tidyCbvInfoTop+ tidyExpr, tidyRules, tidyCbvInfoTop, tidyBndrs ) where import GHC.Prelude@@ -117,8 +117,7 @@ -- See Note [CBV Function Ids] tidyCbvInfoLocal :: HasDebugCallStack => Id -> CoreExpr -> Id-tidyCbvInfoLocal id rhs- | otherwise = computeCbvInfo id rhs+tidyCbvInfoLocal id rhs = computeCbvInfo id rhs -- | For a binding we: -- * Look at the args@@ -135,9 +134,9 @@ -> Id -- computeCbvInfo fun_id rhs = fun_id computeCbvInfo fun_id rhs- | (isWorkerLike || isJoinId fun_id) && (valid_unlifted_worker val_args)- =- -- pprTrace "computeCbvInfo"+ | is_wkr_like || isJust mb_join_id+ , valid_unlifted_worker val_args+ = -- pprTrace "computeCbvInfo" -- (text "fun" <+> ppr fun_id $$ -- text "arg_tys" <+> ppr (map idType val_args) $$ @@ -146,31 +145,48 @@ -- text "cbv_marks" <+> ppr cbv_marks $$ -- text "out_id" <+> ppr cbv_bndr $$ -- ppr rhs)- cbv_bndr+ cbv_bndr+ | otherwise = fun_id where- val_args = filter isId . fst $ collectBinders rhs- cbv_marks =- -- CBV marks are only set during tidy so none should be present already.- assertPpr (maybe True null $ idCbvMarks_maybe fun_id) (ppr fun_id <+> (ppr $ idCbvMarks_maybe fun_id) $$ ppr rhs) $- map mkMark val_args- cbv_bndr- | valid_unlifted_worker val_args- , any isMarkedCbv cbv_marks- -- seqList to avoid retaining the original rhs- = cbv_marks `seqList` setIdCbvMarks fun_id cbv_marks- | otherwise =- -- pprTraceDebug "tidyCbvInfo: Worker seems to take unboxed tuple/sum types!" (ppr fun_id <+> ppr rhs)- asNonWorkerLikeId fun_id- -- We don't set CBV marks on functions which take unboxed tuples or sums as arguments.- -- Doing so would require us to compute the result of unarise here in order to properly determine- -- argument positions at runtime.- -- In practice this doesn't matter much. Most "interesting" functions will get a W/W split which will eliminate- -- unboxed tuple arguments, and unboxed sums are rarely used. But we could change this in the future and support+ mb_join_id = isJoinId_maybe fun_id+ is_wkr_like = isWorkerLikeId fun_id++ val_args = filter isId lam_bndrs+ -- When computing CbvMarks, we limit the arity of join points to+ -- the JoinArity, because that's the arity we are going to use+ -- when calling it. There may be more lambdas than that on the RHS.+ lam_bndrs | Just join_arity <- mb_join_id+ = fst $ collectNBinders join_arity rhs+ | otherwise+ = fst $ collectBinders rhs++ cbv_marks = -- assert: CBV marks are only set during tidy so none should be present already.+ assertPpr (maybe True null $ idCbvMarks_maybe fun_id)+ (ppr fun_id <+> (ppr $ idCbvMarks_maybe fun_id) $$ ppr rhs) $+ map mkMark val_args++ cbv_bndr | any isMarkedCbv cbv_marks+ = cbv_marks `seqList` setIdCbvMarks fun_id cbv_marks+ -- seqList: avoid retaining the original rhs++ | otherwise+ = -- pprTraceDebug "tidyCbvInfo: Worker seems to take unboxed tuple/sum types!"+ -- (ppr fun_id <+> ppr rhs)+ asNonWorkerLikeId fun_id++ -- We don't set CBV marks on functions which take unboxed tuples or sums as+ -- arguments. Doing so would require us to compute the result of unarise+ -- here in order to properly determine argument positions at runtime.+ --+ -- In practice this doesn't matter much. Most "interesting" functions will+ -- get a W/W split which will eliminate unboxed tuple arguments, and unboxed+ -- sums are rarely used. But we could change this in the future and support -- unboxed sums/tuples as well. valid_unlifted_worker args = -- pprTrace "valid_unlifted" (ppr fun_id $$ ppr args) $ all isSingleUnarisedArg args+ isSingleUnarisedArg v | isUnboxedSumType ty = False | isUnboxedTupleType ty = isSimplePrimRep (typePrimRep ty)@@ -188,7 +204,6 @@ , not (isDeadEndId fun_id) = MarkedCbv | otherwise = NotMarkedCbv - isWorkerLike = isWorkerLikeId fun_id ------------ Expressions -------------- tidyExpr :: TidyEnv -> CoreExpr -> CoreExpr@@ -339,39 +354,42 @@ new_info = vanillaIdInfo `setOccInfo` occInfo old_info `setArityInfo` arityInfo old_info- `setDmdSigInfo` zapDmdEnvSig (dmdSigInfo old_info)+ `setDmdSigInfo` zapDmdEnvSig (dmdSigInfo old_info) `setDemandInfo` demandInfo old_info `setInlinePragInfo` inlinePragInfo old_info `setUnfoldingInfo` new_unf old_unf = realUnfoldingInfo old_info- new_unf | isStableUnfolding old_unf = tidyUnfolding rec_tidy_env old_unf old_unf- | otherwise = trimUnfolding old_unf- -- See Note [Preserve evaluatedness]+ new_unf = tidyNestedUnfolding rec_tidy_env old_unf in ((tidy_env', var_env'), id') } ------------ Unfolding ---------------tidyUnfolding :: TidyEnv -> Unfolding -> Unfolding -> Unfolding-tidyUnfolding tidy_env df@(DFunUnfolding { df_bndrs = bndrs, df_args = args }) _+tidyNestedUnfolding :: TidyEnv -> Unfolding -> Unfolding+tidyNestedUnfolding _ NoUnfolding = NoUnfolding+tidyNestedUnfolding _ BootUnfolding = BootUnfolding+tidyNestedUnfolding _ (OtherCon {}) = evaldUnfolding++tidyNestedUnfolding tidy_env df@(DFunUnfolding { df_bndrs = bndrs, df_args = args }) = df { df_bndrs = bndrs', df_args = map (tidyExpr tidy_env') args } where (tidy_env', bndrs') = tidyBndrs tidy_env bndrs -tidyUnfolding tidy_env- unf@(CoreUnfolding { uf_tmpl = unf_rhs, uf_src = src })- unf_from_rhs+tidyNestedUnfolding tidy_env+ unf@(CoreUnfolding { uf_tmpl = unf_rhs, uf_src = src, uf_is_value = is_value }) | isStableSource src = seqIt $ unf { uf_tmpl = tidyExpr tidy_env unf_rhs } -- Preserves OccInfo- -- This seqIt avoids a space leak: otherwise the uf_is_value,- -- uf_is_conlike, ... fields may retain a reference to the- -- pre-tidied expression forever (GHC.CoreToIface doesn't look at them)+ -- This seqIt avoids a space leak: otherwise the uf_is_value,+ -- uf_is_conlike, ... fields may retain a reference to the+ -- pre-tidied expression forever (GHC.CoreToIface doesn't look at them) - | otherwise- = unf_from_rhs- where seqIt unf = seqUnfolding unf `seq` unf-tidyUnfolding _ unf _ = unf -- NoUnfolding or OtherCon+ -- Discard unstable unfoldings, but see Note [Preserve evaluatedness]+ | is_value = evaldUnfolding+ | otherwise = noUnfolding++ where+ seqIt unf = seqUnfolding unf `seq` unf {- Note [Tidy IdInfo]
compiler/GHC/Core/TyCo/Subst.hs view
@@ -12,21 +12,20 @@ module GHC.Core.TyCo.Subst ( -- * Substitutions- TCvSubst(..), TvSubstEnv, CvSubstEnv,- emptyTvSubstEnv, emptyCvSubstEnv, composeTCvSubstEnv, composeTCvSubst,- emptyTCvSubst, mkEmptyTCvSubst, isEmptyTCvSubst,- mkTCvSubst, mkTvSubst, mkCvSubst,- getTvSubstEnv,- getCvSubstEnv, getTCvInScope, getTCvSubstRangeFVs,- isInScope, elemTCvSubst, notElemTCvSubst,- setTvSubstEnv, setCvSubstEnv, zapTCvSubst,- extendTCvInScope, extendTCvInScopeList, extendTCvInScopeSet,+ Subst(..), TvSubstEnv, CvSubstEnv, IdSubstEnv,+ emptyIdSubstEnv, emptyTvSubstEnv, emptyCvSubstEnv, composeTCvSubst,+ emptySubst, mkEmptySubst, isEmptyTCvSubst, isEmptySubst,+ mkSubst, mkTvSubst, mkCvSubst, mkIdSubst,+ getTvSubstEnv, getIdSubstEnv,+ getCvSubstEnv, getSubstInScope, setInScope, getSubstRangeTyCoFVs,+ isInScope, elemSubst, notElemSubst, zapSubst,+ extendSubstInScope, extendSubstInScopeList, extendSubstInScopeSet, extendTCvSubst, extendTCvSubstWithClone, extendCvSubst, extendCvSubstWithClone, extendTvSubst, extendTvSubstBinderAndInScope, extendTvSubstWithClone, extendTvSubstList, extendTvSubstAndInScope, extendTCvSubstList,- unionTCvSubst, zipTyEnv, zipCoEnv,+ unionSubst, zipTyEnv, zipCoEnv, zipTvSubst, zipCvSubst, zipTCvSubst, mkTvSubstPrs,@@ -65,6 +64,8 @@ , mkCoercionType , coercionKind, coercionLKind, coVarKindsTypesRole ) import {-# SOURCE #-} GHC.Core.TyCo.Ppr ( pprTyVar )+import {-# SOURCE #-} GHC.Core.Ppr ( )+import {-# SOURCE #-} GHC.Core ( CoreExpr ) import GHC.Core.TyCo.Rep import GHC.Core.TyCo.FVs@@ -95,28 +96,34 @@ %************************************************************************ -} --- | Type & coercion substitution------ #tcvsubst_invariant#--- The following invariants must hold of a 'TCvSubst':------ 1. The in-scope set is needed /only/ to--- guide the generation of fresh uniques------ 2. In particular, the /kind/ of the type variables in--- the in-scope set is not relevant+-- | Type & coercion & id substitution ----- 3. The substitution is only applied ONCE! This is because--- in general such application will not reach a fixed point.-data TCvSubst- = TCvSubst InScopeSet -- The in-scope type and kind variables- TvSubstEnv -- Substitutes both type and kind variables- CvSubstEnv -- Substitutes coercion variables- -- See Note [Substitutions apply only once]- -- and Note [Extending the TCvSubstEnv]- -- and Note [Substituting types and coercions]- -- and Note [The substitution invariant]+-- The "Subst" data type defined in this module contains substitution+-- for tyvar, covar and id. However, operations on IdSubstEnv (mapping+-- from "Id" to "CoreExpr") that require the definition of the "Expr"+-- data type are defined in GHC.Core.Subst to avoid circular module+-- dependency.+data Subst+ = Subst InScopeSet -- Variables in scope (both Ids and TyVars) /after/+ -- applying the substitution+ IdSubstEnv -- Substitution from NcIds to CoreExprs+ TvSubstEnv -- Substitution from TyVars to Types+ CvSubstEnv -- Substitution from CoVars to Coercions + -- INVARIANT 1: See Note [The substitution invariant]+ -- This is what lets us deal with name capture properly+ --+ -- INVARIANT 2: The substitution is apply-once;+ -- see Note [Substitutions apply only once]+ --+ -- INVARIANT 3: See Note [Extending the IdSubstEnv] in "GHC.Core.Subst"+ -- and Note [Extending the TvSubstEnv and CvSubstEnv]+ --+ -- INVARIANT 4: See Note [Substituting types, coercions, and expressions]++-- | A substitution of 'Expr's for non-coercion 'Id's+type IdSubstEnv = IdEnv CoreExpr -- Domain is NonCoVarIds, i.e. not coercions+ -- | A substitution of 'Type's for 'TyVar's -- and 'Kind's for 'KindVar's type TvSubstEnv = TyVarEnv Type@@ -139,8 +146,6 @@ (SIa) The free vars of the range of the substitution (SIb) The free vars of ty minus the domain of the substitution -The same rules apply to other substitutions (notably GHC.Core.Subst.Subst)- * Reason for (SIa). Consider substTy [a :-> Maybe b] (forall b. b->a) we must rename the forall b, to get@@ -179,7 +184,7 @@ A TCvSubst is not idempotent, but, unlike the non-idempotent substitution we use during unifications, it must not be repeatedly applied. -Note [Extending the TCvSubstEnv]+Note [Extending the TvSubstEnv and CvSubstEnv] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ See #tcvsubst_invariant# for the invariants that must hold. @@ -203,128 +208,145 @@ * In substTy, substTheta, we can short-circuit when the TvSubstEnv is empty -Note [Substituting types and coercions]+Note [Substituting types, coercions, and expressions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Types and coercions are mutually recursive, and either may have variables "belonging" to the other. Thus, every time we wish to substitute in a type, we may also need to substitute in a coercion, and vice versa.-However, the constructor used to create type variables is distinct from-that of coercion variables, so we carry two VarEnvs in a TCvSubst. Note-that it would be possible to use the CoercionTy constructor to combine-these environments, but that seems like a false economy.+Likewise, expressions may contain type variables or coercion variables.+However, we use different constructors for constructing expression variables,+coercion variables, and type variables, so we carry three VarEnvs for each+variable type. Note that it would be possible to use the CoercionTy constructor+and the Type constructor to combine these environments, but that seems like a+false economy. -Note that the TvSubstEnv should *never* map a CoVar (built with the Id-constructor) and the CvSubstEnv should *never* map a TyVar. Furthermore,-the range of the TvSubstEnv should *never* include a type headed with+Note that the domain of the VarEnvs must be respected, despite the fact that+TyVar, Id, and CoVar are all type synonyms of the Var type. For example,+TvSubstEnv should *never* map a CoVar (built with the Id constructor)+and the CvSubstEnv should *never* map a TyVar. Furthermore, the range+of the TvSubstEnv should *never* include a type headed with CoercionTy. -} +emptyIdSubstEnv :: IdSubstEnv+emptyIdSubstEnv = emptyVarEnv+ emptyTvSubstEnv :: TvSubstEnv emptyTvSubstEnv = emptyVarEnv emptyCvSubstEnv :: CvSubstEnv emptyCvSubstEnv = emptyVarEnv -composeTCvSubstEnv :: InScopeSet- -> (TvSubstEnv, CvSubstEnv)- -> (TvSubstEnv, CvSubstEnv)- -> (TvSubstEnv, CvSubstEnv)--- ^ @(compose env1 env2)(x)@ is @env1(env2(x))@; i.e. apply @env2@ then @env1@.--- It assumes that both are idempotent.--- Typically, @env1@ is the refinement to a base substitution @env2@-composeTCvSubstEnv in_scope (tenv1, cenv1) (tenv2, cenv2)- = ( tenv1 `plusVarEnv` mapVarEnv (substTy subst1) tenv2- , cenv1 `plusVarEnv` mapVarEnv (substCo subst1) cenv2 )- -- First apply env1 to the range of env2- -- Then combine the two, making sure that env1 loses if- -- both bind the same variable; that's why env1 is the- -- *left* argument to plusVarEnv, because the right arg wins- where- subst1 = TCvSubst in_scope tenv1 cenv1- -- | Composes two substitutions, applying the second one provided first,--- like in function composition.-composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst-composeTCvSubst (TCvSubst is1 tenv1 cenv1) (TCvSubst is2 tenv2 cenv2)- = TCvSubst is3 tenv3 cenv3+-- like in function composition. This function leaves IdSubstEnv untouched+-- because IdSubstEnv is not used during substitution for types.+composeTCvSubst :: Subst -> Subst -> Subst+composeTCvSubst subst1@(Subst is1 ids1 tenv1 cenv1) (Subst is2 _ tenv2 cenv2)+ = Subst is3 ids1 tenv3 cenv3 where is3 = is1 `unionInScope` is2- (tenv3, cenv3) = composeTCvSubstEnv is3 (tenv1, cenv1) (tenv2, cenv2)+ tenv3 = tenv1 `plusVarEnv` mapVarEnv (substTy subst1) tenv2+ cenv3 = cenv1 `plusVarEnv` mapVarEnv (substCo subst1) cenv2 -emptyTCvSubst :: TCvSubst-emptyTCvSubst = TCvSubst emptyInScopeSet emptyTvSubstEnv emptyCvSubstEnv+emptySubst :: Subst+emptySubst = Subst emptyInScopeSet emptyVarEnv emptyVarEnv emptyVarEnv -mkEmptyTCvSubst :: InScopeSet -> TCvSubst-mkEmptyTCvSubst is = TCvSubst is emptyTvSubstEnv emptyCvSubstEnv+mkEmptySubst :: InScopeSet -> Subst+mkEmptySubst in_scope = Subst in_scope emptyVarEnv emptyVarEnv emptyVarEnv -isEmptyTCvSubst :: TCvSubst -> Bool- -- See Note [Extending the TCvSubstEnv]-isEmptyTCvSubst (TCvSubst _ tenv cenv) = isEmptyVarEnv tenv && isEmptyVarEnv cenv+isEmptySubst :: Subst -> Bool+isEmptySubst (Subst _ id_env tv_env cv_env)+ = isEmptyVarEnv id_env && isEmptyVarEnv tv_env && isEmptyVarEnv cv_env -mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst-mkTCvSubst in_scope (tenv, cenv) = TCvSubst in_scope tenv cenv+-- | Checks whether the tyvar and covar environments are empty.+-- This function should be used over 'isEmptySubst' when substituting+-- for types, because types currently do not contain expressions; we can+-- safely disregard the expression environment when deciding whether+-- to skip a substitution. Using 'isEmptyTCvSubst' gives us a non-trivial+-- performance boost (up to 70% less allocation for T18223)+isEmptyTCvSubst :: Subst -> Bool+isEmptyTCvSubst (Subst _ _ tv_env cv_env)+ = isEmptyVarEnv tv_env && isEmptyVarEnv cv_env -mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst+mkSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> IdSubstEnv -> Subst+mkSubst in_scope tvs cvs ids = Subst in_scope ids tvs cvs++mkIdSubst :: InScopeSet -> IdSubstEnv -> Subst+mkIdSubst in_scope ids = Subst in_scope ids emptyTvSubstEnv emptyCvSubstEnv++mkTvSubst :: InScopeSet -> TvSubstEnv -> Subst -- ^ Make a TCvSubst with specified tyvar subst and empty covar subst-mkTvSubst in_scope tenv = TCvSubst in_scope tenv emptyCvSubstEnv+mkTvSubst in_scope tenv = Subst in_scope emptyIdSubstEnv tenv emptyCvSubstEnv -mkCvSubst :: InScopeSet -> CvSubstEnv -> TCvSubst+mkCvSubst :: InScopeSet -> CvSubstEnv -> Subst -- ^ Make a TCvSubst with specified covar subst and empty tyvar subst-mkCvSubst in_scope cenv = TCvSubst in_scope emptyTvSubstEnv cenv+mkCvSubst in_scope cenv = Subst in_scope emptyIdSubstEnv emptyTvSubstEnv cenv -getTvSubstEnv :: TCvSubst -> TvSubstEnv-getTvSubstEnv (TCvSubst _ env _) = env+getIdSubstEnv :: Subst -> IdSubstEnv+getIdSubstEnv (Subst _ ids _ _) = ids -getCvSubstEnv :: TCvSubst -> CvSubstEnv-getCvSubstEnv (TCvSubst _ _ env) = env+getTvSubstEnv :: Subst -> TvSubstEnv+getTvSubstEnv (Subst _ _ tenv _) = tenv -getTCvInScope :: TCvSubst -> InScopeSet-getTCvInScope (TCvSubst in_scope _ _) = in_scope+getCvSubstEnv :: Subst -> CvSubstEnv+getCvSubstEnv (Subst _ _ _ cenv) = cenv +-- | Find the in-scope set: see Note [The substitution invariant]+getSubstInScope :: Subst -> InScopeSet+getSubstInScope (Subst in_scope _ _ _) = in_scope++setInScope :: Subst -> InScopeSet -> Subst+setInScope (Subst _ ids tvs cvs) in_scope = Subst in_scope ids tvs cvs+ -- | Returns the free variables of the types in the range of a substitution as -- a non-deterministic set.-getTCvSubstRangeFVs :: TCvSubst -> VarSet-getTCvSubstRangeFVs (TCvSubst _ tenv cenv)- = unionVarSet tenvFVs cenvFVs+getSubstRangeTyCoFVs :: Subst -> VarSet+getSubstRangeTyCoFVs (Subst _ _ tenv cenv)+ = tenvFVs `unionVarSet` cenvFVs where tenvFVs = shallowTyCoVarsOfTyVarEnv tenv cenvFVs = shallowTyCoVarsOfCoVarEnv cenv -isInScope :: Var -> TCvSubst -> Bool-isInScope v (TCvSubst in_scope _ _) = v `elemInScopeSet` in_scope+isInScope :: Var -> Subst -> Bool+isInScope v (Subst in_scope _ _ _) = v `elemInScopeSet` in_scope -elemTCvSubst :: Var -> TCvSubst -> Bool-elemTCvSubst v (TCvSubst _ tenv cenv)+elemSubst :: Var -> Subst -> Bool+elemSubst v (Subst _ ids tenv cenv) | isTyVar v = v `elemVarEnv` tenv- | otherwise+ | isCoVar v = v `elemVarEnv` cenv--notElemTCvSubst :: Var -> TCvSubst -> Bool-notElemTCvSubst v = not . elemTCvSubst v--setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst-setTvSubstEnv (TCvSubst in_scope _ cenv) tenv = TCvSubst in_scope tenv cenv+ | otherwise+ = v `elemVarEnv` ids -setCvSubstEnv :: TCvSubst -> CvSubstEnv -> TCvSubst-setCvSubstEnv (TCvSubst in_scope tenv _) cenv = TCvSubst in_scope tenv cenv+notElemSubst :: Var -> Subst -> Bool+notElemSubst v = not . elemSubst v -zapTCvSubst :: TCvSubst -> TCvSubst-zapTCvSubst (TCvSubst in_scope _ _) = TCvSubst in_scope emptyVarEnv emptyVarEnv+-- | Remove all substitutions that might have been built up+-- while preserving the in-scope set+-- originally called zapSubstEnv+zapSubst :: Subst -> Subst+zapSubst (Subst in_scope _ _ _) = Subst in_scope emptyVarEnv emptyVarEnv emptyVarEnv -extendTCvInScope :: TCvSubst -> Var -> TCvSubst-extendTCvInScope (TCvSubst in_scope tenv cenv) var- = TCvSubst (extendInScopeSet in_scope var) tenv cenv+-- | Add the 'Var' to the in-scope set+extendSubstInScope :: Subst -> Var -> Subst+extendSubstInScope (Subst in_scope ids tvs cvs) v+ = Subst (in_scope `extendInScopeSet` v)+ ids tvs cvs -extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst-extendTCvInScopeList (TCvSubst in_scope tenv cenv) vars- = TCvSubst (extendInScopeSetList in_scope vars) tenv cenv+-- | Add the 'Var's to the in-scope set: see also 'extendInScope'+extendSubstInScopeList :: Subst -> [Var] -> Subst+extendSubstInScopeList (Subst in_scope ids tvs cvs) vs+ = Subst (in_scope `extendInScopeSetList` vs)+ ids tvs cvs -extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst-extendTCvInScopeSet (TCvSubst in_scope tenv cenv) vars- = TCvSubst (extendInScopeSetSet in_scope vars) tenv cenv+-- | Add the 'Var's to the in-scope set: see also 'extendInScope'+extendSubstInScopeSet :: Subst -> VarSet -> Subst+extendSubstInScopeSet (Subst in_scope ids tvs cvs) vs+ = Subst (in_scope `extendInScopeSetSet` vs)+ ids tvs cvs -extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst+extendTCvSubst :: Subst -> TyCoVar -> Type -> Subst extendTCvSubst subst v ty | isTyVar v = extendTvSubst subst v ty@@ -333,102 +355,119 @@ | otherwise = pprPanic "extendTCvSubst" (ppr v <+> text "|->" <+> ppr ty) -extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> TCvSubst+extendTCvSubstWithClone :: Subst -> TyCoVar -> TyCoVar -> Subst extendTCvSubstWithClone subst tcv | isTyVar tcv = extendTvSubstWithClone subst tcv | otherwise = extendCvSubstWithClone subst tcv -extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst-extendTvSubst (TCvSubst in_scope tenv cenv) tv ty- = TCvSubst in_scope (extendVarEnv tenv tv ty) cenv+-- | Add a substitution for a 'TyVar' to the 'Subst'+-- The 'TyVar' *must* be a real TyVar, and not a CoVar+-- You must ensure that the in-scope set is such that+-- Note [The substitution invariant] holds+-- after extending the substitution like this.+extendTvSubst :: Subst -> TyVar -> Type -> Subst+extendTvSubst (Subst in_scope ids tvs cvs) tv ty+ = assert (isTyVar tv) $+ Subst in_scope ids (extendVarEnv tvs tv ty) cvs -extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst+extendTvSubstBinderAndInScope :: Subst -> TyCoBinder -> Type -> Subst extendTvSubstBinderAndInScope subst (Named (Bndr v _)) ty = assert (isTyVar v ) extendTvSubstAndInScope subst v ty extendTvSubstBinderAndInScope subst (Anon {}) _ = subst -extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst+extendTvSubstWithClone :: Subst -> TyVar -> TyVar -> Subst -- Adds a new tv -> tv mapping, /and/ extends the in-scope set with the clone -- Does not look in the kind of the new variable; -- those variables should be in scope already-extendTvSubstWithClone (TCvSubst in_scope tenv cenv) tv tv'- = TCvSubst (extendInScopeSet in_scope tv')+extendTvSubstWithClone (Subst in_scope idenv tenv cenv) tv tv'+ = Subst (extendInScopeSet in_scope tv')+ idenv (extendVarEnv tenv tv (mkTyVarTy tv')) cenv -extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst-extendCvSubst (TCvSubst in_scope tenv cenv) v co- = TCvSubst in_scope tenv (extendVarEnv cenv v co)+-- | Add a substitution from a 'CoVar' to a 'Coercion' to the 'Subst':+-- you must ensure that the in-scope set satisfies+-- Note [The substitution invariant]+-- after extending the substitution like this+extendCvSubst :: Subst -> CoVar -> Coercion -> Subst+extendCvSubst (Subst in_scope ids tvs cvs) v r+ = assert (isCoVar v) $+ Subst in_scope ids tvs (extendVarEnv cvs v r) -extendCvSubstWithClone :: TCvSubst -> CoVar -> CoVar -> TCvSubst-extendCvSubstWithClone (TCvSubst in_scope tenv cenv) cv cv'- = TCvSubst (extendInScopeSetSet in_scope new_in_scope)+extendCvSubstWithClone :: Subst -> CoVar -> CoVar -> Subst+extendCvSubstWithClone (Subst in_scope ids tenv cenv) cv cv'+ = Subst (extendInScopeSetSet in_scope new_in_scope)+ ids tenv (extendVarEnv cenv cv (mkCoVarCo cv')) where new_in_scope = tyCoVarsOfType (varType cv') `extendVarSet` cv' -extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst+extendTvSubstAndInScope :: Subst -> TyVar -> Type -> Subst -- Also extends the in-scope set-extendTvSubstAndInScope (TCvSubst in_scope tenv cenv) tv ty- = TCvSubst (in_scope `extendInScopeSetSet` tyCoVarsOfType ty)+extendTvSubstAndInScope (Subst in_scope ids tenv cenv) tv ty+ = Subst (in_scope `extendInScopeSetSet` tyCoVarsOfType ty)+ ids (extendVarEnv tenv tv ty) cenv -extendTvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst-extendTvSubstList subst tvs tys- = foldl2 extendTvSubst subst tvs tys+-- | Adds multiple 'TyVar' substitutions to the 'Subst': see also 'extendTvSubst'+extendTvSubstList :: Subst -> [(TyVar,Type)] -> Subst+extendTvSubstList subst vrs+ = foldl' extend subst vrs+ where+ extend subst (v, r) = extendTvSubst subst v r -extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst+extendTCvSubstList :: Subst -> [Var] -> [Type] -> Subst extendTCvSubstList subst tvs tys = foldl2 extendTCvSubst subst tvs tys -unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst+unionSubst :: Subst -> Subst -> Subst -- Works when the ranges are disjoint-unionTCvSubst (TCvSubst in_scope1 tenv1 cenv1) (TCvSubst in_scope2 tenv2 cenv2)- = assert (tenv1 `disjointVarEnv` tenv2+unionSubst (Subst in_scope1 ids1 tenv1 cenv1) (Subst in_scope2 ids2 tenv2 cenv2)+ = assert (ids1 `disjointVarEnv` ids2+ && tenv1 `disjointVarEnv` tenv2 && cenv1 `disjointVarEnv` cenv2 )- TCvSubst (in_scope1 `unionInScope` in_scope2)- (tenv1 `plusVarEnv` tenv2)- (cenv1 `plusVarEnv` cenv2)---- mkTvSubstPrs and zipTvSubst generate the in-scope set from--- the types given; but it's just a thunk so with a bit of luck--- it'll never be evaluated+ Subst (in_scope1 `unionInScope` in_scope2)+ (ids1 `plusVarEnv` ids2)+ (tenv1 `plusVarEnv` tenv2)+ (cenv1 `plusVarEnv` cenv2) --- | Generates the in-scope set for the 'TCvSubst' from the types in the incoming--- environment. No CoVars, please!-zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst+-- | Generates the in-scope set for the 'Subst' from the types in the incoming+-- environment. No CoVars or Ids, please!+zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> Subst zipTvSubst tvs tys = mkTvSubst (mkInScopeSet (shallowTyCoVarsOfTypes tys)) tenv where tenv = zipTyEnv tvs tys --- | Generates the in-scope set for the 'TCvSubst' from the types in the incoming+-- | Generates the in-scope set for the 'Subst' from the types in the incoming -- environment. No TyVars, please!-zipCvSubst :: HasDebugCallStack => [CoVar] -> [Coercion] -> TCvSubst+zipCvSubst :: HasDebugCallStack => [CoVar] -> [Coercion] -> Subst zipCvSubst cvs cos- = TCvSubst (mkInScopeSet (shallowTyCoVarsOfCos cos)) emptyTvSubstEnv cenv+ = mkCvSubst (mkInScopeSet (shallowTyCoVarsOfCos cos)) cenv where cenv = zipCoEnv cvs cos -zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst++zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> Subst zipTCvSubst tcvs tys = zip_tcvsubst tcvs tys $- mkEmptyTCvSubst $ mkInScopeSet $ shallowTyCoVarsOfTypes tys- where zip_tcvsubst :: [TyCoVar] -> [Type] -> TCvSubst -> TCvSubst+ mkEmptySubst $ mkInScopeSet $ shallowTyCoVarsOfTypes tys+ where zip_tcvsubst :: [TyCoVar] -> [Type] -> Subst -> Subst zip_tcvsubst (tv:tvs) (ty:tys) subst = zip_tcvsubst tvs tys (extendTCvSubst subst tv ty) zip_tcvsubst [] [] subst = subst -- empty case zip_tcvsubst _ _ _ = pprPanic "zipTCvSubst: length mismatch"- (ppr tcvs <+> ppr tys)+ (ppr tcvs <+> ppr tys) -- | Generates the in-scope set for the 'TCvSubst' from the types in the--- incoming environment. No CoVars, please!-mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst-mkTvSubstPrs [] = emptyTCvSubst+-- incoming environment. No CoVars, please! The InScopeSet is just a thunk+-- so with a bit of luck it'll never be evaluated+mkTvSubstPrs :: [(TyVar, Type)] -> Subst+mkTvSubstPrs [] = emptySubst mkTvSubstPrs prs = assertPpr onlyTyVarsAndNoCoercionTy (text "prs" <+> ppr prs) $ mkTvSubst in_scope tenv@@ -438,6 +477,7 @@ and [ isTyVar tv && not (isCoercionTy ty) | (tv, ty) <- prs ] +-- | The InScopeSet is just a thunk so with a bit of luck it'll never be evaluated zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv zipTyEnv tyvars tys | debugIsOn@@ -467,13 +507,18 @@ | otherwise = mkVarEnv (zipEqual "zipCoEnv" cvs cos) -instance Outputable TCvSubst where- ppr (TCvSubst ins tenv cenv)- = brackets $ sep[ text "TCvSubst",- nest 2 (text "In scope:" <+> ppr ins),- nest 2 (text "Type env:" <+> ppr tenv),- nest 2 (text "Co env:" <+> ppr cenv) ]+-- Pretty printing, for debugging only +instance Outputable Subst where+ ppr (Subst in_scope ids tvs cvs)+ = text "<InScope =" <+> in_scope_doc+ $$ text " IdSubst =" <+> ppr ids+ $$ text " TvSubst =" <+> ppr tvs+ $$ text " CvSubst =" <+> ppr cvs+ <> char '>'+ where+ in_scope_doc = pprVarSet (getInScopeVars in_scope) (braces . fsep . map ppr)+ {- %************************************************************************ %* *@@ -614,16 +659,17 @@ -- to the in-scope set. This is useful for the case when the free variables -- aren't already in the in-scope set or easily available. -- See also Note [The substitution invariant].-substTyAddInScope :: TCvSubst -> Type -> Type+substTyAddInScope :: Subst -> Type -> Type substTyAddInScope subst ty =- substTy (extendTCvInScopeSet subst $ tyCoVarsOfType ty) ty+ substTy (extendSubstInScopeSet subst $ tyCoVarsOfType ty) ty -- | When calling `substTy` it should be the case that the in-scope set in -- the substitution is a superset of the free vars of the range of the -- substitution. -- See also Note [The substitution invariant].-isValidTCvSubst :: TCvSubst -> Bool-isValidTCvSubst (TCvSubst in_scope tenv cenv) =+-- TODO: take into account ids and rename as isValidSubst+isValidTCvSubst :: Subst -> Bool+isValidTCvSubst (Subst in_scope _ tenv cenv) = (tenvFVs `varSetInScope` in_scope) && (cenvFVs `varSetInScope` in_scope) where@@ -632,8 +678,8 @@ -- | This checks if the substitution satisfies the invariant from -- Note [The substitution invariant].-checkValidSubst :: HasDebugCallStack => TCvSubst -> [Type] -> [Coercion] -> a -> a-checkValidSubst subst@(TCvSubst in_scope tenv cenv) tys cos a+checkValidSubst :: HasDebugCallStack => Subst -> [Type] -> [Coercion] -> a -> a+checkValidSubst subst@(Subst in_scope _ tenv cenv) tys cos a = assertPpr (isValidTCvSubst subst) (text "in_scope" <+> ppr in_scope $$ text "tenv" <+> ppr tenv $$@@ -663,9 +709,9 @@ -- | Substitute within a 'Type' -- The substitution has to satisfy the invariants described in -- Note [The substitution invariant].-substTy :: HasDebugCallStack => TCvSubst -> Type -> Type+substTy :: HasDebugCallStack => Subst -> Type -> Type substTy subst ty- | isEmptyTCvSubst subst = ty+ | isEmptyTCvSubst subst = ty | otherwise = checkValidSubst subst [ty] [] $ subst_ty subst ty @@ -674,26 +720,26 @@ -- Note [The substitution invariant]. -- The goal of #11371 is to migrate all the calls of substTyUnchecked to -- substTy and remove this function. Please don't use in new code.-substTyUnchecked :: TCvSubst -> Type -> Type+substTyUnchecked :: Subst -> Type -> Type substTyUnchecked subst ty- | isEmptyTCvSubst subst = ty+ | isEmptyTCvSubst subst = ty | otherwise = subst_ty subst ty -substScaledTy :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled Type+substScaledTy :: HasDebugCallStack => Subst -> Scaled Type -> Scaled Type substScaledTy subst scaled_ty = mapScaledType (substTy subst) scaled_ty -substScaledTyUnchecked :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled Type+substScaledTyUnchecked :: HasDebugCallStack => Subst -> Scaled Type -> Scaled Type substScaledTyUnchecked subst scaled_ty = mapScaledType (substTyUnchecked subst) scaled_ty -- | Substitute within several 'Type's -- The substitution has to satisfy the invariants described in -- Note [The substitution invariant].-substTys :: HasDebugCallStack => TCvSubst -> [Type] -> [Type]+substTys :: HasDebugCallStack => Subst -> [Type] -> [Type] substTys subst tys | isEmptyTCvSubst subst = tys | otherwise = checkValidSubst subst tys [] $ map (subst_ty subst) tys -substScaledTys :: HasDebugCallStack => TCvSubst -> [Scaled Type] -> [Scaled Type]+substScaledTys :: HasDebugCallStack => Subst -> [Scaled Type] -> [Scaled Type] substScaledTys subst scaled_tys | isEmptyTCvSubst subst = scaled_tys | otherwise = checkValidSubst subst (map scaledMult scaled_tys ++ map scaledThing scaled_tys) [] $@@ -704,12 +750,12 @@ -- Note [The substitution invariant]. -- The goal of #11371 is to migrate all the calls of substTysUnchecked to -- substTys and remove this function. Please don't use in new code.-substTysUnchecked :: TCvSubst -> [Type] -> [Type]+substTysUnchecked :: Subst -> [Type] -> [Type] substTysUnchecked subst tys | isEmptyTCvSubst subst = tys | otherwise = map (subst_ty subst) tys -substScaledTysUnchecked :: TCvSubst -> [Scaled Type] -> [Scaled Type]+substScaledTysUnchecked :: Subst -> [Scaled Type] -> [Scaled Type] substScaledTysUnchecked subst tys | isEmptyTCvSubst subst = tys | otherwise = map (mapScaledType (subst_ty subst)) tys@@ -717,7 +763,7 @@ -- | Substitute within a 'ThetaType' -- The substitution has to satisfy the invariants described in -- Note [The substitution invariant].-substTheta :: HasDebugCallStack => TCvSubst -> ThetaType -> ThetaType+substTheta :: HasDebugCallStack => Subst -> ThetaType -> ThetaType substTheta = substTys -- | Substitute within a 'ThetaType' disabling the sanity checks.@@ -725,11 +771,11 @@ -- Note [The substitution invariant]. -- The goal of #11371 is to migrate all the calls of substThetaUnchecked to -- substTheta and remove this function. Please don't use in new code.-substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType+substThetaUnchecked :: Subst -> ThetaType -> ThetaType substThetaUnchecked = substTysUnchecked -subst_ty :: TCvSubst -> Type -> Type+subst_ty :: Subst -> Type -> Type -- subst_ty is the main workhorse for type substitution -- -- Note that the in_scope set is poked only if we hit a forall@@ -762,34 +808,34 @@ go (CastTy ty co) = (mkCastTy $! (go ty)) $! (subst_co subst co) go (CoercionTy co) = CoercionTy $! (subst_co subst co) -substTyVar :: TCvSubst -> TyVar -> Type-substTyVar (TCvSubst _ tenv _) tv+substTyVar :: Subst -> TyVar -> Type+substTyVar (Subst _ _ tenv _) tv = assert (isTyVar tv) $ case lookupVarEnv tenv tv of Just ty -> ty Nothing -> TyVarTy tv -substTyVars :: TCvSubst -> [TyVar] -> [Type]+substTyVars :: Subst -> [TyVar] -> [Type] substTyVars subst = map $ substTyVar subst -substTyCoVars :: TCvSubst -> [TyCoVar] -> [Type]+substTyCoVars :: Subst -> [TyCoVar] -> [Type] substTyCoVars subst = map $ substTyCoVar subst -substTyCoVar :: TCvSubst -> TyCoVar -> Type+substTyCoVar :: Subst -> TyCoVar -> Type substTyCoVar subst tv | isTyVar tv = substTyVar subst tv | otherwise = CoercionTy $ substCoVar subst tv -lookupTyVar :: TCvSubst -> TyVar -> Maybe Type- -- See Note [Extending the TCvSubstEnv]-lookupTyVar (TCvSubst _ tenv _) tv+lookupTyVar :: Subst -> TyVar -> Maybe Type+ -- See Note [Extending the TvSubstEnv and CvSubstEnv]+lookupTyVar (Subst _ _ tenv _) tv = assert (isTyVar tv ) lookupVarEnv tenv tv -- | Substitute within a 'Coercion' -- The substitution has to satisfy the invariants described in -- Note [The substitution invariant].-substCo :: HasDebugCallStack => TCvSubst -> Coercion -> Coercion+substCo :: HasDebugCallStack => Subst -> Coercion -> Coercion substCo subst co | isEmptyTCvSubst subst = co | otherwise = checkValidSubst subst [] [co] $ subst_co subst co@@ -799,7 +845,7 @@ -- Note [The substitution invariant]. -- The goal of #11371 is to migrate all the calls of substCoUnchecked to -- substCo and remove this function. Please don't use in new code.-substCoUnchecked :: TCvSubst -> Coercion -> Coercion+substCoUnchecked :: Subst -> Coercion -> Coercion substCoUnchecked subst co | isEmptyTCvSubst subst = co | otherwise = subst_co subst co@@ -807,12 +853,12 @@ -- | Substitute within several 'Coercion's -- The substitution has to satisfy the invariants described in -- Note [The substitution invariant].-substCos :: HasDebugCallStack => TCvSubst -> [Coercion] -> [Coercion]+substCos :: HasDebugCallStack => Subst -> [Coercion] -> [Coercion] substCos subst cos | isEmptyTCvSubst subst = cos | otherwise = checkValidSubst subst [] cos $ map (subst_co subst) cos -subst_co :: TCvSubst -> Coercion -> Coercion+subst_co :: Subst -> Coercion -> Coercion subst_co subst co = go co where@@ -858,8 +904,8 @@ go_hole h@(CoercionHole { ch_co_var = cv }) = h { ch_co_var = updateVarType go_ty cv } -substForAllCoBndr :: TCvSubst -> TyCoVar -> KindCoercion- -> (TCvSubst, TyCoVar, Coercion)+substForAllCoBndr :: Subst -> TyCoVar -> KindCoercion+ -> (Subst, TyCoVar, Coercion) substForAllCoBndr subst = substForAllCoBndrUsing False (substCo subst) subst @@ -868,27 +914,27 @@ -- Note [The substitution invariant]. -- The goal of #11371 is to migrate all the calls of substCoUnchecked to -- substCo and remove this function. Please don't use in new code.-substForAllCoBndrUnchecked :: TCvSubst -> TyCoVar -> KindCoercion- -> (TCvSubst, TyCoVar, Coercion)+substForAllCoBndrUnchecked :: Subst -> TyCoVar -> KindCoercion+ -> (Subst, TyCoVar, Coercion) substForAllCoBndrUnchecked subst = substForAllCoBndrUsing False (substCoUnchecked subst) subst -- See Note [Sym and ForAllCo] substForAllCoBndrUsing :: Bool -- apply sym to binder? -> (Coercion -> Coercion) -- transformation to kind co- -> TCvSubst -> TyCoVar -> KindCoercion- -> (TCvSubst, TyCoVar, KindCoercion)+ -> Subst -> TyCoVar -> KindCoercion+ -> (Subst, TyCoVar, KindCoercion) substForAllCoBndrUsing sym sco subst old_var | isTyVar old_var = substForAllCoTyVarBndrUsing sym sco subst old_var | otherwise = substForAllCoCoVarBndrUsing sym sco subst old_var substForAllCoTyVarBndrUsing :: Bool -- apply sym to binder? -> (Coercion -> Coercion) -- transformation to kind co- -> TCvSubst -> TyVar -> KindCoercion- -> (TCvSubst, TyVar, KindCoercion)-substForAllCoTyVarBndrUsing sym sco (TCvSubst in_scope tenv cenv) old_var old_kind_co+ -> Subst -> TyVar -> KindCoercion+ -> (Subst, TyVar, KindCoercion)+substForAllCoTyVarBndrUsing sym sco (Subst in_scope idenv tenv cenv) old_var old_kind_co = assert (isTyVar old_var )- ( TCvSubst (in_scope `extendInScopeSet` new_var) new_env cenv+ ( Subst (in_scope `extendInScopeSet` new_var) idenv new_env cenv , new_var, new_kind_co ) where new_env | no_change && not sym = delVarEnv tenv old_var@@ -912,12 +958,12 @@ substForAllCoCoVarBndrUsing :: Bool -- apply sym to binder? -> (Coercion -> Coercion) -- transformation to kind co- -> TCvSubst -> CoVar -> KindCoercion- -> (TCvSubst, CoVar, KindCoercion)-substForAllCoCoVarBndrUsing sym sco (TCvSubst in_scope tenv cenv)+ -> Subst -> CoVar -> KindCoercion+ -> (Subst, CoVar, KindCoercion)+substForAllCoCoVarBndrUsing sym sco (Subst in_scope idenv tenv cenv) old_var old_kind_co = assert (isCoVar old_var )- ( TCvSubst (in_scope `extendInScopeSet` new_var) tenv new_cenv+ ( Subst (in_scope `extendInScopeSet` new_var) idenv tenv new_cenv , new_var, new_kind_co ) where new_cenv | no_change && not sym = delVarEnv cenv old_var@@ -935,31 +981,31 @@ new_var_type | sym = h2 | otherwise = h1 -substCoVar :: TCvSubst -> CoVar -> Coercion-substCoVar (TCvSubst _ _ cenv) cv+substCoVar :: Subst -> CoVar -> Coercion+substCoVar (Subst _ _ _ cenv) cv = case lookupVarEnv cenv cv of Just co -> co Nothing -> CoVarCo cv -substCoVars :: TCvSubst -> [CoVar] -> [Coercion]+substCoVars :: Subst -> [CoVar] -> [Coercion] substCoVars subst cvs = map (substCoVar subst) cvs -lookupCoVar :: TCvSubst -> Var -> Maybe Coercion-lookupCoVar (TCvSubst _ _ cenv) v = lookupVarEnv cenv v+lookupCoVar :: Subst -> Var -> Maybe Coercion+lookupCoVar (Subst _ _ _ cenv) v = lookupVarEnv cenv v -substTyVarBndr :: HasDebugCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)+substTyVarBndr :: HasDebugCallStack => Subst -> TyVar -> (Subst, TyVar) substTyVarBndr = substTyVarBndrUsing substTy -substTyVarBndrs :: HasDebugCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar])+substTyVarBndrs :: HasDebugCallStack => Subst -> [TyVar] -> (Subst, [TyVar]) substTyVarBndrs = mapAccumL substTyVarBndr -substVarBndr :: HasDebugCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)+substVarBndr :: HasDebugCallStack => Subst -> TyCoVar -> (Subst, TyCoVar) substVarBndr = substVarBndrUsing substTy -substVarBndrs :: HasDebugCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar])+substVarBndrs :: HasDebugCallStack => Subst -> [TyCoVar] -> (Subst, [TyCoVar]) substVarBndrs = mapAccumL substVarBndr -substCoVarBndr :: HasDebugCallStack => TCvSubst -> CoVar -> (TCvSubst, CoVar)+substCoVarBndr :: HasDebugCallStack => Subst -> CoVar -> (Subst, CoVar) substCoVarBndr = substCoVarBndrUsing substTy -- | Like 'substVarBndr', but disables sanity checks.@@ -967,11 +1013,11 @@ -- Note [The substitution invariant]. -- The goal of #11371 is to migrate all the calls of substTyUnchecked to -- substTy and remove this function. Please don't use in new code.-substVarBndrUnchecked :: TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)+substVarBndrUnchecked :: Subst -> TyCoVar -> (Subst, TyCoVar) substVarBndrUnchecked = substVarBndrUsing substTyUnchecked -substVarBndrUsing :: (TCvSubst -> Type -> Type)- -> TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)+substVarBndrUsing :: (Subst -> Type -> Type)+ -> Subst -> TyCoVar -> (Subst, TyCoVar) substVarBndrUsing subst_fn subst v | isTyVar v = substTyVarBndrUsing subst_fn subst v | otherwise = substCoVarBndrUsing subst_fn subst v@@ -980,12 +1026,12 @@ -- extended subst and a new tyvar. -- Use the supplied function to substitute in the kind substTyVarBndrUsing- :: (TCvSubst -> Type -> Type) -- ^ Use this to substitute in the kind- -> TCvSubst -> TyVar -> (TCvSubst, TyVar)-substTyVarBndrUsing subst_fn subst@(TCvSubst in_scope tenv cenv) old_var+ :: (Subst -> Type -> Type) -- ^ Use this to substitute in the kind+ -> Subst -> TyVar -> (Subst, TyVar)+substTyVarBndrUsing subst_fn subst@(Subst in_scope idenv tenv cenv) old_var = assertPpr _no_capture (pprTyVar old_var $$ pprTyVar new_var $$ ppr subst) $ assert (isTyVar old_var )- (TCvSubst (in_scope `extendInScopeSet` new_var) new_env cenv, new_var)+ (Subst (in_scope `extendInScopeSet` new_var) idenv new_env cenv, new_var) where new_env | no_change = delVarEnv tenv old_var | otherwise = extendVarEnv tenv old_var (TyVarTy new_var)@@ -998,7 +1044,7 @@ no_change = no_kind_change && (new_var == old_var) -- no_change means that the new_var is identical in -- all respects to the old_var (same unique, same kind)- -- See Note [Extending the TCvSubstEnv]+ -- See Note [Extending the TvSubstEnv and CvSubstEnv] -- -- In that case we don't need to extend the substitution -- to map old to new. But instead we must zap any@@ -1015,11 +1061,11 @@ -- extended subst and a new covar. -- Use the supplied function to substitute in the kind substCoVarBndrUsing- :: (TCvSubst -> Type -> Type)- -> TCvSubst -> CoVar -> (TCvSubst, CoVar)-substCoVarBndrUsing subst_fn subst@(TCvSubst in_scope tenv cenv) old_var+ :: (Subst -> Type -> Type)+ -> Subst -> CoVar -> (Subst, CoVar)+substCoVarBndrUsing subst_fn subst@(Subst in_scope idenv tenv cenv) old_var = assert (isCoVar old_var)- (TCvSubst (in_scope `extendInScopeSet` new_var) tenv new_cenv, new_var)+ (Subst (in_scope `extendInScopeSet` new_var) idenv tenv new_cenv, new_var) where new_co = mkCoVarCo new_var no_kind_change = noFreeVarsOfTypes [t1, t2]@@ -1038,11 +1084,14 @@ -- It's important to do the substitution for coercions, -- because they can have free type variables -cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar)-cloneTyVarBndr subst@(TCvSubst in_scope tv_env cv_env) tv uniq+cloneTyVarBndr :: Subst -> TyVar -> Unique -> (Subst, TyVar)+cloneTyVarBndr subst@(Subst in_scope id_env tv_env cv_env) tv uniq = assertPpr (isTyVar tv) (ppr tv) -- I think it's only called on TyVars- (TCvSubst (extendInScopeSet in_scope tv')- (extendVarEnv tv_env tv (mkTyVarTy tv')) cv_env, tv')+ ( Subst (extendInScopeSet in_scope tv')+ id_env+ (extendVarEnv tv_env tv (mkTyVarTy tv'))+ cv_env+ , tv') where old_ki = tyVarKind tv no_kind_change = noFreeVarsOfType old_ki -- verify that kind is closed@@ -1052,7 +1101,7 @@ tv' = setVarUnique tv1 uniq -cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar])+cloneTyVarBndrs :: Subst -> [TyVar] -> UniqSupply -> (Subst, [TyVar]) cloneTyVarBndrs subst [] _usupply = (subst, []) cloneTyVarBndrs subst (t:ts) usupply = (subst'', tv:tvs) where@@ -1060,9 +1109,8 @@ (subst' , tv ) = cloneTyVarBndr subst t uniq (subst'', tvs) = cloneTyVarBndrs subst' ts usupply' -substTyCoBndr :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder)+substTyCoBndr :: Subst -> TyCoBinder -> (Subst, TyCoBinder) substTyCoBndr subst (Anon af ty) = (subst, Anon af (substScaledTy subst ty)) substTyCoBndr subst (Named (Bndr tv vis)) = (subst', Named (Bndr tv' vis)) where (subst', tv') = substVarBndr subst tv-
compiler/GHC/Core/TyCon.hs view
@@ -174,6 +174,8 @@ import GHC.Types.Unique.Set import GHC.Unit.Module +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import qualified Data.Data as Data {-@@ -1803,12 +1805,12 @@ -- | Look up a field label belonging to this 'TyCon' lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel-lookupTyConFieldLabel lbl tc = lookupDFsEnv (tyConFieldLabelEnv tc) lbl+lookupTyConFieldLabel lbl tc = lookupDFsEnv (tyConFieldLabelEnv tc) (field_label lbl) -- | Make a map from strings to FieldLabels from all the data -- constructors of this algebraic tycon fieldsOfAlgTcRhs :: AlgTyConRhs -> FieldLabelEnv-fieldsOfAlgTcRhs rhs = mkDFsEnv [ (flLabel fl, fl)+fieldsOfAlgTcRhs rhs = mkDFsEnv [ (field_label $ flLabel fl, fl) | fl <- dataConsFields (visibleDataCons rhs) ] where -- Duplicates in this list will be removed by 'mkFsEnv'
compiler/GHC/Core/Type.hs view
@@ -129,7 +129,6 @@ isUnliftedType, isBoxedType, isUnboxedTupleType, isUnboxedSumType, kindBoxedRepLevity_maybe, mightBeLiftedType, mightBeUnliftedType,- isStateType, isAlgType, isDataFamilyAppType, isPrimitiveType, isStrictType, isLevityTy, isLevityVar,@@ -193,25 +192,26 @@ -- * Main type substitution data types TvSubstEnv, -- Representation widely visible- TCvSubst(..), -- Representation visible to a few friends+ IdSubstEnv,+ Subst(..), -- Representation visible to a few friends -- ** Manipulating type substitutions- emptyTvSubstEnv, emptyTCvSubst, mkEmptyTCvSubst,+ emptyTvSubstEnv, emptySubst, mkEmptySubst, - mkTCvSubst, zipTvSubst, mkTvSubstPrs,+ mkSubst, zipTvSubst, mkTvSubstPrs, zipTCvSubst,- notElemTCvSubst,- getTvSubstEnv, setTvSubstEnv,- zapTCvSubst, getTCvInScope, getTCvSubstRangeFVs,- extendTCvInScope, extendTCvInScopeList, extendTCvInScopeSet,+ notElemSubst,+ getTvSubstEnv,+ zapSubst, getSubstInScope, setInScope, getSubstRangeTyCoFVs,+ extendSubstInScope, extendSubstInScopeList, extendSubstInScopeSet, extendTCvSubst, extendCvSubst, extendTvSubst, extendTvSubstBinderAndInScope, extendTvSubstList, extendTvSubstAndInScope, extendTCvSubstList, extendTvSubstWithClone, extendTCvSubstWithClone,- isInScope, composeTCvSubstEnv, composeTCvSubst, zipTyEnv, zipCoEnv,- isEmptyTCvSubst, unionTCvSubst,+ isInScope, composeTCvSubst, zipTyEnv, zipCoEnv,+ isEmptySubst, unionSubst, isEmptyTCvSubst, -- ** Performing substitution on types and kinds substTy, substTys, substScaledTy, substScaledTys, substTyWith, substTysWith, substTheta,@@ -486,7 +486,7 @@ | null tvs = mkAppTys rhs arg_tys | otherwise = go empty_subst tvs arg_tys where- empty_subst = mkEmptyTCvSubst in_scope+ empty_subst = mkEmptySubst in_scope in_scope = mkInScopeSet $ shallowTyCoVarsOfTypes $ arg_tys -- The free vars of 'rhs' should all be bound by 'tenv', -- so we only need the free vars of tys@@ -550,7 +550,7 @@ -- -- Keep this synchronized with 'synonymTyConsOfType' expandTypeSynonyms ty- = go (mkEmptyTCvSubst in_scope) ty+ = go (mkEmptySubst in_scope) ty where in_scope = mkInScopeSet (tyCoVarsOfType ty) @@ -1360,7 +1360,7 @@ FunTy { ft_res = res } -> Just res ForAllTy (Bndr tv _) res- -> let empty_subst = mkEmptyTCvSubst $ mkInScopeSet $+ -> let empty_subst = mkEmptySubst $ mkInScopeSet $ tyCoVarsOfTypes [arg,res] in Just (substTy (extendTCvSubst empty_subst tv arg) res) @@ -1402,9 +1402,9 @@ | otherwise = pprPanic "piResultTys1" (ppr ty $$ ppr orig_args) where- init_subst = mkEmptyTCvSubst $ mkInScopeSet (tyCoVarsOfTypes (ty:orig_args))+ init_subst = mkEmptySubst $ mkInScopeSet (tyCoVarsOfTypes (ty:orig_args)) - go :: TCvSubst -> Type -> [Type] -> Type+ go :: Subst -> Type -> [Type] -> Type go subst ty [] = substTyUnchecked subst ty go subst ty all_args@(arg:args)@@ -1641,7 +1641,7 @@ , let fvs = tyCoVarsOfCo co = -- have to make sure that pushing the co in doesn't capture the bound var! if tv `elemVarSet` fvs- then let empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs)+ then let empty_subst = mkEmptySubst (mkInScopeSet fvs) (subst, tv') = substVarBndr empty_subst tv in ForAllTy (Bndr tv' vis) (substTy subst inner_ty `mk_cast_ty` co) else ForAllTy (Bndr tv vis) (inner_ty `mk_cast_ty` co)@@ -2281,7 +2281,7 @@ -- kind aligns with the corresponding position in the argument kind), determine -- each argument's visibility ('Inferred', 'Specified', or 'Required'). fun_kind_arg_flags :: Kind -> [Type] -> [ArgFlag]-fun_kind_arg_flags = go emptyTCvSubst+fun_kind_arg_flags = go emptySubst where go subst ki arg_tys | Just ki' <- coreView ki = go subst ki' arg_tys@@ -2480,13 +2480,6 @@ Just Unlifted -> True Nothing -> pprPanic "isUnliftedType" (ppr ty <+> dcolon <+> ppr (typeKind ty))---- | State token type.-isStateType :: Type -> Bool-isStateType ty- = case tyConAppTyCon_maybe ty of- Just tycon -> tycon == statePrimTyCon- _ -> False -- | Returns: --
compiler/GHC/Core/Unfold.hs view
@@ -580,10 +580,9 @@ ------------ -- Cost to allocate binding with given binder size_up_alloc bndr- | isTyVar bndr -- Doesn't exist at runtime- || isJoinId bndr -- Not allocated at all- || isUnliftedType (idType bndr) -- Doesn't live in heap- -- OK to call isUnliftedType: binders have a fixed RuntimeRep (search for FRRBinder)+ | isTyVar bndr -- Doesn't exist at runtime+ || isJoinId bndr -- Not allocated at all+ || not (isBoxedType (idType bndr)) -- Doesn't live in heap = 0 | otherwise = 10
compiler/GHC/Core/Unify.hs view
@@ -38,7 +38,7 @@ import GHC.Core.TyCon import GHC.Core.TyCo.Rep import GHC.Core.TyCo.FVs ( tyCoVarsOfCoList, tyCoFVsOfTypes )-import GHC.Core.TyCo.Subst ( mkTvSubst )+import GHC.Core.TyCo.Subst ( mkTvSubst, emptyIdSubstEnv ) import GHC.Core.RoughMap import GHC.Core.Map.Type import GHC.Utils.FV( FV, fvVarList )@@ -133,27 +133,27 @@ -- always used on top-level types, so we can bind any of the -- free variables of the LHS. -- See also Note [tcMatchTy vs tcMatchTyKi]-tcMatchTy :: Type -> Type -> Maybe TCvSubst+tcMatchTy :: Type -> Type -> Maybe Subst tcMatchTy ty1 ty2 = tcMatchTys [ty1] [ty2] -tcMatchTyX_BM :: BindFun -> TCvSubst- -> Type -> Type -> Maybe TCvSubst+tcMatchTyX_BM :: BindFun -> Subst+ -> Type -> Type -> Maybe Subst tcMatchTyX_BM bind_me subst ty1 ty2 = tc_match_tys_x bind_me False subst [ty1] [ty2] -- | Like 'tcMatchTy', but allows the kinds of the types to differ, -- and thus matches them as well. -- See also Note [tcMatchTy vs tcMatchTyKi]-tcMatchTyKi :: Type -> Type -> Maybe TCvSubst+tcMatchTyKi :: Type -> Type -> Maybe Subst tcMatchTyKi ty1 ty2 = tc_match_tys alwaysBindFun True [ty1] [ty2] -- | This is similar to 'tcMatchTy', but extends a substitution -- See also Note [tcMatchTy vs tcMatchTyKi]-tcMatchTyX :: TCvSubst -- ^ Substitution to extend+tcMatchTyX :: Subst -- ^ Substitution to extend -> Type -- ^ Template -> Type -- ^ Target- -> Maybe TCvSubst+ -> Maybe Subst tcMatchTyX subst ty1 ty2 = tc_match_tys_x alwaysBindFun False subst [ty1] [ty2] @@ -161,7 +161,7 @@ -- See also Note [tcMatchTy vs tcMatchTyKi] tcMatchTys :: [Type] -- ^ Template -> [Type] -- ^ Target- -> Maybe TCvSubst -- ^ One-shot; in principle the template+ -> Maybe Subst -- ^ One-shot; in principle the template -- variables could be free in the target tcMatchTys tys1 tys2 = tc_match_tys alwaysBindFun False tys1 tys2@@ -170,25 +170,25 @@ -- See also Note [tcMatchTy vs tcMatchTyKi] tcMatchTyKis :: [Type] -- ^ Template -> [Type] -- ^ Target- -> Maybe TCvSubst -- ^ One-shot substitution+ -> Maybe Subst -- ^ One-shot substitution tcMatchTyKis tys1 tys2 = tc_match_tys alwaysBindFun True tys1 tys2 -- | Like 'tcMatchTys', but extending a substitution -- See also Note [tcMatchTy vs tcMatchTyKi]-tcMatchTysX :: TCvSubst -- ^ Substitution to extend+tcMatchTysX :: Subst -- ^ Substitution to extend -> [Type] -- ^ Template -> [Type] -- ^ Target- -> Maybe TCvSubst -- ^ One-shot substitution+ -> Maybe Subst -- ^ One-shot substitution tcMatchTysX subst tys1 tys2 = tc_match_tys_x alwaysBindFun False subst tys1 tys2 -- | Like 'tcMatchTyKis', but extending a substitution -- See also Note [tcMatchTy vs tcMatchTyKi]-tcMatchTyKisX :: TCvSubst -- ^ Substitution to extend+tcMatchTyKisX :: Subst -- ^ Substitution to extend -> [Type] -- ^ Template -> [Type] -- ^ Target- -> Maybe TCvSubst -- ^ One-shot substitution+ -> Maybe Subst -- ^ One-shot substitution tcMatchTyKisX subst tys1 tys2 = tc_match_tys_x alwaysBindFun True subst tys1 tys2 @@ -197,27 +197,27 @@ -> Bool -- ^ match kinds? -> [Type] -> [Type]- -> Maybe TCvSubst+ -> Maybe Subst tc_match_tys bind_me match_kis tys1 tys2- = tc_match_tys_x bind_me match_kis (mkEmptyTCvSubst in_scope) tys1 tys2+ = tc_match_tys_x bind_me match_kis (mkEmptySubst in_scope) tys1 tys2 where in_scope = mkInScopeSet (tyCoVarsOfTypes tys1 `unionVarSet` tyCoVarsOfTypes tys2) -- | Worker for 'tcMatchTysX' and 'tcMatchTyKisX' tc_match_tys_x :: BindFun -> Bool -- ^ match kinds?- -> TCvSubst+ -> Subst -> [Type] -> [Type]- -> Maybe TCvSubst-tc_match_tys_x bind_me match_kis (TCvSubst in_scope tv_env cv_env) tys1 tys2+ -> Maybe Subst+tc_match_tys_x bind_me match_kis (Subst in_scope id_env tv_env cv_env) tys1 tys2 = case tc_unify_tys bind_me False -- Matching, not unifying False -- Not an injectivity check match_kis (mkRnEnv2 in_scope) tv_env cv_env tys1 tys2 of Unifiable (tv_env', cv_env')- -> Just $ TCvSubst in_scope tv_env' cv_env'+ -> Just $ Subst in_scope id_env tv_env' cv_env' _ -> Nothing -- | This one is called from the expression matcher,@@ -460,12 +460,12 @@ -- | Simple unification of two types; all type variables are bindable -- Precondition: the kinds are already equal tcUnifyTy :: Type -> Type -- All tyvars are bindable- -> Maybe TCvSubst+ -> Maybe Subst -- A regular one-shot (idempotent) substitution tcUnifyTy t1 t2 = tcUnifyTys alwaysBindFun [t1] [t2] -- | Like 'tcUnifyTy', but also unifies the kinds-tcUnifyTyKi :: Type -> Type -> Maybe TCvSubst+tcUnifyTyKi :: Type -> Type -> Maybe Subst tcUnifyTyKi t1 t2 = tcUnifyTyKis alwaysBindFun [t1] [t2] -- | Unify two types, treating type family applications as possibly unifying@@ -476,7 +476,7 @@ -- See end of sec 5.2 from the paper -> InScopeSet -- Should include the free tyvars of both Type args -> Type -> Type -- Types to unify- -> Maybe TCvSubst+ -> Maybe Subst -- This algorithm is an implementation of the "Algorithm U" presented in -- the paper "Injective type families for Haskell", Figures 2 and 3. -- The code is incorporated with the standard unifier for convenience, but@@ -493,14 +493,14 @@ where rn_env = mkRnEnv2 in_scope - maybe_fix | twoWay = niFixTCvSubst in_scope+ maybe_fix | twoWay = niFixSubst in_scope | otherwise = mkTvSubst in_scope -- when matching, don't confuse -- domain with range ----------------- tcUnifyTys :: BindFun -> [Type] -> [Type]- -> Maybe TCvSubst+ -> Maybe Subst -- ^ A regular one-shot (idempotent) substitution -- that unifies the erased types. See comments -- for 'tcUnifyTysFG'@@ -515,7 +515,7 @@ -- | Like 'tcUnifyTys' but also unifies the kinds tcUnifyTyKis :: BindFun -> [Type] -> [Type]- -> Maybe TCvSubst+ -> Maybe Subst tcUnifyTyKis bind_fn tys1 tys2 = case tcUnifyTyKisFG bind_fn tys1 tys2 of Unifiable result -> Just result@@ -523,7 +523,7 @@ -- This type does double-duty. It is used in the UM (unifier monad) and to -- return the final result. See Note [Fine-grained unification]-type UnifyResult = UnifyResultM TCvSubst+type UnifyResult = UnifyResultM Subst -- | See Note [Unification result] data UnifyResultM a = Unifiable a -- the subst that unifies the types@@ -591,7 +591,7 @@ = do { (env, _) <- tc_unify_tys bind_fn True False match_kis rn_env emptyTvSubstEnv emptyCvSubstEnv tys1 tys2- ; return $ niFixTCvSubst in_scope env }+ ; return $ niFixSubst in_scope env } where in_scope = mkInScopeSet $ tyCoVarsOfTypes tys1 `unionVarSet` tyCoVarsOfTypes tys2 rn_env = mkRnEnv2 in_scope@@ -727,13 +727,13 @@ shadowing. -} -niFixTCvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst+niFixSubst :: InScopeSet -> TvSubstEnv -> Subst -- Find the idempotent fixed point of the non-idempotent substitution -- This is surprisingly tricky: -- see Note [Finding the substitution fixpoint] -- ToDo: use laziness instead of iteration?-niFixTCvSubst in_scope tenv- | not_fixpoint = niFixTCvSubst in_scope (mapVarEnv (substTy subst) tenv)+niFixSubst in_scope tenv+ | not_fixpoint = niFixSubst in_scope (mapVarEnv (substTy subst) tenv) | otherwise = subst where range_fvs :: FV@@ -754,7 +754,7 @@ (mkTvSubst in_scope tenv) free_tvs - add_free_tv :: TCvSubst -> TyVar -> TCvSubst+ add_free_tv :: Subst -> TyVar -> Subst add_free_tv subst tv = extendTvSubst subst tv (mkTyVarTy tv') where@@ -1435,11 +1435,11 @@ getCvSubstEnv :: UM CvSubstEnv getCvSubstEnv = UM $ \state -> Unifiable (state, um_cv_env state) -getSubst :: UMEnv -> UM TCvSubst+getSubst :: UMEnv -> UM Subst getSubst env = do { tv_env <- getTvSubstEnv ; cv_env <- getCvSubstEnv ; let in_scope = rnInScopeSet (um_rn_env env)- ; return (mkTCvSubst in_scope (tv_env, cv_env)) }+ ; return (mkSubst in_scope tv_env cv_env emptyIdSubstEnv) } extendTvEnv :: TyVar -> Type -> UM () extendTvEnv tv ty = UM $ \state ->@@ -1529,7 +1529,7 @@ = do { cenv1 <- ty_co_match menv emptyVarEnv ki ki_co ki_ki_co ki_ki_co ; cenv2 <- ty_co_match menv cenv1 ty co (mkNomReflCo co_lkind) (mkNomReflCo co_rkind)- ; return (LC (mkEmptyTCvSubst in_scope) cenv2) }+ ; return (LC (mkEmptySubst in_scope) cenv2) } where menv = ME { me_tmpls = tmpls, me_env = mkRnEnv2 in_scope } in_scope = mkInScopeSet (tmpls `unionVarSet` tyCoVarsOfCo co)@@ -1577,7 +1577,7 @@ ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty -- See Note [Matching in the presence of casts (1)]- = let empty_subst = mkEmptyTCvSubst (rnInScopeSet (me_env menv))+ = let empty_subst = mkEmptySubst (rnInScopeSet (me_env menv)) substed_co_l = substCo (liftEnvSubstLeft empty_subst subst) co' substed_co_r = substCo (liftEnvSubstRight empty_subst subst) co' in@@ -1867,7 +1867,7 @@ variables outside of their scope: note that its domain is the *unrenamed* variables. This means that the substitution gets "pushed down" (like a reader monad) while the in-scope set gets threaded (like a state monad).- Because a TCvSubst contains its own in-scope set, we don't carry a TCvSubst;+ Because a Subst contains its own in-scope set, we don't carry a Subst; instead, we just carry a TvSubstEnv down, tying it to the InScopeSet traveling separately as necessary. @@ -2039,7 +2039,7 @@ in (env'', ty') where arity = tyConArity fam_tc- tcv_subst = TCvSubst (fe_in_scope env) tv_subst emptyVarEnv+ tcv_subst = Subst (fe_in_scope env) emptyIdSubstEnv tv_subst emptyVarEnv (sat_fam_args, leftover_args) = assert (arity <= length fam_args) $ splitAt arity fam_args -- Apply the substitution before looking up an application in the
compiler/GHC/Core/Utils.hs view
@@ -23,7 +23,7 @@ -- * Properties of expressions exprType, coreAltType, coreAltsType, mkLamType, mkLamTypes, mkFunctionType,- exprIsDupable, exprIsTrivial, getIdFromTrivialExpr, exprIsDeadEnd,+ exprIsDupable, exprIsTrivial, getIdFromTrivialExpr, getIdFromTrivialExpr_maybe, exprIsCheap, exprIsExpandable, exprIsCheapX, CheapAppFun, exprIsHNF, exprOkForSpeculation, exprOkForSideEffects, exprOkForSpecEval,@@ -706,7 +706,11 @@ -- in a "case" statement then they will need to manually add a dummy case branch that just -- calls "error" or similar. filterAlts _tycon inst_tys imposs_cons alts- = (imposs_deflt_cons, addDefault trimmed_alts maybe_deflt)+ = imposs_deflt_cons `seqList`+ (imposs_deflt_cons, addDefault trimmed_alts maybe_deflt)+ -- Very important to force `imposs_deflt_cons` as that forces `alt_cons`, which+ -- is essentially as retaining `alts_wo_default` or any `Alt b` for that matter+ -- leads to a huge space leak (see #22102 and !8896) where (alts_wo_default, maybe_deflt) = findDefault alts alt_cons = [con | Alt con _ _ <- alts_wo_default]@@ -1073,63 +1077,8 @@ go (Var v) = Just v go _ = Nothing -{--exprIsDeadEnd is a very cheap and cheerful function; it may return-False for bottoming expressions, but it never costs much to ask. See-also GHC.Core.Opt.Arity.exprBotStrictness_maybe, but that's a bit more-expensive.--} -exprIsDeadEnd :: CoreExpr -> Bool--- See Note [Bottoming expressions]-exprIsDeadEnd e- | isEmptyTy (exprType e)- = True- | otherwise- = go 0 e- where- go n (Var v) = isDeadEndAppSig (idDmdSig v) n- go n (App e a) | isTypeArg a = go n e- | otherwise = go (n+1) e- go n (Tick _ e) = go n e- go n (Cast e _) = go n e- go n (Let _ e) = go n e- go n (Lam v e) | isTyVar v = go n e- go _ (Case _ _ _ alts) = null alts- -- See Note [Empty case alternatives] in GHC.Core- go _ _ = False--{- Note [Bottoming expressions]-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-A bottoming expression is guaranteed to diverge, or raise an-exception. We can test for it in two different ways, and exprIsDeadEnd-checks for both of these situations:--* Visibly-bottom computations. For example- (error Int "Hello")- is visibly bottom. The strictness analyser also finds out if- a function diverges or raises an exception, and puts that info- in its strictness signature.--* Empty types. If a type is empty, its only inhabitant is bottom.- For example:- data T- f :: T -> Bool- f = \(x:t). case x of Bool {}- Since T has no data constructors, the case alternatives are of course- empty. However note that 'x' is not bound to a visibly-bottom value;- it's the *type* that tells us it's going to diverge.--A GADT may also be empty even though it has constructors:- data T a where- T1 :: a -> T Bool- T2 :: T Int- ...(case (x::T Char) of {})...-Here (T Char) is uninhabited. A more realistic case is (Int ~ Bool),-which is likewise uninhabited.---************************************************************************+{- ********************************************************************* * * exprIsDupable * *@@ -2101,7 +2050,7 @@ (full_subst, ex_bndrs) = mapAccumL mk_ex_var univ_subst (zip3 ex_tvs ex_fss ex_uniqs) - mk_ex_var :: TCvSubst -> (TyCoVar, FastString, Unique) -> (TCvSubst, TyCoVar)+ mk_ex_var :: Subst -> (TyCoVar, FastString, Unique) -> (Subst, TyCoVar) mk_ex_var subst (tv, fs, uniq) = (Type.extendTCvSubstWithClone subst tv new_tv , new_tv)
compiler/GHC/CoreToIface.hs view
@@ -1,4 +1,3 @@- {-# LANGUAGE Strict #-} -- See Note [Avoiding space leaks in toIface*] -- | Functions for converting Core things to interface file things.@@ -338,7 +337,7 @@ -- Is 'blib' visible? It depends on the visibility flag on j, -- so we have to substitute for k. Annoying! toIfaceAppArgsX fr kind ty_args- = go (mkEmptyTCvSubst in_scope) kind ty_args+ = go (mkEmptySubst in_scope) kind ty_args where in_scope = mkInScopeSet (tyCoVarsOfTypes ty_args) @@ -363,7 +362,7 @@ go env ty ts@(t1:ts1) | not (isEmptyTCvSubst env)- = go (zapTCvSubst env) (substTy env ty) ts+ = go (zapSubst env) (substTy env ty) ts -- See Note [Care with kind instantiation] in GHC.Core.Type | otherwise
compiler/GHC/Driver/Env.hs view
@@ -14,6 +14,7 @@ , hsc_all_home_unit_ids , hscUpdateLoggerFlags , hscUpdateHUG+ , hscUpdateHPT_lazy , hscUpdateHPT , hscSetActiveHomeUnit , hscSetActiveUnitId@@ -133,8 +134,15 @@ hsc_all_home_unit_ids :: HscEnv -> Set.Set UnitId hsc_all_home_unit_ids = unitEnv_keys . hsc_HUG +hscUpdateHPT_lazy :: (HomePackageTable -> HomePackageTable) -> HscEnv -> HscEnv+hscUpdateHPT_lazy f hsc_env =+ let !res = updateHpt_lazy f (hsc_unit_env hsc_env)+ in hsc_env { hsc_unit_env = res }+ hscUpdateHPT :: (HomePackageTable -> HomePackageTable) -> HscEnv -> HscEnv-hscUpdateHPT f hsc_env = hsc_env { hsc_unit_env = updateHpt f (hsc_unit_env hsc_env) }+hscUpdateHPT f hsc_env =+ let !res = updateHpt f (hsc_unit_env hsc_env)+ in hsc_env { hsc_unit_env = res } hscUpdateHUG :: (HomeUnitGraph -> HomeUnitGraph) -> HscEnv -> HscEnv hscUpdateHUG f hsc_env = hsc_env { hsc_unit_env = updateHug f (hsc_unit_env hsc_env) }
compiler/GHC/Driver/Flags.hs view
@@ -96,6 +96,7 @@ | Opt_D_dump_simpl_iterations | Opt_D_dump_spec | Opt_D_dump_prep+ | Opt_D_dump_late_cc | Opt_D_dump_stg_from_core -- ^ Initial STG (CoreToStg output) | Opt_D_dump_stg_unarised -- ^ STG after unarise | Opt_D_dump_stg_cg -- ^ STG (after stg2stg)@@ -303,6 +304,7 @@ -- profiling opts | Opt_AutoSccsOnIndividualCafs | Opt_ProfCountEntries+ | Opt_ProfLateInlineCcs | Opt_ProfLateCcs | Opt_ProfManualCcs -- ^ Ignore manual SCC annotations @@ -399,8 +401,10 @@ | Opt_ShowLoadedModules | Opt_HexWordLiterals -- See Note [Print Hexadecimal Literals] - -- Suppress all coercions, them replacing with '...'+ -- Suppress a coercions inner structure, replacing it with '...' | Opt_SuppressCoercions+ -- Suppress the type of a coercion as well+ | Opt_SuppressCoercionTypes | Opt_SuppressVarKinds -- Suppress module id prefixes on variables. | Opt_SuppressModulePrefixes
compiler/GHC/Driver/Pipeline/Monad.hs view
@@ -29,6 +29,7 @@ src_filename :: String, -- ^ basename of original input source src_basename :: String, -- ^ basename of original input source src_suffix :: String, -- ^ its extension+ start_phase :: Phase, output_spec :: PipelineOutput -- ^ says where to put the pipeline output }
compiler/GHC/Driver/Plugins.hs view
@@ -1,6 +1,13 @@ {-# LANGUAGE RankNTypes #-}+{-# LANGUAGE CPP #-} +#if defined(HAVE_INTERNAL_INTERPRETER) && defined(CAN_LOAD_DLL)+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE UnboxedTuples #-}+#endif + -- | Definitions for writing /plugins/ for GHC. Plugins can hook into -- several areas of the compiler. See the 'Plugin' type. These plugins -- include type-checker plugins, source plugins, and core-to-core plugins.@@ -14,6 +21,10 @@ , CommandLineOption , PsMessages(..) , ParsedResult(..)++ -- * External plugins+ , loadExternalPlugins+ -- ** Recompilation checking , purePlugin, impurePlugin, flagRecompile , PluginRecompile(..)@@ -52,6 +63,7 @@ , PluginWithArgs(..), pluginsWithArgs, pluginRecompile' , LoadedPlugin(..), lpModuleName , StaticPlugin(..)+ , ExternalPlugin(..) , mapPlugins, withPlugins, withPlugins_ ) where @@ -60,6 +72,7 @@ import GHC.Driver.Env import GHC.Driver.Monad import GHC.Driver.Phases+import GHC.Driver.Plugins.External import GHC.Unit.Module import GHC.Unit.Module.ModIface@@ -75,8 +88,12 @@ import GHC.Core.Opt.Pipeline.Types ( CoreToDo ) import GHC.Hs import GHC.Types.Error (Messages)+import GHC.Linker.Types+import GHC.Types.Unique.DFM+ import GHC.Utils.Fingerprint-import GHC.Utils.Outputable (Outputable(..), text, (<+>))+import GHC.Utils.Outputable+import GHC.Utils.Panic import Data.List (sort) @@ -85,9 +102,14 @@ import qualified Data.Semigroup import Control.Monad-import GHC.Linker.Types-import GHC.Types.Unique.DFM +#if defined(HAVE_INTERNAL_INTERPRETER) && defined(CAN_LOAD_DLL)+import GHCi.ObjLink+import GHC.Exts (addrToAny#, Ptr(..))+import GHC.Utils.Encoding+#endif++ -- | Command line options gathered from the -PModule.Name:stuff syntax -- are given to you as this type type CommandLineOption = String@@ -196,6 +218,14 @@ -- ^ the module containing the plugin } +-- | External plugin loaded directly from a library without loading module+-- interfaces+data ExternalPlugin = ExternalPlugin+ { epPlugin :: PluginWithArgs -- ^ Plugin with its arguments+ , epUnit :: String -- ^ UnitId+ , epModule :: String -- ^ Module name+ }+ -- | A static plugin with its arguments. For registering compiled-in plugins -- through the GHC API. data StaticPlugin = StaticPlugin@@ -285,6 +315,10 @@ -- To add dynamically loaded plugins through the GHC API see -- 'addPluginModuleName' instead. + , externalPlugins :: ![ExternalPlugin]+ -- ^ External plugins loaded directly from libraries without loading+ -- module interfaces.+ , loadedPlugins :: ![LoadedPlugin] -- ^ Plugins dynamically loaded after processing arguments. What -- will be loaded here is directed by DynFlags.pluginModNames.@@ -299,12 +333,17 @@ } emptyPlugins :: Plugins-emptyPlugins = Plugins [] [] ([], emptyUDFM)-+emptyPlugins = Plugins+ { staticPlugins = []+ , externalPlugins = []+ , loadedPlugins = []+ , loadedPluginDeps = ([], emptyUDFM)+ } pluginsWithArgs :: Plugins -> [PluginWithArgs] pluginsWithArgs plugins = map lpPlugin (loadedPlugins plugins) +++ map epPlugin (externalPlugins plugins) ++ map spPlugin (staticPlugins plugins) -- | Perform an operation by using all of the plugins in turn.@@ -328,3 +367,53 @@ } defaultFrontendPlugin :: FrontendPlugin defaultFrontendPlugin = FrontendPlugin { frontend = \_ _ -> return () }+++-- | Load external plugins+loadExternalPlugins :: [ExternalPluginSpec] -> IO [ExternalPlugin]+loadExternalPlugins [] = return []+#if !defined(HAVE_INTERNAL_INTERPRETER)+loadExternalPlugins _ = do+ panic "loadExternalPlugins: can't load external plugins with GHC built without internal interpreter"+#elif !defined(CAN_LOAD_DLL)+loadExternalPlugins _ = do+ panic "loadExternalPlugins: loading shared libraries isn't supported by this compiler"+#else+loadExternalPlugins ps = do+ -- initialize the linker+ initObjLinker RetainCAFs+ -- load plugins+ forM ps $ \(ExternalPluginSpec path unit mod_name opts) -> do+ loadExternalPluginLib path+ -- lookup symbol+ let ztmp = zEncodeString mod_name ++ "_plugin_closure"+ symbol+ | null unit = ztmp+ | otherwise = zEncodeString unit ++ "_" ++ ztmp+ plugin <- lookupSymbol symbol >>= \case+ Nothing -> pprPanic "loadExternalPlugins"+ (vcat [ text "Symbol not found"+ , text " Library path: " <> text path+ , text " Symbol : " <> text symbol+ ])+ Just (Ptr addr) -> case addrToAny# addr of+ (# a #) -> pure a++ pure $ ExternalPlugin (PluginWithArgs plugin opts) unit mod_name++loadExternalPluginLib :: FilePath -> IO ()+loadExternalPluginLib path = do+ -- load library+ loadDLL path >>= \case+ Just errmsg -> pprPanic "loadExternalPluginLib"+ (vcat [ text "Can't load plugin library"+ , text " Library path: " <> text path+ , text " Error : " <> text errmsg+ ])+ Nothing -> do+ -- resolve objects+ resolveObjs >>= \case+ True -> return ()+ False -> pprPanic "loadExternalPluginLib" (text "Unable to resolve objects for library: " <> text path)++#endif
+ compiler/GHC/Driver/Plugins/External.hs view
@@ -0,0 +1,79 @@+-- | External plugins+--+-- GHC supports two kinds of "static" plugins:+-- 1. internal: setup with GHC-API+-- 2. external: setup as explained below and loaded from shared libraries+--+-- The intended use case for external static plugins is with cross compilers: at+-- the time of writing, GHC is mono-target and a GHC cross-compiler (i.e. when+-- host /= target) can't build nor load plugins for the host using the+-- "non-static" plugin approach. Fixing this is tracked in #14335. If you're not+-- using a cross-compiler, you'd better use non-static plugins which are easier+-- to build and and safer to use (see below).+--+-- External static plugins can be configured via the command-line with+-- the -fplugin-library flag. Syntax is:+--+-- -fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩+--+-- Example:+-- -fplugin-library=path/to/plugin;package-123;Plugin.Module;["Argument","List"]+--+-- Building the plugin library:+-- 1. link with the libraries used to build the compiler you target. If you+-- target a cross-compiler (stage2), you can't directly use it to build the+-- plugin library. Use the stage1 compiler instead.+--+-- 2. if you use cabal to build the library, its unit-id will be set by cabal+-- and will contain a hash (e.g. "my-plugin-unit-1345656546ABCDEF"). To force+-- the unit id, use GHC's `-this-unit-id` command line flag:+-- e.g. -this-unit-id my-plugin-unit+-- You can set this in the .cabal file of your library with the following+-- stanza: `ghc-options: -this-unit-id my-plugin-unit`+--+-- 3. To make your plugin easier to distribute, you may want to link it+-- statically with all its dependencies. You would need to use `-shared`+-- without `-dynamic` when building your library.+--+-- However, all the static dependencies have to be built with `-fPIC` and it's+-- not done by default. See+-- https://www.hobson.space/posts/haskell-foreign-library/ for a way to modify+-- the compiler to do it.+--+-- In any case, don't link your plugin library statically with the RTS (e.g.+-- use `-fno-link-rts`) as there are some global variables in the RTS that must+-- be shared between the plugin and the compiler.+--+-- With external static plugins we don't check the type of the `plugin` closure+-- we look up. If it's not a valid `Plugin` value, it will probably crash badly.+--++module GHC.Driver.Plugins.External+ ( ExternalPluginSpec (..)+ , parseExternalPluginSpec+ )+where++import GHC.Prelude+import Text.Read++-- | External plugin spec+data ExternalPluginSpec = ExternalPluginSpec+ { esp_lib :: !FilePath+ , esp_unit_id :: !String+ , esp_module :: !String+ , esp_args :: ![String]+ }++-- | Parser external static plugin specification from command-line flag+parseExternalPluginSpec :: String -> Maybe ExternalPluginSpec+parseExternalPluginSpec optflag =+ case break (== ';') optflag of+ (libPath, _:rest) -> case break (== ';') rest of+ (libName, _:pack) -> case break (== ';') pack of+ (modName, _:args) -> case readMaybe args of+ Just as -> Just (ExternalPluginSpec libPath libName modName as)+ Nothing -> Nothing+ _ -> Nothing+ _ -> Nothing+ _ -> Nothing
compiler/GHC/Driver/Session.hs view
@@ -82,7 +82,6 @@ sTopDir, sGlobalPackageDatabasePath, sLdSupportsCompactUnwind,- sLdSupportsBuildId, sLdSupportsFilelist, sLdIsGnuLd, sGccSupportsNoPie,@@ -230,6 +229,7 @@ import GHC.Driver.Phases ( Phase(..), phaseInputExt ) import GHC.Driver.Flags import GHC.Driver.Backend+import GHC.Driver.Plugins.External import GHC.Settings.Config import GHC.Utils.CliOption import GHC.Core.Unfold@@ -591,6 +591,9 @@ -- ^ the @-ffrontend-opt@ flags given on the command line, in *reverse* -- order that they're specified on the command line. + externalPluginSpecs :: [ExternalPluginSpec],+ -- ^ External plugins loaded from shared libraries+ -- For ghc -M depMakefile :: FilePath, depIncludePkgDeps :: Bool,@@ -1177,6 +1180,8 @@ pluginModNameOpts = [], frontendPluginOpts = [], + externalPluginSpecs = [],+ outputFile_ = Nothing, dynOutputFile_ = Nothing, outputHi = Nothing,@@ -1716,6 +1721,11 @@ [] -> "" -- should probably signal an error (_:plug_opt) -> plug_opt -- ignore the ':' from break +addExternalPlugin :: String -> DynFlags -> DynFlags+addExternalPlugin optflag d = case parseExternalPluginSpec optflag of+ Just r -> d { externalPluginSpecs = r : externalPluginSpecs d }+ Nothing -> cmdLineError $ "Couldn't parse external plugin specification: " ++ optflag+ addFrontendPluginOption :: String -> DynFlags -> DynFlags addFrontendPluginOption s d = d { frontendPluginOpts = s : frontendPluginOpts d } @@ -1947,7 +1957,8 @@ " must be specified with a Safe Haskell flag"] -- Have we inferred Unsafe? See Note [Safe Haskell Inference] in GHC.Driver.Main- safeFlags = all (\(_,_,t,_) -> not $ t dflags) unsafeFlagsForInfer+ -- Force this to avoid retaining reference to old DynFlags value+ !safeFlags = all (\(_,_,t,_) -> not $ t dflags) unsafeFlagsForInfer {- **********************************************************************@@ -2377,6 +2388,7 @@ -- have otherwise identical names. , make_ord_flag defGhcFlag "dsuppress-all" (NoArg $ do setGeneralFlag Opt_SuppressCoercions+ setGeneralFlag Opt_SuppressCoercionTypes setGeneralFlag Opt_SuppressVarKinds setGeneralFlag Opt_SuppressModulePrefixes setGeneralFlag Opt_SuppressTypeApplications@@ -2485,6 +2497,8 @@ (setDumpFlag Opt_D_dump_spec) , make_ord_flag defGhcFlag "ddump-prep" (setDumpFlag Opt_D_dump_prep)+ , make_ord_flag defGhcFlag "ddump-late-cc"+ (setDumpFlag Opt_D_dump_late_cc) , make_ord_flag defGhcFlag "ddump-stg-from-core" (setDumpFlag Opt_D_dump_stg_from_core) , make_ord_flag defGhcFlag "ddump-stg-unarised"@@ -2692,6 +2706,8 @@ , make_ord_flag defGhcFlag "fclear-plugins" (noArg clearPluginModuleNames) , make_ord_flag defGhcFlag "ffrontend-opt" (hasArg addFrontendPluginOption) + , make_ord_flag defGhcFlag "fplugin-library" (hasArg addExternalPlugin)+ ------ Optimisation flags ------------------------------------------ , make_dep_flag defGhcFlag "Onot" (noArgM $ setOptLevel 0 ) "Use -O0 instead"@@ -3331,6 +3347,7 @@ (useInstead "-d" "suppress-stg-exts"), flagSpec "suppress-stg-exts" Opt_SuppressStgExts, flagSpec "suppress-coercions" Opt_SuppressCoercions,+ flagSpec "suppress-coercion-types" Opt_SuppressCoercionTypes, flagSpec "suppress-idinfo" Opt_SuppressIdInfo, flagSpec "suppress-unfoldings" Opt_SuppressUnfoldings, flagSpec "suppress-module-prefixes" Opt_SuppressModulePrefixes,@@ -3444,6 +3461,7 @@ flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "prof-late" Opt_ProfLateCcs, flagSpec "prof-manual" Opt_ProfManualCcs,+ flagSpec "prof-late-inline" Opt_ProfLateInlineCcs, flagSpec "regs-graph" Opt_RegsGraph, flagSpec "regs-iterative" Opt_RegsIterative, depFlagSpec' "rewrite-rules" Opt_EnableRewriteRules@@ -3468,7 +3486,7 @@ flagSpec "unbox-strict-fields" Opt_UnboxStrictFields, flagSpec "version-macros" Opt_VersionMacros, flagSpec "worker-wrapper" Opt_WorkerWrapper,- flagSpec "worker-wrapper-cbv" Opt_WorkerWrapperUnlift,+ flagSpec "worker-wrapper-cbv" Opt_WorkerWrapperUnlift, -- See Note [Worker/wrapper for strict arguments] flagSpec "solve-constant-dicts" Opt_SolveConstantDicts, flagSpec "catch-nonexhaustive-cases" Opt_CatchNonexhaustiveCases, flagSpec "alignment-sanitisation" Opt_AlignmentSanitisation,@@ -4998,6 +5016,7 @@ , sdocSuppressTypeApplications = gopt Opt_SuppressTypeApplications dflags , sdocSuppressIdInfo = gopt Opt_SuppressIdInfo dflags , sdocSuppressCoercions = gopt Opt_SuppressCoercions dflags+ , sdocSuppressCoercionTypes = gopt Opt_SuppressCoercionTypes dflags , sdocSuppressUnfoldings = gopt Opt_SuppressUnfoldings dflags , sdocSuppressVarKinds = gopt Opt_SuppressVarKinds dflags , sdocSuppressUniques = gopt Opt_SuppressUniques dflags@@ -5005,7 +5024,6 @@ , sdocSuppressStgExts = gopt Opt_SuppressStgExts dflags , sdocErrorSpans = gopt Opt_ErrorSpans dflags , sdocStarIsType = xopt LangExt.StarIsType dflags- , sdocImpredicativeTypes = xopt LangExt.ImpredicativeTypes dflags , sdocLinearTypes = xopt LangExt.LinearTypes dflags , sdocListTuplePuns = True , sdocPrintTypeAbbreviations = True
compiler/GHC/Hs/Expr.hs view
@@ -37,7 +37,7 @@ import GHC.Hs.Pat import GHC.Hs.Lit import Language.Haskell.Syntax.Extension-import Language.Haskell.Syntax.Basic (FieldLabelString)+import Language.Haskell.Syntax.Basic (FieldLabelString(..)) import GHC.Hs.Extension import GHC.Hs.Type import GHC.Hs.Binds@@ -46,6 +46,7 @@ -- others: import GHC.Tc.Types.Evidence import GHC.Types.Name+import GHC.Types.Name.Reader import GHC.Types.Name.Set import GHC.Types.Basic import GHC.Types.Fixity@@ -2121,8 +2122,11 @@ pprFieldLabelStrings (FieldLabelStrings flds) = hcat (punctuate dot (map (ppr . unXRec @p) flds)) -instance Outputable(XRec p FieldLabelString) => Outputable (DotFieldOcc p) where- ppr (DotFieldOcc _ s) = ppr s+pprPrefixFastString :: FastString -> SDoc+pprPrefixFastString fs = pprPrefixOcc (mkVarUnqual fs)++instance UnXRec p => Outputable (DotFieldOcc p) where+ ppr (DotFieldOcc _ s) = (pprPrefixFastString . field_label . unXRec @p) s ppr XDotFieldOcc{} = text "XDotFieldOcc" {-@@ -2157,8 +2161,10 @@ type instance Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))] = SrcSpanAnnL type instance Anno (FieldLabelStrings (GhcPass p)) = SrcAnn NoEpAnns+type instance Anno FieldLabelString = SrcSpanAnnN+ type instance Anno FastString = SrcAnn NoEpAnns- -- NB: type FieldLabelString = FastString+ -- Used in HsQuasiQuote and perhaps elsewhere type instance Anno (DotFieldOcc (GhcPass p)) = SrcAnn NoEpAnns
compiler/GHC/Iface/Syntax.hs view
@@ -78,6 +78,8 @@ import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith, seqList, zipWithEqual ) +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import Control.Monad import System.IO.Unsafe import Control.DeepSeq@@ -1262,7 +1264,7 @@ | otherwise = Nothing where sel = flSelector lbl- occ = mkVarOccFS (flLabel lbl)+ occ = mkVarOccFS (field_label $ flLabel lbl) mk_user_con_res_ty :: IfaceEqSpec -> SDoc -- See Note [Result type of a data family GADT]
compiler/GHC/Parser.y view
@@ -93,6 +93,8 @@ unboxedUnitTyCon, unboxedUnitDataCon, listTyCon_RDR, consDataCon_RDR) +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import qualified Data.Semigroup as Semi } @@ -2881,8 +2883,8 @@ | aexp1 TIGHT_INFIX_PROJ field {% runPV (unECP $1) >>= \ $1 -> fmap ecpFromExp $ acsa (\cs ->- let fl = sLLa $2 $> (DotFieldOcc ((EpAnn (glR $2) (AnnFieldLabel (Just $ glAA $2)) emptyComments)) (reLocA $3)) in- mkRdrGetField (noAnnSrcSpan $ comb2 (reLoc $1) $>) $1 fl (EpAnn (glAR $1) NoEpAnns cs)) }+ let fl = sLLa $2 (reLoc $>) (DotFieldOcc ((EpAnn (glR $2) (AnnFieldLabel (Just $ glAA $2)) emptyComments)) $3) in+ mkRdrGetField (noAnnSrcSpan $ comb2 (reLoc $1) (reLoc $>)) $1 fl (EpAnn (glAR $1) NoEpAnns cs)) } | aexp2 { $1 }@@ -2967,8 +2969,8 @@ projection -- See Note [Whitespace-sensitive operator parsing] in GHC.Parsing.Lexer : projection TIGHT_INFIX_PROJ field- {% acs (\cs -> sLL $1 $> ((sLLa $2 $> $ DotFieldOcc (EpAnn (glR $1) (AnnFieldLabel (Just $ glAA $2)) cs) (reLocA $3)) `NE.cons` unLoc $1)) }- | PREFIX_PROJ field {% acs (\cs -> sLL $1 $> ((sLLa $1 $> $ DotFieldOcc (EpAnn (glR $1) (AnnFieldLabel (Just $ glAA $1)) cs) (reLocA $2)) :| [])) }+ {% acs (\cs -> sLL $1 (reLoc $>) ((sLLa $2 (reLoc $>) $ DotFieldOcc (EpAnn (glR $1) (AnnFieldLabel (Just $ glAA $2)) cs) $3) `NE.cons` unLoc $1)) }+ | PREFIX_PROJ field {% acs (\cs -> sLL $1 (reLoc $>) ((sLLa $1 (reLoc $>) $ DotFieldOcc (EpAnn (glR $1) (AnnFieldLabel (Just $ glAA $1)) cs) $2) :| [])) } splice_exp :: { LHsExpr GhcPs } : splice_untyped { mapLoc (HsUntypedSplice noAnn) (reLocA $1) }@@ -3416,15 +3418,15 @@ -- AZ: need to pull out the let block into a helper | field TIGHT_INFIX_PROJ fieldToUpdate '=' texp { do- let top = sL1a $1 $ DotFieldOcc noAnn (reLocA $1)+ let top = sL1 (la2la $1) $ DotFieldOcc noAnn $1 ((L lf (DotFieldOcc _ f)):t) = reverse (unLoc $3) lf' = comb2 $2 (reLoc $ L lf ()) fields = top : L (noAnnSrcSpan lf') (DotFieldOcc (EpAnn (spanAsAnchor lf') (AnnFieldLabel (Just $ glAA $2)) emptyComments) f) : t final = last fields- l = comb2 $1 $3+ l = comb2 (reLoc $1) $3 isPun = False $5 <- unECP $5- fmap Right $ mkHsProjUpdatePV (comb2 $1 (reLoc $5)) (L l fields) $5 isPun+ fmap Right $ mkHsProjUpdatePV (comb2 (reLoc $1) (reLoc $5)) (L l fields) $5 isPun [mj AnnEqual $4] } @@ -3432,24 +3434,24 @@ -- AZ: need to pull out the let block into a helper | field TIGHT_INFIX_PROJ fieldToUpdate { do- let top = sL1a $1 $ DotFieldOcc noAnn (reLocA $1)+ let top = sL1 (la2la $1) $ DotFieldOcc noAnn $1 ((L lf (DotFieldOcc _ f)):t) = reverse (unLoc $3) lf' = comb2 $2 (reLoc $ L lf ()) fields = top : L (noAnnSrcSpan lf') (DotFieldOcc (EpAnn (spanAsAnchor lf') (AnnFieldLabel (Just $ glAA $2)) emptyComments) f) : t final = last fields- l = comb2 $1 $3+ l = comb2 (reLoc $1) $3 isPun = True- var <- mkHsVarPV (L (noAnnSrcSpan $ getLocA final) (mkRdrUnqual . mkVarOcc . unpackFS . unLoc . dfoLabel . unLoc $ final))+ var <- mkHsVarPV (L (noAnnSrcSpan $ getLocA final) (mkRdrUnqual . mkVarOcc . unpackFS . field_label . unLoc . dfoLabel . unLoc $ final)) fmap Right $ mkHsProjUpdatePV l (L l fields) var isPun [] } fieldToUpdate :: { Located [LocatedAn NoEpAnns (DotFieldOcc GhcPs)] } fieldToUpdate -- See Note [Whitespace-sensitive operator parsing] in Lexer.x- : fieldToUpdate TIGHT_INFIX_PROJ field {% getCommentsFor (getLoc $3) >>= \cs ->- return (sLL $1 $> ((sLLa $2 $> (DotFieldOcc (EpAnn (glR $2) (AnnFieldLabel $ Just $ glAA $2) cs) (reLocA $3))) : unLoc $1)) }- | field {% getCommentsFor (getLoc $1) >>= \cs ->- return (sL1 $1 [sL1a $1 (DotFieldOcc (EpAnn (glR $1) (AnnFieldLabel Nothing) cs) (reLocA $1))]) }+ : fieldToUpdate TIGHT_INFIX_PROJ field {% getCommentsFor (getLocA $3) >>= \cs ->+ return (sLL $1 (reLoc $>) ((sLLa $2 (reLoc $>) (DotFieldOcc (EpAnn (glR $2) (AnnFieldLabel $ Just $ glAA $2) cs) $3)) : unLoc $1)) }+ | field {% getCommentsFor (getLocA $1) >>= \cs ->+ return (sL1 (reLoc $1) [sL1a (reLoc $1) (DotFieldOcc (EpAnn (glNR $1) (AnnFieldLabel Nothing) cs) $1)]) } ----------------------------------------------------------------------------- -- Implicit Parameter Bindings@@ -3751,8 +3753,8 @@ -- whether it's a qvar or a var can be postponed until -- *after* we see the close paren. -field :: { Located FastString }- : varid { reLocN $ fmap (occNameFS . rdrNameOcc) $1 }+field :: { LocatedN FieldLabelString }+ : varid { fmap (FieldLabelString . occNameFS . rdrNameOcc) $1 } qvarid :: { LocatedN RdrName } : varid { $1 }
compiler/GHC/Parser/PostProcess.hs view
@@ -157,6 +157,8 @@ import GHC.Utils.Panic.Plain import qualified GHC.Data.Strict as Strict +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import Control.Monad import Text.ParserCombinators.ReadP as ReadP import Data.Char@@ -2561,7 +2563,7 @@ recFieldToProjUpdate (L l (HsFieldBind anns (L _ (FieldOcc _ (L loc rdr))) arg pun)) = -- The idea here is to convert the label to a singleton [FastString]. let f = occNameFS . rdrNameOcc $ rdr- fl = DotFieldOcc noAnn (L (l2l loc) f) -- AZ: what about the ann?+ fl = DotFieldOcc noAnn (L loc (FieldLabelString f)) lf = locA loc in mkRdrProjUpdate l (L lf [L (l2l loc) fl]) (punnedVar f) pun anns where
compiler/GHC/Runtime/Context.hs view
@@ -441,7 +441,7 @@ _ -> False is_sub_bndr _ = False -substInteractiveContext :: InteractiveContext -> TCvSubst -> InteractiveContext+substInteractiveContext :: InteractiveContext -> Subst -> InteractiveContext substInteractiveContext ictxt@InteractiveContext{ ic_tythings = tts } subst | isEmptyTCvSubst subst = ictxt | otherwise = ictxt { ic_tythings = map subst_ty tts }
compiler/GHC/Settings.hs view
@@ -18,7 +18,6 @@ , sTopDir , sGlobalPackageDatabasePath , sLdSupportsCompactUnwind- , sLdSupportsBuildId , sLdSupportsFilelist , sLdIsGnuLd , sGccSupportsNoPie@@ -87,7 +86,6 @@ -- platform-specific and platform-agnostic. data ToolSettings = ToolSettings { toolSettings_ldSupportsCompactUnwind :: Bool- , toolSettings_ldSupportsBuildId :: Bool , toolSettings_ldSupportsFilelist :: Bool , toolSettings_ldIsGnuLd :: Bool , toolSettings_ccSupportsNoPie :: Bool@@ -189,8 +187,6 @@ sLdSupportsCompactUnwind :: Settings -> Bool sLdSupportsCompactUnwind = toolSettings_ldSupportsCompactUnwind . sToolSettings-sLdSupportsBuildId :: Settings -> Bool-sLdSupportsBuildId = toolSettings_ldSupportsBuildId . sToolSettings sLdSupportsFilelist :: Settings -> Bool sLdSupportsFilelist = toolSettings_ldSupportsFilelist . sToolSettings sLdIsGnuLd :: Settings -> Bool
compiler/GHC/SysTools/BaseDir.hs view
@@ -55,13 +55,10 @@ Note [tooldir: How GHC finds mingw on Windows] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GHC has some custom logic on Windows for finding the mingw-toolchain and perl. Depending on whether GHC is built-with the make build system or Hadrian, and on whether we're-running a bindist, we might find the mingw toolchain-either under $topdir/../{mingw, perl}/ or-$topdir/../../{mingw, perl}/.+toolchain. In general we will find the mingw toolchain+in $topdir/../../mingw/. -This story is long and with lots of twist and turns.. But lets talk about how+This story is long and with lots of twist and turns.. But let's talk about how the build system finds and wires through the toolchain information. 1) It all starts in configure.ac which has two modes it operates on:@@ -90,25 +87,11 @@ From `aclocal.m4` we export a couple of variables starting with `Settings` which will be used to generate the settings file. -3) The next step is to generate the settings file, this is where things diverge- based on the build system. Both Make and Hadrian handle this differently:--make)- Make deals with this rather simply. As an output of configure.ac- `config.mk.in` is processed and `config.mk` generated which has the values we- set in `aclocal.m4`. This allows the rest of the build system to have access- to these and other values determined by configure.-- Based on this file, `rts/include/ghc.mk` when ran will produce the settings file- by echoing the values into a the final file. Coincidentally this is also- where `ghcplatform.h` and `ghcversion.h` generated which contains information- about the build platform and sets CPP for use by the entire build.--hadrian)- For hadrian the file `cfg/system.config.in` is preprocessed by configure and- the output written to `system.config`. This serves the same purpose as- `config.mk` but it rewrites the values that were exported. As an example- `SettingsCCompilerCommand` is rewritten to `settings-c-compiler-command`.+3) The next step is to generate the settings file: The file+ `cfg/system.config.in` is preprocessed by configure and the output written to+ `system.config`. This serves the same purpose as `config.mk` but it rewrites+ the values that were exported. As an example `SettingsCCompilerCommand` is+ rewritten to `settings-c-compiler-command`. Next up is `src/Oracles/Settings.hs` which makes from some Haskell ADT to the settings `keys` in the `system.config`. As an example,
compiler/GHC/Tc/Errors/Ppr.hs view
@@ -82,6 +82,8 @@ import qualified GHC.LanguageExtensions as LangExt +import GHC.Data.BooleanFormula (pprBooleanFormulaNice)+ import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.List.NonEmpty as NE import Data.Function (on)@@ -445,6 +447,9 @@ TcRnBangOnUnliftedType ty -> mkSimpleDecorated $ text "Strictness flag has no effect on unlifted type" <+> quotes (ppr ty)+ TcRnLazyBangOnUnliftedType ty+ -> mkSimpleDecorated $+ text "Lazy flag has no effect on unlifted type" <+> quotes (ppr ty) TcRnMultipleDefaultDeclarations dup_things -> mkSimpleDecorated $ hang (text "Multiple default declarations")@@ -958,6 +963,36 @@ impMsg = text "imported from" <+> ppr pragma_warning_import_mod <> extra extra | pragma_warning_import_mod == pragma_warning_defined_mod = empty | otherwise = text ", but defined in" <+> ppr pragma_warning_defined_mod+ TcRnIllegalHsigDefaultMethods name meths+ -> mkSimpleDecorated $+ text "Illegal default method" <> plural (NE.toList meths) <+> text "in class definition of" <+> ppr name <+> text "in hsig file"+ TcRnBadGenericMethod clas op+ -> mkSimpleDecorated $+ hsep [text "Class", quotes (ppr clas),+ text "has a generic-default signature without a binding", quotes (ppr op)]+ TcRnWarningMinimalDefIncomplete mindef+ -> mkSimpleDecorated $+ vcat [ text "The MINIMAL pragma does not require:"+ , nest 2 (pprBooleanFormulaNice mindef)+ , text "but there is no default implementation." ]+ TcRnDefaultMethodForPragmaLacksBinding sel_id prag+ -> mkSimpleDecorated $+ text "The" <+> hsSigDoc prag <+> text "for default method"+ <+> quotes (ppr sel_id)+ <+> text "lacks an accompanying binding"+ TcRnIgnoreSpecialisePragmaOnDefMethod sel_name+ -> mkSimpleDecorated $+ text "Ignoring SPECIALISE pragmas on default method"+ <+> quotes (ppr sel_name)+ TcRnBadMethodErr{badMethodErrClassName, badMethodErrMethodName}+ -> mkSimpleDecorated $+ hsep [text "Class", quotes (ppr badMethodErrClassName),+ text "does not have a method", quotes (ppr badMethodErrMethodName)]+ TcRnNoExplicitAssocTypeOrDefaultDeclaration name+ -> mkSimpleDecorated $+ text "No explicit" <+> text "associated type"+ <+> text "or default declaration for"+ <+> quotes (ppr name) diagnosticReason = \case TcRnUnknownMessage m -> diagnosticReason m@@ -1094,6 +1129,8 @@ -> ErrorWithoutFlag TcRnBangOnUnliftedType{} -> WarningWithFlag Opt_WarnRedundantStrictnessFlags+ TcRnLazyBangOnUnliftedType{}+ -> WarningWithFlag Opt_WarnRedundantStrictnessFlags TcRnMultipleDefaultDeclarations{} -> ErrorWithoutFlag TcRnBadDefaultType{}@@ -1271,6 +1308,20 @@ -> ErrorWithoutFlag TcRnPragmaWarning{} -> WarningWithFlag Opt_WarnWarningsDeprecations+ TcRnIllegalHsigDefaultMethods{}+ -> ErrorWithoutFlag+ TcRnBadGenericMethod{}+ -> ErrorWithoutFlag+ TcRnWarningMinimalDefIncomplete{}+ -> WarningWithoutFlag+ TcRnDefaultMethodForPragmaLacksBinding{}+ -> ErrorWithoutFlag+ TcRnIgnoreSpecialisePragmaOnDefMethod{}+ -> WarningWithoutFlag+ TcRnBadMethodErr{}+ -> ErrorWithoutFlag+ TcRnNoExplicitAssocTypeOrDefaultDeclaration{}+ -> WarningWithFlag (Opt_WarnMissingMethods) diagnosticHints = \case TcRnUnknownMessage m@@ -1424,6 +1475,8 @@ -> noHints TcRnBangOnUnliftedType{} -> noHints+ TcRnLazyBangOnUnliftedType{}+ -> noHints TcRnMultipleDefaultDeclarations{} -> noHints TcRnBadDefaultType{}@@ -1584,7 +1637,13 @@ TcRnNameByTemplateHaskellQuote{} -> noHints TcRnIllegalBindingOfBuiltIn{} -> noHints TcRnPragmaWarning{} -> noHints-+ TcRnIllegalHsigDefaultMethods{} -> noHints+ TcRnBadGenericMethod{} -> noHints+ TcRnWarningMinimalDefIncomplete{} -> noHints+ TcRnDefaultMethodForPragmaLacksBinding{} -> noHints+ TcRnIgnoreSpecialisePragmaOnDefMethod{} -> noHints+ TcRnBadMethodErr{} -> noHints+ TcRnNoExplicitAssocTypeOrDefaultDeclaration{} -> noHints -- | Change [x] to "x", [x, y] to "x and y", [x, y, z] to "x, y, and z", -- and so on. The `and` stands for any `conjunction`, which is passed in.@@ -2315,7 +2374,7 @@ missing = case wanteds of- [wanted] -> pprParendType wanted+ [wanted] -> quotes (ppr wanted) _ -> pprTheta wanteds pprTcSolverReportMsg ctxt (AmbiguityPreventsSolvingCt item ambigs) =
compiler/GHC/Tc/Errors/Types.hs view
@@ -81,7 +81,6 @@ import GHC.Tc.Utils.TcType (IllegalForeignTypeReason, TcType) import GHC.Types.Error import GHC.Types.Hint (UntickedPromotedThing(..))-import GHC.Types.FieldLabel (FieldLabelString) import GHC.Types.ForeignCall (CLabelString) import GHC.Types.Name (Name, OccName, getSrcLoc, getSrcSpan) import GHC.Types.Name.Reader@@ -92,7 +91,7 @@ import GHC.Types.Var.Set (TyVarSet, VarSet) import GHC.Unit.Types (Module) import GHC.Utils.Outputable-import GHC.Core.Class (Class)+import GHC.Core.Class (Class, ClassMinimalDef) import GHC.Core.Coercion.Axiom (CoAxBranch) import GHC.Core.ConLike (ConLike) import GHC.Core.DataCon (DataCon)@@ -109,6 +108,8 @@ import qualified GHC.LanguageExtensions as LangExt import GHC.Data.FastString (FastString) +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import qualified Data.List.NonEmpty as NE import Data.Typeable hiding (TyCon) import qualified Data.Semigroup as Semigroup@@ -1132,6 +1133,17 @@ -} TcRnBangOnUnliftedType :: !Type -> TcRnMessage + {-| TcRnLazyBangOnUnliftedType is a warning (controlled by -Wredundant-strictness-flags) that+ occurs when a lazy annotation is applied to an unlifted type.++ Example(s):+ data T = MkT ~Int# -- Lazy flag has no effect on unlifted types++ Test cases: typecheck/should_compile/T21951a+ typecheck/should_compile/T21951b+ -}+ TcRnLazyBangOnUnliftedType :: !Type -> TcRnMessage+ {-| TcRnMultipleDefaultDeclarations is an error that occurs when a module has more than one default declaration. @@ -2175,9 +2187,93 @@ pragma_warning_defined_mod :: ModuleName } -> TcRnMessage ++ {-| TcRnIllegalHsigDefaultMethods is an error that occurs when a binding for+ a class default method is provided in a Backpack signature file.++ Test case:+ bkpfail40+ -}++ TcRnIllegalHsigDefaultMethods :: !Name -- ^ 'Name' of the class+ -> NE.NonEmpty (LHsBind GhcRn) -- ^ default methods+ -> TcRnMessage+ {-| TcRnBadGenericMethod+ This test ensures that if you provide a "more specific" type signatures+ for the default method, you must also provide a binding.++ Example:+ {-# LANGUAGE DefaultSignatures #-}++ class C a where+ meth :: a+ default meth :: Num a => a+ meth = 0++ Test case:+ testsuite/tests/typecheck/should_fail/MissingDefaultMethodBinding.hs+ -}+ TcRnBadGenericMethod :: !Name -- ^ 'Name' of the class+ -> !Name -- ^ Problematic method+ -> TcRnMessage++ {-| TcRnWarningMinimalDefIncomplete is a warning that one must+ specify which methods must be implemented by all instances.++ Example:+ class Cheater a where -- WARNING LINE+ cheater :: a+ {-# MINIMAL #-} -- warning!++ Test case:+ testsuite/tests/warnings/minimal/WarnMinimal.hs:+ -}+ TcRnWarningMinimalDefIncomplete :: ClassMinimalDef -> TcRnMessage++ {-| TcRnDefaultMethodForPragmaLacksBinding is an error that occurs when+ a default method pragma is missing an accompanying binding.++ Test cases:+ testsuite/tests/typecheck/should_fail/T5084.hs+ testsuite/tests/typecheck/should_fail/T2354.hs+ -}+ TcRnDefaultMethodForPragmaLacksBinding+ :: Id -- ^ method+ -> Sig GhcRn -- ^ the pragma+ -> TcRnMessage+ {-| TcRnIgnoreSpecialisePragmaOnDefMethod is a warning that occurs when+ a specialise pragma is put on a default method.++ Test cases: none+ -}+ TcRnIgnoreSpecialisePragmaOnDefMethod+ :: !Name+ -> TcRnMessage+ {-| TcRnBadMethodErr is an error that happens when one attempts to provide a method+ in a class instance, when the class doesn't have a method by that name.++ Test case:+ testsuite/tests/th/T12387+ -}+ TcRnBadMethodErr+ :: { badMethodErrClassName :: !Name+ , badMethodErrMethodName :: !Name+ } -> TcRnMessage+ {-| TcRnNoExplicitAssocTypeOrDefaultDeclaration is an error that occurs+ when a class instance does not provide an expected associated type+ or default declaration.++ Test cases:+ testsuite/tests/deriving/should_compile/T14094+ testsuite/tests/indexed-types/should_compile/Simple2+ testsuite/tests/typecheck/should_compile/tc254+ -}+ TcRnNoExplicitAssocTypeOrDefaultDeclaration+ :: Name+ -> TcRnMessage+ -- | Specifies which back ends can handle a requested foreign import or export type ExpectedBackends = [Backend]- -- | Specifies which calling convention is unsupported on the current platform data UnsupportedCallConvention = StdCallConvUnsupported
compiler/GHC/Tc/Types/Origin.hs view
@@ -68,6 +68,8 @@ import GHC.Types.Unique import GHC.Types.Unique.Supply +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ {- ********************************************************************* * * UserTypeCtxt@@ -673,7 +675,7 @@ exprCtOrigin :: HsExpr GhcRn -> CtOrigin exprCtOrigin (HsVar _ (L _ name)) = OccurrenceOf name-exprCtOrigin (HsGetField _ _ (L _ f)) = HasFieldOrigin (unLoc $ dfoLabel f)+exprCtOrigin (HsGetField _ _ (L _ f)) = HasFieldOrigin (field_label $ unLoc $ dfoLabel f) exprCtOrigin (HsUnboundVar {}) = Shouldn'tHappenOrigin "unbound variable" exprCtOrigin (HsRecSel _ f) = OccurrenceOfRecSel (unLoc $ foLabel f) exprCtOrigin (HsOverLabel _ l) = OverLabelOrigin l
compiler/GHC/Tc/Utils/TcType.hs view
@@ -1,4 +1,3 @@- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-}@@ -158,15 +157,15 @@ isVisibleBinder, isInvisibleBinder, -- Type substitutions- TCvSubst(..), -- Representation visible to a few friends- TvSubstEnv, emptyTCvSubst, mkEmptyTCvSubst,+ Subst(..), -- Representation visible to a few friends+ TvSubstEnv, emptySubst, mkEmptySubst, zipTvSubst,- mkTvSubstPrs, notElemTCvSubst, unionTCvSubst,- getTvSubstEnv, setTvSubstEnv, getTCvInScope, extendTCvInScope,- extendTCvInScopeList, extendTCvInScopeSet, extendTvSubstAndInScope,+ mkTvSubstPrs, notElemSubst, unionSubst,+ getTvSubstEnv, getSubstInScope, extendSubstInScope,+ extendSubstInScopeList, extendSubstInScopeSet, extendTvSubstAndInScope, Type.lookupTyVar, Type.extendTCvSubst, Type.substTyVarBndr, Type.extendTvSubst,- isInScope, mkTCvSubst, mkTvSubst, zipTyEnv, zipCoEnv,+ isInScope, mkSubst, mkTvSubst, zipTyEnv, zipCoEnv, Type.substTy, substTys, substScaledTys, substTyWith, substTyWithCoVars, substTyAddInScope, substTyUnchecked, substTysUnchecked, substScaledTyUnchecked,
compiler/GHC/Types/CostCentre.hs view
@@ -31,6 +31,7 @@ import GHC.Types.SrcLoc import GHC.Data.FastString import GHC.Types.CostCentre.State+import GHC.Utils.Panic.Plain import Data.Data @@ -71,6 +72,7 @@ | ExprCC !CostCentreIndex -- ^ Explicitly annotated expression | DeclCC !CostCentreIndex -- ^ Explicitly annotated declaration | HpcCC !CostCentreIndex -- ^ Generated by HPC for coverage+ | LateCC !CostCentreIndex -- ^ Annotated by the one of the prof-last* passes. deriving (Eq, Ord, Data) -- | Extract the index from a flavour@@ -79,6 +81,7 @@ flavourIndex (ExprCC x) = unCostCentreIndex x flavourIndex (DeclCC x) = unCostCentreIndex x flavourIndex (HpcCC x) = unCostCentreIndex x+flavourIndex (LateCC x) = unCostCentreIndex x instance Eq CostCentre where c1 == c2 = case c1 `cmpCostCentre` c2 of { EQ -> True; _ -> False }@@ -292,7 +295,8 @@ ppFlavourLblComponent CafCC = text "CAF" ppFlavourLblComponent (ExprCC i) = text "EXPR" <> ppIdxLblComponent i ppFlavourLblComponent (DeclCC i) = text "DECL" <> ppIdxLblComponent i-ppFlavourLblComponent (HpcCC i) = text "HPC" <> ppIdxLblComponent i+ppFlavourLblComponent (HpcCC i) = text "HPC" <> ppIdxLblComponent i+ppFlavourLblComponent (LateCC i) = text "LATECC" <> ppIdxLblComponent i -- ^ Print the flavour index component of a C label ppIdxLblComponent :: CostCentreIndex -> SDoc@@ -328,13 +332,18 @@ put_ bh (HpcCC i) = do putByte bh 3 put_ bh i+ put_ bh (LateCC i) = do+ putByte bh 4+ put_ bh i get bh = do h <- getByte bh case h of 0 -> return CafCC 1 -> ExprCC <$> get bh 2 -> DeclCC <$> get bh- _ -> HpcCC <$> get bh+ 3 -> HpcCC <$> get bh+ 4 -> LateCC <$> get bh+ _ -> panic "Invalid CCFlavour" instance Binary CostCentre where put_ bh (NormalCC aa ab ac _ad) = do
compiler/GHC/Types/FieldLabel.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-}+{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable FieldLabelString {- %@@ -71,8 +72,7 @@ -} module GHC.Types.FieldLabel- ( FieldLabelString- , FieldLabelEnv+ ( FieldLabelEnv , FieldLabel(..) , fieldSelectorOccName , fieldLabelPrintableName@@ -89,10 +89,11 @@ import GHC.Data.FastString import GHC.Data.FastString.Env+import GHC.Types.Unique (Uniquable(..)) import GHC.Utils.Outputable import GHC.Utils.Binary -import Language.Haskell.Syntax.Basic (FieldLabelString)+import Language.Haskell.Syntax.Basic (FieldLabelString(..)) import Data.Bool import Data.Data@@ -115,13 +116,20 @@ deriving (Data, Eq) instance HasOccName FieldLabel where- occName = mkVarOccFS . flLabel+ occName = mkVarOccFS . field_label . flLabel instance Outputable FieldLabel where ppr fl = ppr (flLabel fl) <> whenPprDebug (braces (ppr (flSelector fl)) <> ppr (flHasDuplicateRecordFields fl) <> ppr (flHasFieldSelector fl)) +instance Outputable FieldLabelString where+ ppr (FieldLabelString l) = ppr l++instance Uniquable FieldLabelString where+ getUnique (FieldLabelString fs) = getUnique fs++ -- | Flag to indicate whether the DuplicateRecordFields extension is enabled. data DuplicateRecordFields = DuplicateRecordFields -- ^ Fields may be duplicated in a single module@@ -158,7 +166,7 @@ -- because "GHC.Utils.Binary" itself depends on "GHC.Types.Name". instance Binary Name => Binary FieldLabel where put_ bh (FieldLabel aa ab ac ad) = do- put_ bh aa+ put_ bh (field_label aa) put_ bh ab put_ bh ac put_ bh ad@@ -167,7 +175,7 @@ ab <- get bh ac <- get bh ad <- get bh- return (FieldLabel aa ab ac ad)+ return (FieldLabel (FieldLabelString aa) ab ac ad) -- | Record selector OccNames are built from the underlying field name@@ -177,9 +185,10 @@ fieldSelectorOccName :: FieldLabelString -> OccName -> DuplicateRecordFields -> FieldSelectors -> OccName fieldSelectorOccName lbl dc dup_fields_ok has_sel | shouldMangleSelectorNames dup_fields_ok has_sel = mkRecFldSelOcc str- | otherwise = mkVarOccFS lbl+ | otherwise = mkVarOccFS fl where- str = ":" ++ unpackFS lbl ++ ":" ++ occNameString dc+ fl = field_label lbl+ str = ":" ++ unpackFS fl ++ ":" ++ occNameString dc -- | Undo the name mangling described in Note [FieldLabel] to produce a Name -- that has the user-visible OccName (but the selector's unique). This should@@ -187,7 +196,7 @@ -- need to qualify it with a module prefix. fieldLabelPrintableName :: FieldLabel -> Name fieldLabelPrintableName fl- | flIsOverloaded fl = tidyNameOcc (flSelector fl) (mkVarOccFS (flLabel fl))+ | flIsOverloaded fl = tidyNameOcc (flSelector fl) (mkVarOccFS (field_label $ flLabel fl)) | otherwise = flSelector fl -- | Selector name mangling should be used if either DuplicateRecordFields or
compiler/GHC/Types/Id/Info.hs view
@@ -816,7 +816,7 @@ trimUnfolding :: Unfolding -> Unfolding -- Squash all unfolding info, preserving only evaluated-ness trimUnfolding unf | isEvaldUnfolding unf = evaldUnfolding- | otherwise = noUnfolding+ | otherwise = noUnfolding zapTailCallInfo :: IdInfo -> Maybe IdInfo zapTailCallInfo info
compiler/GHC/Types/Id/Make.hs view
@@ -25,6 +25,7 @@ DataConBoxer(..), vanillaDataConBoxer, mkDataConRep, mkDataConWorkId, DataConBangOpts (..), BangOpts (..),+ unboxedUnitExpr, -- And some particular Ids; see below for why they are wired in wiredInIds, ghcPrimIds,@@ -616,7 +617,7 @@ type Unboxer = Var -> UniqSM ([Var], CoreExpr -> CoreExpr) -- Unbox: bind rep vars by decomposing src var -data Boxer = UnitBox | Boxer (TCvSubst -> UniqSM ([Var], CoreExpr))+data Boxer = UnitBox | Boxer (Subst -> UniqSM ([Var], CoreExpr)) -- Box: build src arg using these rep vars -- | Data Constructor Boxer@@ -1812,9 +1813,10 @@ -- We cannot define it in normal Haskell, since it's -- a top-level unlifted value. voidPrimId = pcMiscPrelId voidPrimIdName unboxedUnitTy- (noCafIdInfo `setUnfoldingInfo` mkCompulsoryUnfolding defaultSimpleOpts rhs)- where rhs = Var (dataConWorkId unboxedUnitDataCon)+ (noCafIdInfo `setUnfoldingInfo` mkCompulsoryUnfolding defaultSimpleOpts unboxedUnitExpr) +unboxedUnitExpr :: CoreExpr+unboxedUnitExpr = Var (dataConWorkId unboxedUnitDataCon) voidArgId :: Id -- Local lambda-bound :: Void# voidArgId = mkSysLocal (fsLit "void") voidArgIdKey Many unboxedUnitTy
compiler/GHC/Types/Name/Occurrence.hs view
@@ -6,7 +6,6 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE LambdaCase #-} -- | -- #name_types#@@ -282,24 +281,9 @@ = getPprStyle $ \ sty -> if codeStyle sty then ztext (zEncodeFS occ)- else pp_occ <> whenPprDebug (braces (pprNameSpaceBrief sp))- where- pp_occ = sdocOption sdocSuppressUniques $ \case- True -> text (strip_th_unique (unpackFS occ))- False -> ftext occ-- -- See Note [Suppressing uniques in OccNames]- strip_th_unique ('[' : c : _) | isAlphaNum c = []- strip_th_unique (c : cs) = c : strip_th_unique cs- strip_th_unique [] = []+ else ftext occ <> whenPprDebug (braces (pprNameSpaceBrief sp)) {--Note [Suppressing uniques in OccNames]-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-This is a hack to de-wobblify the OccNames that contain uniques from-Template Haskell that have been turned into a string in the OccName.-See Note [Unique OccNames from Template Haskell] in "GHC.ThToHs"- ************************************************************************ * * \subsection{Construction}
compiler/GHC/Types/Name/Reader.hs view
@@ -93,6 +93,8 @@ import GHC.Utils.Panic import GHC.Types.Name.Env +import Language.Haskell.Syntax.Basic (FieldLabelString(..))+ import Data.Data import Data.List( sortBy ) import GHC.Data.Bag@@ -867,7 +869,7 @@ -- selector name and field label may be different: the GlobalRdrEnv is keyed on -- the label. See Note [GreNames] for why this happens. lookupGRE_FieldLabel env fl- = lookupGRE_Name_OccName env (flSelector fl) (mkVarOccFS (flLabel fl))+ = lookupGRE_Name_OccName env (flSelector fl) (mkVarOccFS (field_label $ flLabel fl)) lookupGRE_Name_OccName :: GlobalRdrEnv -> Name -> OccName -> Maybe GlobalRdrElt -- ^ Look for precisely this 'Name' in the environment, but with an 'OccName'
compiler/GHC/Types/RepType.hs view
@@ -22,6 +22,9 @@ ubxSumRepType, layoutUbxSum, typeSlotTy, SlotTy (..), slotPrimRep, primRepSlot, + -- * Is this type known to be data?+ mightBeFunTy+ ) where import GHC.Prelude@@ -674,3 +677,19 @@ -- See also Note [RuntimeRep and PrimRep] primRepToType :: PrimRep -> Type primRepToType = anyTypeOfKind . mkTYPEapp . primRepToRuntimeRep++--------------+mightBeFunTy :: Type -> Bool+-- Return False only if we are *sure* it's a data type+-- Look through newtypes etc as much as possible. Used to+-- decide if we need to enter a closure via a slow call.+--+-- AK: It would be nice to figure out and document the difference+-- between this and isFunTy at some point.+mightBeFunTy ty+ | [LiftedRep] <- typePrimRep ty+ , Just tc <- tyConAppTyCon_maybe (unwrapType ty)+ , isDataTyCon tc+ = False+ | otherwise+ = True
compiler/GHC/Types/Unique/DFM.hs view
@@ -58,6 +58,7 @@ udfmMinusUFM, ufmMinusUDFM, partitionUDFM, udfmRestrictKeys,+ udfmRestrictKeysSet, anyUDFM, allUDFM, pprUniqDFM, pprUDFM, @@ -81,6 +82,7 @@ import Data.Function (on) import GHC.Types.Unique.FM (UniqFM, nonDetUFMToList, ufmToIntMap, unsafeIntMapToUFM) import Unsafe.Coerce+import qualified Data.IntSet as I -- Note [Deterministic UniqFM] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~@@ -313,6 +315,11 @@ udfmRestrictKeys :: UniqDFM key elt -> UniqDFM key elt2 -> UniqDFM key elt udfmRestrictKeys (UDFM a i) (UDFM b _) = UDFM (M.restrictKeys a (M.keysSet b)) i++udfmRestrictKeysSet :: UniqDFM key elt -> I.IntSet -> UniqDFM key elt+udfmRestrictKeysSet (UDFM val_set i) set =+ let key_set = set+ in UDFM (M.restrictKeys val_set key_set) i -- | Converts `UniqDFM` to a list, with elements in deterministic order. -- It's O(n log n) while the corresponding function on `UniqFM` is O(n).
compiler/GHC/Types/Var.hs view
@@ -79,7 +79,7 @@ mkTyVarBinder, mkTyVarBinders, isTyVarBinder, tyVarSpecToBinder, tyVarSpecToBinders, tyVarReqToBinder, tyVarReqToBinders,- mapVarBndr, mapVarBndrs, lookupVarBndr,+ mapVarBndr, mapVarBndrs, -- ** Constructing TyVar's mkTyVar, mkTcTyVar,@@ -695,11 +695,6 @@ mapVarBndrs :: (var -> var') -> [VarBndr var flag] -> [VarBndr var' flag] mapVarBndrs f = map (mapVarBndr f)--lookupVarBndr :: Eq var => var -> [VarBndr var flag] -> Maybe flag-lookupVarBndr var bndrs = lookup var zipped_bndrs- where- zipped_bndrs = map (\(Bndr v f) -> (v,f)) bndrs instance Outputable tv => Outputable (VarBndr tv ArgFlag) where ppr (Bndr v Required) = ppr v
compiler/GHC/Types/Var/Env.hs view
@@ -9,7 +9,7 @@ -- ** Manipulating these environments emptyVarEnv, unitVarEnv, mkVarEnv, mkVarEnv_Directly,- elemVarEnv, disjointVarEnv,+ elemVarEnv, disjointVarEnv, anyVarEnv, extendVarEnv, extendVarEnv_C, extendVarEnv_Acc, extendVarEnvList, plusVarEnv, plusVarEnv_C, plusVarEnv_CD, plusMaybeVarEnv_C,@@ -62,7 +62,8 @@ -- ** Operations on RnEnv2s mkRnEnv2, rnBndr2, rnBndrs2, rnBndr2_var,- rnOccL, rnOccR, inRnEnvL, inRnEnvR, rnOccL_maybe, rnOccR_maybe,+ rnOccL, rnOccR, inRnEnvL, inRnEnvR, anyInRnEnvR,+ rnOccL_maybe, rnOccR_maybe, rnBndrL, rnBndrR, nukeRnEnvL, nukeRnEnvR, rnSwap, delBndrL, delBndrR, delBndrsL, delBndrsR, extendRnInScopeSetList,@@ -72,7 +73,7 @@ -- * TidyEnv and its operation TidyEnv,- emptyTidyEnv, mkEmptyTidyEnv, delTidyEnvList, anyInRnEnvR+ emptyTidyEnv, mkEmptyTidyEnv, delTidyEnvList ) where import GHC.Prelude@@ -409,7 +410,7 @@ anyInRnEnvR (RV2 { envR = env }) vs -- Avoid allocating the predicate if we deal with an empty env. | isEmptyVarEnv env = False- | otherwise = anyVarEnv (`elemVarSet` vs) env+ | otherwise = anyVarSet (`elemVarEnv` env) vs lookupRnInScope :: RnEnv2 -> Var -> Var lookupRnInScope env v = lookupInScope (in_scope env) v `orElse` v
compiler/GHC/Unit/Env.hs view
@@ -6,6 +6,7 @@ , ueEPS , unsafeGetHomeUnit , updateHug+ , updateHpt_lazy , updateHpt -- * Unit Env helper functions , ue_units@@ -49,6 +50,7 @@ , unitEnv_elts , unitEnv_hpts , unitEnv_foldWithKey+ , unitEnv_union , unitEnv_mapWithKey -- * Invariants , assertUnitEnvInvariant@@ -119,6 +121,9 @@ unsafeGetHomeUnit :: UnitEnv -> HomeUnit unsafeGetHomeUnit ue = ue_unsafeHomeUnit ue +updateHpt_lazy :: (HomePackageTable -> HomePackageTable) -> UnitEnv -> UnitEnv+updateHpt_lazy = ue_updateHPT_lazy+ updateHpt :: (HomePackageTable -> HomePackageTable) -> UnitEnv -> UnitEnv updateHpt = ue_updateHPT @@ -266,7 +271,9 @@ go (Just hue) = Just (updateHueHpt (addHomeModInfoToHpt hmi) hue) updateHueHpt :: (HomePackageTable -> HomePackageTable) -> HomeUnitEnv -> HomeUnitEnv-updateHueHpt f hue = hue { homeUnitEnv_hpt = f (homeUnitEnv_hpt hue)}+updateHueHpt f hue =+ let !hpt = f (homeUnitEnv_hpt hue)+ in hue { homeUnitEnv_hpt = hpt } lookupHug :: HomeUnitGraph -> UnitId -> ModuleName -> Maybe HomeModInfo@@ -342,6 +349,9 @@ unitEnv_foldWithKey :: (b -> UnitEnvGraphKey -> a -> b) -> b -> UnitEnvGraph a -> b unitEnv_foldWithKey f z (UnitEnvGraph g)= Map.foldlWithKey' f z g +unitEnv_union :: (a -> a -> a) -> UnitEnvGraph a -> UnitEnvGraph a -> UnitEnvGraph a+unitEnv_union f (UnitEnvGraph env1) (UnitEnvGraph env2) = UnitEnvGraph (Map.unionWith f env1 env2)+ -- ------------------------------------------------------- -- Query and modify UnitState in HomeUnitEnv -- -------------------------------------------------------@@ -369,16 +379,26 @@ ue_hpt :: HasDebugCallStack => UnitEnv -> HomePackageTable ue_hpt = homeUnitEnv_hpt . ue_currentHomeUnitEnv +ue_updateHPT_lazy :: HasDebugCallStack => (HomePackageTable -> HomePackageTable) -> UnitEnv -> UnitEnv+ue_updateHPT_lazy f e = ue_updateUnitHPT_lazy f (ue_currentUnit e) e+ ue_updateHPT :: HasDebugCallStack => (HomePackageTable -> HomePackageTable) -> UnitEnv -> UnitEnv ue_updateHPT f e = ue_updateUnitHPT f (ue_currentUnit e) e ue_updateHUG :: HasDebugCallStack => (HomeUnitGraph -> HomeUnitGraph) -> UnitEnv -> UnitEnv ue_updateHUG f e = ue_updateUnitHUG f e +ue_updateUnitHPT_lazy :: HasDebugCallStack => (HomePackageTable -> HomePackageTable) -> UnitId -> UnitEnv -> UnitEnv+ue_updateUnitHPT_lazy f uid ue_env = ue_updateHomeUnitEnv update uid ue_env+ where+ update unitEnv = unitEnv { homeUnitEnv_hpt = f $ homeUnitEnv_hpt unitEnv }+ ue_updateUnitHPT :: HasDebugCallStack => (HomePackageTable -> HomePackageTable) -> UnitId -> UnitEnv -> UnitEnv ue_updateUnitHPT f uid ue_env = ue_updateHomeUnitEnv update uid ue_env where- update unitEnv = unitEnv { homeUnitEnv_hpt = f $ homeUnitEnv_hpt unitEnv }+ update unitEnv =+ let !res = f $ homeUnitEnv_hpt unitEnv+ in unitEnv { homeUnitEnv_hpt = res } ue_updateUnitHUG :: HasDebugCallStack => (HomeUnitGraph -> HomeUnitGraph) -> UnitEnv -> UnitEnv ue_updateUnitHUG f ue_env = ue_env { ue_home_unit_graph = f (ue_home_unit_graph ue_env)}
compiler/GHC/Unit/Module/Graph.hs view
@@ -29,6 +29,7 @@ , NodeKey(..) , nodeKeyUnitId+ , nodeKeyModName , ModNodeKey , mkNodeKey , msKey@@ -125,6 +126,10 @@ nodeKeyUnitId (NodeKey_Unit iu) = instUnitInstanceOf iu nodeKeyUnitId (NodeKey_Module mk) = mnkUnitId mk nodeKeyUnitId (NodeKey_Link uid) = uid++nodeKeyModName :: NodeKey -> Maybe ModuleName+nodeKeyModName (NodeKey_Module mk) = Just (gwib_mod $ mnkModuleName mk)+nodeKeyModName _ = Nothing data ModNodeKeyWithUid = ModNodeKeyWithUid { mnkModuleName :: ModuleNameWithIsBoot , mnkUnitId :: UnitId } deriving (Eq, Ord)
compiler/GHC/Unit/Types.hs view
@@ -207,7 +207,7 @@ | qualModule sty mod = case p of HoleUnit -> angleBrackets (pprModuleName n)- _ -> ppr (moduleUnit mod) <> char ':' <> pprModuleName n+ _ -> ppr p <> char ':' <> pprModuleName n | otherwise = pprModuleName n
compiler/GHC/Utils/Logger.hs view
@@ -332,7 +332,7 @@ jsonLogAction logflags msg_class srcSpan msg = defaultLogActionHPutStrDoc logflags True stdout- (withPprStyle (PprCode CStyle) (doc $$ text ""))+ (withPprStyle PprCode (doc $$ text "")) where str = renderWithContext (log_default_user_context logflags) msg doc = renderJSON $
compiler/GHC/Utils/Misc.hs view
@@ -730,7 +730,7 @@ go n [] bs = (take (I# n) ys, bs) -- = splitAt n ys go n (_:as) (_:bs) = go (n +# 1#) as bs --- drop from the end of a list+-- | drop from the end of a list dropTail :: Int -> [a] -> [a] -- Specification: dropTail n = reverse . drop n . reverse -- Better implementation due to Joachim Breitner
compiler/GHC/Utils/Outputable.hs view
@@ -96,7 +96,7 @@ defaultSDocContext, traceSDocContext, getPprStyle, withPprStyle, setStyleColoured, pprDeeper, pprDeeperList, pprSetDepth,- codeStyle, userStyle, dumpStyle, asmStyle,+ codeStyle, userStyle, dumpStyle, qualName, qualModule, qualPackage, mkErrStyle, defaultErrStyle, defaultDumpStyle, mkDumpStyle, defaultUserStyle, mkUserStyle, cmdlineParserStyle, Depth(..),@@ -170,7 +170,7 @@ -- Does not assume tidied code: non-external names -- are printed with uniques. - | PprCode !LabelStyle -- ^ Print code; either C or assembler+ | PprCode -- ^ Print code; either C or assembler -- | Style of label pretty-printing. --@@ -381,6 +381,7 @@ , sdocSuppressTypeApplications :: !Bool , sdocSuppressIdInfo :: !Bool , sdocSuppressCoercions :: !Bool+ , sdocSuppressCoercionTypes :: !Bool , sdocSuppressUnfoldings :: !Bool , sdocSuppressVarKinds :: !Bool , sdocSuppressUniques :: !Bool@@ -389,7 +390,6 @@ , sdocErrorSpans :: !Bool , sdocStarIsType :: !Bool , sdocLinearTypes :: !Bool- , sdocImpredicativeTypes :: !Bool , sdocListTuplePuns :: !Bool , sdocPrintTypeAbbreviations :: !Bool , sdocUnitIdForUser :: !(FastString -> SDoc)@@ -441,6 +441,7 @@ , sdocSuppressTypeApplications = False , sdocSuppressIdInfo = False , sdocSuppressCoercions = False+ , sdocSuppressCoercionTypes = False , sdocSuppressUnfoldings = False , sdocSuppressVarKinds = False , sdocSuppressUniques = False@@ -448,7 +449,6 @@ , sdocSuppressStgExts = False , sdocErrorSpans = False , sdocStarIsType = False- , sdocImpredicativeTypes = False , sdocLinearTypes = False , sdocListTuplePuns = True , sdocPrintTypeAbbreviations = True@@ -548,12 +548,8 @@ (qualPackage s) codeStyle :: PprStyle -> Bool-codeStyle (PprCode _) = True-codeStyle _ = False--asmStyle :: PprStyle -> Bool-asmStyle (PprCode AsmStyle) = True-asmStyle _other = False+codeStyle PprCode = True+codeStyle _ = False dumpStyle :: PprStyle -> Bool dumpStyle (PprDump {}) = True@@ -601,9 +597,9 @@ bufLeftRenderSDoc ctx bufHandle doc = Pretty.bufLeftRender bufHandle (runSDoc doc ctx) -pprCode :: LabelStyle -> SDoc -> SDoc+pprCode :: SDoc -> SDoc {-# INLINE CONLIKE pprCode #-}-pprCode cs d = withPprStyle (PprCode cs) d+pprCode d = withPprStyle PprCode d renderWithContext :: SDocContext -> SDoc -> String renderWithContext ctx sdoc
compiler/Language/Haskell/Syntax/Basic.hs view
@@ -53,8 +53,8 @@ -- | Field labels are just represented as strings; -- they are not necessarily unique (even within a module)-type FieldLabelString = FastString-+newtype FieldLabelString = FieldLabelString { field_label:: FastString }+ deriving (Data, Eq) {- ************************************************************************
compiler/Language/Haskell/Syntax/Expr.hs view
@@ -1638,4 +1638,3 @@ isMonadDoCompContext GhciStmtCtxt = False isMonadDoCompContext (DoExpr _) = False isMonadDoCompContext (MDoExpr _) = False-
ghc-lib-parser.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.0 build-type: Simple name: ghc-lib-parser-version: 0.20220801+version: 0.20220901 license: BSD3 license-file: LICENSE category: Development@@ -72,7 +72,7 @@ else build-depends: Win32 build-depends:- base >= 4.15 && < 4.18,+ base > 4.16 && < 4.18, ghc-prim > 0.2 && < 0.10, bytestring >= 0.10 && < 0.12, time >= 1.4 && < 1.13,@@ -267,6 +267,7 @@ GHC.Driver.Pipeline.Monad GHC.Driver.Pipeline.Phases GHC.Driver.Plugins+ GHC.Driver.Plugins.External GHC.Driver.Ppr GHC.Driver.Session GHC.Exts.Heap
ghc-lib/stage0/compiler/build/primop-data-decl.hs-incl view
@@ -598,7 +598,9 @@ | LabelThreadOp | IsCurrentThreadBoundOp | NoDuplicateOp+ | GetThreadLabelOp | ThreadStatusOp+ | ListThreadsOp | MkWeakOp | MkWeakNoFinalizerOp | AddCFinalizerToWeakOp
ghc-lib/stage0/compiler/build/primop-docs.hs-incl view
@@ -282,6 +282,10 @@ , ("State#"," 'State#' is the primitive, unlifted type of states. It has\n one type parameter, thus @'State#' 'RealWorld'@, or @'State#' s@,\n where s is a type variable. The only purpose of the type parameter\n is to keep different state threads separate. It is represented by\n nothing at all. ") , ("RealWorld"," 'RealWorld' is deeply magical. It is /primitive/, but it is not\n /unlifted/ (hence @ptrArg@). We never manipulate values of type\n 'RealWorld'; it's only used in the type system, to parameterise 'State#'. ") , ("ThreadId#","(In a non-concurrent implementation, this can be a singleton\n type, whose (unique) value is returned by 'myThreadId#'. The\n other operations can be omitted.)")+ , ("labelThread#","Set the label of the given thread. The @ByteArray#@ should contain\n a UTF-8-encoded string.")+ , ("threadLabel#","Get the label of the given thread.\n Morally of type @ThreadId# -> IO (Maybe ByteArray#)@, with a @1#@ tag\n denoting @Just@.\n\n @since 0.10")+ , ("threadStatus#","Get the status of the given thread. Result is\n @(ThreadStatus, Capability, Locked)@ where\n @ThreadStatus@ is one of the status constants defined in\n @rts/Constants.h@, @Capability@ is the number of\n the capability which currently owns the thread, and\n @Locked@ is a boolean indicating whether the\n thread is bound to that capability.\n\n @since 0.9")+ , ("listThreads#"," Returns an array of the threads started by the program. Note that this\n threads which have finished execution may or may not be present in this\n list, depending upon whether they have been collected by the garbage collector.\n\n @since 0.10") , ("mkWeak#"," @'mkWeak#' k v finalizer s@ creates a weak reference to value @k@,\n with an associated reference to some value @v@. If @k@ is still\n alive then @v@ can be retrieved using 'deRefWeak#'. Note that\n the type of @k@ must be represented by a pointer (i.e. of kind\n @'TYPE' ''LiftedRep' or @'TYPE' ''UnliftedRep'@). ") , ("addCFinalizerToWeak#"," @'addCFinalizerToWeak#' fptr ptr flag eptr w@ attaches a C\n function pointer @fptr@ to a weak pointer @w@ as a finalizer. If\n @flag@ is zero, @fptr@ will be called with one argument,\n @ptr@. Otherwise, it will be called with two arguments,\n @eptr@ and @ptr@. 'addCFinalizerToWeak#' returns\n 1 on success, or 0 if @w@ is already dead. ") , ("finalizeWeak#"," Finalize a weak pointer. The return value is an unboxed tuple\n containing the new state of the world and an \"unboxed Maybe\",\n represented by an 'Int#' and a (possibly invalid) finalization\n action. An 'Int#' of @1@ indicates that the finalizer is valid. The\n return value @b@ from the finalizer should be ignored. ")
ghc-lib/stage0/compiler/build/primop-has-side-effects.hs-incl view
@@ -199,6 +199,7 @@ primOpHasSideEffects IsCurrentThreadBoundOp = True primOpHasSideEffects NoDuplicateOp = True primOpHasSideEffects ThreadStatusOp = True+primOpHasSideEffects ListThreadsOp = True primOpHasSideEffects MkWeakOp = True primOpHasSideEffects MkWeakNoFinalizerOp = True primOpHasSideEffects AddCFinalizerToWeakOp = True
ghc-lib/stage0/compiler/build/primop-list.hs-incl view
@@ -597,7 +597,9 @@ , LabelThreadOp , IsCurrentThreadBoundOp , NoDuplicateOp+ , GetThreadLabelOp , ThreadStatusOp+ , ListThreadsOp , MkWeakOp , MkWeakNoFinalizerOp , AddCFinalizerToWeakOp
ghc-lib/stage0/compiler/build/primop-out-of-line.hs-incl view
@@ -67,7 +67,9 @@ primOpOutOfLine LabelThreadOp = True primOpOutOfLine IsCurrentThreadBoundOp = True primOpOutOfLine NoDuplicateOp = True+primOpOutOfLine GetThreadLabelOp = True primOpOutOfLine ThreadStatusOp = True+primOpOutOfLine ListThreadsOp = True primOpOutOfLine MkWeakOp = True primOpOutOfLine MkWeakNoFinalizerOp = True primOpOutOfLine AddCFinalizerToWeakOp = True
ghc-lib/stage0/compiler/build/primop-primop-info.hs-incl view
@@ -594,10 +594,12 @@ primOpInfo KillThreadOp = mkGenPrimOp (fsLit "killThread#") [alphaTyVarSpec] [threadIdPrimTy, alphaTy, mkStatePrimTy realWorldTy] (mkStatePrimTy realWorldTy) primOpInfo YieldOp = mkGenPrimOp (fsLit "yield#") [] [mkStatePrimTy realWorldTy] (mkStatePrimTy realWorldTy) primOpInfo MyThreadIdOp = mkGenPrimOp (fsLit "myThreadId#") [] [mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, threadIdPrimTy]))-primOpInfo LabelThreadOp = mkGenPrimOp (fsLit "labelThread#") [] [threadIdPrimTy, addrPrimTy, mkStatePrimTy realWorldTy] (mkStatePrimTy realWorldTy)+primOpInfo LabelThreadOp = mkGenPrimOp (fsLit "labelThread#") [] [threadIdPrimTy, byteArrayPrimTy, mkStatePrimTy realWorldTy] (mkStatePrimTy realWorldTy) primOpInfo IsCurrentThreadBoundOp = mkGenPrimOp (fsLit "isCurrentThreadBound#") [] [mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, intPrimTy])) primOpInfo NoDuplicateOp = mkGenPrimOp (fsLit "noDuplicate#") [deltaTyVarSpec] [mkStatePrimTy deltaTy] (mkStatePrimTy deltaTy)+primOpInfo GetThreadLabelOp = mkGenPrimOp (fsLit "threadLabel#") [] [threadIdPrimTy, mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, intPrimTy, byteArrayPrimTy])) primOpInfo ThreadStatusOp = mkGenPrimOp (fsLit "threadStatus#") [] [threadIdPrimTy, mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, intPrimTy, intPrimTy, intPrimTy]))+primOpInfo ListThreadsOp = mkGenPrimOp (fsLit "listThreads#") [] [mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, mkArrayPrimTy threadIdPrimTy])) primOpInfo MkWeakOp = mkGenPrimOp (fsLit "mkWeak#") [levity1TyVarInf, levity2TyVarInf, levPolyAlphaTyVarSpec, levPolyBetaTyVarSpec, gammaTyVarSpec] [levPolyAlphaTy, levPolyBetaTy, (mkVisFunTyMany (mkStatePrimTy realWorldTy) ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, gammaTy]))), mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, mkWeakPrimTy levPolyBetaTy])) primOpInfo MkWeakNoFinalizerOp = mkGenPrimOp (fsLit "mkWeakNoFinalizer#") [levity1TyVarInf, levity2TyVarInf, levPolyAlphaTyVarSpec, levPolyBetaTyVarSpec] [levPolyAlphaTy, levPolyBetaTy, mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, mkWeakPrimTy levPolyBetaTy])) primOpInfo AddCFinalizerToWeakOp = mkGenPrimOp (fsLit "addCFinalizerToWeak#") [levity2TyVarInf, levPolyBetaTyVarSpec] [addrPrimTy, addrPrimTy, intPrimTy, addrPrimTy, mkWeakPrimTy levPolyBetaTy, mkStatePrimTy realWorldTy] ((mkTupleTy Unboxed [mkStatePrimTy realWorldTy, intPrimTy]))
ghc-lib/stage0/compiler/build/primop-tag.hs-incl view
@@ -1,1307 +1,1309 @@ maxPrimOpTag :: Int-maxPrimOpTag = 1303-primOpTag :: PrimOp -> Int-primOpTag CharGtOp = 0-primOpTag CharGeOp = 1-primOpTag CharEqOp = 2-primOpTag CharNeOp = 3-primOpTag CharLtOp = 4-primOpTag CharLeOp = 5-primOpTag OrdOp = 6-primOpTag Int8ToIntOp = 7-primOpTag IntToInt8Op = 8-primOpTag Int8NegOp = 9-primOpTag Int8AddOp = 10-primOpTag Int8SubOp = 11-primOpTag Int8MulOp = 12-primOpTag Int8QuotOp = 13-primOpTag Int8RemOp = 14-primOpTag Int8QuotRemOp = 15-primOpTag Int8SllOp = 16-primOpTag Int8SraOp = 17-primOpTag Int8SrlOp = 18-primOpTag Int8ToWord8Op = 19-primOpTag Int8EqOp = 20-primOpTag Int8GeOp = 21-primOpTag Int8GtOp = 22-primOpTag Int8LeOp = 23-primOpTag Int8LtOp = 24-primOpTag Int8NeOp = 25-primOpTag Word8ToWordOp = 26-primOpTag WordToWord8Op = 27-primOpTag Word8AddOp = 28-primOpTag Word8SubOp = 29-primOpTag Word8MulOp = 30-primOpTag Word8QuotOp = 31-primOpTag Word8RemOp = 32-primOpTag Word8QuotRemOp = 33-primOpTag Word8AndOp = 34-primOpTag Word8OrOp = 35-primOpTag Word8XorOp = 36-primOpTag Word8NotOp = 37-primOpTag Word8SllOp = 38-primOpTag Word8SrlOp = 39-primOpTag Word8ToInt8Op = 40-primOpTag Word8EqOp = 41-primOpTag Word8GeOp = 42-primOpTag Word8GtOp = 43-primOpTag Word8LeOp = 44-primOpTag Word8LtOp = 45-primOpTag Word8NeOp = 46-primOpTag Int16ToIntOp = 47-primOpTag IntToInt16Op = 48-primOpTag Int16NegOp = 49-primOpTag Int16AddOp = 50-primOpTag Int16SubOp = 51-primOpTag Int16MulOp = 52-primOpTag Int16QuotOp = 53-primOpTag Int16RemOp = 54-primOpTag Int16QuotRemOp = 55-primOpTag Int16SllOp = 56-primOpTag Int16SraOp = 57-primOpTag Int16SrlOp = 58-primOpTag Int16ToWord16Op = 59-primOpTag Int16EqOp = 60-primOpTag Int16GeOp = 61-primOpTag Int16GtOp = 62-primOpTag Int16LeOp = 63-primOpTag Int16LtOp = 64-primOpTag Int16NeOp = 65-primOpTag Word16ToWordOp = 66-primOpTag WordToWord16Op = 67-primOpTag Word16AddOp = 68-primOpTag Word16SubOp = 69-primOpTag Word16MulOp = 70-primOpTag Word16QuotOp = 71-primOpTag Word16RemOp = 72-primOpTag Word16QuotRemOp = 73-primOpTag Word16AndOp = 74-primOpTag Word16OrOp = 75-primOpTag Word16XorOp = 76-primOpTag Word16NotOp = 77-primOpTag Word16SllOp = 78-primOpTag Word16SrlOp = 79-primOpTag Word16ToInt16Op = 80-primOpTag Word16EqOp = 81-primOpTag Word16GeOp = 82-primOpTag Word16GtOp = 83-primOpTag Word16LeOp = 84-primOpTag Word16LtOp = 85-primOpTag Word16NeOp = 86-primOpTag Int32ToIntOp = 87-primOpTag IntToInt32Op = 88-primOpTag Int32NegOp = 89-primOpTag Int32AddOp = 90-primOpTag Int32SubOp = 91-primOpTag Int32MulOp = 92-primOpTag Int32QuotOp = 93-primOpTag Int32RemOp = 94-primOpTag Int32QuotRemOp = 95-primOpTag Int32SllOp = 96-primOpTag Int32SraOp = 97-primOpTag Int32SrlOp = 98-primOpTag Int32ToWord32Op = 99-primOpTag Int32EqOp = 100-primOpTag Int32GeOp = 101-primOpTag Int32GtOp = 102-primOpTag Int32LeOp = 103-primOpTag Int32LtOp = 104-primOpTag Int32NeOp = 105-primOpTag Word32ToWordOp = 106-primOpTag WordToWord32Op = 107-primOpTag Word32AddOp = 108-primOpTag Word32SubOp = 109-primOpTag Word32MulOp = 110-primOpTag Word32QuotOp = 111-primOpTag Word32RemOp = 112-primOpTag Word32QuotRemOp = 113-primOpTag Word32AndOp = 114-primOpTag Word32OrOp = 115-primOpTag Word32XorOp = 116-primOpTag Word32NotOp = 117-primOpTag Word32SllOp = 118-primOpTag Word32SrlOp = 119-primOpTag Word32ToInt32Op = 120-primOpTag Word32EqOp = 121-primOpTag Word32GeOp = 122-primOpTag Word32GtOp = 123-primOpTag Word32LeOp = 124-primOpTag Word32LtOp = 125-primOpTag Word32NeOp = 126-primOpTag Int64ToIntOp = 127-primOpTag IntToInt64Op = 128-primOpTag Int64NegOp = 129-primOpTag Int64AddOp = 130-primOpTag Int64SubOp = 131-primOpTag Int64MulOp = 132-primOpTag Int64QuotOp = 133-primOpTag Int64RemOp = 134-primOpTag Int64SllOp = 135-primOpTag Int64SraOp = 136-primOpTag Int64SrlOp = 137-primOpTag Int64ToWord64Op = 138-primOpTag Int64EqOp = 139-primOpTag Int64GeOp = 140-primOpTag Int64GtOp = 141-primOpTag Int64LeOp = 142-primOpTag Int64LtOp = 143-primOpTag Int64NeOp = 144-primOpTag Word64ToWordOp = 145-primOpTag WordToWord64Op = 146-primOpTag Word64AddOp = 147-primOpTag Word64SubOp = 148-primOpTag Word64MulOp = 149-primOpTag Word64QuotOp = 150-primOpTag Word64RemOp = 151-primOpTag Word64AndOp = 152-primOpTag Word64OrOp = 153-primOpTag Word64XorOp = 154-primOpTag Word64NotOp = 155-primOpTag Word64SllOp = 156-primOpTag Word64SrlOp = 157-primOpTag Word64ToInt64Op = 158-primOpTag Word64EqOp = 159-primOpTag Word64GeOp = 160-primOpTag Word64GtOp = 161-primOpTag Word64LeOp = 162-primOpTag Word64LtOp = 163-primOpTag Word64NeOp = 164-primOpTag IntAddOp = 165-primOpTag IntSubOp = 166-primOpTag IntMulOp = 167-primOpTag IntMul2Op = 168-primOpTag IntMulMayOfloOp = 169-primOpTag IntQuotOp = 170-primOpTag IntRemOp = 171-primOpTag IntQuotRemOp = 172-primOpTag IntAndOp = 173-primOpTag IntOrOp = 174-primOpTag IntXorOp = 175-primOpTag IntNotOp = 176-primOpTag IntNegOp = 177-primOpTag IntAddCOp = 178-primOpTag IntSubCOp = 179-primOpTag IntGtOp = 180-primOpTag IntGeOp = 181-primOpTag IntEqOp = 182-primOpTag IntNeOp = 183-primOpTag IntLtOp = 184-primOpTag IntLeOp = 185-primOpTag ChrOp = 186-primOpTag IntToWordOp = 187-primOpTag IntToFloatOp = 188-primOpTag IntToDoubleOp = 189-primOpTag WordToFloatOp = 190-primOpTag WordToDoubleOp = 191-primOpTag IntSllOp = 192-primOpTag IntSraOp = 193-primOpTag IntSrlOp = 194-primOpTag WordAddOp = 195-primOpTag WordAddCOp = 196-primOpTag WordSubCOp = 197-primOpTag WordAdd2Op = 198-primOpTag WordSubOp = 199-primOpTag WordMulOp = 200-primOpTag WordMul2Op = 201-primOpTag WordQuotOp = 202-primOpTag WordRemOp = 203-primOpTag WordQuotRemOp = 204-primOpTag WordQuotRem2Op = 205-primOpTag WordAndOp = 206-primOpTag WordOrOp = 207-primOpTag WordXorOp = 208-primOpTag WordNotOp = 209-primOpTag WordSllOp = 210-primOpTag WordSrlOp = 211-primOpTag WordToIntOp = 212-primOpTag WordGtOp = 213-primOpTag WordGeOp = 214-primOpTag WordEqOp = 215-primOpTag WordNeOp = 216-primOpTag WordLtOp = 217-primOpTag WordLeOp = 218-primOpTag PopCnt8Op = 219-primOpTag PopCnt16Op = 220-primOpTag PopCnt32Op = 221-primOpTag PopCnt64Op = 222-primOpTag PopCntOp = 223-primOpTag Pdep8Op = 224-primOpTag Pdep16Op = 225-primOpTag Pdep32Op = 226-primOpTag Pdep64Op = 227-primOpTag PdepOp = 228-primOpTag Pext8Op = 229-primOpTag Pext16Op = 230-primOpTag Pext32Op = 231-primOpTag Pext64Op = 232-primOpTag PextOp = 233-primOpTag Clz8Op = 234-primOpTag Clz16Op = 235-primOpTag Clz32Op = 236-primOpTag Clz64Op = 237-primOpTag ClzOp = 238-primOpTag Ctz8Op = 239-primOpTag Ctz16Op = 240-primOpTag Ctz32Op = 241-primOpTag Ctz64Op = 242-primOpTag CtzOp = 243-primOpTag BSwap16Op = 244-primOpTag BSwap32Op = 245-primOpTag BSwap64Op = 246-primOpTag BSwapOp = 247-primOpTag BRev8Op = 248-primOpTag BRev16Op = 249-primOpTag BRev32Op = 250-primOpTag BRev64Op = 251-primOpTag BRevOp = 252-primOpTag Narrow8IntOp = 253-primOpTag Narrow16IntOp = 254-primOpTag Narrow32IntOp = 255-primOpTag Narrow8WordOp = 256-primOpTag Narrow16WordOp = 257-primOpTag Narrow32WordOp = 258-primOpTag DoubleGtOp = 259-primOpTag DoubleGeOp = 260-primOpTag DoubleEqOp = 261-primOpTag DoubleNeOp = 262-primOpTag DoubleLtOp = 263-primOpTag DoubleLeOp = 264-primOpTag DoubleAddOp = 265-primOpTag DoubleSubOp = 266-primOpTag DoubleMulOp = 267-primOpTag DoubleDivOp = 268-primOpTag DoubleNegOp = 269-primOpTag DoubleFabsOp = 270-primOpTag DoubleToIntOp = 271-primOpTag DoubleToFloatOp = 272-primOpTag DoubleExpOp = 273-primOpTag DoubleExpM1Op = 274-primOpTag DoubleLogOp = 275-primOpTag DoubleLog1POp = 276-primOpTag DoubleSqrtOp = 277-primOpTag DoubleSinOp = 278-primOpTag DoubleCosOp = 279-primOpTag DoubleTanOp = 280-primOpTag DoubleAsinOp = 281-primOpTag DoubleAcosOp = 282-primOpTag DoubleAtanOp = 283-primOpTag DoubleSinhOp = 284-primOpTag DoubleCoshOp = 285-primOpTag DoubleTanhOp = 286-primOpTag DoubleAsinhOp = 287-primOpTag DoubleAcoshOp = 288-primOpTag DoubleAtanhOp = 289-primOpTag DoublePowerOp = 290-primOpTag DoubleDecode_2IntOp = 291-primOpTag DoubleDecode_Int64Op = 292-primOpTag FloatGtOp = 293-primOpTag FloatGeOp = 294-primOpTag FloatEqOp = 295-primOpTag FloatNeOp = 296-primOpTag FloatLtOp = 297-primOpTag FloatLeOp = 298-primOpTag FloatAddOp = 299-primOpTag FloatSubOp = 300-primOpTag FloatMulOp = 301-primOpTag FloatDivOp = 302-primOpTag FloatNegOp = 303-primOpTag FloatFabsOp = 304-primOpTag FloatToIntOp = 305-primOpTag FloatExpOp = 306-primOpTag FloatExpM1Op = 307-primOpTag FloatLogOp = 308-primOpTag FloatLog1POp = 309-primOpTag FloatSqrtOp = 310-primOpTag FloatSinOp = 311-primOpTag FloatCosOp = 312-primOpTag FloatTanOp = 313-primOpTag FloatAsinOp = 314-primOpTag FloatAcosOp = 315-primOpTag FloatAtanOp = 316-primOpTag FloatSinhOp = 317-primOpTag FloatCoshOp = 318-primOpTag FloatTanhOp = 319-primOpTag FloatAsinhOp = 320-primOpTag FloatAcoshOp = 321-primOpTag FloatAtanhOp = 322-primOpTag FloatPowerOp = 323-primOpTag FloatToDoubleOp = 324-primOpTag FloatDecode_IntOp = 325-primOpTag NewArrayOp = 326-primOpTag ReadArrayOp = 327-primOpTag WriteArrayOp = 328-primOpTag SizeofArrayOp = 329-primOpTag SizeofMutableArrayOp = 330-primOpTag IndexArrayOp = 331-primOpTag UnsafeFreezeArrayOp = 332-primOpTag UnsafeThawArrayOp = 333-primOpTag CopyArrayOp = 334-primOpTag CopyMutableArrayOp = 335-primOpTag CloneArrayOp = 336-primOpTag CloneMutableArrayOp = 337-primOpTag FreezeArrayOp = 338-primOpTag ThawArrayOp = 339-primOpTag CasArrayOp = 340-primOpTag NewSmallArrayOp = 341-primOpTag ShrinkSmallMutableArrayOp_Char = 342-primOpTag ReadSmallArrayOp = 343-primOpTag WriteSmallArrayOp = 344-primOpTag SizeofSmallArrayOp = 345-primOpTag SizeofSmallMutableArrayOp = 346-primOpTag GetSizeofSmallMutableArrayOp = 347-primOpTag IndexSmallArrayOp = 348-primOpTag UnsafeFreezeSmallArrayOp = 349-primOpTag UnsafeThawSmallArrayOp = 350-primOpTag CopySmallArrayOp = 351-primOpTag CopySmallMutableArrayOp = 352-primOpTag CloneSmallArrayOp = 353-primOpTag CloneSmallMutableArrayOp = 354-primOpTag FreezeSmallArrayOp = 355-primOpTag ThawSmallArrayOp = 356-primOpTag CasSmallArrayOp = 357-primOpTag NewByteArrayOp_Char = 358-primOpTag NewPinnedByteArrayOp_Char = 359-primOpTag NewAlignedPinnedByteArrayOp_Char = 360-primOpTag MutableByteArrayIsPinnedOp = 361-primOpTag ByteArrayIsPinnedOp = 362-primOpTag ByteArrayContents_Char = 363-primOpTag MutableByteArrayContents_Char = 364-primOpTag ShrinkMutableByteArrayOp_Char = 365-primOpTag ResizeMutableByteArrayOp_Char = 366-primOpTag UnsafeFreezeByteArrayOp = 367-primOpTag SizeofByteArrayOp = 368-primOpTag SizeofMutableByteArrayOp = 369-primOpTag GetSizeofMutableByteArrayOp = 370-primOpTag IndexByteArrayOp_Char = 371-primOpTag IndexByteArrayOp_WideChar = 372-primOpTag IndexByteArrayOp_Int = 373-primOpTag IndexByteArrayOp_Word = 374-primOpTag IndexByteArrayOp_Addr = 375-primOpTag IndexByteArrayOp_Float = 376-primOpTag IndexByteArrayOp_Double = 377-primOpTag IndexByteArrayOp_StablePtr = 378-primOpTag IndexByteArrayOp_Int8 = 379-primOpTag IndexByteArrayOp_Int16 = 380-primOpTag IndexByteArrayOp_Int32 = 381-primOpTag IndexByteArrayOp_Int64 = 382-primOpTag IndexByteArrayOp_Word8 = 383-primOpTag IndexByteArrayOp_Word16 = 384-primOpTag IndexByteArrayOp_Word32 = 385-primOpTag IndexByteArrayOp_Word64 = 386-primOpTag IndexByteArrayOp_Word8AsChar = 387-primOpTag IndexByteArrayOp_Word8AsWideChar = 388-primOpTag IndexByteArrayOp_Word8AsInt = 389-primOpTag IndexByteArrayOp_Word8AsWord = 390-primOpTag IndexByteArrayOp_Word8AsAddr = 391-primOpTag IndexByteArrayOp_Word8AsFloat = 392-primOpTag IndexByteArrayOp_Word8AsDouble = 393-primOpTag IndexByteArrayOp_Word8AsStablePtr = 394-primOpTag IndexByteArrayOp_Word8AsInt16 = 395-primOpTag IndexByteArrayOp_Word8AsInt32 = 396-primOpTag IndexByteArrayOp_Word8AsInt64 = 397-primOpTag IndexByteArrayOp_Word8AsWord16 = 398-primOpTag IndexByteArrayOp_Word8AsWord32 = 399-primOpTag IndexByteArrayOp_Word8AsWord64 = 400-primOpTag ReadByteArrayOp_Char = 401-primOpTag ReadByteArrayOp_WideChar = 402-primOpTag ReadByteArrayOp_Int = 403-primOpTag ReadByteArrayOp_Word = 404-primOpTag ReadByteArrayOp_Addr = 405-primOpTag ReadByteArrayOp_Float = 406-primOpTag ReadByteArrayOp_Double = 407-primOpTag ReadByteArrayOp_StablePtr = 408-primOpTag ReadByteArrayOp_Int8 = 409-primOpTag ReadByteArrayOp_Int16 = 410-primOpTag ReadByteArrayOp_Int32 = 411-primOpTag ReadByteArrayOp_Int64 = 412-primOpTag ReadByteArrayOp_Word8 = 413-primOpTag ReadByteArrayOp_Word16 = 414-primOpTag ReadByteArrayOp_Word32 = 415-primOpTag ReadByteArrayOp_Word64 = 416-primOpTag ReadByteArrayOp_Word8AsChar = 417-primOpTag ReadByteArrayOp_Word8AsWideChar = 418-primOpTag ReadByteArrayOp_Word8AsInt = 419-primOpTag ReadByteArrayOp_Word8AsWord = 420-primOpTag ReadByteArrayOp_Word8AsAddr = 421-primOpTag ReadByteArrayOp_Word8AsFloat = 422-primOpTag ReadByteArrayOp_Word8AsDouble = 423-primOpTag ReadByteArrayOp_Word8AsStablePtr = 424-primOpTag ReadByteArrayOp_Word8AsInt16 = 425-primOpTag ReadByteArrayOp_Word8AsInt32 = 426-primOpTag ReadByteArrayOp_Word8AsInt64 = 427-primOpTag ReadByteArrayOp_Word8AsWord16 = 428-primOpTag ReadByteArrayOp_Word8AsWord32 = 429-primOpTag ReadByteArrayOp_Word8AsWord64 = 430-primOpTag WriteByteArrayOp_Char = 431-primOpTag WriteByteArrayOp_WideChar = 432-primOpTag WriteByteArrayOp_Int = 433-primOpTag WriteByteArrayOp_Word = 434-primOpTag WriteByteArrayOp_Addr = 435-primOpTag WriteByteArrayOp_Float = 436-primOpTag WriteByteArrayOp_Double = 437-primOpTag WriteByteArrayOp_StablePtr = 438-primOpTag WriteByteArrayOp_Int8 = 439-primOpTag WriteByteArrayOp_Int16 = 440-primOpTag WriteByteArrayOp_Int32 = 441-primOpTag WriteByteArrayOp_Int64 = 442-primOpTag WriteByteArrayOp_Word8 = 443-primOpTag WriteByteArrayOp_Word16 = 444-primOpTag WriteByteArrayOp_Word32 = 445-primOpTag WriteByteArrayOp_Word64 = 446-primOpTag WriteByteArrayOp_Word8AsChar = 447-primOpTag WriteByteArrayOp_Word8AsWideChar = 448-primOpTag WriteByteArrayOp_Word8AsInt = 449-primOpTag WriteByteArrayOp_Word8AsWord = 450-primOpTag WriteByteArrayOp_Word8AsAddr = 451-primOpTag WriteByteArrayOp_Word8AsFloat = 452-primOpTag WriteByteArrayOp_Word8AsDouble = 453-primOpTag WriteByteArrayOp_Word8AsStablePtr = 454-primOpTag WriteByteArrayOp_Word8AsInt16 = 455-primOpTag WriteByteArrayOp_Word8AsInt32 = 456-primOpTag WriteByteArrayOp_Word8AsInt64 = 457-primOpTag WriteByteArrayOp_Word8AsWord16 = 458-primOpTag WriteByteArrayOp_Word8AsWord32 = 459-primOpTag WriteByteArrayOp_Word8AsWord64 = 460-primOpTag CompareByteArraysOp = 461-primOpTag CopyByteArrayOp = 462-primOpTag CopyMutableByteArrayOp = 463-primOpTag CopyByteArrayToAddrOp = 464-primOpTag CopyMutableByteArrayToAddrOp = 465-primOpTag CopyAddrToByteArrayOp = 466-primOpTag SetByteArrayOp = 467-primOpTag AtomicReadByteArrayOp_Int = 468-primOpTag AtomicWriteByteArrayOp_Int = 469-primOpTag CasByteArrayOp_Int = 470-primOpTag CasByteArrayOp_Int8 = 471-primOpTag CasByteArrayOp_Int16 = 472-primOpTag CasByteArrayOp_Int32 = 473-primOpTag CasByteArrayOp_Int64 = 474-primOpTag FetchAddByteArrayOp_Int = 475-primOpTag FetchSubByteArrayOp_Int = 476-primOpTag FetchAndByteArrayOp_Int = 477-primOpTag FetchNandByteArrayOp_Int = 478-primOpTag FetchOrByteArrayOp_Int = 479-primOpTag FetchXorByteArrayOp_Int = 480-primOpTag AddrAddOp = 481-primOpTag AddrSubOp = 482-primOpTag AddrRemOp = 483-primOpTag AddrToIntOp = 484-primOpTag IntToAddrOp = 485-primOpTag AddrGtOp = 486-primOpTag AddrGeOp = 487-primOpTag AddrEqOp = 488-primOpTag AddrNeOp = 489-primOpTag AddrLtOp = 490-primOpTag AddrLeOp = 491-primOpTag IndexOffAddrOp_Char = 492-primOpTag IndexOffAddrOp_WideChar = 493-primOpTag IndexOffAddrOp_Int = 494-primOpTag IndexOffAddrOp_Word = 495-primOpTag IndexOffAddrOp_Addr = 496-primOpTag IndexOffAddrOp_Float = 497-primOpTag IndexOffAddrOp_Double = 498-primOpTag IndexOffAddrOp_StablePtr = 499-primOpTag IndexOffAddrOp_Int8 = 500-primOpTag IndexOffAddrOp_Int16 = 501-primOpTag IndexOffAddrOp_Int32 = 502-primOpTag IndexOffAddrOp_Int64 = 503-primOpTag IndexOffAddrOp_Word8 = 504-primOpTag IndexOffAddrOp_Word16 = 505-primOpTag IndexOffAddrOp_Word32 = 506-primOpTag IndexOffAddrOp_Word64 = 507-primOpTag ReadOffAddrOp_Char = 508-primOpTag ReadOffAddrOp_WideChar = 509-primOpTag ReadOffAddrOp_Int = 510-primOpTag ReadOffAddrOp_Word = 511-primOpTag ReadOffAddrOp_Addr = 512-primOpTag ReadOffAddrOp_Float = 513-primOpTag ReadOffAddrOp_Double = 514-primOpTag ReadOffAddrOp_StablePtr = 515-primOpTag ReadOffAddrOp_Int8 = 516-primOpTag ReadOffAddrOp_Int16 = 517-primOpTag ReadOffAddrOp_Int32 = 518-primOpTag ReadOffAddrOp_Int64 = 519-primOpTag ReadOffAddrOp_Word8 = 520-primOpTag ReadOffAddrOp_Word16 = 521-primOpTag ReadOffAddrOp_Word32 = 522-primOpTag ReadOffAddrOp_Word64 = 523-primOpTag WriteOffAddrOp_Char = 524-primOpTag WriteOffAddrOp_WideChar = 525-primOpTag WriteOffAddrOp_Int = 526-primOpTag WriteOffAddrOp_Word = 527-primOpTag WriteOffAddrOp_Addr = 528-primOpTag WriteOffAddrOp_Float = 529-primOpTag WriteOffAddrOp_Double = 530-primOpTag WriteOffAddrOp_StablePtr = 531-primOpTag WriteOffAddrOp_Int8 = 532-primOpTag WriteOffAddrOp_Int16 = 533-primOpTag WriteOffAddrOp_Int32 = 534-primOpTag WriteOffAddrOp_Int64 = 535-primOpTag WriteOffAddrOp_Word8 = 536-primOpTag WriteOffAddrOp_Word16 = 537-primOpTag WriteOffAddrOp_Word32 = 538-primOpTag WriteOffAddrOp_Word64 = 539-primOpTag InterlockedExchange_Addr = 540-primOpTag InterlockedExchange_Word = 541-primOpTag CasAddrOp_Addr = 542-primOpTag CasAddrOp_Word = 543-primOpTag CasAddrOp_Word8 = 544-primOpTag CasAddrOp_Word16 = 545-primOpTag CasAddrOp_Word32 = 546-primOpTag CasAddrOp_Word64 = 547-primOpTag FetchAddAddrOp_Word = 548-primOpTag FetchSubAddrOp_Word = 549-primOpTag FetchAndAddrOp_Word = 550-primOpTag FetchNandAddrOp_Word = 551-primOpTag FetchOrAddrOp_Word = 552-primOpTag FetchXorAddrOp_Word = 553-primOpTag AtomicReadAddrOp_Word = 554-primOpTag AtomicWriteAddrOp_Word = 555-primOpTag NewMutVarOp = 556-primOpTag ReadMutVarOp = 557-primOpTag WriteMutVarOp = 558-primOpTag AtomicModifyMutVar2Op = 559-primOpTag AtomicModifyMutVar_Op = 560-primOpTag CasMutVarOp = 561-primOpTag CatchOp = 562-primOpTag RaiseOp = 563-primOpTag RaiseIOOp = 564-primOpTag MaskAsyncExceptionsOp = 565-primOpTag MaskUninterruptibleOp = 566-primOpTag UnmaskAsyncExceptionsOp = 567-primOpTag MaskStatus = 568-primOpTag AtomicallyOp = 569-primOpTag RetryOp = 570-primOpTag CatchRetryOp = 571-primOpTag CatchSTMOp = 572-primOpTag NewTVarOp = 573-primOpTag ReadTVarOp = 574-primOpTag ReadTVarIOOp = 575-primOpTag WriteTVarOp = 576-primOpTag NewMVarOp = 577-primOpTag TakeMVarOp = 578-primOpTag TryTakeMVarOp = 579-primOpTag PutMVarOp = 580-primOpTag TryPutMVarOp = 581-primOpTag ReadMVarOp = 582-primOpTag TryReadMVarOp = 583-primOpTag IsEmptyMVarOp = 584-primOpTag NewIOPortOp = 585-primOpTag ReadIOPortOp = 586-primOpTag WriteIOPortOp = 587-primOpTag DelayOp = 588-primOpTag WaitReadOp = 589-primOpTag WaitWriteOp = 590-primOpTag ForkOp = 591-primOpTag ForkOnOp = 592-primOpTag KillThreadOp = 593-primOpTag YieldOp = 594-primOpTag MyThreadIdOp = 595-primOpTag LabelThreadOp = 596-primOpTag IsCurrentThreadBoundOp = 597-primOpTag NoDuplicateOp = 598-primOpTag ThreadStatusOp = 599-primOpTag MkWeakOp = 600-primOpTag MkWeakNoFinalizerOp = 601-primOpTag AddCFinalizerToWeakOp = 602-primOpTag DeRefWeakOp = 603-primOpTag FinalizeWeakOp = 604-primOpTag TouchOp = 605-primOpTag MakeStablePtrOp = 606-primOpTag DeRefStablePtrOp = 607-primOpTag EqStablePtrOp = 608-primOpTag MakeStableNameOp = 609-primOpTag StableNameToIntOp = 610-primOpTag CompactNewOp = 611-primOpTag CompactResizeOp = 612-primOpTag CompactContainsOp = 613-primOpTag CompactContainsAnyOp = 614-primOpTag CompactGetFirstBlockOp = 615-primOpTag CompactGetNextBlockOp = 616-primOpTag CompactAllocateBlockOp = 617-primOpTag CompactFixupPointersOp = 618-primOpTag CompactAdd = 619-primOpTag CompactAddWithSharing = 620-primOpTag CompactSize = 621-primOpTag ReallyUnsafePtrEqualityOp = 622-primOpTag ParOp = 623-primOpTag SparkOp = 624-primOpTag SeqOp = 625-primOpTag GetSparkOp = 626-primOpTag NumSparks = 627-primOpTag KeepAliveOp = 628-primOpTag DataToTagOp = 629-primOpTag TagToEnumOp = 630-primOpTag AddrToAnyOp = 631-primOpTag AnyToAddrOp = 632-primOpTag MkApUpd0_Op = 633-primOpTag NewBCOOp = 634-primOpTag UnpackClosureOp = 635-primOpTag ClosureSizeOp = 636-primOpTag GetApStackValOp = 637-primOpTag GetCCSOfOp = 638-primOpTag GetCurrentCCSOp = 639-primOpTag ClearCCSOp = 640-primOpTag WhereFromOp = 641-primOpTag TraceEventOp = 642-primOpTag TraceEventBinaryOp = 643-primOpTag TraceMarkerOp = 644-primOpTag SetThreadAllocationCounter = 645-primOpTag (VecBroadcastOp IntVec 16 W8) = 646-primOpTag (VecBroadcastOp IntVec 8 W16) = 647-primOpTag (VecBroadcastOp IntVec 4 W32) = 648-primOpTag (VecBroadcastOp IntVec 2 W64) = 649-primOpTag (VecBroadcastOp IntVec 32 W8) = 650-primOpTag (VecBroadcastOp IntVec 16 W16) = 651-primOpTag (VecBroadcastOp IntVec 8 W32) = 652-primOpTag (VecBroadcastOp IntVec 4 W64) = 653-primOpTag (VecBroadcastOp IntVec 64 W8) = 654-primOpTag (VecBroadcastOp IntVec 32 W16) = 655-primOpTag (VecBroadcastOp IntVec 16 W32) = 656-primOpTag (VecBroadcastOp IntVec 8 W64) = 657-primOpTag (VecBroadcastOp WordVec 16 W8) = 658-primOpTag (VecBroadcastOp WordVec 8 W16) = 659-primOpTag (VecBroadcastOp WordVec 4 W32) = 660-primOpTag (VecBroadcastOp WordVec 2 W64) = 661-primOpTag (VecBroadcastOp WordVec 32 W8) = 662-primOpTag (VecBroadcastOp WordVec 16 W16) = 663-primOpTag (VecBroadcastOp WordVec 8 W32) = 664-primOpTag (VecBroadcastOp WordVec 4 W64) = 665-primOpTag (VecBroadcastOp WordVec 64 W8) = 666-primOpTag (VecBroadcastOp WordVec 32 W16) = 667-primOpTag (VecBroadcastOp WordVec 16 W32) = 668-primOpTag (VecBroadcastOp WordVec 8 W64) = 669-primOpTag (VecBroadcastOp FloatVec 4 W32) = 670-primOpTag (VecBroadcastOp FloatVec 2 W64) = 671-primOpTag (VecBroadcastOp FloatVec 8 W32) = 672-primOpTag (VecBroadcastOp FloatVec 4 W64) = 673-primOpTag (VecBroadcastOp FloatVec 16 W32) = 674-primOpTag (VecBroadcastOp FloatVec 8 W64) = 675-primOpTag (VecPackOp IntVec 16 W8) = 676-primOpTag (VecPackOp IntVec 8 W16) = 677-primOpTag (VecPackOp IntVec 4 W32) = 678-primOpTag (VecPackOp IntVec 2 W64) = 679-primOpTag (VecPackOp IntVec 32 W8) = 680-primOpTag (VecPackOp IntVec 16 W16) = 681-primOpTag (VecPackOp IntVec 8 W32) = 682-primOpTag (VecPackOp IntVec 4 W64) = 683-primOpTag (VecPackOp IntVec 64 W8) = 684-primOpTag (VecPackOp IntVec 32 W16) = 685-primOpTag (VecPackOp IntVec 16 W32) = 686-primOpTag (VecPackOp IntVec 8 W64) = 687-primOpTag (VecPackOp WordVec 16 W8) = 688-primOpTag (VecPackOp WordVec 8 W16) = 689-primOpTag (VecPackOp WordVec 4 W32) = 690-primOpTag (VecPackOp WordVec 2 W64) = 691-primOpTag (VecPackOp WordVec 32 W8) = 692-primOpTag (VecPackOp WordVec 16 W16) = 693-primOpTag (VecPackOp WordVec 8 W32) = 694-primOpTag (VecPackOp WordVec 4 W64) = 695-primOpTag (VecPackOp WordVec 64 W8) = 696-primOpTag (VecPackOp WordVec 32 W16) = 697-primOpTag (VecPackOp WordVec 16 W32) = 698-primOpTag (VecPackOp WordVec 8 W64) = 699-primOpTag (VecPackOp FloatVec 4 W32) = 700-primOpTag (VecPackOp FloatVec 2 W64) = 701-primOpTag (VecPackOp FloatVec 8 W32) = 702-primOpTag (VecPackOp FloatVec 4 W64) = 703-primOpTag (VecPackOp FloatVec 16 W32) = 704-primOpTag (VecPackOp FloatVec 8 W64) = 705-primOpTag (VecUnpackOp IntVec 16 W8) = 706-primOpTag (VecUnpackOp IntVec 8 W16) = 707-primOpTag (VecUnpackOp IntVec 4 W32) = 708-primOpTag (VecUnpackOp IntVec 2 W64) = 709-primOpTag (VecUnpackOp IntVec 32 W8) = 710-primOpTag (VecUnpackOp IntVec 16 W16) = 711-primOpTag (VecUnpackOp IntVec 8 W32) = 712-primOpTag (VecUnpackOp IntVec 4 W64) = 713-primOpTag (VecUnpackOp IntVec 64 W8) = 714-primOpTag (VecUnpackOp IntVec 32 W16) = 715-primOpTag (VecUnpackOp IntVec 16 W32) = 716-primOpTag (VecUnpackOp IntVec 8 W64) = 717-primOpTag (VecUnpackOp WordVec 16 W8) = 718-primOpTag (VecUnpackOp WordVec 8 W16) = 719-primOpTag (VecUnpackOp WordVec 4 W32) = 720-primOpTag (VecUnpackOp WordVec 2 W64) = 721-primOpTag (VecUnpackOp WordVec 32 W8) = 722-primOpTag (VecUnpackOp WordVec 16 W16) = 723-primOpTag (VecUnpackOp WordVec 8 W32) = 724-primOpTag (VecUnpackOp WordVec 4 W64) = 725-primOpTag (VecUnpackOp WordVec 64 W8) = 726-primOpTag (VecUnpackOp WordVec 32 W16) = 727-primOpTag (VecUnpackOp WordVec 16 W32) = 728-primOpTag (VecUnpackOp WordVec 8 W64) = 729-primOpTag (VecUnpackOp FloatVec 4 W32) = 730-primOpTag (VecUnpackOp FloatVec 2 W64) = 731-primOpTag (VecUnpackOp FloatVec 8 W32) = 732-primOpTag (VecUnpackOp FloatVec 4 W64) = 733-primOpTag (VecUnpackOp FloatVec 16 W32) = 734-primOpTag (VecUnpackOp FloatVec 8 W64) = 735-primOpTag (VecInsertOp IntVec 16 W8) = 736-primOpTag (VecInsertOp IntVec 8 W16) = 737-primOpTag (VecInsertOp IntVec 4 W32) = 738-primOpTag (VecInsertOp IntVec 2 W64) = 739-primOpTag (VecInsertOp IntVec 32 W8) = 740-primOpTag (VecInsertOp IntVec 16 W16) = 741-primOpTag (VecInsertOp IntVec 8 W32) = 742-primOpTag (VecInsertOp IntVec 4 W64) = 743-primOpTag (VecInsertOp IntVec 64 W8) = 744-primOpTag (VecInsertOp IntVec 32 W16) = 745-primOpTag (VecInsertOp IntVec 16 W32) = 746-primOpTag (VecInsertOp IntVec 8 W64) = 747-primOpTag (VecInsertOp WordVec 16 W8) = 748-primOpTag (VecInsertOp WordVec 8 W16) = 749-primOpTag (VecInsertOp WordVec 4 W32) = 750-primOpTag (VecInsertOp WordVec 2 W64) = 751-primOpTag (VecInsertOp WordVec 32 W8) = 752-primOpTag (VecInsertOp WordVec 16 W16) = 753-primOpTag (VecInsertOp WordVec 8 W32) = 754-primOpTag (VecInsertOp WordVec 4 W64) = 755-primOpTag (VecInsertOp WordVec 64 W8) = 756-primOpTag (VecInsertOp WordVec 32 W16) = 757-primOpTag (VecInsertOp WordVec 16 W32) = 758-primOpTag (VecInsertOp WordVec 8 W64) = 759-primOpTag (VecInsertOp FloatVec 4 W32) = 760-primOpTag (VecInsertOp FloatVec 2 W64) = 761-primOpTag (VecInsertOp FloatVec 8 W32) = 762-primOpTag (VecInsertOp FloatVec 4 W64) = 763-primOpTag (VecInsertOp FloatVec 16 W32) = 764-primOpTag (VecInsertOp FloatVec 8 W64) = 765-primOpTag (VecAddOp IntVec 16 W8) = 766-primOpTag (VecAddOp IntVec 8 W16) = 767-primOpTag (VecAddOp IntVec 4 W32) = 768-primOpTag (VecAddOp IntVec 2 W64) = 769-primOpTag (VecAddOp IntVec 32 W8) = 770-primOpTag (VecAddOp IntVec 16 W16) = 771-primOpTag (VecAddOp IntVec 8 W32) = 772-primOpTag (VecAddOp IntVec 4 W64) = 773-primOpTag (VecAddOp IntVec 64 W8) = 774-primOpTag (VecAddOp IntVec 32 W16) = 775-primOpTag (VecAddOp IntVec 16 W32) = 776-primOpTag (VecAddOp IntVec 8 W64) = 777-primOpTag (VecAddOp WordVec 16 W8) = 778-primOpTag (VecAddOp WordVec 8 W16) = 779-primOpTag (VecAddOp WordVec 4 W32) = 780-primOpTag (VecAddOp WordVec 2 W64) = 781-primOpTag (VecAddOp WordVec 32 W8) = 782-primOpTag (VecAddOp WordVec 16 W16) = 783-primOpTag (VecAddOp WordVec 8 W32) = 784-primOpTag (VecAddOp WordVec 4 W64) = 785-primOpTag (VecAddOp WordVec 64 W8) = 786-primOpTag (VecAddOp WordVec 32 W16) = 787-primOpTag (VecAddOp WordVec 16 W32) = 788-primOpTag (VecAddOp WordVec 8 W64) = 789-primOpTag (VecAddOp FloatVec 4 W32) = 790-primOpTag (VecAddOp FloatVec 2 W64) = 791-primOpTag (VecAddOp FloatVec 8 W32) = 792-primOpTag (VecAddOp FloatVec 4 W64) = 793-primOpTag (VecAddOp FloatVec 16 W32) = 794-primOpTag (VecAddOp FloatVec 8 W64) = 795-primOpTag (VecSubOp IntVec 16 W8) = 796-primOpTag (VecSubOp IntVec 8 W16) = 797-primOpTag (VecSubOp IntVec 4 W32) = 798-primOpTag (VecSubOp IntVec 2 W64) = 799-primOpTag (VecSubOp IntVec 32 W8) = 800-primOpTag (VecSubOp IntVec 16 W16) = 801-primOpTag (VecSubOp IntVec 8 W32) = 802-primOpTag (VecSubOp IntVec 4 W64) = 803-primOpTag (VecSubOp IntVec 64 W8) = 804-primOpTag (VecSubOp IntVec 32 W16) = 805-primOpTag (VecSubOp IntVec 16 W32) = 806-primOpTag (VecSubOp IntVec 8 W64) = 807-primOpTag (VecSubOp WordVec 16 W8) = 808-primOpTag (VecSubOp WordVec 8 W16) = 809-primOpTag (VecSubOp WordVec 4 W32) = 810-primOpTag (VecSubOp WordVec 2 W64) = 811-primOpTag (VecSubOp WordVec 32 W8) = 812-primOpTag (VecSubOp WordVec 16 W16) = 813-primOpTag (VecSubOp WordVec 8 W32) = 814-primOpTag (VecSubOp WordVec 4 W64) = 815-primOpTag (VecSubOp WordVec 64 W8) = 816-primOpTag (VecSubOp WordVec 32 W16) = 817-primOpTag (VecSubOp WordVec 16 W32) = 818-primOpTag (VecSubOp WordVec 8 W64) = 819-primOpTag (VecSubOp FloatVec 4 W32) = 820-primOpTag (VecSubOp FloatVec 2 W64) = 821-primOpTag (VecSubOp FloatVec 8 W32) = 822-primOpTag (VecSubOp FloatVec 4 W64) = 823-primOpTag (VecSubOp FloatVec 16 W32) = 824-primOpTag (VecSubOp FloatVec 8 W64) = 825-primOpTag (VecMulOp IntVec 16 W8) = 826-primOpTag (VecMulOp IntVec 8 W16) = 827-primOpTag (VecMulOp IntVec 4 W32) = 828-primOpTag (VecMulOp IntVec 2 W64) = 829-primOpTag (VecMulOp IntVec 32 W8) = 830-primOpTag (VecMulOp IntVec 16 W16) = 831-primOpTag (VecMulOp IntVec 8 W32) = 832-primOpTag (VecMulOp IntVec 4 W64) = 833-primOpTag (VecMulOp IntVec 64 W8) = 834-primOpTag (VecMulOp IntVec 32 W16) = 835-primOpTag (VecMulOp IntVec 16 W32) = 836-primOpTag (VecMulOp IntVec 8 W64) = 837-primOpTag (VecMulOp WordVec 16 W8) = 838-primOpTag (VecMulOp WordVec 8 W16) = 839-primOpTag (VecMulOp WordVec 4 W32) = 840-primOpTag (VecMulOp WordVec 2 W64) = 841-primOpTag (VecMulOp WordVec 32 W8) = 842-primOpTag (VecMulOp WordVec 16 W16) = 843-primOpTag (VecMulOp WordVec 8 W32) = 844-primOpTag (VecMulOp WordVec 4 W64) = 845-primOpTag (VecMulOp WordVec 64 W8) = 846-primOpTag (VecMulOp WordVec 32 W16) = 847-primOpTag (VecMulOp WordVec 16 W32) = 848-primOpTag (VecMulOp WordVec 8 W64) = 849-primOpTag (VecMulOp FloatVec 4 W32) = 850-primOpTag (VecMulOp FloatVec 2 W64) = 851-primOpTag (VecMulOp FloatVec 8 W32) = 852-primOpTag (VecMulOp FloatVec 4 W64) = 853-primOpTag (VecMulOp FloatVec 16 W32) = 854-primOpTag (VecMulOp FloatVec 8 W64) = 855-primOpTag (VecDivOp FloatVec 4 W32) = 856-primOpTag (VecDivOp FloatVec 2 W64) = 857-primOpTag (VecDivOp FloatVec 8 W32) = 858-primOpTag (VecDivOp FloatVec 4 W64) = 859-primOpTag (VecDivOp FloatVec 16 W32) = 860-primOpTag (VecDivOp FloatVec 8 W64) = 861-primOpTag (VecQuotOp IntVec 16 W8) = 862-primOpTag (VecQuotOp IntVec 8 W16) = 863-primOpTag (VecQuotOp IntVec 4 W32) = 864-primOpTag (VecQuotOp IntVec 2 W64) = 865-primOpTag (VecQuotOp IntVec 32 W8) = 866-primOpTag (VecQuotOp IntVec 16 W16) = 867-primOpTag (VecQuotOp IntVec 8 W32) = 868-primOpTag (VecQuotOp IntVec 4 W64) = 869-primOpTag (VecQuotOp IntVec 64 W8) = 870-primOpTag (VecQuotOp IntVec 32 W16) = 871-primOpTag (VecQuotOp IntVec 16 W32) = 872-primOpTag (VecQuotOp IntVec 8 W64) = 873-primOpTag (VecQuotOp WordVec 16 W8) = 874-primOpTag (VecQuotOp WordVec 8 W16) = 875-primOpTag (VecQuotOp WordVec 4 W32) = 876-primOpTag (VecQuotOp WordVec 2 W64) = 877-primOpTag (VecQuotOp WordVec 32 W8) = 878-primOpTag (VecQuotOp WordVec 16 W16) = 879-primOpTag (VecQuotOp WordVec 8 W32) = 880-primOpTag (VecQuotOp WordVec 4 W64) = 881-primOpTag (VecQuotOp WordVec 64 W8) = 882-primOpTag (VecQuotOp WordVec 32 W16) = 883-primOpTag (VecQuotOp WordVec 16 W32) = 884-primOpTag (VecQuotOp WordVec 8 W64) = 885-primOpTag (VecRemOp IntVec 16 W8) = 886-primOpTag (VecRemOp IntVec 8 W16) = 887-primOpTag (VecRemOp IntVec 4 W32) = 888-primOpTag (VecRemOp IntVec 2 W64) = 889-primOpTag (VecRemOp IntVec 32 W8) = 890-primOpTag (VecRemOp IntVec 16 W16) = 891-primOpTag (VecRemOp IntVec 8 W32) = 892-primOpTag (VecRemOp IntVec 4 W64) = 893-primOpTag (VecRemOp IntVec 64 W8) = 894-primOpTag (VecRemOp IntVec 32 W16) = 895-primOpTag (VecRemOp IntVec 16 W32) = 896-primOpTag (VecRemOp IntVec 8 W64) = 897-primOpTag (VecRemOp WordVec 16 W8) = 898-primOpTag (VecRemOp WordVec 8 W16) = 899-primOpTag (VecRemOp WordVec 4 W32) = 900-primOpTag (VecRemOp WordVec 2 W64) = 901-primOpTag (VecRemOp WordVec 32 W8) = 902-primOpTag (VecRemOp WordVec 16 W16) = 903-primOpTag (VecRemOp WordVec 8 W32) = 904-primOpTag (VecRemOp WordVec 4 W64) = 905-primOpTag (VecRemOp WordVec 64 W8) = 906-primOpTag (VecRemOp WordVec 32 W16) = 907-primOpTag (VecRemOp WordVec 16 W32) = 908-primOpTag (VecRemOp WordVec 8 W64) = 909-primOpTag (VecNegOp IntVec 16 W8) = 910-primOpTag (VecNegOp IntVec 8 W16) = 911-primOpTag (VecNegOp IntVec 4 W32) = 912-primOpTag (VecNegOp IntVec 2 W64) = 913-primOpTag (VecNegOp IntVec 32 W8) = 914-primOpTag (VecNegOp IntVec 16 W16) = 915-primOpTag (VecNegOp IntVec 8 W32) = 916-primOpTag (VecNegOp IntVec 4 W64) = 917-primOpTag (VecNegOp IntVec 64 W8) = 918-primOpTag (VecNegOp IntVec 32 W16) = 919-primOpTag (VecNegOp IntVec 16 W32) = 920-primOpTag (VecNegOp IntVec 8 W64) = 921-primOpTag (VecNegOp FloatVec 4 W32) = 922-primOpTag (VecNegOp FloatVec 2 W64) = 923-primOpTag (VecNegOp FloatVec 8 W32) = 924-primOpTag (VecNegOp FloatVec 4 W64) = 925-primOpTag (VecNegOp FloatVec 16 W32) = 926-primOpTag (VecNegOp FloatVec 8 W64) = 927-primOpTag (VecIndexByteArrayOp IntVec 16 W8) = 928-primOpTag (VecIndexByteArrayOp IntVec 8 W16) = 929-primOpTag (VecIndexByteArrayOp IntVec 4 W32) = 930-primOpTag (VecIndexByteArrayOp IntVec 2 W64) = 931-primOpTag (VecIndexByteArrayOp IntVec 32 W8) = 932-primOpTag (VecIndexByteArrayOp IntVec 16 W16) = 933-primOpTag (VecIndexByteArrayOp IntVec 8 W32) = 934-primOpTag (VecIndexByteArrayOp IntVec 4 W64) = 935-primOpTag (VecIndexByteArrayOp IntVec 64 W8) = 936-primOpTag (VecIndexByteArrayOp IntVec 32 W16) = 937-primOpTag (VecIndexByteArrayOp IntVec 16 W32) = 938-primOpTag (VecIndexByteArrayOp IntVec 8 W64) = 939-primOpTag (VecIndexByteArrayOp WordVec 16 W8) = 940-primOpTag (VecIndexByteArrayOp WordVec 8 W16) = 941-primOpTag (VecIndexByteArrayOp WordVec 4 W32) = 942-primOpTag (VecIndexByteArrayOp WordVec 2 W64) = 943-primOpTag (VecIndexByteArrayOp WordVec 32 W8) = 944-primOpTag (VecIndexByteArrayOp WordVec 16 W16) = 945-primOpTag (VecIndexByteArrayOp WordVec 8 W32) = 946-primOpTag (VecIndexByteArrayOp WordVec 4 W64) = 947-primOpTag (VecIndexByteArrayOp WordVec 64 W8) = 948-primOpTag (VecIndexByteArrayOp WordVec 32 W16) = 949-primOpTag (VecIndexByteArrayOp WordVec 16 W32) = 950-primOpTag (VecIndexByteArrayOp WordVec 8 W64) = 951-primOpTag (VecIndexByteArrayOp FloatVec 4 W32) = 952-primOpTag (VecIndexByteArrayOp FloatVec 2 W64) = 953-primOpTag (VecIndexByteArrayOp FloatVec 8 W32) = 954-primOpTag (VecIndexByteArrayOp FloatVec 4 W64) = 955-primOpTag (VecIndexByteArrayOp FloatVec 16 W32) = 956-primOpTag (VecIndexByteArrayOp FloatVec 8 W64) = 957-primOpTag (VecReadByteArrayOp IntVec 16 W8) = 958-primOpTag (VecReadByteArrayOp IntVec 8 W16) = 959-primOpTag (VecReadByteArrayOp IntVec 4 W32) = 960-primOpTag (VecReadByteArrayOp IntVec 2 W64) = 961-primOpTag (VecReadByteArrayOp IntVec 32 W8) = 962-primOpTag (VecReadByteArrayOp IntVec 16 W16) = 963-primOpTag (VecReadByteArrayOp IntVec 8 W32) = 964-primOpTag (VecReadByteArrayOp IntVec 4 W64) = 965-primOpTag (VecReadByteArrayOp IntVec 64 W8) = 966-primOpTag (VecReadByteArrayOp IntVec 32 W16) = 967-primOpTag (VecReadByteArrayOp IntVec 16 W32) = 968-primOpTag (VecReadByteArrayOp IntVec 8 W64) = 969-primOpTag (VecReadByteArrayOp WordVec 16 W8) = 970-primOpTag (VecReadByteArrayOp WordVec 8 W16) = 971-primOpTag (VecReadByteArrayOp WordVec 4 W32) = 972-primOpTag (VecReadByteArrayOp WordVec 2 W64) = 973-primOpTag (VecReadByteArrayOp WordVec 32 W8) = 974-primOpTag (VecReadByteArrayOp WordVec 16 W16) = 975-primOpTag (VecReadByteArrayOp WordVec 8 W32) = 976-primOpTag (VecReadByteArrayOp WordVec 4 W64) = 977-primOpTag (VecReadByteArrayOp WordVec 64 W8) = 978-primOpTag (VecReadByteArrayOp WordVec 32 W16) = 979-primOpTag (VecReadByteArrayOp WordVec 16 W32) = 980-primOpTag (VecReadByteArrayOp WordVec 8 W64) = 981-primOpTag (VecReadByteArrayOp FloatVec 4 W32) = 982-primOpTag (VecReadByteArrayOp FloatVec 2 W64) = 983-primOpTag (VecReadByteArrayOp FloatVec 8 W32) = 984-primOpTag (VecReadByteArrayOp FloatVec 4 W64) = 985-primOpTag (VecReadByteArrayOp FloatVec 16 W32) = 986-primOpTag (VecReadByteArrayOp FloatVec 8 W64) = 987-primOpTag (VecWriteByteArrayOp IntVec 16 W8) = 988-primOpTag (VecWriteByteArrayOp IntVec 8 W16) = 989-primOpTag (VecWriteByteArrayOp IntVec 4 W32) = 990-primOpTag (VecWriteByteArrayOp IntVec 2 W64) = 991-primOpTag (VecWriteByteArrayOp IntVec 32 W8) = 992-primOpTag (VecWriteByteArrayOp IntVec 16 W16) = 993-primOpTag (VecWriteByteArrayOp IntVec 8 W32) = 994-primOpTag (VecWriteByteArrayOp IntVec 4 W64) = 995-primOpTag (VecWriteByteArrayOp IntVec 64 W8) = 996-primOpTag (VecWriteByteArrayOp IntVec 32 W16) = 997-primOpTag (VecWriteByteArrayOp IntVec 16 W32) = 998-primOpTag (VecWriteByteArrayOp IntVec 8 W64) = 999-primOpTag (VecWriteByteArrayOp WordVec 16 W8) = 1000-primOpTag (VecWriteByteArrayOp WordVec 8 W16) = 1001-primOpTag (VecWriteByteArrayOp WordVec 4 W32) = 1002-primOpTag (VecWriteByteArrayOp WordVec 2 W64) = 1003-primOpTag (VecWriteByteArrayOp WordVec 32 W8) = 1004-primOpTag (VecWriteByteArrayOp WordVec 16 W16) = 1005-primOpTag (VecWriteByteArrayOp WordVec 8 W32) = 1006-primOpTag (VecWriteByteArrayOp WordVec 4 W64) = 1007-primOpTag (VecWriteByteArrayOp WordVec 64 W8) = 1008-primOpTag (VecWriteByteArrayOp WordVec 32 W16) = 1009-primOpTag (VecWriteByteArrayOp WordVec 16 W32) = 1010-primOpTag (VecWriteByteArrayOp WordVec 8 W64) = 1011-primOpTag (VecWriteByteArrayOp FloatVec 4 W32) = 1012-primOpTag (VecWriteByteArrayOp FloatVec 2 W64) = 1013-primOpTag (VecWriteByteArrayOp FloatVec 8 W32) = 1014-primOpTag (VecWriteByteArrayOp FloatVec 4 W64) = 1015-primOpTag (VecWriteByteArrayOp FloatVec 16 W32) = 1016-primOpTag (VecWriteByteArrayOp FloatVec 8 W64) = 1017-primOpTag (VecIndexOffAddrOp IntVec 16 W8) = 1018-primOpTag (VecIndexOffAddrOp IntVec 8 W16) = 1019-primOpTag (VecIndexOffAddrOp IntVec 4 W32) = 1020-primOpTag (VecIndexOffAddrOp IntVec 2 W64) = 1021-primOpTag (VecIndexOffAddrOp IntVec 32 W8) = 1022-primOpTag (VecIndexOffAddrOp IntVec 16 W16) = 1023-primOpTag (VecIndexOffAddrOp IntVec 8 W32) = 1024-primOpTag (VecIndexOffAddrOp IntVec 4 W64) = 1025-primOpTag (VecIndexOffAddrOp IntVec 64 W8) = 1026-primOpTag (VecIndexOffAddrOp IntVec 32 W16) = 1027-primOpTag (VecIndexOffAddrOp IntVec 16 W32) = 1028-primOpTag (VecIndexOffAddrOp IntVec 8 W64) = 1029-primOpTag (VecIndexOffAddrOp WordVec 16 W8) = 1030-primOpTag (VecIndexOffAddrOp WordVec 8 W16) = 1031-primOpTag (VecIndexOffAddrOp WordVec 4 W32) = 1032-primOpTag (VecIndexOffAddrOp WordVec 2 W64) = 1033-primOpTag (VecIndexOffAddrOp WordVec 32 W8) = 1034-primOpTag (VecIndexOffAddrOp WordVec 16 W16) = 1035-primOpTag (VecIndexOffAddrOp WordVec 8 W32) = 1036-primOpTag (VecIndexOffAddrOp WordVec 4 W64) = 1037-primOpTag (VecIndexOffAddrOp WordVec 64 W8) = 1038-primOpTag (VecIndexOffAddrOp WordVec 32 W16) = 1039-primOpTag (VecIndexOffAddrOp WordVec 16 W32) = 1040-primOpTag (VecIndexOffAddrOp WordVec 8 W64) = 1041-primOpTag (VecIndexOffAddrOp FloatVec 4 W32) = 1042-primOpTag (VecIndexOffAddrOp FloatVec 2 W64) = 1043-primOpTag (VecIndexOffAddrOp FloatVec 8 W32) = 1044-primOpTag (VecIndexOffAddrOp FloatVec 4 W64) = 1045-primOpTag (VecIndexOffAddrOp FloatVec 16 W32) = 1046-primOpTag (VecIndexOffAddrOp FloatVec 8 W64) = 1047-primOpTag (VecReadOffAddrOp IntVec 16 W8) = 1048-primOpTag (VecReadOffAddrOp IntVec 8 W16) = 1049-primOpTag (VecReadOffAddrOp IntVec 4 W32) = 1050-primOpTag (VecReadOffAddrOp IntVec 2 W64) = 1051-primOpTag (VecReadOffAddrOp IntVec 32 W8) = 1052-primOpTag (VecReadOffAddrOp IntVec 16 W16) = 1053-primOpTag (VecReadOffAddrOp IntVec 8 W32) = 1054-primOpTag (VecReadOffAddrOp IntVec 4 W64) = 1055-primOpTag (VecReadOffAddrOp IntVec 64 W8) = 1056-primOpTag (VecReadOffAddrOp IntVec 32 W16) = 1057-primOpTag (VecReadOffAddrOp IntVec 16 W32) = 1058-primOpTag (VecReadOffAddrOp IntVec 8 W64) = 1059-primOpTag (VecReadOffAddrOp WordVec 16 W8) = 1060-primOpTag (VecReadOffAddrOp WordVec 8 W16) = 1061-primOpTag (VecReadOffAddrOp WordVec 4 W32) = 1062-primOpTag (VecReadOffAddrOp WordVec 2 W64) = 1063-primOpTag (VecReadOffAddrOp WordVec 32 W8) = 1064-primOpTag (VecReadOffAddrOp WordVec 16 W16) = 1065-primOpTag (VecReadOffAddrOp WordVec 8 W32) = 1066-primOpTag (VecReadOffAddrOp WordVec 4 W64) = 1067-primOpTag (VecReadOffAddrOp WordVec 64 W8) = 1068-primOpTag (VecReadOffAddrOp WordVec 32 W16) = 1069-primOpTag (VecReadOffAddrOp WordVec 16 W32) = 1070-primOpTag (VecReadOffAddrOp WordVec 8 W64) = 1071-primOpTag (VecReadOffAddrOp FloatVec 4 W32) = 1072-primOpTag (VecReadOffAddrOp FloatVec 2 W64) = 1073-primOpTag (VecReadOffAddrOp FloatVec 8 W32) = 1074-primOpTag (VecReadOffAddrOp FloatVec 4 W64) = 1075-primOpTag (VecReadOffAddrOp FloatVec 16 W32) = 1076-primOpTag (VecReadOffAddrOp FloatVec 8 W64) = 1077-primOpTag (VecWriteOffAddrOp IntVec 16 W8) = 1078-primOpTag (VecWriteOffAddrOp IntVec 8 W16) = 1079-primOpTag (VecWriteOffAddrOp IntVec 4 W32) = 1080-primOpTag (VecWriteOffAddrOp IntVec 2 W64) = 1081-primOpTag (VecWriteOffAddrOp IntVec 32 W8) = 1082-primOpTag (VecWriteOffAddrOp IntVec 16 W16) = 1083-primOpTag (VecWriteOffAddrOp IntVec 8 W32) = 1084-primOpTag (VecWriteOffAddrOp IntVec 4 W64) = 1085-primOpTag (VecWriteOffAddrOp IntVec 64 W8) = 1086-primOpTag (VecWriteOffAddrOp IntVec 32 W16) = 1087-primOpTag (VecWriteOffAddrOp IntVec 16 W32) = 1088-primOpTag (VecWriteOffAddrOp IntVec 8 W64) = 1089-primOpTag (VecWriteOffAddrOp WordVec 16 W8) = 1090-primOpTag (VecWriteOffAddrOp WordVec 8 W16) = 1091-primOpTag (VecWriteOffAddrOp WordVec 4 W32) = 1092-primOpTag (VecWriteOffAddrOp WordVec 2 W64) = 1093-primOpTag (VecWriteOffAddrOp WordVec 32 W8) = 1094-primOpTag (VecWriteOffAddrOp WordVec 16 W16) = 1095-primOpTag (VecWriteOffAddrOp WordVec 8 W32) = 1096-primOpTag (VecWriteOffAddrOp WordVec 4 W64) = 1097-primOpTag (VecWriteOffAddrOp WordVec 64 W8) = 1098-primOpTag (VecWriteOffAddrOp WordVec 32 W16) = 1099-primOpTag (VecWriteOffAddrOp WordVec 16 W32) = 1100-primOpTag (VecWriteOffAddrOp WordVec 8 W64) = 1101-primOpTag (VecWriteOffAddrOp FloatVec 4 W32) = 1102-primOpTag (VecWriteOffAddrOp FloatVec 2 W64) = 1103-primOpTag (VecWriteOffAddrOp FloatVec 8 W32) = 1104-primOpTag (VecWriteOffAddrOp FloatVec 4 W64) = 1105-primOpTag (VecWriteOffAddrOp FloatVec 16 W32) = 1106-primOpTag (VecWriteOffAddrOp FloatVec 8 W64) = 1107-primOpTag (VecIndexScalarByteArrayOp IntVec 16 W8) = 1108-primOpTag (VecIndexScalarByteArrayOp IntVec 8 W16) = 1109-primOpTag (VecIndexScalarByteArrayOp IntVec 4 W32) = 1110-primOpTag (VecIndexScalarByteArrayOp IntVec 2 W64) = 1111-primOpTag (VecIndexScalarByteArrayOp IntVec 32 W8) = 1112-primOpTag (VecIndexScalarByteArrayOp IntVec 16 W16) = 1113-primOpTag (VecIndexScalarByteArrayOp IntVec 8 W32) = 1114-primOpTag (VecIndexScalarByteArrayOp IntVec 4 W64) = 1115-primOpTag (VecIndexScalarByteArrayOp IntVec 64 W8) = 1116-primOpTag (VecIndexScalarByteArrayOp IntVec 32 W16) = 1117-primOpTag (VecIndexScalarByteArrayOp IntVec 16 W32) = 1118-primOpTag (VecIndexScalarByteArrayOp IntVec 8 W64) = 1119-primOpTag (VecIndexScalarByteArrayOp WordVec 16 W8) = 1120-primOpTag (VecIndexScalarByteArrayOp WordVec 8 W16) = 1121-primOpTag (VecIndexScalarByteArrayOp WordVec 4 W32) = 1122-primOpTag (VecIndexScalarByteArrayOp WordVec 2 W64) = 1123-primOpTag (VecIndexScalarByteArrayOp WordVec 32 W8) = 1124-primOpTag (VecIndexScalarByteArrayOp WordVec 16 W16) = 1125-primOpTag (VecIndexScalarByteArrayOp WordVec 8 W32) = 1126-primOpTag (VecIndexScalarByteArrayOp WordVec 4 W64) = 1127-primOpTag (VecIndexScalarByteArrayOp WordVec 64 W8) = 1128-primOpTag (VecIndexScalarByteArrayOp WordVec 32 W16) = 1129-primOpTag (VecIndexScalarByteArrayOp WordVec 16 W32) = 1130-primOpTag (VecIndexScalarByteArrayOp WordVec 8 W64) = 1131-primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W32) = 1132-primOpTag (VecIndexScalarByteArrayOp FloatVec 2 W64) = 1133-primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W32) = 1134-primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W64) = 1135-primOpTag (VecIndexScalarByteArrayOp FloatVec 16 W32) = 1136-primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W64) = 1137-primOpTag (VecReadScalarByteArrayOp IntVec 16 W8) = 1138-primOpTag (VecReadScalarByteArrayOp IntVec 8 W16) = 1139-primOpTag (VecReadScalarByteArrayOp IntVec 4 W32) = 1140-primOpTag (VecReadScalarByteArrayOp IntVec 2 W64) = 1141-primOpTag (VecReadScalarByteArrayOp IntVec 32 W8) = 1142-primOpTag (VecReadScalarByteArrayOp IntVec 16 W16) = 1143-primOpTag (VecReadScalarByteArrayOp IntVec 8 W32) = 1144-primOpTag (VecReadScalarByteArrayOp IntVec 4 W64) = 1145-primOpTag (VecReadScalarByteArrayOp IntVec 64 W8) = 1146-primOpTag (VecReadScalarByteArrayOp IntVec 32 W16) = 1147-primOpTag (VecReadScalarByteArrayOp IntVec 16 W32) = 1148-primOpTag (VecReadScalarByteArrayOp IntVec 8 W64) = 1149-primOpTag (VecReadScalarByteArrayOp WordVec 16 W8) = 1150-primOpTag (VecReadScalarByteArrayOp WordVec 8 W16) = 1151-primOpTag (VecReadScalarByteArrayOp WordVec 4 W32) = 1152-primOpTag (VecReadScalarByteArrayOp WordVec 2 W64) = 1153-primOpTag (VecReadScalarByteArrayOp WordVec 32 W8) = 1154-primOpTag (VecReadScalarByteArrayOp WordVec 16 W16) = 1155-primOpTag (VecReadScalarByteArrayOp WordVec 8 W32) = 1156-primOpTag (VecReadScalarByteArrayOp WordVec 4 W64) = 1157-primOpTag (VecReadScalarByteArrayOp WordVec 64 W8) = 1158-primOpTag (VecReadScalarByteArrayOp WordVec 32 W16) = 1159-primOpTag (VecReadScalarByteArrayOp WordVec 16 W32) = 1160-primOpTag (VecReadScalarByteArrayOp WordVec 8 W64) = 1161-primOpTag (VecReadScalarByteArrayOp FloatVec 4 W32) = 1162-primOpTag (VecReadScalarByteArrayOp FloatVec 2 W64) = 1163-primOpTag (VecReadScalarByteArrayOp FloatVec 8 W32) = 1164-primOpTag (VecReadScalarByteArrayOp FloatVec 4 W64) = 1165-primOpTag (VecReadScalarByteArrayOp FloatVec 16 W32) = 1166-primOpTag (VecReadScalarByteArrayOp FloatVec 8 W64) = 1167-primOpTag (VecWriteScalarByteArrayOp IntVec 16 W8) = 1168-primOpTag (VecWriteScalarByteArrayOp IntVec 8 W16) = 1169-primOpTag (VecWriteScalarByteArrayOp IntVec 4 W32) = 1170-primOpTag (VecWriteScalarByteArrayOp IntVec 2 W64) = 1171-primOpTag (VecWriteScalarByteArrayOp IntVec 32 W8) = 1172-primOpTag (VecWriteScalarByteArrayOp IntVec 16 W16) = 1173-primOpTag (VecWriteScalarByteArrayOp IntVec 8 W32) = 1174-primOpTag (VecWriteScalarByteArrayOp IntVec 4 W64) = 1175-primOpTag (VecWriteScalarByteArrayOp IntVec 64 W8) = 1176-primOpTag (VecWriteScalarByteArrayOp IntVec 32 W16) = 1177-primOpTag (VecWriteScalarByteArrayOp IntVec 16 W32) = 1178-primOpTag (VecWriteScalarByteArrayOp IntVec 8 W64) = 1179-primOpTag (VecWriteScalarByteArrayOp WordVec 16 W8) = 1180-primOpTag (VecWriteScalarByteArrayOp WordVec 8 W16) = 1181-primOpTag (VecWriteScalarByteArrayOp WordVec 4 W32) = 1182-primOpTag (VecWriteScalarByteArrayOp WordVec 2 W64) = 1183-primOpTag (VecWriteScalarByteArrayOp WordVec 32 W8) = 1184-primOpTag (VecWriteScalarByteArrayOp WordVec 16 W16) = 1185-primOpTag (VecWriteScalarByteArrayOp WordVec 8 W32) = 1186-primOpTag (VecWriteScalarByteArrayOp WordVec 4 W64) = 1187-primOpTag (VecWriteScalarByteArrayOp WordVec 64 W8) = 1188-primOpTag (VecWriteScalarByteArrayOp WordVec 32 W16) = 1189-primOpTag (VecWriteScalarByteArrayOp WordVec 16 W32) = 1190-primOpTag (VecWriteScalarByteArrayOp WordVec 8 W64) = 1191-primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W32) = 1192-primOpTag (VecWriteScalarByteArrayOp FloatVec 2 W64) = 1193-primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W32) = 1194-primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W64) = 1195-primOpTag (VecWriteScalarByteArrayOp FloatVec 16 W32) = 1196-primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W64) = 1197-primOpTag (VecIndexScalarOffAddrOp IntVec 16 W8) = 1198-primOpTag (VecIndexScalarOffAddrOp IntVec 8 W16) = 1199-primOpTag (VecIndexScalarOffAddrOp IntVec 4 W32) = 1200-primOpTag (VecIndexScalarOffAddrOp IntVec 2 W64) = 1201-primOpTag (VecIndexScalarOffAddrOp IntVec 32 W8) = 1202-primOpTag (VecIndexScalarOffAddrOp IntVec 16 W16) = 1203-primOpTag (VecIndexScalarOffAddrOp IntVec 8 W32) = 1204-primOpTag (VecIndexScalarOffAddrOp IntVec 4 W64) = 1205-primOpTag (VecIndexScalarOffAddrOp IntVec 64 W8) = 1206-primOpTag (VecIndexScalarOffAddrOp IntVec 32 W16) = 1207-primOpTag (VecIndexScalarOffAddrOp IntVec 16 W32) = 1208-primOpTag (VecIndexScalarOffAddrOp IntVec 8 W64) = 1209-primOpTag (VecIndexScalarOffAddrOp WordVec 16 W8) = 1210-primOpTag (VecIndexScalarOffAddrOp WordVec 8 W16) = 1211-primOpTag (VecIndexScalarOffAddrOp WordVec 4 W32) = 1212-primOpTag (VecIndexScalarOffAddrOp WordVec 2 W64) = 1213-primOpTag (VecIndexScalarOffAddrOp WordVec 32 W8) = 1214-primOpTag (VecIndexScalarOffAddrOp WordVec 16 W16) = 1215-primOpTag (VecIndexScalarOffAddrOp WordVec 8 W32) = 1216-primOpTag (VecIndexScalarOffAddrOp WordVec 4 W64) = 1217-primOpTag (VecIndexScalarOffAddrOp WordVec 64 W8) = 1218-primOpTag (VecIndexScalarOffAddrOp WordVec 32 W16) = 1219-primOpTag (VecIndexScalarOffAddrOp WordVec 16 W32) = 1220-primOpTag (VecIndexScalarOffAddrOp WordVec 8 W64) = 1221-primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W32) = 1222-primOpTag (VecIndexScalarOffAddrOp FloatVec 2 W64) = 1223-primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W32) = 1224-primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W64) = 1225-primOpTag (VecIndexScalarOffAddrOp FloatVec 16 W32) = 1226-primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W64) = 1227-primOpTag (VecReadScalarOffAddrOp IntVec 16 W8) = 1228-primOpTag (VecReadScalarOffAddrOp IntVec 8 W16) = 1229-primOpTag (VecReadScalarOffAddrOp IntVec 4 W32) = 1230-primOpTag (VecReadScalarOffAddrOp IntVec 2 W64) = 1231-primOpTag (VecReadScalarOffAddrOp IntVec 32 W8) = 1232-primOpTag (VecReadScalarOffAddrOp IntVec 16 W16) = 1233-primOpTag (VecReadScalarOffAddrOp IntVec 8 W32) = 1234-primOpTag (VecReadScalarOffAddrOp IntVec 4 W64) = 1235-primOpTag (VecReadScalarOffAddrOp IntVec 64 W8) = 1236-primOpTag (VecReadScalarOffAddrOp IntVec 32 W16) = 1237-primOpTag (VecReadScalarOffAddrOp IntVec 16 W32) = 1238-primOpTag (VecReadScalarOffAddrOp IntVec 8 W64) = 1239-primOpTag (VecReadScalarOffAddrOp WordVec 16 W8) = 1240-primOpTag (VecReadScalarOffAddrOp WordVec 8 W16) = 1241-primOpTag (VecReadScalarOffAddrOp WordVec 4 W32) = 1242-primOpTag (VecReadScalarOffAddrOp WordVec 2 W64) = 1243-primOpTag (VecReadScalarOffAddrOp WordVec 32 W8) = 1244-primOpTag (VecReadScalarOffAddrOp WordVec 16 W16) = 1245-primOpTag (VecReadScalarOffAddrOp WordVec 8 W32) = 1246-primOpTag (VecReadScalarOffAddrOp WordVec 4 W64) = 1247-primOpTag (VecReadScalarOffAddrOp WordVec 64 W8) = 1248-primOpTag (VecReadScalarOffAddrOp WordVec 32 W16) = 1249-primOpTag (VecReadScalarOffAddrOp WordVec 16 W32) = 1250-primOpTag (VecReadScalarOffAddrOp WordVec 8 W64) = 1251-primOpTag (VecReadScalarOffAddrOp FloatVec 4 W32) = 1252-primOpTag (VecReadScalarOffAddrOp FloatVec 2 W64) = 1253-primOpTag (VecReadScalarOffAddrOp FloatVec 8 W32) = 1254-primOpTag (VecReadScalarOffAddrOp FloatVec 4 W64) = 1255-primOpTag (VecReadScalarOffAddrOp FloatVec 16 W32) = 1256-primOpTag (VecReadScalarOffAddrOp FloatVec 8 W64) = 1257-primOpTag (VecWriteScalarOffAddrOp IntVec 16 W8) = 1258-primOpTag (VecWriteScalarOffAddrOp IntVec 8 W16) = 1259-primOpTag (VecWriteScalarOffAddrOp IntVec 4 W32) = 1260-primOpTag (VecWriteScalarOffAddrOp IntVec 2 W64) = 1261-primOpTag (VecWriteScalarOffAddrOp IntVec 32 W8) = 1262-primOpTag (VecWriteScalarOffAddrOp IntVec 16 W16) = 1263-primOpTag (VecWriteScalarOffAddrOp IntVec 8 W32) = 1264-primOpTag (VecWriteScalarOffAddrOp IntVec 4 W64) = 1265-primOpTag (VecWriteScalarOffAddrOp IntVec 64 W8) = 1266-primOpTag (VecWriteScalarOffAddrOp IntVec 32 W16) = 1267-primOpTag (VecWriteScalarOffAddrOp IntVec 16 W32) = 1268-primOpTag (VecWriteScalarOffAddrOp IntVec 8 W64) = 1269-primOpTag (VecWriteScalarOffAddrOp WordVec 16 W8) = 1270-primOpTag (VecWriteScalarOffAddrOp WordVec 8 W16) = 1271-primOpTag (VecWriteScalarOffAddrOp WordVec 4 W32) = 1272-primOpTag (VecWriteScalarOffAddrOp WordVec 2 W64) = 1273-primOpTag (VecWriteScalarOffAddrOp WordVec 32 W8) = 1274-primOpTag (VecWriteScalarOffAddrOp WordVec 16 W16) = 1275-primOpTag (VecWriteScalarOffAddrOp WordVec 8 W32) = 1276-primOpTag (VecWriteScalarOffAddrOp WordVec 4 W64) = 1277-primOpTag (VecWriteScalarOffAddrOp WordVec 64 W8) = 1278-primOpTag (VecWriteScalarOffAddrOp WordVec 32 W16) = 1279-primOpTag (VecWriteScalarOffAddrOp WordVec 16 W32) = 1280-primOpTag (VecWriteScalarOffAddrOp WordVec 8 W64) = 1281-primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W32) = 1282-primOpTag (VecWriteScalarOffAddrOp FloatVec 2 W64) = 1283-primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W32) = 1284-primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W64) = 1285-primOpTag (VecWriteScalarOffAddrOp FloatVec 16 W32) = 1286-primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W64) = 1287-primOpTag PrefetchByteArrayOp3 = 1288-primOpTag PrefetchMutableByteArrayOp3 = 1289-primOpTag PrefetchAddrOp3 = 1290-primOpTag PrefetchValueOp3 = 1291-primOpTag PrefetchByteArrayOp2 = 1292-primOpTag PrefetchMutableByteArrayOp2 = 1293-primOpTag PrefetchAddrOp2 = 1294-primOpTag PrefetchValueOp2 = 1295-primOpTag PrefetchByteArrayOp1 = 1296-primOpTag PrefetchMutableByteArrayOp1 = 1297-primOpTag PrefetchAddrOp1 = 1298-primOpTag PrefetchValueOp1 = 1299-primOpTag PrefetchByteArrayOp0 = 1300-primOpTag PrefetchMutableByteArrayOp0 = 1301-primOpTag PrefetchAddrOp0 = 1302-primOpTag PrefetchValueOp0 = 1303+maxPrimOpTag = 1305+primOpTag :: PrimOp -> Int+primOpTag CharGtOp = 0+primOpTag CharGeOp = 1+primOpTag CharEqOp = 2+primOpTag CharNeOp = 3+primOpTag CharLtOp = 4+primOpTag CharLeOp = 5+primOpTag OrdOp = 6+primOpTag Int8ToIntOp = 7+primOpTag IntToInt8Op = 8+primOpTag Int8NegOp = 9+primOpTag Int8AddOp = 10+primOpTag Int8SubOp = 11+primOpTag Int8MulOp = 12+primOpTag Int8QuotOp = 13+primOpTag Int8RemOp = 14+primOpTag Int8QuotRemOp = 15+primOpTag Int8SllOp = 16+primOpTag Int8SraOp = 17+primOpTag Int8SrlOp = 18+primOpTag Int8ToWord8Op = 19+primOpTag Int8EqOp = 20+primOpTag Int8GeOp = 21+primOpTag Int8GtOp = 22+primOpTag Int8LeOp = 23+primOpTag Int8LtOp = 24+primOpTag Int8NeOp = 25+primOpTag Word8ToWordOp = 26+primOpTag WordToWord8Op = 27+primOpTag Word8AddOp = 28+primOpTag Word8SubOp = 29+primOpTag Word8MulOp = 30+primOpTag Word8QuotOp = 31+primOpTag Word8RemOp = 32+primOpTag Word8QuotRemOp = 33+primOpTag Word8AndOp = 34+primOpTag Word8OrOp = 35+primOpTag Word8XorOp = 36+primOpTag Word8NotOp = 37+primOpTag Word8SllOp = 38+primOpTag Word8SrlOp = 39+primOpTag Word8ToInt8Op = 40+primOpTag Word8EqOp = 41+primOpTag Word8GeOp = 42+primOpTag Word8GtOp = 43+primOpTag Word8LeOp = 44+primOpTag Word8LtOp = 45+primOpTag Word8NeOp = 46+primOpTag Int16ToIntOp = 47+primOpTag IntToInt16Op = 48+primOpTag Int16NegOp = 49+primOpTag Int16AddOp = 50+primOpTag Int16SubOp = 51+primOpTag Int16MulOp = 52+primOpTag Int16QuotOp = 53+primOpTag Int16RemOp = 54+primOpTag Int16QuotRemOp = 55+primOpTag Int16SllOp = 56+primOpTag Int16SraOp = 57+primOpTag Int16SrlOp = 58+primOpTag Int16ToWord16Op = 59+primOpTag Int16EqOp = 60+primOpTag Int16GeOp = 61+primOpTag Int16GtOp = 62+primOpTag Int16LeOp = 63+primOpTag Int16LtOp = 64+primOpTag Int16NeOp = 65+primOpTag Word16ToWordOp = 66+primOpTag WordToWord16Op = 67+primOpTag Word16AddOp = 68+primOpTag Word16SubOp = 69+primOpTag Word16MulOp = 70+primOpTag Word16QuotOp = 71+primOpTag Word16RemOp = 72+primOpTag Word16QuotRemOp = 73+primOpTag Word16AndOp = 74+primOpTag Word16OrOp = 75+primOpTag Word16XorOp = 76+primOpTag Word16NotOp = 77+primOpTag Word16SllOp = 78+primOpTag Word16SrlOp = 79+primOpTag Word16ToInt16Op = 80+primOpTag Word16EqOp = 81+primOpTag Word16GeOp = 82+primOpTag Word16GtOp = 83+primOpTag Word16LeOp = 84+primOpTag Word16LtOp = 85+primOpTag Word16NeOp = 86+primOpTag Int32ToIntOp = 87+primOpTag IntToInt32Op = 88+primOpTag Int32NegOp = 89+primOpTag Int32AddOp = 90+primOpTag Int32SubOp = 91+primOpTag Int32MulOp = 92+primOpTag Int32QuotOp = 93+primOpTag Int32RemOp = 94+primOpTag Int32QuotRemOp = 95+primOpTag Int32SllOp = 96+primOpTag Int32SraOp = 97+primOpTag Int32SrlOp = 98+primOpTag Int32ToWord32Op = 99+primOpTag Int32EqOp = 100+primOpTag Int32GeOp = 101+primOpTag Int32GtOp = 102+primOpTag Int32LeOp = 103+primOpTag Int32LtOp = 104+primOpTag Int32NeOp = 105+primOpTag Word32ToWordOp = 106+primOpTag WordToWord32Op = 107+primOpTag Word32AddOp = 108+primOpTag Word32SubOp = 109+primOpTag Word32MulOp = 110+primOpTag Word32QuotOp = 111+primOpTag Word32RemOp = 112+primOpTag Word32QuotRemOp = 113+primOpTag Word32AndOp = 114+primOpTag Word32OrOp = 115+primOpTag Word32XorOp = 116+primOpTag Word32NotOp = 117+primOpTag Word32SllOp = 118+primOpTag Word32SrlOp = 119+primOpTag Word32ToInt32Op = 120+primOpTag Word32EqOp = 121+primOpTag Word32GeOp = 122+primOpTag Word32GtOp = 123+primOpTag Word32LeOp = 124+primOpTag Word32LtOp = 125+primOpTag Word32NeOp = 126+primOpTag Int64ToIntOp = 127+primOpTag IntToInt64Op = 128+primOpTag Int64NegOp = 129+primOpTag Int64AddOp = 130+primOpTag Int64SubOp = 131+primOpTag Int64MulOp = 132+primOpTag Int64QuotOp = 133+primOpTag Int64RemOp = 134+primOpTag Int64SllOp = 135+primOpTag Int64SraOp = 136+primOpTag Int64SrlOp = 137+primOpTag Int64ToWord64Op = 138+primOpTag Int64EqOp = 139+primOpTag Int64GeOp = 140+primOpTag Int64GtOp = 141+primOpTag Int64LeOp = 142+primOpTag Int64LtOp = 143+primOpTag Int64NeOp = 144+primOpTag Word64ToWordOp = 145+primOpTag WordToWord64Op = 146+primOpTag Word64AddOp = 147+primOpTag Word64SubOp = 148+primOpTag Word64MulOp = 149+primOpTag Word64QuotOp = 150+primOpTag Word64RemOp = 151+primOpTag Word64AndOp = 152+primOpTag Word64OrOp = 153+primOpTag Word64XorOp = 154+primOpTag Word64NotOp = 155+primOpTag Word64SllOp = 156+primOpTag Word64SrlOp = 157+primOpTag Word64ToInt64Op = 158+primOpTag Word64EqOp = 159+primOpTag Word64GeOp = 160+primOpTag Word64GtOp = 161+primOpTag Word64LeOp = 162+primOpTag Word64LtOp = 163+primOpTag Word64NeOp = 164+primOpTag IntAddOp = 165+primOpTag IntSubOp = 166+primOpTag IntMulOp = 167+primOpTag IntMul2Op = 168+primOpTag IntMulMayOfloOp = 169+primOpTag IntQuotOp = 170+primOpTag IntRemOp = 171+primOpTag IntQuotRemOp = 172+primOpTag IntAndOp = 173+primOpTag IntOrOp = 174+primOpTag IntXorOp = 175+primOpTag IntNotOp = 176+primOpTag IntNegOp = 177+primOpTag IntAddCOp = 178+primOpTag IntSubCOp = 179+primOpTag IntGtOp = 180+primOpTag IntGeOp = 181+primOpTag IntEqOp = 182+primOpTag IntNeOp = 183+primOpTag IntLtOp = 184+primOpTag IntLeOp = 185+primOpTag ChrOp = 186+primOpTag IntToWordOp = 187+primOpTag IntToFloatOp = 188+primOpTag IntToDoubleOp = 189+primOpTag WordToFloatOp = 190+primOpTag WordToDoubleOp = 191+primOpTag IntSllOp = 192+primOpTag IntSraOp = 193+primOpTag IntSrlOp = 194+primOpTag WordAddOp = 195+primOpTag WordAddCOp = 196+primOpTag WordSubCOp = 197+primOpTag WordAdd2Op = 198+primOpTag WordSubOp = 199+primOpTag WordMulOp = 200+primOpTag WordMul2Op = 201+primOpTag WordQuotOp = 202+primOpTag WordRemOp = 203+primOpTag WordQuotRemOp = 204+primOpTag WordQuotRem2Op = 205+primOpTag WordAndOp = 206+primOpTag WordOrOp = 207+primOpTag WordXorOp = 208+primOpTag WordNotOp = 209+primOpTag WordSllOp = 210+primOpTag WordSrlOp = 211+primOpTag WordToIntOp = 212+primOpTag WordGtOp = 213+primOpTag WordGeOp = 214+primOpTag WordEqOp = 215+primOpTag WordNeOp = 216+primOpTag WordLtOp = 217+primOpTag WordLeOp = 218+primOpTag PopCnt8Op = 219+primOpTag PopCnt16Op = 220+primOpTag PopCnt32Op = 221+primOpTag PopCnt64Op = 222+primOpTag PopCntOp = 223+primOpTag Pdep8Op = 224+primOpTag Pdep16Op = 225+primOpTag Pdep32Op = 226+primOpTag Pdep64Op = 227+primOpTag PdepOp = 228+primOpTag Pext8Op = 229+primOpTag Pext16Op = 230+primOpTag Pext32Op = 231+primOpTag Pext64Op = 232+primOpTag PextOp = 233+primOpTag Clz8Op = 234+primOpTag Clz16Op = 235+primOpTag Clz32Op = 236+primOpTag Clz64Op = 237+primOpTag ClzOp = 238+primOpTag Ctz8Op = 239+primOpTag Ctz16Op = 240+primOpTag Ctz32Op = 241+primOpTag Ctz64Op = 242+primOpTag CtzOp = 243+primOpTag BSwap16Op = 244+primOpTag BSwap32Op = 245+primOpTag BSwap64Op = 246+primOpTag BSwapOp = 247+primOpTag BRev8Op = 248+primOpTag BRev16Op = 249+primOpTag BRev32Op = 250+primOpTag BRev64Op = 251+primOpTag BRevOp = 252+primOpTag Narrow8IntOp = 253+primOpTag Narrow16IntOp = 254+primOpTag Narrow32IntOp = 255+primOpTag Narrow8WordOp = 256+primOpTag Narrow16WordOp = 257+primOpTag Narrow32WordOp = 258+primOpTag DoubleGtOp = 259+primOpTag DoubleGeOp = 260+primOpTag DoubleEqOp = 261+primOpTag DoubleNeOp = 262+primOpTag DoubleLtOp = 263+primOpTag DoubleLeOp = 264+primOpTag DoubleAddOp = 265+primOpTag DoubleSubOp = 266+primOpTag DoubleMulOp = 267+primOpTag DoubleDivOp = 268+primOpTag DoubleNegOp = 269+primOpTag DoubleFabsOp = 270+primOpTag DoubleToIntOp = 271+primOpTag DoubleToFloatOp = 272+primOpTag DoubleExpOp = 273+primOpTag DoubleExpM1Op = 274+primOpTag DoubleLogOp = 275+primOpTag DoubleLog1POp = 276+primOpTag DoubleSqrtOp = 277+primOpTag DoubleSinOp = 278+primOpTag DoubleCosOp = 279+primOpTag DoubleTanOp = 280+primOpTag DoubleAsinOp = 281+primOpTag DoubleAcosOp = 282+primOpTag DoubleAtanOp = 283+primOpTag DoubleSinhOp = 284+primOpTag DoubleCoshOp = 285+primOpTag DoubleTanhOp = 286+primOpTag DoubleAsinhOp = 287+primOpTag DoubleAcoshOp = 288+primOpTag DoubleAtanhOp = 289+primOpTag DoublePowerOp = 290+primOpTag DoubleDecode_2IntOp = 291+primOpTag DoubleDecode_Int64Op = 292+primOpTag FloatGtOp = 293+primOpTag FloatGeOp = 294+primOpTag FloatEqOp = 295+primOpTag FloatNeOp = 296+primOpTag FloatLtOp = 297+primOpTag FloatLeOp = 298+primOpTag FloatAddOp = 299+primOpTag FloatSubOp = 300+primOpTag FloatMulOp = 301+primOpTag FloatDivOp = 302+primOpTag FloatNegOp = 303+primOpTag FloatFabsOp = 304+primOpTag FloatToIntOp = 305+primOpTag FloatExpOp = 306+primOpTag FloatExpM1Op = 307+primOpTag FloatLogOp = 308+primOpTag FloatLog1POp = 309+primOpTag FloatSqrtOp = 310+primOpTag FloatSinOp = 311+primOpTag FloatCosOp = 312+primOpTag FloatTanOp = 313+primOpTag FloatAsinOp = 314+primOpTag FloatAcosOp = 315+primOpTag FloatAtanOp = 316+primOpTag FloatSinhOp = 317+primOpTag FloatCoshOp = 318+primOpTag FloatTanhOp = 319+primOpTag FloatAsinhOp = 320+primOpTag FloatAcoshOp = 321+primOpTag FloatAtanhOp = 322+primOpTag FloatPowerOp = 323+primOpTag FloatToDoubleOp = 324+primOpTag FloatDecode_IntOp = 325+primOpTag NewArrayOp = 326+primOpTag ReadArrayOp = 327+primOpTag WriteArrayOp = 328+primOpTag SizeofArrayOp = 329+primOpTag SizeofMutableArrayOp = 330+primOpTag IndexArrayOp = 331+primOpTag UnsafeFreezeArrayOp = 332+primOpTag UnsafeThawArrayOp = 333+primOpTag CopyArrayOp = 334+primOpTag CopyMutableArrayOp = 335+primOpTag CloneArrayOp = 336+primOpTag CloneMutableArrayOp = 337+primOpTag FreezeArrayOp = 338+primOpTag ThawArrayOp = 339+primOpTag CasArrayOp = 340+primOpTag NewSmallArrayOp = 341+primOpTag ShrinkSmallMutableArrayOp_Char = 342+primOpTag ReadSmallArrayOp = 343+primOpTag WriteSmallArrayOp = 344+primOpTag SizeofSmallArrayOp = 345+primOpTag SizeofSmallMutableArrayOp = 346+primOpTag GetSizeofSmallMutableArrayOp = 347+primOpTag IndexSmallArrayOp = 348+primOpTag UnsafeFreezeSmallArrayOp = 349+primOpTag UnsafeThawSmallArrayOp = 350+primOpTag CopySmallArrayOp = 351+primOpTag CopySmallMutableArrayOp = 352+primOpTag CloneSmallArrayOp = 353+primOpTag CloneSmallMutableArrayOp = 354+primOpTag FreezeSmallArrayOp = 355+primOpTag ThawSmallArrayOp = 356+primOpTag CasSmallArrayOp = 357+primOpTag NewByteArrayOp_Char = 358+primOpTag NewPinnedByteArrayOp_Char = 359+primOpTag NewAlignedPinnedByteArrayOp_Char = 360+primOpTag MutableByteArrayIsPinnedOp = 361+primOpTag ByteArrayIsPinnedOp = 362+primOpTag ByteArrayContents_Char = 363+primOpTag MutableByteArrayContents_Char = 364+primOpTag ShrinkMutableByteArrayOp_Char = 365+primOpTag ResizeMutableByteArrayOp_Char = 366+primOpTag UnsafeFreezeByteArrayOp = 367+primOpTag SizeofByteArrayOp = 368+primOpTag SizeofMutableByteArrayOp = 369+primOpTag GetSizeofMutableByteArrayOp = 370+primOpTag IndexByteArrayOp_Char = 371+primOpTag IndexByteArrayOp_WideChar = 372+primOpTag IndexByteArrayOp_Int = 373+primOpTag IndexByteArrayOp_Word = 374+primOpTag IndexByteArrayOp_Addr = 375+primOpTag IndexByteArrayOp_Float = 376+primOpTag IndexByteArrayOp_Double = 377+primOpTag IndexByteArrayOp_StablePtr = 378+primOpTag IndexByteArrayOp_Int8 = 379+primOpTag IndexByteArrayOp_Int16 = 380+primOpTag IndexByteArrayOp_Int32 = 381+primOpTag IndexByteArrayOp_Int64 = 382+primOpTag IndexByteArrayOp_Word8 = 383+primOpTag IndexByteArrayOp_Word16 = 384+primOpTag IndexByteArrayOp_Word32 = 385+primOpTag IndexByteArrayOp_Word64 = 386+primOpTag IndexByteArrayOp_Word8AsChar = 387+primOpTag IndexByteArrayOp_Word8AsWideChar = 388+primOpTag IndexByteArrayOp_Word8AsInt = 389+primOpTag IndexByteArrayOp_Word8AsWord = 390+primOpTag IndexByteArrayOp_Word8AsAddr = 391+primOpTag IndexByteArrayOp_Word8AsFloat = 392+primOpTag IndexByteArrayOp_Word8AsDouble = 393+primOpTag IndexByteArrayOp_Word8AsStablePtr = 394+primOpTag IndexByteArrayOp_Word8AsInt16 = 395+primOpTag IndexByteArrayOp_Word8AsInt32 = 396+primOpTag IndexByteArrayOp_Word8AsInt64 = 397+primOpTag IndexByteArrayOp_Word8AsWord16 = 398+primOpTag IndexByteArrayOp_Word8AsWord32 = 399+primOpTag IndexByteArrayOp_Word8AsWord64 = 400+primOpTag ReadByteArrayOp_Char = 401+primOpTag ReadByteArrayOp_WideChar = 402+primOpTag ReadByteArrayOp_Int = 403+primOpTag ReadByteArrayOp_Word = 404+primOpTag ReadByteArrayOp_Addr = 405+primOpTag ReadByteArrayOp_Float = 406+primOpTag ReadByteArrayOp_Double = 407+primOpTag ReadByteArrayOp_StablePtr = 408+primOpTag ReadByteArrayOp_Int8 = 409+primOpTag ReadByteArrayOp_Int16 = 410+primOpTag ReadByteArrayOp_Int32 = 411+primOpTag ReadByteArrayOp_Int64 = 412+primOpTag ReadByteArrayOp_Word8 = 413+primOpTag ReadByteArrayOp_Word16 = 414+primOpTag ReadByteArrayOp_Word32 = 415+primOpTag ReadByteArrayOp_Word64 = 416+primOpTag ReadByteArrayOp_Word8AsChar = 417+primOpTag ReadByteArrayOp_Word8AsWideChar = 418+primOpTag ReadByteArrayOp_Word8AsInt = 419+primOpTag ReadByteArrayOp_Word8AsWord = 420+primOpTag ReadByteArrayOp_Word8AsAddr = 421+primOpTag ReadByteArrayOp_Word8AsFloat = 422+primOpTag ReadByteArrayOp_Word8AsDouble = 423+primOpTag ReadByteArrayOp_Word8AsStablePtr = 424+primOpTag ReadByteArrayOp_Word8AsInt16 = 425+primOpTag ReadByteArrayOp_Word8AsInt32 = 426+primOpTag ReadByteArrayOp_Word8AsInt64 = 427+primOpTag ReadByteArrayOp_Word8AsWord16 = 428+primOpTag ReadByteArrayOp_Word8AsWord32 = 429+primOpTag ReadByteArrayOp_Word8AsWord64 = 430+primOpTag WriteByteArrayOp_Char = 431+primOpTag WriteByteArrayOp_WideChar = 432+primOpTag WriteByteArrayOp_Int = 433+primOpTag WriteByteArrayOp_Word = 434+primOpTag WriteByteArrayOp_Addr = 435+primOpTag WriteByteArrayOp_Float = 436+primOpTag WriteByteArrayOp_Double = 437+primOpTag WriteByteArrayOp_StablePtr = 438+primOpTag WriteByteArrayOp_Int8 = 439+primOpTag WriteByteArrayOp_Int16 = 440+primOpTag WriteByteArrayOp_Int32 = 441+primOpTag WriteByteArrayOp_Int64 = 442+primOpTag WriteByteArrayOp_Word8 = 443+primOpTag WriteByteArrayOp_Word16 = 444+primOpTag WriteByteArrayOp_Word32 = 445+primOpTag WriteByteArrayOp_Word64 = 446+primOpTag WriteByteArrayOp_Word8AsChar = 447+primOpTag WriteByteArrayOp_Word8AsWideChar = 448+primOpTag WriteByteArrayOp_Word8AsInt = 449+primOpTag WriteByteArrayOp_Word8AsWord = 450+primOpTag WriteByteArrayOp_Word8AsAddr = 451+primOpTag WriteByteArrayOp_Word8AsFloat = 452+primOpTag WriteByteArrayOp_Word8AsDouble = 453+primOpTag WriteByteArrayOp_Word8AsStablePtr = 454+primOpTag WriteByteArrayOp_Word8AsInt16 = 455+primOpTag WriteByteArrayOp_Word8AsInt32 = 456+primOpTag WriteByteArrayOp_Word8AsInt64 = 457+primOpTag WriteByteArrayOp_Word8AsWord16 = 458+primOpTag WriteByteArrayOp_Word8AsWord32 = 459+primOpTag WriteByteArrayOp_Word8AsWord64 = 460+primOpTag CompareByteArraysOp = 461+primOpTag CopyByteArrayOp = 462+primOpTag CopyMutableByteArrayOp = 463+primOpTag CopyByteArrayToAddrOp = 464+primOpTag CopyMutableByteArrayToAddrOp = 465+primOpTag CopyAddrToByteArrayOp = 466+primOpTag SetByteArrayOp = 467+primOpTag AtomicReadByteArrayOp_Int = 468+primOpTag AtomicWriteByteArrayOp_Int = 469+primOpTag CasByteArrayOp_Int = 470+primOpTag CasByteArrayOp_Int8 = 471+primOpTag CasByteArrayOp_Int16 = 472+primOpTag CasByteArrayOp_Int32 = 473+primOpTag CasByteArrayOp_Int64 = 474+primOpTag FetchAddByteArrayOp_Int = 475+primOpTag FetchSubByteArrayOp_Int = 476+primOpTag FetchAndByteArrayOp_Int = 477+primOpTag FetchNandByteArrayOp_Int = 478+primOpTag FetchOrByteArrayOp_Int = 479+primOpTag FetchXorByteArrayOp_Int = 480+primOpTag AddrAddOp = 481+primOpTag AddrSubOp = 482+primOpTag AddrRemOp = 483+primOpTag AddrToIntOp = 484+primOpTag IntToAddrOp = 485+primOpTag AddrGtOp = 486+primOpTag AddrGeOp = 487+primOpTag AddrEqOp = 488+primOpTag AddrNeOp = 489+primOpTag AddrLtOp = 490+primOpTag AddrLeOp = 491+primOpTag IndexOffAddrOp_Char = 492+primOpTag IndexOffAddrOp_WideChar = 493+primOpTag IndexOffAddrOp_Int = 494+primOpTag IndexOffAddrOp_Word = 495+primOpTag IndexOffAddrOp_Addr = 496+primOpTag IndexOffAddrOp_Float = 497+primOpTag IndexOffAddrOp_Double = 498+primOpTag IndexOffAddrOp_StablePtr = 499+primOpTag IndexOffAddrOp_Int8 = 500+primOpTag IndexOffAddrOp_Int16 = 501+primOpTag IndexOffAddrOp_Int32 = 502+primOpTag IndexOffAddrOp_Int64 = 503+primOpTag IndexOffAddrOp_Word8 = 504+primOpTag IndexOffAddrOp_Word16 = 505+primOpTag IndexOffAddrOp_Word32 = 506+primOpTag IndexOffAddrOp_Word64 = 507+primOpTag ReadOffAddrOp_Char = 508+primOpTag ReadOffAddrOp_WideChar = 509+primOpTag ReadOffAddrOp_Int = 510+primOpTag ReadOffAddrOp_Word = 511+primOpTag ReadOffAddrOp_Addr = 512+primOpTag ReadOffAddrOp_Float = 513+primOpTag ReadOffAddrOp_Double = 514+primOpTag ReadOffAddrOp_StablePtr = 515+primOpTag ReadOffAddrOp_Int8 = 516+primOpTag ReadOffAddrOp_Int16 = 517+primOpTag ReadOffAddrOp_Int32 = 518+primOpTag ReadOffAddrOp_Int64 = 519+primOpTag ReadOffAddrOp_Word8 = 520+primOpTag ReadOffAddrOp_Word16 = 521+primOpTag ReadOffAddrOp_Word32 = 522+primOpTag ReadOffAddrOp_Word64 = 523+primOpTag WriteOffAddrOp_Char = 524+primOpTag WriteOffAddrOp_WideChar = 525+primOpTag WriteOffAddrOp_Int = 526+primOpTag WriteOffAddrOp_Word = 527+primOpTag WriteOffAddrOp_Addr = 528+primOpTag WriteOffAddrOp_Float = 529+primOpTag WriteOffAddrOp_Double = 530+primOpTag WriteOffAddrOp_StablePtr = 531+primOpTag WriteOffAddrOp_Int8 = 532+primOpTag WriteOffAddrOp_Int16 = 533+primOpTag WriteOffAddrOp_Int32 = 534+primOpTag WriteOffAddrOp_Int64 = 535+primOpTag WriteOffAddrOp_Word8 = 536+primOpTag WriteOffAddrOp_Word16 = 537+primOpTag WriteOffAddrOp_Word32 = 538+primOpTag WriteOffAddrOp_Word64 = 539+primOpTag InterlockedExchange_Addr = 540+primOpTag InterlockedExchange_Word = 541+primOpTag CasAddrOp_Addr = 542+primOpTag CasAddrOp_Word = 543+primOpTag CasAddrOp_Word8 = 544+primOpTag CasAddrOp_Word16 = 545+primOpTag CasAddrOp_Word32 = 546+primOpTag CasAddrOp_Word64 = 547+primOpTag FetchAddAddrOp_Word = 548+primOpTag FetchSubAddrOp_Word = 549+primOpTag FetchAndAddrOp_Word = 550+primOpTag FetchNandAddrOp_Word = 551+primOpTag FetchOrAddrOp_Word = 552+primOpTag FetchXorAddrOp_Word = 553+primOpTag AtomicReadAddrOp_Word = 554+primOpTag AtomicWriteAddrOp_Word = 555+primOpTag NewMutVarOp = 556+primOpTag ReadMutVarOp = 557+primOpTag WriteMutVarOp = 558+primOpTag AtomicModifyMutVar2Op = 559+primOpTag AtomicModifyMutVar_Op = 560+primOpTag CasMutVarOp = 561+primOpTag CatchOp = 562+primOpTag RaiseOp = 563+primOpTag RaiseIOOp = 564+primOpTag MaskAsyncExceptionsOp = 565+primOpTag MaskUninterruptibleOp = 566+primOpTag UnmaskAsyncExceptionsOp = 567+primOpTag MaskStatus = 568+primOpTag AtomicallyOp = 569+primOpTag RetryOp = 570+primOpTag CatchRetryOp = 571+primOpTag CatchSTMOp = 572+primOpTag NewTVarOp = 573+primOpTag ReadTVarOp = 574+primOpTag ReadTVarIOOp = 575+primOpTag WriteTVarOp = 576+primOpTag NewMVarOp = 577+primOpTag TakeMVarOp = 578+primOpTag TryTakeMVarOp = 579+primOpTag PutMVarOp = 580+primOpTag TryPutMVarOp = 581+primOpTag ReadMVarOp = 582+primOpTag TryReadMVarOp = 583+primOpTag IsEmptyMVarOp = 584+primOpTag NewIOPortOp = 585+primOpTag ReadIOPortOp = 586+primOpTag WriteIOPortOp = 587+primOpTag DelayOp = 588+primOpTag WaitReadOp = 589+primOpTag WaitWriteOp = 590+primOpTag ForkOp = 591+primOpTag ForkOnOp = 592+primOpTag KillThreadOp = 593+primOpTag YieldOp = 594+primOpTag MyThreadIdOp = 595+primOpTag LabelThreadOp = 596+primOpTag IsCurrentThreadBoundOp = 597+primOpTag NoDuplicateOp = 598+primOpTag GetThreadLabelOp = 599+primOpTag ThreadStatusOp = 600+primOpTag ListThreadsOp = 601+primOpTag MkWeakOp = 602+primOpTag MkWeakNoFinalizerOp = 603+primOpTag AddCFinalizerToWeakOp = 604+primOpTag DeRefWeakOp = 605+primOpTag FinalizeWeakOp = 606+primOpTag TouchOp = 607+primOpTag MakeStablePtrOp = 608+primOpTag DeRefStablePtrOp = 609+primOpTag EqStablePtrOp = 610+primOpTag MakeStableNameOp = 611+primOpTag StableNameToIntOp = 612+primOpTag CompactNewOp = 613+primOpTag CompactResizeOp = 614+primOpTag CompactContainsOp = 615+primOpTag CompactContainsAnyOp = 616+primOpTag CompactGetFirstBlockOp = 617+primOpTag CompactGetNextBlockOp = 618+primOpTag CompactAllocateBlockOp = 619+primOpTag CompactFixupPointersOp = 620+primOpTag CompactAdd = 621+primOpTag CompactAddWithSharing = 622+primOpTag CompactSize = 623+primOpTag ReallyUnsafePtrEqualityOp = 624+primOpTag ParOp = 625+primOpTag SparkOp = 626+primOpTag SeqOp = 627+primOpTag GetSparkOp = 628+primOpTag NumSparks = 629+primOpTag KeepAliveOp = 630+primOpTag DataToTagOp = 631+primOpTag TagToEnumOp = 632+primOpTag AddrToAnyOp = 633+primOpTag AnyToAddrOp = 634+primOpTag MkApUpd0_Op = 635+primOpTag NewBCOOp = 636+primOpTag UnpackClosureOp = 637+primOpTag ClosureSizeOp = 638+primOpTag GetApStackValOp = 639+primOpTag GetCCSOfOp = 640+primOpTag GetCurrentCCSOp = 641+primOpTag ClearCCSOp = 642+primOpTag WhereFromOp = 643+primOpTag TraceEventOp = 644+primOpTag TraceEventBinaryOp = 645+primOpTag TraceMarkerOp = 646+primOpTag SetThreadAllocationCounter = 647+primOpTag (VecBroadcastOp IntVec 16 W8) = 648+primOpTag (VecBroadcastOp IntVec 8 W16) = 649+primOpTag (VecBroadcastOp IntVec 4 W32) = 650+primOpTag (VecBroadcastOp IntVec 2 W64) = 651+primOpTag (VecBroadcastOp IntVec 32 W8) = 652+primOpTag (VecBroadcastOp IntVec 16 W16) = 653+primOpTag (VecBroadcastOp IntVec 8 W32) = 654+primOpTag (VecBroadcastOp IntVec 4 W64) = 655+primOpTag (VecBroadcastOp IntVec 64 W8) = 656+primOpTag (VecBroadcastOp IntVec 32 W16) = 657+primOpTag (VecBroadcastOp IntVec 16 W32) = 658+primOpTag (VecBroadcastOp IntVec 8 W64) = 659+primOpTag (VecBroadcastOp WordVec 16 W8) = 660+primOpTag (VecBroadcastOp WordVec 8 W16) = 661+primOpTag (VecBroadcastOp WordVec 4 W32) = 662+primOpTag (VecBroadcastOp WordVec 2 W64) = 663+primOpTag (VecBroadcastOp WordVec 32 W8) = 664+primOpTag (VecBroadcastOp WordVec 16 W16) = 665+primOpTag (VecBroadcastOp WordVec 8 W32) = 666+primOpTag (VecBroadcastOp WordVec 4 W64) = 667+primOpTag (VecBroadcastOp WordVec 64 W8) = 668+primOpTag (VecBroadcastOp WordVec 32 W16) = 669+primOpTag (VecBroadcastOp WordVec 16 W32) = 670+primOpTag (VecBroadcastOp WordVec 8 W64) = 671+primOpTag (VecBroadcastOp FloatVec 4 W32) = 672+primOpTag (VecBroadcastOp FloatVec 2 W64) = 673+primOpTag (VecBroadcastOp FloatVec 8 W32) = 674+primOpTag (VecBroadcastOp FloatVec 4 W64) = 675+primOpTag (VecBroadcastOp FloatVec 16 W32) = 676+primOpTag (VecBroadcastOp FloatVec 8 W64) = 677+primOpTag (VecPackOp IntVec 16 W8) = 678+primOpTag (VecPackOp IntVec 8 W16) = 679+primOpTag (VecPackOp IntVec 4 W32) = 680+primOpTag (VecPackOp IntVec 2 W64) = 681+primOpTag (VecPackOp IntVec 32 W8) = 682+primOpTag (VecPackOp IntVec 16 W16) = 683+primOpTag (VecPackOp IntVec 8 W32) = 684+primOpTag (VecPackOp IntVec 4 W64) = 685+primOpTag (VecPackOp IntVec 64 W8) = 686+primOpTag (VecPackOp IntVec 32 W16) = 687+primOpTag (VecPackOp IntVec 16 W32) = 688+primOpTag (VecPackOp IntVec 8 W64) = 689+primOpTag (VecPackOp WordVec 16 W8) = 690+primOpTag (VecPackOp WordVec 8 W16) = 691+primOpTag (VecPackOp WordVec 4 W32) = 692+primOpTag (VecPackOp WordVec 2 W64) = 693+primOpTag (VecPackOp WordVec 32 W8) = 694+primOpTag (VecPackOp WordVec 16 W16) = 695+primOpTag (VecPackOp WordVec 8 W32) = 696+primOpTag (VecPackOp WordVec 4 W64) = 697+primOpTag (VecPackOp WordVec 64 W8) = 698+primOpTag (VecPackOp WordVec 32 W16) = 699+primOpTag (VecPackOp WordVec 16 W32) = 700+primOpTag (VecPackOp WordVec 8 W64) = 701+primOpTag (VecPackOp FloatVec 4 W32) = 702+primOpTag (VecPackOp FloatVec 2 W64) = 703+primOpTag (VecPackOp FloatVec 8 W32) = 704+primOpTag (VecPackOp FloatVec 4 W64) = 705+primOpTag (VecPackOp FloatVec 16 W32) = 706+primOpTag (VecPackOp FloatVec 8 W64) = 707+primOpTag (VecUnpackOp IntVec 16 W8) = 708+primOpTag (VecUnpackOp IntVec 8 W16) = 709+primOpTag (VecUnpackOp IntVec 4 W32) = 710+primOpTag (VecUnpackOp IntVec 2 W64) = 711+primOpTag (VecUnpackOp IntVec 32 W8) = 712+primOpTag (VecUnpackOp IntVec 16 W16) = 713+primOpTag (VecUnpackOp IntVec 8 W32) = 714+primOpTag (VecUnpackOp IntVec 4 W64) = 715+primOpTag (VecUnpackOp IntVec 64 W8) = 716+primOpTag (VecUnpackOp IntVec 32 W16) = 717+primOpTag (VecUnpackOp IntVec 16 W32) = 718+primOpTag (VecUnpackOp IntVec 8 W64) = 719+primOpTag (VecUnpackOp WordVec 16 W8) = 720+primOpTag (VecUnpackOp WordVec 8 W16) = 721+primOpTag (VecUnpackOp WordVec 4 W32) = 722+primOpTag (VecUnpackOp WordVec 2 W64) = 723+primOpTag (VecUnpackOp WordVec 32 W8) = 724+primOpTag (VecUnpackOp WordVec 16 W16) = 725+primOpTag (VecUnpackOp WordVec 8 W32) = 726+primOpTag (VecUnpackOp WordVec 4 W64) = 727+primOpTag (VecUnpackOp WordVec 64 W8) = 728+primOpTag (VecUnpackOp WordVec 32 W16) = 729+primOpTag (VecUnpackOp WordVec 16 W32) = 730+primOpTag (VecUnpackOp WordVec 8 W64) = 731+primOpTag (VecUnpackOp FloatVec 4 W32) = 732+primOpTag (VecUnpackOp FloatVec 2 W64) = 733+primOpTag (VecUnpackOp FloatVec 8 W32) = 734+primOpTag (VecUnpackOp FloatVec 4 W64) = 735+primOpTag (VecUnpackOp FloatVec 16 W32) = 736+primOpTag (VecUnpackOp FloatVec 8 W64) = 737+primOpTag (VecInsertOp IntVec 16 W8) = 738+primOpTag (VecInsertOp IntVec 8 W16) = 739+primOpTag (VecInsertOp IntVec 4 W32) = 740+primOpTag (VecInsertOp IntVec 2 W64) = 741+primOpTag (VecInsertOp IntVec 32 W8) = 742+primOpTag (VecInsertOp IntVec 16 W16) = 743+primOpTag (VecInsertOp IntVec 8 W32) = 744+primOpTag (VecInsertOp IntVec 4 W64) = 745+primOpTag (VecInsertOp IntVec 64 W8) = 746+primOpTag (VecInsertOp IntVec 32 W16) = 747+primOpTag (VecInsertOp IntVec 16 W32) = 748+primOpTag (VecInsertOp IntVec 8 W64) = 749+primOpTag (VecInsertOp WordVec 16 W8) = 750+primOpTag (VecInsertOp WordVec 8 W16) = 751+primOpTag (VecInsertOp WordVec 4 W32) = 752+primOpTag (VecInsertOp WordVec 2 W64) = 753+primOpTag (VecInsertOp WordVec 32 W8) = 754+primOpTag (VecInsertOp WordVec 16 W16) = 755+primOpTag (VecInsertOp WordVec 8 W32) = 756+primOpTag (VecInsertOp WordVec 4 W64) = 757+primOpTag (VecInsertOp WordVec 64 W8) = 758+primOpTag (VecInsertOp WordVec 32 W16) = 759+primOpTag (VecInsertOp WordVec 16 W32) = 760+primOpTag (VecInsertOp WordVec 8 W64) = 761+primOpTag (VecInsertOp FloatVec 4 W32) = 762+primOpTag (VecInsertOp FloatVec 2 W64) = 763+primOpTag (VecInsertOp FloatVec 8 W32) = 764+primOpTag (VecInsertOp FloatVec 4 W64) = 765+primOpTag (VecInsertOp FloatVec 16 W32) = 766+primOpTag (VecInsertOp FloatVec 8 W64) = 767+primOpTag (VecAddOp IntVec 16 W8) = 768+primOpTag (VecAddOp IntVec 8 W16) = 769+primOpTag (VecAddOp IntVec 4 W32) = 770+primOpTag (VecAddOp IntVec 2 W64) = 771+primOpTag (VecAddOp IntVec 32 W8) = 772+primOpTag (VecAddOp IntVec 16 W16) = 773+primOpTag (VecAddOp IntVec 8 W32) = 774+primOpTag (VecAddOp IntVec 4 W64) = 775+primOpTag (VecAddOp IntVec 64 W8) = 776+primOpTag (VecAddOp IntVec 32 W16) = 777+primOpTag (VecAddOp IntVec 16 W32) = 778+primOpTag (VecAddOp IntVec 8 W64) = 779+primOpTag (VecAddOp WordVec 16 W8) = 780+primOpTag (VecAddOp WordVec 8 W16) = 781+primOpTag (VecAddOp WordVec 4 W32) = 782+primOpTag (VecAddOp WordVec 2 W64) = 783+primOpTag (VecAddOp WordVec 32 W8) = 784+primOpTag (VecAddOp WordVec 16 W16) = 785+primOpTag (VecAddOp WordVec 8 W32) = 786+primOpTag (VecAddOp WordVec 4 W64) = 787+primOpTag (VecAddOp WordVec 64 W8) = 788+primOpTag (VecAddOp WordVec 32 W16) = 789+primOpTag (VecAddOp WordVec 16 W32) = 790+primOpTag (VecAddOp WordVec 8 W64) = 791+primOpTag (VecAddOp FloatVec 4 W32) = 792+primOpTag (VecAddOp FloatVec 2 W64) = 793+primOpTag (VecAddOp FloatVec 8 W32) = 794+primOpTag (VecAddOp FloatVec 4 W64) = 795+primOpTag (VecAddOp FloatVec 16 W32) = 796+primOpTag (VecAddOp FloatVec 8 W64) = 797+primOpTag (VecSubOp IntVec 16 W8) = 798+primOpTag (VecSubOp IntVec 8 W16) = 799+primOpTag (VecSubOp IntVec 4 W32) = 800+primOpTag (VecSubOp IntVec 2 W64) = 801+primOpTag (VecSubOp IntVec 32 W8) = 802+primOpTag (VecSubOp IntVec 16 W16) = 803+primOpTag (VecSubOp IntVec 8 W32) = 804+primOpTag (VecSubOp IntVec 4 W64) = 805+primOpTag (VecSubOp IntVec 64 W8) = 806+primOpTag (VecSubOp IntVec 32 W16) = 807+primOpTag (VecSubOp IntVec 16 W32) = 808+primOpTag (VecSubOp IntVec 8 W64) = 809+primOpTag (VecSubOp WordVec 16 W8) = 810+primOpTag (VecSubOp WordVec 8 W16) = 811+primOpTag (VecSubOp WordVec 4 W32) = 812+primOpTag (VecSubOp WordVec 2 W64) = 813+primOpTag (VecSubOp WordVec 32 W8) = 814+primOpTag (VecSubOp WordVec 16 W16) = 815+primOpTag (VecSubOp WordVec 8 W32) = 816+primOpTag (VecSubOp WordVec 4 W64) = 817+primOpTag (VecSubOp WordVec 64 W8) = 818+primOpTag (VecSubOp WordVec 32 W16) = 819+primOpTag (VecSubOp WordVec 16 W32) = 820+primOpTag (VecSubOp WordVec 8 W64) = 821+primOpTag (VecSubOp FloatVec 4 W32) = 822+primOpTag (VecSubOp FloatVec 2 W64) = 823+primOpTag (VecSubOp FloatVec 8 W32) = 824+primOpTag (VecSubOp FloatVec 4 W64) = 825+primOpTag (VecSubOp FloatVec 16 W32) = 826+primOpTag (VecSubOp FloatVec 8 W64) = 827+primOpTag (VecMulOp IntVec 16 W8) = 828+primOpTag (VecMulOp IntVec 8 W16) = 829+primOpTag (VecMulOp IntVec 4 W32) = 830+primOpTag (VecMulOp IntVec 2 W64) = 831+primOpTag (VecMulOp IntVec 32 W8) = 832+primOpTag (VecMulOp IntVec 16 W16) = 833+primOpTag (VecMulOp IntVec 8 W32) = 834+primOpTag (VecMulOp IntVec 4 W64) = 835+primOpTag (VecMulOp IntVec 64 W8) = 836+primOpTag (VecMulOp IntVec 32 W16) = 837+primOpTag (VecMulOp IntVec 16 W32) = 838+primOpTag (VecMulOp IntVec 8 W64) = 839+primOpTag (VecMulOp WordVec 16 W8) = 840+primOpTag (VecMulOp WordVec 8 W16) = 841+primOpTag (VecMulOp WordVec 4 W32) = 842+primOpTag (VecMulOp WordVec 2 W64) = 843+primOpTag (VecMulOp WordVec 32 W8) = 844+primOpTag (VecMulOp WordVec 16 W16) = 845+primOpTag (VecMulOp WordVec 8 W32) = 846+primOpTag (VecMulOp WordVec 4 W64) = 847+primOpTag (VecMulOp WordVec 64 W8) = 848+primOpTag (VecMulOp WordVec 32 W16) = 849+primOpTag (VecMulOp WordVec 16 W32) = 850+primOpTag (VecMulOp WordVec 8 W64) = 851+primOpTag (VecMulOp FloatVec 4 W32) = 852+primOpTag (VecMulOp FloatVec 2 W64) = 853+primOpTag (VecMulOp FloatVec 8 W32) = 854+primOpTag (VecMulOp FloatVec 4 W64) = 855+primOpTag (VecMulOp FloatVec 16 W32) = 856+primOpTag (VecMulOp FloatVec 8 W64) = 857+primOpTag (VecDivOp FloatVec 4 W32) = 858+primOpTag (VecDivOp FloatVec 2 W64) = 859+primOpTag (VecDivOp FloatVec 8 W32) = 860+primOpTag (VecDivOp FloatVec 4 W64) = 861+primOpTag (VecDivOp FloatVec 16 W32) = 862+primOpTag (VecDivOp FloatVec 8 W64) = 863+primOpTag (VecQuotOp IntVec 16 W8) = 864+primOpTag (VecQuotOp IntVec 8 W16) = 865+primOpTag (VecQuotOp IntVec 4 W32) = 866+primOpTag (VecQuotOp IntVec 2 W64) = 867+primOpTag (VecQuotOp IntVec 32 W8) = 868+primOpTag (VecQuotOp IntVec 16 W16) = 869+primOpTag (VecQuotOp IntVec 8 W32) = 870+primOpTag (VecQuotOp IntVec 4 W64) = 871+primOpTag (VecQuotOp IntVec 64 W8) = 872+primOpTag (VecQuotOp IntVec 32 W16) = 873+primOpTag (VecQuotOp IntVec 16 W32) = 874+primOpTag (VecQuotOp IntVec 8 W64) = 875+primOpTag (VecQuotOp WordVec 16 W8) = 876+primOpTag (VecQuotOp WordVec 8 W16) = 877+primOpTag (VecQuotOp WordVec 4 W32) = 878+primOpTag (VecQuotOp WordVec 2 W64) = 879+primOpTag (VecQuotOp WordVec 32 W8) = 880+primOpTag (VecQuotOp WordVec 16 W16) = 881+primOpTag (VecQuotOp WordVec 8 W32) = 882+primOpTag (VecQuotOp WordVec 4 W64) = 883+primOpTag (VecQuotOp WordVec 64 W8) = 884+primOpTag (VecQuotOp WordVec 32 W16) = 885+primOpTag (VecQuotOp WordVec 16 W32) = 886+primOpTag (VecQuotOp WordVec 8 W64) = 887+primOpTag (VecRemOp IntVec 16 W8) = 888+primOpTag (VecRemOp IntVec 8 W16) = 889+primOpTag (VecRemOp IntVec 4 W32) = 890+primOpTag (VecRemOp IntVec 2 W64) = 891+primOpTag (VecRemOp IntVec 32 W8) = 892+primOpTag (VecRemOp IntVec 16 W16) = 893+primOpTag (VecRemOp IntVec 8 W32) = 894+primOpTag (VecRemOp IntVec 4 W64) = 895+primOpTag (VecRemOp IntVec 64 W8) = 896+primOpTag (VecRemOp IntVec 32 W16) = 897+primOpTag (VecRemOp IntVec 16 W32) = 898+primOpTag (VecRemOp IntVec 8 W64) = 899+primOpTag (VecRemOp WordVec 16 W8) = 900+primOpTag (VecRemOp WordVec 8 W16) = 901+primOpTag (VecRemOp WordVec 4 W32) = 902+primOpTag (VecRemOp WordVec 2 W64) = 903+primOpTag (VecRemOp WordVec 32 W8) = 904+primOpTag (VecRemOp WordVec 16 W16) = 905+primOpTag (VecRemOp WordVec 8 W32) = 906+primOpTag (VecRemOp WordVec 4 W64) = 907+primOpTag (VecRemOp WordVec 64 W8) = 908+primOpTag (VecRemOp WordVec 32 W16) = 909+primOpTag (VecRemOp WordVec 16 W32) = 910+primOpTag (VecRemOp WordVec 8 W64) = 911+primOpTag (VecNegOp IntVec 16 W8) = 912+primOpTag (VecNegOp IntVec 8 W16) = 913+primOpTag (VecNegOp IntVec 4 W32) = 914+primOpTag (VecNegOp IntVec 2 W64) = 915+primOpTag (VecNegOp IntVec 32 W8) = 916+primOpTag (VecNegOp IntVec 16 W16) = 917+primOpTag (VecNegOp IntVec 8 W32) = 918+primOpTag (VecNegOp IntVec 4 W64) = 919+primOpTag (VecNegOp IntVec 64 W8) = 920+primOpTag (VecNegOp IntVec 32 W16) = 921+primOpTag (VecNegOp IntVec 16 W32) = 922+primOpTag (VecNegOp IntVec 8 W64) = 923+primOpTag (VecNegOp FloatVec 4 W32) = 924+primOpTag (VecNegOp FloatVec 2 W64) = 925+primOpTag (VecNegOp FloatVec 8 W32) = 926+primOpTag (VecNegOp FloatVec 4 W64) = 927+primOpTag (VecNegOp FloatVec 16 W32) = 928+primOpTag (VecNegOp FloatVec 8 W64) = 929+primOpTag (VecIndexByteArrayOp IntVec 16 W8) = 930+primOpTag (VecIndexByteArrayOp IntVec 8 W16) = 931+primOpTag (VecIndexByteArrayOp IntVec 4 W32) = 932+primOpTag (VecIndexByteArrayOp IntVec 2 W64) = 933+primOpTag (VecIndexByteArrayOp IntVec 32 W8) = 934+primOpTag (VecIndexByteArrayOp IntVec 16 W16) = 935+primOpTag (VecIndexByteArrayOp IntVec 8 W32) = 936+primOpTag (VecIndexByteArrayOp IntVec 4 W64) = 937+primOpTag (VecIndexByteArrayOp IntVec 64 W8) = 938+primOpTag (VecIndexByteArrayOp IntVec 32 W16) = 939+primOpTag (VecIndexByteArrayOp IntVec 16 W32) = 940+primOpTag (VecIndexByteArrayOp IntVec 8 W64) = 941+primOpTag (VecIndexByteArrayOp WordVec 16 W8) = 942+primOpTag (VecIndexByteArrayOp WordVec 8 W16) = 943+primOpTag (VecIndexByteArrayOp WordVec 4 W32) = 944+primOpTag (VecIndexByteArrayOp WordVec 2 W64) = 945+primOpTag (VecIndexByteArrayOp WordVec 32 W8) = 946+primOpTag (VecIndexByteArrayOp WordVec 16 W16) = 947+primOpTag (VecIndexByteArrayOp WordVec 8 W32) = 948+primOpTag (VecIndexByteArrayOp WordVec 4 W64) = 949+primOpTag (VecIndexByteArrayOp WordVec 64 W8) = 950+primOpTag (VecIndexByteArrayOp WordVec 32 W16) = 951+primOpTag (VecIndexByteArrayOp WordVec 16 W32) = 952+primOpTag (VecIndexByteArrayOp WordVec 8 W64) = 953+primOpTag (VecIndexByteArrayOp FloatVec 4 W32) = 954+primOpTag (VecIndexByteArrayOp FloatVec 2 W64) = 955+primOpTag (VecIndexByteArrayOp FloatVec 8 W32) = 956+primOpTag (VecIndexByteArrayOp FloatVec 4 W64) = 957+primOpTag (VecIndexByteArrayOp FloatVec 16 W32) = 958+primOpTag (VecIndexByteArrayOp FloatVec 8 W64) = 959+primOpTag (VecReadByteArrayOp IntVec 16 W8) = 960+primOpTag (VecReadByteArrayOp IntVec 8 W16) = 961+primOpTag (VecReadByteArrayOp IntVec 4 W32) = 962+primOpTag (VecReadByteArrayOp IntVec 2 W64) = 963+primOpTag (VecReadByteArrayOp IntVec 32 W8) = 964+primOpTag (VecReadByteArrayOp IntVec 16 W16) = 965+primOpTag (VecReadByteArrayOp IntVec 8 W32) = 966+primOpTag (VecReadByteArrayOp IntVec 4 W64) = 967+primOpTag (VecReadByteArrayOp IntVec 64 W8) = 968+primOpTag (VecReadByteArrayOp IntVec 32 W16) = 969+primOpTag (VecReadByteArrayOp IntVec 16 W32) = 970+primOpTag (VecReadByteArrayOp IntVec 8 W64) = 971+primOpTag (VecReadByteArrayOp WordVec 16 W8) = 972+primOpTag (VecReadByteArrayOp WordVec 8 W16) = 973+primOpTag (VecReadByteArrayOp WordVec 4 W32) = 974+primOpTag (VecReadByteArrayOp WordVec 2 W64) = 975+primOpTag (VecReadByteArrayOp WordVec 32 W8) = 976+primOpTag (VecReadByteArrayOp WordVec 16 W16) = 977+primOpTag (VecReadByteArrayOp WordVec 8 W32) = 978+primOpTag (VecReadByteArrayOp WordVec 4 W64) = 979+primOpTag (VecReadByteArrayOp WordVec 64 W8) = 980+primOpTag (VecReadByteArrayOp WordVec 32 W16) = 981+primOpTag (VecReadByteArrayOp WordVec 16 W32) = 982+primOpTag (VecReadByteArrayOp WordVec 8 W64) = 983+primOpTag (VecReadByteArrayOp FloatVec 4 W32) = 984+primOpTag (VecReadByteArrayOp FloatVec 2 W64) = 985+primOpTag (VecReadByteArrayOp FloatVec 8 W32) = 986+primOpTag (VecReadByteArrayOp FloatVec 4 W64) = 987+primOpTag (VecReadByteArrayOp FloatVec 16 W32) = 988+primOpTag (VecReadByteArrayOp FloatVec 8 W64) = 989+primOpTag (VecWriteByteArrayOp IntVec 16 W8) = 990+primOpTag (VecWriteByteArrayOp IntVec 8 W16) = 991+primOpTag (VecWriteByteArrayOp IntVec 4 W32) = 992+primOpTag (VecWriteByteArrayOp IntVec 2 W64) = 993+primOpTag (VecWriteByteArrayOp IntVec 32 W8) = 994+primOpTag (VecWriteByteArrayOp IntVec 16 W16) = 995+primOpTag (VecWriteByteArrayOp IntVec 8 W32) = 996+primOpTag (VecWriteByteArrayOp IntVec 4 W64) = 997+primOpTag (VecWriteByteArrayOp IntVec 64 W8) = 998+primOpTag (VecWriteByteArrayOp IntVec 32 W16) = 999+primOpTag (VecWriteByteArrayOp IntVec 16 W32) = 1000+primOpTag (VecWriteByteArrayOp IntVec 8 W64) = 1001+primOpTag (VecWriteByteArrayOp WordVec 16 W8) = 1002+primOpTag (VecWriteByteArrayOp WordVec 8 W16) = 1003+primOpTag (VecWriteByteArrayOp WordVec 4 W32) = 1004+primOpTag (VecWriteByteArrayOp WordVec 2 W64) = 1005+primOpTag (VecWriteByteArrayOp WordVec 32 W8) = 1006+primOpTag (VecWriteByteArrayOp WordVec 16 W16) = 1007+primOpTag (VecWriteByteArrayOp WordVec 8 W32) = 1008+primOpTag (VecWriteByteArrayOp WordVec 4 W64) = 1009+primOpTag (VecWriteByteArrayOp WordVec 64 W8) = 1010+primOpTag (VecWriteByteArrayOp WordVec 32 W16) = 1011+primOpTag (VecWriteByteArrayOp WordVec 16 W32) = 1012+primOpTag (VecWriteByteArrayOp WordVec 8 W64) = 1013+primOpTag (VecWriteByteArrayOp FloatVec 4 W32) = 1014+primOpTag (VecWriteByteArrayOp FloatVec 2 W64) = 1015+primOpTag (VecWriteByteArrayOp FloatVec 8 W32) = 1016+primOpTag (VecWriteByteArrayOp FloatVec 4 W64) = 1017+primOpTag (VecWriteByteArrayOp FloatVec 16 W32) = 1018+primOpTag (VecWriteByteArrayOp FloatVec 8 W64) = 1019+primOpTag (VecIndexOffAddrOp IntVec 16 W8) = 1020+primOpTag (VecIndexOffAddrOp IntVec 8 W16) = 1021+primOpTag (VecIndexOffAddrOp IntVec 4 W32) = 1022+primOpTag (VecIndexOffAddrOp IntVec 2 W64) = 1023+primOpTag (VecIndexOffAddrOp IntVec 32 W8) = 1024+primOpTag (VecIndexOffAddrOp IntVec 16 W16) = 1025+primOpTag (VecIndexOffAddrOp IntVec 8 W32) = 1026+primOpTag (VecIndexOffAddrOp IntVec 4 W64) = 1027+primOpTag (VecIndexOffAddrOp IntVec 64 W8) = 1028+primOpTag (VecIndexOffAddrOp IntVec 32 W16) = 1029+primOpTag (VecIndexOffAddrOp IntVec 16 W32) = 1030+primOpTag (VecIndexOffAddrOp IntVec 8 W64) = 1031+primOpTag (VecIndexOffAddrOp WordVec 16 W8) = 1032+primOpTag (VecIndexOffAddrOp WordVec 8 W16) = 1033+primOpTag (VecIndexOffAddrOp WordVec 4 W32) = 1034+primOpTag (VecIndexOffAddrOp WordVec 2 W64) = 1035+primOpTag (VecIndexOffAddrOp WordVec 32 W8) = 1036+primOpTag (VecIndexOffAddrOp WordVec 16 W16) = 1037+primOpTag (VecIndexOffAddrOp WordVec 8 W32) = 1038+primOpTag (VecIndexOffAddrOp WordVec 4 W64) = 1039+primOpTag (VecIndexOffAddrOp WordVec 64 W8) = 1040+primOpTag (VecIndexOffAddrOp WordVec 32 W16) = 1041+primOpTag (VecIndexOffAddrOp WordVec 16 W32) = 1042+primOpTag (VecIndexOffAddrOp WordVec 8 W64) = 1043+primOpTag (VecIndexOffAddrOp FloatVec 4 W32) = 1044+primOpTag (VecIndexOffAddrOp FloatVec 2 W64) = 1045+primOpTag (VecIndexOffAddrOp FloatVec 8 W32) = 1046+primOpTag (VecIndexOffAddrOp FloatVec 4 W64) = 1047+primOpTag (VecIndexOffAddrOp FloatVec 16 W32) = 1048+primOpTag (VecIndexOffAddrOp FloatVec 8 W64) = 1049+primOpTag (VecReadOffAddrOp IntVec 16 W8) = 1050+primOpTag (VecReadOffAddrOp IntVec 8 W16) = 1051+primOpTag (VecReadOffAddrOp IntVec 4 W32) = 1052+primOpTag (VecReadOffAddrOp IntVec 2 W64) = 1053+primOpTag (VecReadOffAddrOp IntVec 32 W8) = 1054+primOpTag (VecReadOffAddrOp IntVec 16 W16) = 1055+primOpTag (VecReadOffAddrOp IntVec 8 W32) = 1056+primOpTag (VecReadOffAddrOp IntVec 4 W64) = 1057+primOpTag (VecReadOffAddrOp IntVec 64 W8) = 1058+primOpTag (VecReadOffAddrOp IntVec 32 W16) = 1059+primOpTag (VecReadOffAddrOp IntVec 16 W32) = 1060+primOpTag (VecReadOffAddrOp IntVec 8 W64) = 1061+primOpTag (VecReadOffAddrOp WordVec 16 W8) = 1062+primOpTag (VecReadOffAddrOp WordVec 8 W16) = 1063+primOpTag (VecReadOffAddrOp WordVec 4 W32) = 1064+primOpTag (VecReadOffAddrOp WordVec 2 W64) = 1065+primOpTag (VecReadOffAddrOp WordVec 32 W8) = 1066+primOpTag (VecReadOffAddrOp WordVec 16 W16) = 1067+primOpTag (VecReadOffAddrOp WordVec 8 W32) = 1068+primOpTag (VecReadOffAddrOp WordVec 4 W64) = 1069+primOpTag (VecReadOffAddrOp WordVec 64 W8) = 1070+primOpTag (VecReadOffAddrOp WordVec 32 W16) = 1071+primOpTag (VecReadOffAddrOp WordVec 16 W32) = 1072+primOpTag (VecReadOffAddrOp WordVec 8 W64) = 1073+primOpTag (VecReadOffAddrOp FloatVec 4 W32) = 1074+primOpTag (VecReadOffAddrOp FloatVec 2 W64) = 1075+primOpTag (VecReadOffAddrOp FloatVec 8 W32) = 1076+primOpTag (VecReadOffAddrOp FloatVec 4 W64) = 1077+primOpTag (VecReadOffAddrOp FloatVec 16 W32) = 1078+primOpTag (VecReadOffAddrOp FloatVec 8 W64) = 1079+primOpTag (VecWriteOffAddrOp IntVec 16 W8) = 1080+primOpTag (VecWriteOffAddrOp IntVec 8 W16) = 1081+primOpTag (VecWriteOffAddrOp IntVec 4 W32) = 1082+primOpTag (VecWriteOffAddrOp IntVec 2 W64) = 1083+primOpTag (VecWriteOffAddrOp IntVec 32 W8) = 1084+primOpTag (VecWriteOffAddrOp IntVec 16 W16) = 1085+primOpTag (VecWriteOffAddrOp IntVec 8 W32) = 1086+primOpTag (VecWriteOffAddrOp IntVec 4 W64) = 1087+primOpTag (VecWriteOffAddrOp IntVec 64 W8) = 1088+primOpTag (VecWriteOffAddrOp IntVec 32 W16) = 1089+primOpTag (VecWriteOffAddrOp IntVec 16 W32) = 1090+primOpTag (VecWriteOffAddrOp IntVec 8 W64) = 1091+primOpTag (VecWriteOffAddrOp WordVec 16 W8) = 1092+primOpTag (VecWriteOffAddrOp WordVec 8 W16) = 1093+primOpTag (VecWriteOffAddrOp WordVec 4 W32) = 1094+primOpTag (VecWriteOffAddrOp WordVec 2 W64) = 1095+primOpTag (VecWriteOffAddrOp WordVec 32 W8) = 1096+primOpTag (VecWriteOffAddrOp WordVec 16 W16) = 1097+primOpTag (VecWriteOffAddrOp WordVec 8 W32) = 1098+primOpTag (VecWriteOffAddrOp WordVec 4 W64) = 1099+primOpTag (VecWriteOffAddrOp WordVec 64 W8) = 1100+primOpTag (VecWriteOffAddrOp WordVec 32 W16) = 1101+primOpTag (VecWriteOffAddrOp WordVec 16 W32) = 1102+primOpTag (VecWriteOffAddrOp WordVec 8 W64) = 1103+primOpTag (VecWriteOffAddrOp FloatVec 4 W32) = 1104+primOpTag (VecWriteOffAddrOp FloatVec 2 W64) = 1105+primOpTag (VecWriteOffAddrOp FloatVec 8 W32) = 1106+primOpTag (VecWriteOffAddrOp FloatVec 4 W64) = 1107+primOpTag (VecWriteOffAddrOp FloatVec 16 W32) = 1108+primOpTag (VecWriteOffAddrOp FloatVec 8 W64) = 1109+primOpTag (VecIndexScalarByteArrayOp IntVec 16 W8) = 1110+primOpTag (VecIndexScalarByteArrayOp IntVec 8 W16) = 1111+primOpTag (VecIndexScalarByteArrayOp IntVec 4 W32) = 1112+primOpTag (VecIndexScalarByteArrayOp IntVec 2 W64) = 1113+primOpTag (VecIndexScalarByteArrayOp IntVec 32 W8) = 1114+primOpTag (VecIndexScalarByteArrayOp IntVec 16 W16) = 1115+primOpTag (VecIndexScalarByteArrayOp IntVec 8 W32) = 1116+primOpTag (VecIndexScalarByteArrayOp IntVec 4 W64) = 1117+primOpTag (VecIndexScalarByteArrayOp IntVec 64 W8) = 1118+primOpTag (VecIndexScalarByteArrayOp IntVec 32 W16) = 1119+primOpTag (VecIndexScalarByteArrayOp IntVec 16 W32) = 1120+primOpTag (VecIndexScalarByteArrayOp IntVec 8 W64) = 1121+primOpTag (VecIndexScalarByteArrayOp WordVec 16 W8) = 1122+primOpTag (VecIndexScalarByteArrayOp WordVec 8 W16) = 1123+primOpTag (VecIndexScalarByteArrayOp WordVec 4 W32) = 1124+primOpTag (VecIndexScalarByteArrayOp WordVec 2 W64) = 1125+primOpTag (VecIndexScalarByteArrayOp WordVec 32 W8) = 1126+primOpTag (VecIndexScalarByteArrayOp WordVec 16 W16) = 1127+primOpTag (VecIndexScalarByteArrayOp WordVec 8 W32) = 1128+primOpTag (VecIndexScalarByteArrayOp WordVec 4 W64) = 1129+primOpTag (VecIndexScalarByteArrayOp WordVec 64 W8) = 1130+primOpTag (VecIndexScalarByteArrayOp WordVec 32 W16) = 1131+primOpTag (VecIndexScalarByteArrayOp WordVec 16 W32) = 1132+primOpTag (VecIndexScalarByteArrayOp WordVec 8 W64) = 1133+primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W32) = 1134+primOpTag (VecIndexScalarByteArrayOp FloatVec 2 W64) = 1135+primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W32) = 1136+primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W64) = 1137+primOpTag (VecIndexScalarByteArrayOp FloatVec 16 W32) = 1138+primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W64) = 1139+primOpTag (VecReadScalarByteArrayOp IntVec 16 W8) = 1140+primOpTag (VecReadScalarByteArrayOp IntVec 8 W16) = 1141+primOpTag (VecReadScalarByteArrayOp IntVec 4 W32) = 1142+primOpTag (VecReadScalarByteArrayOp IntVec 2 W64) = 1143+primOpTag (VecReadScalarByteArrayOp IntVec 32 W8) = 1144+primOpTag (VecReadScalarByteArrayOp IntVec 16 W16) = 1145+primOpTag (VecReadScalarByteArrayOp IntVec 8 W32) = 1146+primOpTag (VecReadScalarByteArrayOp IntVec 4 W64) = 1147+primOpTag (VecReadScalarByteArrayOp IntVec 64 W8) = 1148+primOpTag (VecReadScalarByteArrayOp IntVec 32 W16) = 1149+primOpTag (VecReadScalarByteArrayOp IntVec 16 W32) = 1150+primOpTag (VecReadScalarByteArrayOp IntVec 8 W64) = 1151+primOpTag (VecReadScalarByteArrayOp WordVec 16 W8) = 1152+primOpTag (VecReadScalarByteArrayOp WordVec 8 W16) = 1153+primOpTag (VecReadScalarByteArrayOp WordVec 4 W32) = 1154+primOpTag (VecReadScalarByteArrayOp WordVec 2 W64) = 1155+primOpTag (VecReadScalarByteArrayOp WordVec 32 W8) = 1156+primOpTag (VecReadScalarByteArrayOp WordVec 16 W16) = 1157+primOpTag (VecReadScalarByteArrayOp WordVec 8 W32) = 1158+primOpTag (VecReadScalarByteArrayOp WordVec 4 W64) = 1159+primOpTag (VecReadScalarByteArrayOp WordVec 64 W8) = 1160+primOpTag (VecReadScalarByteArrayOp WordVec 32 W16) = 1161+primOpTag (VecReadScalarByteArrayOp WordVec 16 W32) = 1162+primOpTag (VecReadScalarByteArrayOp WordVec 8 W64) = 1163+primOpTag (VecReadScalarByteArrayOp FloatVec 4 W32) = 1164+primOpTag (VecReadScalarByteArrayOp FloatVec 2 W64) = 1165+primOpTag (VecReadScalarByteArrayOp FloatVec 8 W32) = 1166+primOpTag (VecReadScalarByteArrayOp FloatVec 4 W64) = 1167+primOpTag (VecReadScalarByteArrayOp FloatVec 16 W32) = 1168+primOpTag (VecReadScalarByteArrayOp FloatVec 8 W64) = 1169+primOpTag (VecWriteScalarByteArrayOp IntVec 16 W8) = 1170+primOpTag (VecWriteScalarByteArrayOp IntVec 8 W16) = 1171+primOpTag (VecWriteScalarByteArrayOp IntVec 4 W32) = 1172+primOpTag (VecWriteScalarByteArrayOp IntVec 2 W64) = 1173+primOpTag (VecWriteScalarByteArrayOp IntVec 32 W8) = 1174+primOpTag (VecWriteScalarByteArrayOp IntVec 16 W16) = 1175+primOpTag (VecWriteScalarByteArrayOp IntVec 8 W32) = 1176+primOpTag (VecWriteScalarByteArrayOp IntVec 4 W64) = 1177+primOpTag (VecWriteScalarByteArrayOp IntVec 64 W8) = 1178+primOpTag (VecWriteScalarByteArrayOp IntVec 32 W16) = 1179+primOpTag (VecWriteScalarByteArrayOp IntVec 16 W32) = 1180+primOpTag (VecWriteScalarByteArrayOp IntVec 8 W64) = 1181+primOpTag (VecWriteScalarByteArrayOp WordVec 16 W8) = 1182+primOpTag (VecWriteScalarByteArrayOp WordVec 8 W16) = 1183+primOpTag (VecWriteScalarByteArrayOp WordVec 4 W32) = 1184+primOpTag (VecWriteScalarByteArrayOp WordVec 2 W64) = 1185+primOpTag (VecWriteScalarByteArrayOp WordVec 32 W8) = 1186+primOpTag (VecWriteScalarByteArrayOp WordVec 16 W16) = 1187+primOpTag (VecWriteScalarByteArrayOp WordVec 8 W32) = 1188+primOpTag (VecWriteScalarByteArrayOp WordVec 4 W64) = 1189+primOpTag (VecWriteScalarByteArrayOp WordVec 64 W8) = 1190+primOpTag (VecWriteScalarByteArrayOp WordVec 32 W16) = 1191+primOpTag (VecWriteScalarByteArrayOp WordVec 16 W32) = 1192+primOpTag (VecWriteScalarByteArrayOp WordVec 8 W64) = 1193+primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W32) = 1194+primOpTag (VecWriteScalarByteArrayOp FloatVec 2 W64) = 1195+primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W32) = 1196+primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W64) = 1197+primOpTag (VecWriteScalarByteArrayOp FloatVec 16 W32) = 1198+primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W64) = 1199+primOpTag (VecIndexScalarOffAddrOp IntVec 16 W8) = 1200+primOpTag (VecIndexScalarOffAddrOp IntVec 8 W16) = 1201+primOpTag (VecIndexScalarOffAddrOp IntVec 4 W32) = 1202+primOpTag (VecIndexScalarOffAddrOp IntVec 2 W64) = 1203+primOpTag (VecIndexScalarOffAddrOp IntVec 32 W8) = 1204+primOpTag (VecIndexScalarOffAddrOp IntVec 16 W16) = 1205+primOpTag (VecIndexScalarOffAddrOp IntVec 8 W32) = 1206+primOpTag (VecIndexScalarOffAddrOp IntVec 4 W64) = 1207+primOpTag (VecIndexScalarOffAddrOp IntVec 64 W8) = 1208+primOpTag (VecIndexScalarOffAddrOp IntVec 32 W16) = 1209+primOpTag (VecIndexScalarOffAddrOp IntVec 16 W32) = 1210+primOpTag (VecIndexScalarOffAddrOp IntVec 8 W64) = 1211+primOpTag (VecIndexScalarOffAddrOp WordVec 16 W8) = 1212+primOpTag (VecIndexScalarOffAddrOp WordVec 8 W16) = 1213+primOpTag (VecIndexScalarOffAddrOp WordVec 4 W32) = 1214+primOpTag (VecIndexScalarOffAddrOp WordVec 2 W64) = 1215+primOpTag (VecIndexScalarOffAddrOp WordVec 32 W8) = 1216+primOpTag (VecIndexScalarOffAddrOp WordVec 16 W16) = 1217+primOpTag (VecIndexScalarOffAddrOp WordVec 8 W32) = 1218+primOpTag (VecIndexScalarOffAddrOp WordVec 4 W64) = 1219+primOpTag (VecIndexScalarOffAddrOp WordVec 64 W8) = 1220+primOpTag (VecIndexScalarOffAddrOp WordVec 32 W16) = 1221+primOpTag (VecIndexScalarOffAddrOp WordVec 16 W32) = 1222+primOpTag (VecIndexScalarOffAddrOp WordVec 8 W64) = 1223+primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W32) = 1224+primOpTag (VecIndexScalarOffAddrOp FloatVec 2 W64) = 1225+primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W32) = 1226+primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W64) = 1227+primOpTag (VecIndexScalarOffAddrOp FloatVec 16 W32) = 1228+primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W64) = 1229+primOpTag (VecReadScalarOffAddrOp IntVec 16 W8) = 1230+primOpTag (VecReadScalarOffAddrOp IntVec 8 W16) = 1231+primOpTag (VecReadScalarOffAddrOp IntVec 4 W32) = 1232+primOpTag (VecReadScalarOffAddrOp IntVec 2 W64) = 1233+primOpTag (VecReadScalarOffAddrOp IntVec 32 W8) = 1234+primOpTag (VecReadScalarOffAddrOp IntVec 16 W16) = 1235+primOpTag (VecReadScalarOffAddrOp IntVec 8 W32) = 1236+primOpTag (VecReadScalarOffAddrOp IntVec 4 W64) = 1237+primOpTag (VecReadScalarOffAddrOp IntVec 64 W8) = 1238+primOpTag (VecReadScalarOffAddrOp IntVec 32 W16) = 1239+primOpTag (VecReadScalarOffAddrOp IntVec 16 W32) = 1240+primOpTag (VecReadScalarOffAddrOp IntVec 8 W64) = 1241+primOpTag (VecReadScalarOffAddrOp WordVec 16 W8) = 1242+primOpTag (VecReadScalarOffAddrOp WordVec 8 W16) = 1243+primOpTag (VecReadScalarOffAddrOp WordVec 4 W32) = 1244+primOpTag (VecReadScalarOffAddrOp WordVec 2 W64) = 1245+primOpTag (VecReadScalarOffAddrOp WordVec 32 W8) = 1246+primOpTag (VecReadScalarOffAddrOp WordVec 16 W16) = 1247+primOpTag (VecReadScalarOffAddrOp WordVec 8 W32) = 1248+primOpTag (VecReadScalarOffAddrOp WordVec 4 W64) = 1249+primOpTag (VecReadScalarOffAddrOp WordVec 64 W8) = 1250+primOpTag (VecReadScalarOffAddrOp WordVec 32 W16) = 1251+primOpTag (VecReadScalarOffAddrOp WordVec 16 W32) = 1252+primOpTag (VecReadScalarOffAddrOp WordVec 8 W64) = 1253+primOpTag (VecReadScalarOffAddrOp FloatVec 4 W32) = 1254+primOpTag (VecReadScalarOffAddrOp FloatVec 2 W64) = 1255+primOpTag (VecReadScalarOffAddrOp FloatVec 8 W32) = 1256+primOpTag (VecReadScalarOffAddrOp FloatVec 4 W64) = 1257+primOpTag (VecReadScalarOffAddrOp FloatVec 16 W32) = 1258+primOpTag (VecReadScalarOffAddrOp FloatVec 8 W64) = 1259+primOpTag (VecWriteScalarOffAddrOp IntVec 16 W8) = 1260+primOpTag (VecWriteScalarOffAddrOp IntVec 8 W16) = 1261+primOpTag (VecWriteScalarOffAddrOp IntVec 4 W32) = 1262+primOpTag (VecWriteScalarOffAddrOp IntVec 2 W64) = 1263+primOpTag (VecWriteScalarOffAddrOp IntVec 32 W8) = 1264+primOpTag (VecWriteScalarOffAddrOp IntVec 16 W16) = 1265+primOpTag (VecWriteScalarOffAddrOp IntVec 8 W32) = 1266+primOpTag (VecWriteScalarOffAddrOp IntVec 4 W64) = 1267+primOpTag (VecWriteScalarOffAddrOp IntVec 64 W8) = 1268+primOpTag (VecWriteScalarOffAddrOp IntVec 32 W16) = 1269+primOpTag (VecWriteScalarOffAddrOp IntVec 16 W32) = 1270+primOpTag (VecWriteScalarOffAddrOp IntVec 8 W64) = 1271+primOpTag (VecWriteScalarOffAddrOp WordVec 16 W8) = 1272+primOpTag (VecWriteScalarOffAddrOp WordVec 8 W16) = 1273+primOpTag (VecWriteScalarOffAddrOp WordVec 4 W32) = 1274+primOpTag (VecWriteScalarOffAddrOp WordVec 2 W64) = 1275+primOpTag (VecWriteScalarOffAddrOp WordVec 32 W8) = 1276+primOpTag (VecWriteScalarOffAddrOp WordVec 16 W16) = 1277+primOpTag (VecWriteScalarOffAddrOp WordVec 8 W32) = 1278+primOpTag (VecWriteScalarOffAddrOp WordVec 4 W64) = 1279+primOpTag (VecWriteScalarOffAddrOp WordVec 64 W8) = 1280+primOpTag (VecWriteScalarOffAddrOp WordVec 32 W16) = 1281+primOpTag (VecWriteScalarOffAddrOp WordVec 16 W32) = 1282+primOpTag (VecWriteScalarOffAddrOp WordVec 8 W64) = 1283+primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W32) = 1284+primOpTag (VecWriteScalarOffAddrOp FloatVec 2 W64) = 1285+primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W32) = 1286+primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W64) = 1287+primOpTag (VecWriteScalarOffAddrOp FloatVec 16 W32) = 1288+primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W64) = 1289+primOpTag PrefetchByteArrayOp3 = 1290+primOpTag PrefetchMutableByteArrayOp3 = 1291+primOpTag PrefetchAddrOp3 = 1292+primOpTag PrefetchValueOp3 = 1293+primOpTag PrefetchByteArrayOp2 = 1294+primOpTag PrefetchMutableByteArrayOp2 = 1295+primOpTag PrefetchAddrOp2 = 1296+primOpTag PrefetchValueOp2 = 1297+primOpTag PrefetchByteArrayOp1 = 1298+primOpTag PrefetchMutableByteArrayOp1 = 1299+primOpTag PrefetchAddrOp1 = 1300+primOpTag PrefetchValueOp1 = 1301+primOpTag PrefetchByteArrayOp0 = 1302+primOpTag PrefetchMutableByteArrayOp0 = 1303+primOpTag PrefetchAddrOp0 = 1304+primOpTag PrefetchValueOp0 = 1305
ghc-lib/stage0/lib/settings view
@@ -10,7 +10,6 @@ ,("ld command", "ld") ,("ld flags", "") ,("ld supports compact unwind", "YES")-,("ld supports build-id", "NO") ,("ld supports filelist", "YES") ,("ld is GNU ld", "NO") ,("Merge objects command", "ld")
ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs view
@@ -3,19 +3,19 @@ import Prelude -- See Note [Why do we import Prelude here?] cProjectGitCommitId :: String-cProjectGitCommitId = "fc23b5ed0f7924308040bf4163fc0a6da176feed"+cProjectGitCommitId = "7d3a055d4df6842f8fbcfbc1ca96e2a45a47d351" cProjectVersion :: String-cProjectVersion = "9.5.20220728"+cProjectVersion = "9.5.20220901" cProjectVersionInt :: String cProjectVersionInt = "905" cProjectPatchLevel :: String-cProjectPatchLevel = "20220728"+cProjectPatchLevel = "20220901" cProjectPatchLevel1 :: String-cProjectPatchLevel1 = "20220728"+cProjectPatchLevel1 = "20220901" cProjectPatchLevel2 :: String cProjectPatchLevel2 = "0"
ghc-lib/stage0/rts/build/include/GhclibDerivedConstants.h view
@@ -1,6 +1,6 @@ /* This file is created automatically. Do not edit by hand.*/ -#define HS_CONSTANTS "291,1,2,4096,252,9,0,8,16,24,32,40,48,56,64,72,80,84,88,92,96,100,104,112,120,128,136,144,152,168,184,200,216,232,248,280,312,344,376,408,440,504,568,632,696,760,824,832,840,848,856,864,872,888,904,-24,-16,-8,24,0,8,48,46,96,72,8,48,8,8,16,8,64,8,16,8,0,72,56,8,16,0,8,8,0,8,0,96,112,16,8,16,0,4,4,24,20,4,15,7,1,-16,255,0,255,7,10,6,6,1,6,6,6,6,6,0,16384,21,1024,8,4,8,8,6,3,30,1152921503533105152,0,1152921504606846976,1"+#define HS_CONSTANTS "291,1,2,4096,252,9,0,8,16,24,32,40,48,56,64,72,80,84,88,92,96,100,104,112,120,128,136,144,152,168,184,200,216,232,248,280,312,344,376,408,440,504,568,632,696,760,824,832,840,848,856,864,872,888,904,-24,-16,-8,24,0,8,48,46,96,72,8,48,8,8,16,8,64,8,16,8,0,72,56,8,16,0,8,8,0,8,0,104,120,16,8,16,0,4,4,24,20,4,15,7,1,-16,255,0,255,7,10,6,6,1,6,6,6,6,6,0,16384,21,1024,8,4,8,8,6,3,30,1152921503533105152,0,1152921504606846976,1" #define CONTROL_GROUP_CONST_291 291 #define STD_HDR_SIZE 1 #define PROF_HDR_SIZE 2@@ -210,7 +210,7 @@ #define OFFSET_StgTSO_block_info 32 #define REP_StgTSO_block_info b64 #define StgTSO_block_info(__ptr__) REP_StgTSO_block_info[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_block_info]-#define OFFSET_StgTSO_blocked_exceptions 80+#define OFFSET_StgTSO_blocked_exceptions 88 #define REP_StgTSO_blocked_exceptions b64 #define StgTSO_blocked_exceptions(__ptr__) REP_StgTSO_blocked_exceptions[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_blocked_exceptions] #define OFFSET_StgTSO_id 40@@ -231,13 +231,16 @@ #define OFFSET_StgTSO_dirty 52 #define REP_StgTSO_dirty b32 #define StgTSO_dirty(__ptr__) REP_StgTSO_dirty[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_dirty]-#define OFFSET_StgTSO_bq 88+#define OFFSET_StgTSO_bq 96 #define REP_StgTSO_bq b64 #define StgTSO_bq(__ptr__) REP_StgTSO_bq[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_bq]-#define OFFSET_StgTSO_alloc_limit 96+#define OFFSET_StgTSO_label 80+#define REP_StgTSO_label b64+#define StgTSO_label(__ptr__) REP_StgTSO_label[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_label]+#define OFFSET_StgTSO_alloc_limit 104 #define REP_StgTSO_alloc_limit b64 #define StgTSO_alloc_limit(__ptr__) REP_StgTSO_alloc_limit[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_alloc_limit]-#define OFFSET_StgTSO_cccs 112+#define OFFSET_StgTSO_cccs 120 #define REP_StgTSO_cccs b64 #define StgTSO_cccs(__ptr__) REP_StgTSO_cccs[__ptr__+SIZEOF_StgHeader+OFFSET_StgTSO_cccs] #define OFFSET_StgTSO_stackobj 16
libraries/ghc-heap/GHC/Exts/Heap.hs view
@@ -350,7 +350,7 @@ [p] -> Just p _ -> error $ "Expected 4 or 5 words in WEAK, found " ++ show (length pts) }- TSO | [ u_lnk, u_gbl_lnk, tso_stack, u_trec, u_blk_ex, u_bq] <- pts+ TSO | ( u_lnk : u_gbl_lnk : tso_stack : u_trec : u_blk_ex : u_bq : other) <- pts -> withArray rawHeapWords (\ptr -> do fields <- FFIClosures.peekTSOFields decodeCCS ptr pure $ TSOClosure@@ -361,6 +361,10 @@ , trec = u_trec , blocked_exceptions = u_blk_ex , bq = u_bq+ , thread_label = case other of+ [tl] -> Just tl+ [] -> Nothing+ _ -> error $ "thead_label:Expected 0 or 1 extra arguments" , what_next = FFIClosures.tso_what_next fields , why_blocked = FFIClosures.tso_why_blocked fields , flags = FFIClosures.tso_flags fields@@ -372,7 +376,7 @@ , prof = FFIClosures.tso_prof fields }) | otherwise- -> fail $ "Expected 6 ptr arguments to TSO, found "+ -> fail $ "Expected at least 6 ptr arguments to TSO, found " ++ show (length pts) STACK | [] <- pts
libraries/ghc-heap/GHC/Exts/Heap/Closures.hs view
@@ -280,6 +280,7 @@ , trec :: !b , blocked_exceptions :: !b , bq :: !b+ , thread_label :: !(Maybe b) -- values , what_next :: !WhatNext , why_blocked :: !WhyBlocked
libraries/ghci/GHCi/Message.hs view
@@ -465,7 +465,7 @@ #define MIN_VERSION_ghc_heap(major1,major2,minor) (\ (major1) < 9 || \ (major1) == 9 && (major2) < 5 || \- (major1) == 9 && (major2) == 5 && (minor) <= 20220728)+ (major1) == 9 && (major2) == 5 && (minor) <= 20220901) #endif /* MIN_VERSION_ghc_heap */ #if MIN_VERSION_ghc_heap(8,11,0) instance Binary Heap.StgTSOProfInfo
libraries/template-haskell/Language/Haskell/TH/Ppr.hs view
@@ -23,10 +23,12 @@ nestDepth = 4 type Precedence = Int-appPrec, opPrec, unopPrec, sigPrec, noPrec :: Precedence-appPrec = 4 -- Argument of a function application-opPrec = 3 -- Argument of an infix operator-unopPrec = 2 -- Argument of an unresolved infix operator+appPrec, opPrec, unopPrec, funPrec, qualPrec, sigPrec, noPrec :: Precedence+appPrec = 6 -- Argument of a function or type application+opPrec = 5 -- Argument of an infix operator+unopPrec = 4 -- Argument of an unresolved infix operator+funPrec = 3 -- Argument of a function arrow+qualPrec = 2 -- Forall-qualified type or result of a function arrow sigPrec = 1 -- Argument of an explicit type signature noPrec = 0 -- Others @@ -220,7 +222,7 @@ pprExp _ (ArithSeqE d) = ppr d pprExp _ (ListE es) = brackets (commaSep es) pprExp i (SigE e t) = parensIf (i > noPrec) $ pprExp sigPrec e- <+> dcolon <+> ppr t+ <+> dcolon <+> pprType sigPrec t pprExp _ (RecConE nm fs) = pprName' Applied nm <> braces (pprFields fs) pprExp _ (RecUpdE e fs) = pprExp appPrec e <> braces (pprFields fs) pprExp i (StaticE e) = parensIf (i >= appPrec) $@@ -792,60 +794,63 @@ pprStrictType = pprBangType -------------------------------pprParendType :: Type -> Doc-pprParendType (VarT v) = pprName' Applied v+pprType :: Precedence -> Type -> Doc+pprType _ (VarT v) = pprName' Applied v -- `Applied` is used here instead of `ppr` because of infix names (#13887)-pprParendType (ConT c) = pprName' Applied c-pprParendType (TupleT 0) = text "()"-pprParendType (TupleT 1) = pprParendType (ConT (tupleTypeName 1))-pprParendType (TupleT n) = parens (hcat (replicate (n-1) comma))-pprParendType (UnboxedTupleT n) = hashParens $ hcat $ replicate (n-1) comma-pprParendType (UnboxedSumT arity) = hashParens $ hcat $ replicate (arity-1) bar-pprParendType ArrowT = parens (text "->")-pprParendType MulArrowT = text "FUN"-pprParendType ListT = text "[]"-pprParendType (LitT l) = pprTyLit l-pprParendType (PromotedT c) = text "'" <> pprName' Applied c-pprParendType (PromotedTupleT 0) = text "'()"-pprParendType (PromotedTupleT 1) = pprParendType (PromotedT (tupleDataName 1))-pprParendType (PromotedTupleT n) = quoteParens (hcat (replicate (n-1) comma))-pprParendType PromotedNilT = text "'[]"-pprParendType PromotedConsT = text "'(:)"-pprParendType StarT = char '*'-pprParendType ConstraintT = text "Constraint"-pprParendType (SigT ty k) = parens (ppr ty <+> text "::" <+> ppr k)-pprParendType WildCardT = char '_'-pprParendType t@(InfixT {}) = parens (pprInfixT t)-pprParendType t@(UInfixT {}) = parens (pprInfixT t)-pprParendType t@(PromotedInfixT {}) = parens (pprInfixT t)-pprParendType t@(PromotedUInfixT {}) = parens (pprInfixT t)-pprParendType (ParensT t) = ppr t-pprParendType tuple | (TupleT n, args) <- split tuple- , length args == n- = parens (commaSep args)-pprParendType (ImplicitParamT n t) = text ('?':n) <+> text "::" <+> ppr t-pprParendType EqualityT = text "(~)"-pprParendType t@(ForallT {}) = parens (ppr t)-pprParendType t@(ForallVisT {}) = parens (ppr t)-pprParendType t@(AppT {}) = parens (ppr t)-pprParendType t@(AppKindT {}) = parens (ppr t)+pprType _ (ConT c) = pprName' Applied c+pprType _ (TupleT 0) = text "()"+pprType p (TupleT 1) = pprType p (ConT (tupleTypeName 1))+pprType _ (TupleT n) = parens (hcat (replicate (n-1) comma))+pprType _ (UnboxedTupleT n) = hashParens $ hcat $ replicate (n-1) comma+pprType _ (UnboxedSumT arity) = hashParens $ hcat $ replicate (arity-1) bar+pprType _ ArrowT = parens (text "->")+pprType _ MulArrowT = text "FUN"+pprType _ ListT = text "[]"+pprType _ (LitT l) = pprTyLit l+pprType _ (PromotedT c) = text "'" <> pprName' Applied c+pprType _ (PromotedTupleT 0) = text "'()"+pprType p (PromotedTupleT 1) = pprType p (PromotedT (tupleDataName 1))+pprType _ (PromotedTupleT n) = quoteParens (hcat (replicate (n-1) comma))+pprType _ PromotedNilT = text "'[]"+pprType _ PromotedConsT = text "'(:)"+pprType _ StarT = char '*'+pprType _ ConstraintT = text "Constraint"+pprType _ (SigT ty k) = parens (ppr ty <+> text "::" <+> ppr k)+pprType _ WildCardT = char '_'+pprType p t@(InfixT {}) = pprInfixT p t+pprType p t@(UInfixT {}) = pprInfixT p t+pprType p t@(PromotedInfixT {}) = pprInfixT p t+pprType p t@(PromotedUInfixT {}) = pprInfixT p t+pprType _ (ParensT t) = parens (pprType noPrec t)+pprType p (ImplicitParamT n ty) =+ parensIf (p >= sigPrec) $ text ('?':n) <+> text "::" <+> pprType sigPrec ty+pprType _ EqualityT = text "(~)"+pprType p (ForallT tvars ctxt ty) =+ parensIf (p >= funPrec) $ sep [pprForall tvars ctxt, pprType qualPrec ty]+pprType p (ForallVisT tvars ty) =+ parensIf (p >= funPrec) $ sep [pprForallVis tvars [], pprType qualPrec ty]+pprType p t@AppT{} = pprTyApp p (split t)+pprType p t@AppKindT{} = pprTyApp p (split t) -pprInfixT :: Type -> Doc-pprInfixT = \case- (InfixT x n y) -> with x n y "" ppr- (UInfixT x n y) -> with x n y "" pprInfixT- (PromotedInfixT x n y) -> with x n y "'" ppr- (PromotedUInfixT x n y) -> with x n y "'" pprInfixT- t -> ppr t+------------------------------+pprParendType :: Type -> Doc+pprParendType = pprType appPrec++pprInfixT :: Precedence -> Type -> Doc+pprInfixT p = \case+ InfixT x n y -> with x n y "" opPrec+ UInfixT x n y -> with x n y "" unopPrec+ PromotedInfixT x n y -> with x n y "'" opPrec+ PromotedUInfixT x n y -> with x n y "'" unopPrec+ t -> pprParendType t where- with x n y prefix ppr' = ppr' x <+> text prefix <> pprName' Infix n <+> ppr' y+ with x n y prefix p' =+ parensIf+ (p >= p')+ (pprType opPrec x <+> text prefix <> pprName' Infix n <+> pprType opPrec y) instance Ppr Type where- ppr (ForallT tvars ctxt ty) = sep [pprForall tvars ctxt, ppr ty]- ppr (ForallVisT tvars ty) = sep [pprForallVis tvars [], ppr ty]- ppr ty = pprTyApp (split ty)- -- Works, in a degenerate way, for SigT, and puts parens round (ty :: kind)- -- See Note [Pretty-printing kind signatures]+ ppr = pprType noPrec instance Ppr TypeArg where ppr (TANormal ty) = parensIf (isStarT ty) (ppr ty) ppr (TyArg ki) = char '@' <> parensIf (isStarT ki) (ppr ki)@@ -866,38 +871,40 @@ type instance F Int = (Bool :: *) So we always print a SigT with parens (see #10050). -} -pprTyApp :: (Type, [TypeArg]) -> Doc-pprTyApp (MulArrowT, [TANormal (PromotedT c), TANormal arg1, TANormal arg2])- | c == oneName = sep [pprFunArgType arg1 <+> text "%1 ->", ppr arg2]- | c == manyName = sep [pprFunArgType arg1 <+> text "->", ppr arg2]-pprTyApp (MulArrowT, [TANormal argm, TANormal arg1, TANormal arg2]) =- sep [pprFunArgType arg1 <+> text "%" <> ppr argm <+> text "->", ppr arg2]-pprTyApp (ArrowT, [TANormal arg1, TANormal arg2]) = sep [pprFunArgType arg1 <+> text "->", ppr arg2]-pprTyApp (EqualityT, [TANormal arg1, TANormal arg2]) =- sep [pprFunArgType arg1 <+> text "~", ppr arg2]-pprTyApp (ListT, [TANormal arg]) = brackets (ppr arg)-pprTyApp (TupleT 1, args) = pprTyApp (ConT (tupleTypeName 1), args)-pprTyApp (PromotedTupleT 1, args) = pprTyApp (PromotedT (tupleDataName 1), args)-pprTyApp (TupleT n, args)+pprTyApp :: Precedence -> (Type, [TypeArg]) -> Doc+pprTyApp p app@(MulArrowT, [TANormal (PromotedT c), TANormal arg1, TANormal arg2])+ | p >= funPrec = parens (pprTyApp noPrec app)+ | c == oneName = sep [pprFunArgType arg1 <+> text "%1 ->", pprType qualPrec arg2]+ | c == manyName = sep [pprFunArgType arg1 <+> text "->", pprType qualPrec arg2]+pprTyApp p (MulArrowT, [TANormal argm, TANormal arg1, TANormal arg2]) =+ parensIf (p >= funPrec) $+ sep [pprFunArgType arg1 <+> text "%" <> pprType appPrec argm <+> text "->",+ pprType qualPrec arg2]+pprTyApp p (ArrowT, [TANormal arg1, TANormal arg2]) =+ parensIf (p >= funPrec) $+ sep [pprFunArgType arg1 <+> text "->", pprType qualPrec arg2]+pprTyApp p (EqualityT, [TANormal arg1, TANormal arg2]) =+ parensIf (p >= opPrec) $+ sep [pprType opPrec arg1 <+> text "~", pprType opPrec arg2]+pprTyApp _ (ListT, [TANormal arg]) = brackets (pprType noPrec arg)+pprTyApp p (TupleT 1, args) = pprTyApp p (ConT (tupleTypeName 1), args)+pprTyApp _ (TupleT n, args) | length args == n, Just args' <- traverse fromTANormal args = parens (commaSep args')-pprTyApp (PromotedTupleT n, args)+pprTyApp p (PromotedTupleT 1, args) = pprTyApp p (PromotedT (tupleDataName 1), args)+pprTyApp _ (PromotedTupleT n, args) | length args == n, Just args' <- traverse fromTANormal args = quoteParens (commaSep args')-pprTyApp (fun, args) = pprParendType fun <+> sep (map pprParendTypeArg args)+pprTyApp p (fun, args) =+ parensIf (p >= appPrec) $ pprParendType fun <+> sep (map pprParendTypeArg args) fromTANormal :: TypeArg -> Maybe Type fromTANormal (TANormal arg) = Just arg fromTANormal (TyArg _) = Nothing -pprFunArgType :: Type -> Doc -- Should really use a precedence argument--- Everything except forall and (->) binds more tightly than (->)-pprFunArgType ty@(ForallT {}) = parens (ppr ty)-pprFunArgType ty@(ForallVisT {}) = parens (ppr ty)-pprFunArgType ty@(((MulArrowT `AppT` _) `AppT` _) `AppT` _) = parens (ppr ty)-pprFunArgType ty@((ArrowT `AppT` _) `AppT` _) = parens (ppr ty)-pprFunArgType ty@(SigT _ _) = parens (ppr ty)-pprFunArgType ty = ppr ty+-- Print the type to the left of @->@. Everything except forall and (->) binds more tightly than (->).+pprFunArgType :: Type -> Doc+pprFunArgType = pprType funPrec data ForallVisFlag = ForallVis -- forall a -> {...} | ForallInvis -- forall a. {...}