diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs
--- a/compiler/basicTypes/Id.hs
+++ b/compiler/basicTypes/Id.hs
@@ -524,9 +524,17 @@
 -- Data constructor workers used to be things of this kind, but
 -- they aren't any more.  Instead, we inject a binding for
 -- them at the CorePrep stage.
+--
+-- 'PrimOpId's also used to be of this kind. See Note [Primop wrappers] in PrimOp.hs.
+-- for the history of this.
+--
+-- Note that CorePrep currently eta expands things no-binding things and this
+-- can cause quite subtle bugs. See Note [Eta expansion of hasNoBinding things
+-- in CorePrep] in CorePrep for details.
+--
 -- EXCEPT: unboxed tuples, which definitely have no binding
 hasNoBinding id = case Var.idDetails id of
-                        PrimOpId _       -> True        -- See Note [Primop wrappers]
+                        PrimOpId _       -> False   -- See Note [Primop wrappers] in PrimOp.hs
                         FCallId _        -> True
                         DataConWorkId dc -> isUnboxedTupleCon dc || isUnboxedSumCon dc
                         _                -> isCompulsoryUnfolding (idUnfolding id)
@@ -567,22 +575,9 @@
 The desugar has special magic to detect such cases: DsExpr.badUseOfLevPolyPrimop.
 And we want that magic to apply to levity-polymorphic compulsory-inline things.
 The easiest way to do this is for hasNoBinding to return True of all things
-that have compulsory unfolding.  A very Ids with a compulsory unfolding also
+that have compulsory unfolding.  Some Ids with a compulsory unfolding also
 have a binding, but it does not harm to say they don't here, and its a very
 simple way to fix #14561.
-
-Note [Primop wrappers]
-~~~~~~~~~~~~~~~~~~~~~~
-Currently hasNoBinding claims that PrimOpIds don't have a curried
-function definition.  But actually they do, in GHC.PrimopWrappers,
-which is auto-generated from prelude/primops.txt.pp.  So actually, hasNoBinding
-could return 'False' for PrimOpIds.
-
-But we'd need to add something in CoreToStg to swizzle any unsaturated
-applications of GHC.Prim.plusInt# to GHC.PrimopWrappers.plusInt#.
-
-Nota Bene: GHC.PrimopWrappers is needed *regardless*, because it's
-used by GHCi, which does not implement primops direct at all.
 -}
 
 isDeadBinder :: Id -> Bool
diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs
--- a/compiler/basicTypes/Literal.hs
+++ b/compiler/basicTypes/Literal.hs
@@ -61,7 +61,7 @@
 import Binary
 import Constants
 import DynFlags
-import Platform
+import GHC.Platform
 import UniqFM
 import Util
 
diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs
--- a/compiler/basicTypes/MkId.hs
+++ b/compiler/basicTypes/MkId.hs
@@ -29,6 +29,7 @@
         nullAddrId, seqId, lazyId, lazyIdKey,
         coercionTokenId, magicDictId, coerceId,
         proxyHashId, noinlineId, noinlineIdName,
+        coerceName,
 
         -- Re-export error Ids
         module PrelRules
@@ -71,6 +72,7 @@
 import Outputable
 import FastString
 import ListSetOps
+import Var (VarBndr(Bndr))
 import qualified GHC.LanguageExtensions as LangExt
 
 import Data.Maybe       ( maybeToList )
@@ -298,6 +300,24 @@
 predicate (C a).  But now we treat that as an ordinary argument, not
 part of the theta-type, so all is well.
 
+Note [Newtype workers]
+~~~~~~~~~~~~~~~~~~~~~~
+A newtype does not really have a worker. Instead, newtype constructors
+just unfold into a cast. But we need *something* for, say, MkAge to refer
+to. So, we do this:
+
+* The Id used as the newtype worker will have a compulsory unfolding to
+  a cast. See Note [Compulsory newtype unfolding]
+
+* This Id is labeled as a DataConWrapId. We don't want to use a DataConWorkId,
+  as those have special treatment in the back end.
+
+* There is no top-level binding, because the compulsory unfolding
+  means that it will be inlined (to a cast) at every call site.
+
+We probably should have a NewtypeWorkId, but these Ids disappear as soon as
+we desugar anyway, so it seems a step too far.
+
 Note [Compulsory newtype unfolding]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Newtype wrappers, just like workers, have compulsory unfoldings.
@@ -320,6 +340,32 @@
     We'd like 'map Age' to match the LHS. For this to happen, Age
     must be unfolded, otherwise we'll be stuck. This is tested in T16208.
 
+It also allows for the posssibility of levity polymorphic newtypes
+with wrappers (with -XUnliftedNewtypes):
+
+  newtype N (a :: TYPE r) = MkN a
+
+With -XUnliftedNewtypes, this is allowed -- even though MkN is levity-
+polymorphic. It's OK because MkN evaporates in the compiled code, becoming
+just a cast. That is, it has a compulsory unfolding. As long as its
+argument is not levity-polymorphic (which it can't be, according to
+Note [Levity polymorphism invariants] in CoreSyn), and it's saturated,
+no levity-polymorphic code ends up in the code generator. The saturation
+condition is effectively checked by Note [Detecting forced eta expansion]
+in DsExpr.
+
+However, if we make a *wrapper* for a newtype, we get into trouble.
+The saturation condition is no longer checked (because hasNoBinding
+returns False) and indeed we generate a forbidden levity-polymorphic
+binding.
+
+The solution is simple, though: just make the newtype wrappers
+as ephemeral as the newtype workers. In other words, give the wrappers
+compulsory unfoldings and no bindings. The compulsory unfolding is given
+in wrap_unf in mkDataConRep, and the lack of a binding happens in
+TidyPgm.getTyConImplicitBinds, where we say that a newtype has no implicit
+bindings.
+
 ************************************************************************
 *                                                                      *
 \subsection{Dictionary selectors}
@@ -447,6 +493,8 @@
 mkDataConWorkId wkr_name data_con
   | isNewTyCon tycon
   = mkGlobalId (DataConWrapId data_con) wkr_name wkr_ty nt_work_info
+      -- See Note [Newtype workers]
+
   | otherwise
   = mkGlobalId (DataConWorkId data_con) wkr_name wkr_ty alg_wkr_info
 
@@ -575,6 +623,7 @@
    map (\a. case i of I# i# a -> Foo i# a) (f a)
 
 and now case-of-known-constructor eliminates the redundant allocation.
+
 -}
 
 mkDataConRep :: DynFlags
@@ -604,7 +653,7 @@
                              -- We need to get the CAF info right here because TidyPgm
                              -- does not tidy the IdInfo of implicit bindings (like the wrapper)
                              -- so it not make sure that the CAF info is sane
-                         `setNeverLevPoly`      wrap_ty
+                         `setLevityInfoWithType` wrap_ty
 
              wrap_sig = mkClosedStrictSig wrap_arg_dmds (dataConCPR data_con)
 
@@ -1403,19 +1452,23 @@
   where
     info = noCafIdInfo `setInlinePragInfo` alwaysInlinePragma
                        `setUnfoldingInfo`  mkCompulsoryUnfolding rhs
-                       `setNeverLevPoly`   ty
-    eqRTy     = mkTyConApp coercibleTyCon [ liftedTypeKind
-                                          , alphaTy, betaTy ]
-    eqRPrimTy = mkTyConApp eqReprPrimTyCon [ liftedTypeKind
-                                           , liftedTypeKind
-                                           , alphaTy, betaTy ]
-    ty        = mkSpecForAllTys [alphaTyVar, betaTyVar] $
-                mkInvisFunTy eqRTy                      $
-                mkVisFunTy alphaTy betaTy
+    eqRTy     = mkTyConApp coercibleTyCon [ tYPE r , a, b ]
+    eqRPrimTy = mkTyConApp eqReprPrimTyCon [ tYPE r, tYPE r, a, b ]
+    ty        = mkForAllTys [ Bndr rv Inferred
+                            , Bndr av Specified
+                            , Bndr bv Specified
+                            ] $
+                mkInvisFunTy eqRTy $
+                mkVisFunTy a b
 
-    [eqR,x,eq] = mkTemplateLocals [eqRTy, alphaTy, eqRPrimTy]
-    rhs = mkLams [alphaTyVar, betaTyVar, eqR, x] $
-          mkWildCase (Var eqR) eqRTy betaTy $
+    bndrs@[rv,av,bv] = mkTemplateKiTyVar runtimeRepTy
+                        (\r -> [tYPE r, tYPE r])
+
+    [r, a, b] = mkTyVarTys bndrs
+
+    [eqR,x,eq] = mkTemplateLocals [eqRTy, a, eqRPrimTy]
+    rhs = mkLams (bndrs ++ [eqR, x]) $
+          mkWildCase (Var eqR) eqRTy b $
           [(DataAlt coercibleDataCon, [eq], Cast (Var x) (mkCoVarCo eq))]
 
 {-
diff --git a/compiler/basicTypes/NameEnv.hs b/compiler/basicTypes/NameEnv.hs
--- a/compiler/basicTypes/NameEnv.hs
+++ b/compiler/basicTypes/NameEnv.hs
@@ -25,6 +25,7 @@
 
         emptyDNameEnv,
         lookupDNameEnv,
+        delFromDNameEnv,
         mapDNameEnv,
         alterDNameEnv,
         -- ** Dependency analysis
@@ -146,6 +147,9 @@
 
 lookupDNameEnv :: DNameEnv a -> Name -> Maybe a
 lookupDNameEnv = lookupUDFM
+
+delFromDNameEnv :: DNameEnv a -> Name -> DNameEnv a
+delFromDNameEnv = delFromUDFM
 
 mapDNameEnv :: (a -> b) -> DNameEnv a -> DNameEnv b
 mapDNameEnv = mapUDFM
diff --git a/compiler/basicTypes/PatSyn.hs b/compiler/basicTypes/PatSyn.hs
--- a/compiler/basicTypes/PatSyn.hs
+++ b/compiler/basicTypes/PatSyn.hs
@@ -19,7 +19,7 @@
         patSynInstArgTys, patSynInstResTy, patSynFieldLabels,
         patSynFieldType,
 
-        tidyPatSynIds, pprPatSynType
+        updatePatSynIds, pprPatSynType
     ) where
 
 #include "HsVersions.h"
@@ -417,8 +417,8 @@
 patSynBuilder :: PatSyn -> Maybe (Id, Bool)
 patSynBuilder = psBuilder
 
-tidyPatSynIds :: (Id -> Id) -> PatSyn -> PatSyn
-tidyPatSynIds tidy_fn ps@(MkPatSyn { psMatcher = matcher, psBuilder = builder })
+updatePatSynIds :: (Id -> Id) -> PatSyn -> PatSyn
+updatePatSynIds tidy_fn ps@(MkPatSyn { psMatcher = matcher, psBuilder = builder })
   = ps { psMatcher = tidy_pr matcher, psBuilder = fmap tidy_pr builder }
   where
     tidy_pr (id, dummy) = (tidy_fn id, dummy)
diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs
--- a/compiler/basicTypes/UniqSupply.hs
+++ b/compiler/basicTypes/UniqSupply.hs
@@ -4,7 +4,9 @@
 -}
 
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE BangPatterns #-}
 
 #if !defined(GHC_LOADED_INTO_GHCI)
 {-# LANGUAGE UnboxedTuples #-}
@@ -20,15 +22,12 @@
 
         mkSplitUniqSupply,
         splitUniqSupply, listSplitUniqSupply,
-        splitUniqSupply3, splitUniqSupply4,
 
         -- * Unique supply monad and its abstraction
-        UniqSM, MonadUnique(..), liftUs,
+        UniqSM, MonadUnique(..),
 
         -- ** Operations on the monad
         initUs, initUs_,
-        lazyThenUs, lazyMapUs,
-        getUniqueSupplyM3,
 
         -- * Set supply strategy
         initUniqSupply
@@ -87,7 +86,7 @@
 
 mkSplitUniqSupply c
   = case ord c `shiftL` uNIQUE_BITS of
-     mask -> let
+     !mask -> let
         -- here comes THE MAGIC:
 
         -- This is one of the most hammered bits in the whole compiler
@@ -112,22 +111,6 @@
 uniqsFromSupply (MkSplitUniqSupply n _ s2) = mkUniqueGrimily n : uniqsFromSupply s2
 takeUniqFromSupply (MkSplitUniqSupply n s1 _) = (mkUniqueGrimily n, s1)
 
--- | Build three 'UniqSupply' from a single one,
--- each of which can supply its own unique
-splitUniqSupply3 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply)
-splitUniqSupply3 us = (us1, us2, us3)
-  where
-    (us1, us') = splitUniqSupply us
-    (us2, us3) = splitUniqSupply us'
-
--- | Build four 'UniqSupply' from a single one,
--- each of which can supply its own unique
-splitUniqSupply4 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply, UniqSupply)
-splitUniqSupply4 us = (us1, us2, us3, us4)
-  where
-    (us1, us2, us') = splitUniqSupply3 us
-    (us3, us4)      = splitUniqSupply us'
-
 {-
 ************************************************************************
 *                                                                      *
@@ -148,20 +131,18 @@
 #else
 
 data UniqResult result = UniqResult !result {-# UNPACK #-} !UniqSupply
+  deriving (Functor)
 
 #endif
 
 -- | A monad which just gives the ability to obtain 'Unique's
 newtype UniqSM result = USM { unUSM :: UniqSupply -> UniqResult result }
+    deriving (Functor)
 
 instance Monad UniqSM where
   (>>=) = thenUs
   (>>)  = (*>)
 
-instance Functor UniqSM where
-    fmap f (USM x) = USM (\us0 -> case x us0 of
-                                 UniqResult r us1 -> UniqResult (f r) us1)
-
 instance Applicative UniqSM where
     pure = returnUs
     (USM f) <*> (USM x) = USM $ \us0 -> case f us0 of
@@ -182,7 +163,6 @@
 initUs_ init_us m = case unUSM m init_us of { UniqResult r _ -> r }
 
 {-# INLINE thenUs #-}
-{-# INLINE lazyThenUs #-}
 {-# INLINE returnUs #-}
 {-# INLINE splitUniqSupply #-}
 
@@ -199,10 +179,6 @@
   = USM (\us0 -> case (expr us0) of
                    UniqResult result us1 -> unUSM (cont result) us1)
 
-lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b
-lazyThenUs expr cont
-  = USM (\us0 -> let (result, us1) = liftUSM expr us0 in unUSM (cont result) us1)
-
 thenUs_ :: UniqSM a -> UniqSM b -> UniqSM b
 thenUs_ (USM expr) (USM cont)
   = USM (\us0 -> case (expr us0) of { UniqResult _ us1 -> cont us1 })
@@ -234,12 +210,6 @@
     getUniqueM  = getUniqueUs
     getUniquesM = getUniquesUs
 
-getUniqueSupplyM3 :: MonadUnique m => m (UniqSupply, UniqSupply, UniqSupply)
-getUniqueSupplyM3 = liftM3 (,,) getUniqueSupplyM getUniqueSupplyM getUniqueSupplyM
-
-liftUs :: MonadUnique m => UniqSM a -> m a
-liftUs m = getUniqueSupplyM >>= return . flip initUs_ m
-
 getUniqueUs :: UniqSM Unique
 getUniqueUs = USM (\us0 -> case takeUniqFromSupply us0 of
                            (u,us1) -> UniqResult u us1)
@@ -247,14 +217,3 @@
 getUniquesUs :: UniqSM [Unique]
 getUniquesUs = USM (\us0 -> case splitUniqSupply us0 of
                             (us1,us2) -> UniqResult (uniqsFromSupply us1) us2)
-
--- {-# SPECIALIZE mapM          :: (a -> UniqSM b) -> [a] -> UniqSM [b] #-}
--- {-# SPECIALIZE mapAndUnzipM  :: (a -> UniqSM (b,c))   -> [a] -> UniqSM ([b],[c]) #-}
--- {-# SPECIALIZE mapAndUnzip3M :: (a -> UniqSM (b,c,d)) -> [a] -> UniqSM ([b],[c],[d]) #-}
-
-lazyMapUs :: (a -> UniqSM b) -> [a] -> UniqSM [b]
-lazyMapUs _ []     = returnUs []
-lazyMapUs f (x:xs)
-  = f x             `lazyThenUs` \ r  ->
-    lazyMapUs f xs  `lazyThenUs` \ rs ->
-    returnUs (r:rs)
diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs
--- a/compiler/basicTypes/Unique.hs
+++ b/compiler/basicTypes/Unique.hs
@@ -46,7 +46,7 @@
         -- now all the built-in Uniques (and functions to make them)
         -- [the Oh-So-Wonderful Haskell module system wins again...]
         mkAlphaTyVarUnique,
-        mkPrimOpIdUnique,
+        mkPrimOpIdUnique, mkPrimOpWrapperUnique,
         mkPreludeMiscIdUnique, mkPreludeDataConUnique,
         mkPreludeTyConUnique, mkPreludeClassUnique,
         mkCoVarUnique,
@@ -368,6 +368,8 @@
 mkPreludeTyConUnique   :: Int -> Unique
 mkPreludeDataConUnique :: Arity -> Unique
 mkPrimOpIdUnique       :: Int -> Unique
+-- See Note [Primop wrappers] in PrimOp.hs.
+mkPrimOpWrapperUnique  :: Int -> Unique
 mkPreludeMiscIdUnique  :: Int -> Unique
 mkCoVarUnique          :: Int -> Unique
 
@@ -405,7 +407,8 @@
 dataConTyRepNameUnique u = stepUnique u 2
 
 --------------------------------------------------
-mkPrimOpIdUnique op         = mkUnique '9' op
+mkPrimOpIdUnique op         = mkUnique '9' (2*op)
+mkPrimOpWrapperUnique op    = mkUnique '9' (2*op+1)
 mkPreludeMiscIdUnique  i    = mkUnique '0' i
 
 -- The "tyvar uniques" print specially nicely: a, b, c, etc.
diff --git a/compiler/cmm/CmmType.hs b/compiler/cmm/CmmType.hs
--- a/compiler/cmm/CmmType.hs
+++ b/compiler/cmm/CmmType.hs
@@ -6,6 +6,7 @@
     , typeWidth, cmmEqType, cmmEqType_ignoring_ptrhood
     , isFloatType, isGcPtrType, isBitsType
     , isWord32, isWord64, isFloat64, isFloat32
+    , isVecCatType
 
     , Width(..)
     , widthInBits, widthInBytes, widthInLog, widthFromBytes
@@ -133,7 +134,7 @@
 cInt dflags = cmmBits (cIntWidth  dflags)
 
 ------------ Predicates ----------------
-isFloatType, isGcPtrType, isBitsType :: CmmType -> Bool
+isFloatType, isGcPtrType, isBitsType, isVecCatType :: CmmType -> Bool
 isFloatType (CmmType FloatCat    _) = True
 isFloatType _other                  = False
 
@@ -142,6 +143,9 @@
 
 isBitsType (CmmType BitsCat _) = True
 isBitsType _                   = False
+
+isVecCatType (CmmType (VecCat _ _) _) = True
+isVecCatType _other                   = False
 
 isWord32, isWord64, isFloat32, isFloat64 :: CmmType -> Bool
 -- isWord64 is true of 64-bit non-floats (both gc-ptrs and otherwise)
diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs
--- a/compiler/coreSyn/CoreArity.hs
+++ b/compiler/coreSyn/CoreArity.hs
@@ -694,7 +694,7 @@
                            False -> \s(one-shot). e1
            in go2 x
 We *really* want to eta-expand go and go2.
-When combining the barnches of the case we have
+When combining the branches of the case we have
      ATop [] `andAT` ATop [OneShotLam]
 and we want to get ATop [OneShotLam].  But if the inner
 lambda wasn't one-shot we don't want to do this.
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs
--- a/compiler/coreSyn/CoreSyn.hs
+++ b/compiler/coreSyn/CoreSyn.hs
@@ -445,6 +445,9 @@
 The let/app invariant is initially enforced by mkCoreLet and mkCoreApp in
 coreSyn/MkCore.
 
+For discussion of some implications of the let/app invariant primops see
+Note [Checking versus non-checking primops] in PrimOp.
+
 Note [CoreSyn type and coercion invariant]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 We allow a /non-recursive/, /non-top-level/ let to bind type and
diff --git a/compiler/coreSyn/CoreTidy.hs b/compiler/coreSyn/CoreTidy.hs
--- a/compiler/coreSyn/CoreTidy.hs
+++ b/compiler/coreSyn/CoreTidy.hs
@@ -9,7 +9,7 @@
 
 {-# LANGUAGE CPP #-}
 module CoreTidy (
-        tidyExpr, tidyVarOcc, tidyRule, tidyRules, tidyUnfolding
+        tidyExpr, tidyRule, tidyRules, tidyUnfolding
     ) where
 
 #include "HsVersions.h"
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -88,7 +88,7 @@
 import Maybes
 import ListSetOps       ( minusList )
 import BasicTypes       ( Arity, isConLike )
-import Platform
+import GHC.Platform
 import Util
 import Pair
 import Data.ByteString     ( ByteString )
diff --git a/compiler/deSugar/PmExpr.hs b/compiler/deSugar/PmExpr.hs
--- a/compiler/deSugar/PmExpr.hs
+++ b/compiler/deSugar/PmExpr.hs
@@ -6,12 +6,11 @@
 
 {-# LANGUAGE CPP #-}
 {-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 
 module PmExpr (
-        PmExpr(..), PmLit(..), SimpleEq, ComplexEq, toComplex, eqPmLit,
-        truePmExpr, falsePmExpr, isTruePmExpr, isFalsePmExpr, isNotPmExprOther,
-        lhsExprToPmExpr, hsExprToPmExpr, substComplexEq, filterComplex,
-        pprPmExprWithParens, runPmPprM
+        PmExpr(..), PmLit(..), PmAltCon(..), TmVarCt(..),
+        eqPmLit, isNotPmExprOther, lhsExprToPmExpr, hsExprToPmExpr
     ) where
 
 #include "HsVersions.h"
@@ -23,19 +22,14 @@
 import HsSyn
 import Id
 import Name
-import NameSet
 import DataCon
 import ConLike
+import TcEvidence (isErasableHsWrapper)
 import TcType (isStringTy)
 import TysWiredIn
 import Outputable
-import Util
 import SrcLoc
 
-import Data.Maybe (mapMaybe)
-import Data.List (groupBy, sortBy, nubBy)
-import Control.Monad.Trans.State.Lazy
-
 {-
 %************************************************************************
 %*                                                                      *
@@ -61,7 +55,6 @@
 data PmExpr = PmExprVar   Name
             | PmExprCon   ConLike [PmExpr]
             | PmExprLit   PmLit
-            | PmExprEq    PmExpr PmExpr  -- Syntactic equality
             | PmExprOther (HsExpr GhcTc)  -- Note [PmExprOther in PmExpr]
 
 
@@ -79,6 +72,16 @@
   -- See Note [Undecidable Equality for Overloaded Literals]
 eqPmLit _              _              = False
 
+-- | Represents a match against a literal. We mostly use it to to encode shapes
+-- for a variable that immediately lead to a refutation.
+--
+-- See Note [Refutable shapes] in TmOracle. Really similar to 'CoreSyn.AltCon'.
+newtype PmAltCon = PmAltLit PmLit
+  deriving Outputable
+
+instance Eq PmAltCon where
+  PmAltLit l1 == PmAltLit l2 = eqPmLit l1 l2
+
 {- Note [Undecidable Equality for Overloaded Literals]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Equality on overloaded literals is undecidable in the general case. Consider
@@ -145,24 +148,11 @@
        appearance of the warnings and is, in practice safe.
 -}
 
-nubPmLit :: [PmLit] -> [PmLit]
-nubPmLit = nubBy eqPmLit
-
--- | Term equalities
-type SimpleEq  = (Id, PmExpr) -- We always use this orientation
-type ComplexEq = (PmExpr, PmExpr)
-
--- | Lift a `SimpleEq` to a `ComplexEq`
-toComplex :: SimpleEq -> ComplexEq
-toComplex (x,e) = (PmExprVar (idName x), e)
-
--- | Expression `True'
-truePmExpr :: PmExpr
-truePmExpr = mkPmExprData trueDataCon []
+-- | A term constraint. @TVC x e@ encodes that @x@ is equal to @e@.
+data TmVarCt = TVC !Id !PmExpr
 
--- | Expression `False'
-falsePmExpr :: PmExpr
-falsePmExpr = mkPmExprData falseDataCon []
+instance Outputable TmVarCt where
+  ppr (TVC x e) = ppr x <+> char '~' <+> ppr e
 
 -- ----------------------------------------------------------------------------
 -- ** Predicates on PmExpr
@@ -172,66 +162,6 @@
 isNotPmExprOther (PmExprOther _) = False
 isNotPmExprOther _expr           = True
 
--- | Check whether a literal is negated
-isNegatedPmLit :: PmLit -> Bool
-isNegatedPmLit (PmOLit b _) = b
-isNegatedPmLit _other_lit   = False
-
--- | Check whether a PmExpr is syntactically equal to term `True'.
-isTruePmExpr :: PmExpr -> Bool
-isTruePmExpr (PmExprCon c []) = c == RealDataCon trueDataCon
-isTruePmExpr _other_expr      = False
-
--- | Check whether a PmExpr is syntactically equal to term `False'.
-isFalsePmExpr :: PmExpr -> Bool
-isFalsePmExpr (PmExprCon c []) = c == RealDataCon falseDataCon
-isFalsePmExpr _other_expr      = False
-
--- | Check whether a PmExpr is syntactically e
-isNilPmExpr :: PmExpr -> Bool
-isNilPmExpr (PmExprCon c _) = c == RealDataCon nilDataCon
-isNilPmExpr _other_expr     = False
-
--- | Check whether a PmExpr is syntactically equal to (x == y).
--- Since (==) is overloaded and can have an arbitrary implementation, we use
--- the PmExprEq constructor to represent only equalities with non-overloaded
--- literals where it coincides with a syntactic equality check.
-isPmExprEq :: PmExpr -> Maybe (PmExpr, PmExpr)
-isPmExprEq (PmExprEq e1 e2) = Just (e1,e2)
-isPmExprEq _other_expr      = Nothing
-
--- | Check if a DataCon is (:).
-isConsDataCon :: DataCon -> Bool
-isConsDataCon con = consDataCon == con
-
--- ----------------------------------------------------------------------------
--- ** Substitution in PmExpr
-
--- | We return a boolean along with the expression. Hence, if substitution was
--- a no-op, we know that the expression still cannot progress.
-substPmExpr :: Name -> PmExpr -> PmExpr -> (PmExpr, Bool)
-substPmExpr x e1 e =
-  case e of
-    PmExprVar z | x == z    -> (e1, True)
-                | otherwise -> (e, False)
-    PmExprCon c ps -> let (ps', bs) = mapAndUnzip (substPmExpr x e1) ps
-                      in  (PmExprCon c ps', or bs)
-    PmExprEq ex ey -> let (ex', bx) = substPmExpr x e1 ex
-                          (ey', by) = substPmExpr x e1 ey
-                      in  (PmExprEq ex' ey', bx || by)
-    _other_expr    -> (e, False) -- The rest are terminals (We silently ignore
-                                 -- Other). See Note [PmExprOther in PmExpr]
-
--- | Substitute in a complex equality. We return (Left eq) if the substitution
--- affected the equality or (Right eq) if nothing happened.
-substComplexEq :: Name -> PmExpr -> ComplexEq -> Either ComplexEq ComplexEq
-substComplexEq x e (ex, ey)
-  | bx || by  = Left  (ex', ey')
-  | otherwise = Right (ex', ey')
-  where
-    (ex', bx) = substPmExpr x e ex
-    (ey', by) = substPmExpr x e ey
-
 -- -----------------------------------------------------------------------
 -- ** Lift source expressions (HsExpr Id) to PmExpr
 
@@ -240,9 +170,21 @@
 
 hsExprToPmExpr :: HsExpr GhcTc -> PmExpr
 
+-- Translating HsVar to flexible meta variables in the unification problem is
+-- morally wrong, but it does the right thing for now.
+-- In contrast to the situation in pattern matches, HsVars in expression syntax
+-- are object language variables, most similar to rigid variables with an
+-- unknown solution. The correct way would be to handle them through PmExprOther
+-- and identify syntactically equal occurrences by the same rigid meta variable,
+-- but we can't compare the wrapped HsExpr for equality. Hence we are stuck with
+-- this hack.
 hsExprToPmExpr (HsVar        _ x) = PmExprVar (idName (unLoc x))
-hsExprToPmExpr (HsConLikeOut _ c) = PmExprVar (conLikeName c)
 
+-- Translating HsConLikeOut to a flexible meta variable is misleading.
+-- For an example why, consider `consAreRigid` in
+-- `testsuite/tests/pmcheck/should_compile/PmExprVars.hs`.
+-- hsExprToPmExpr (HsConLikeOut _ c) = PmExprVar (conLikeName c)
+
 -- Desugar literal strings as a list of characters. For other literal values,
 -- keep it as it is.
 -- See `translatePat` in Check.hs (the `NPat` and `LitPat` case), and
@@ -294,7 +236,12 @@
 hsExprToPmExpr (HsSCC          _ _ _ e) = lhsExprToPmExpr e
 hsExprToPmExpr (HsCoreAnn      _ _ _ e) = lhsExprToPmExpr e
 hsExprToPmExpr (ExprWithTySig    _ e _) = lhsExprToPmExpr e
-hsExprToPmExpr (HsWrap           _ _ e) =  hsExprToPmExpr e
+hsExprToPmExpr (HsWrap           _ w e)
+  -- A dictionary application spoils e and we have no choice but to return an
+  -- PmExprOther. Same thing for other stuff that can't erased in the
+  -- compilation process. Otherwise this bites in
+  -- teststuite/tests/pmcheck/should_compile/PmExprVars.hs.
+  | isErasableHsWrapper w = hsExprToPmExpr e
 hsExprToPmExpr e = PmExprOther e -- the rest are not handled by the oracle
 
 stringExprToList :: SourceText -> FastString -> PmExpr
@@ -312,155 +259,22 @@
 %************************************************************************
 -}
 
-{- 1. Literals
-~~~~~~~~~~~~~~
-Starting with a function definition like:
-
-    f :: Int -> Bool
-    f 5 = True
-    f 6 = True
-
-The uncovered set looks like:
-    { var |> False == (var == 5), False == (var == 6) }
-
-Yet, we would like to print this nicely as follows:
-   x , where x not one of {5,6}
-
-Function `filterComplex' takes the set of residual constraints and packs
-together the negative constraints that refer to the same variable so we can do
-just this. Since these variables will be shown to the programmer, we also give
-them better names (t1, t2, ..), hence the SDoc in PmNegLitCt.
-
-2. Residual Constraints
-~~~~~~~~~~~~~~~~~~~~~~~
-Unhandled constraints that refer to HsExpr are typically ignored by the solver
-(it does not even substitute in HsExpr so they are even printed as wildcards).
-Additionally, the oracle returns a substitution if it succeeds so we apply this
-substitution to the vectors before printing them out (see function `pprOne' in
-Check.hs) to be more precice.
--}
-
--- -----------------------------------------------------------------------------
--- ** Transform residual constraints in appropriate form for pretty printing
-
-type PmNegLitCt = (Name, (SDoc, [PmLit]))
-
-filterComplex :: [ComplexEq] -> [PmNegLitCt]
-filterComplex = zipWith rename nameList . map mkGroup
-              . groupBy name . sortBy order . mapMaybe isNegLitCs
-  where
-    order x y = compare (fst x) (fst y)
-    name  x y = fst x == fst y
-    mkGroup l = (fst (head l), nubPmLit $ map snd l)
-    rename new (old, lits) = (old, (new, lits))
-
-    isNegLitCs (e1,e2)
-      | isFalsePmExpr e1, Just (x,y) <- isPmExprEq e2 = isNegLitCs' x y
-      | isFalsePmExpr e2, Just (x,y) <- isPmExprEq e1 = isNegLitCs' x y
-      | otherwise = Nothing
-
-    isNegLitCs' (PmExprVar x) (PmExprLit l) = Just (x, l)
-    isNegLitCs' (PmExprLit l) (PmExprVar x) = Just (x, l)
-    isNegLitCs' _ _             = Nothing
-
-    -- Try nice names p,q,r,s,t before using the (ugly) t_i
-    nameList :: [SDoc]
-    nameList = map text ["p","q","r","s","t"] ++
-                 [ text ('t':show u) | u <- [(0 :: Int)..] ]
-
--- ----------------------------------------------------------------------------
-
-runPmPprM :: PmPprM a -> [PmNegLitCt] -> (a, [(SDoc,[PmLit])])
-runPmPprM m lit_env = (result, mapMaybe is_used lit_env)
-  where
-    (result, (_lit_env, used)) = runState m (lit_env, emptyNameSet)
-
-    is_used (x,(name, lits))
-      | elemNameSet x used = Just (name, lits)
-      | otherwise         = Nothing
-
-type PmPprM a = State ([PmNegLitCt], NameSet) a
--- (the first part of the state is read only. make it a reader?)
-
-addUsed :: Name -> PmPprM ()
-addUsed x = modify (\(negated, used) -> (negated, extendNameSet used x))
-
-checkNegation :: Name -> PmPprM (Maybe SDoc) -- the clean name if it is negated
-checkNegation x = do
-  negated <- gets fst
-  return $ case lookup x negated of
-    Just (new, _) -> Just new
-    Nothing       -> Nothing
-
--- | Pretty print a pmexpr, but remember to prettify the names of the variables
--- that refer to neg-literals. The ones that cannot be shown are printed as
--- underscores.
-pprPmExpr :: PmExpr -> PmPprM SDoc
-pprPmExpr (PmExprVar x) = do
-  mb_name <- checkNegation x
-  case mb_name of
-    Just name -> addUsed x >> return name
-    Nothing   -> return underscore
-
-pprPmExpr (PmExprCon con args) = pprPmExprCon con args
-pprPmExpr (PmExprLit l)        = return (ppr l)
-pprPmExpr (PmExprEq _ _)       = return underscore -- don't show
-pprPmExpr (PmExprOther _)      = return underscore -- don't show
-
-needsParens :: PmExpr -> Bool
-needsParens (PmExprVar   {}) = False
-needsParens (PmExprLit    l) = isNegatedPmLit l
-needsParens (PmExprEq    {}) = False -- will become a wildcard
-needsParens (PmExprOther {}) = False -- will become a wildcard
-needsParens (PmExprCon (RealDataCon c) es)
-  | isTupleDataCon c
-  || isConsDataCon c || null es = False
-  | otherwise                   = True
-needsParens (PmExprCon (PatSynCon _) es) = not (null es)
-
-pprPmExprWithParens :: PmExpr -> PmPprM SDoc
-pprPmExprWithParens expr
-  | needsParens expr = parens <$> pprPmExpr expr
-  | otherwise        =            pprPmExpr expr
-
-pprPmExprCon :: ConLike -> [PmExpr] -> PmPprM SDoc
-pprPmExprCon (RealDataCon con) args
-  | isTupleDataCon con = mkTuple <$> mapM pprPmExpr args
-  | isConsDataCon con  = pretty_list
-  where
-    mkTuple :: [SDoc] -> SDoc
-    mkTuple = parens     . fsep . punctuate comma
-
-    -- lazily, to be used in the list case only
-    pretty_list :: PmPprM SDoc
-    pretty_list = case isNilPmExpr (last list) of
-      True  -> brackets . fsep . punctuate comma <$> mapM pprPmExpr (init list)
-      False -> parens   . hcat . punctuate colon <$> mapM pprPmExpr list
-
-    list = list_elements args
-
-    list_elements [x,y]
-      | PmExprCon c es <- y,  RealDataCon nilDataCon == c
-          = ASSERT(null es) [x,y]
-      | PmExprCon c es <- y, RealDataCon consDataCon == c
-          = x : list_elements es
-      | otherwise = [x,y]
-    list_elements list  = pprPanic "list_elements:" (ppr list)
-pprPmExprCon cl args
-  | conLikeIsInfix cl = case args of
-      [x, y] -> do x' <- pprPmExprWithParens x
-                   y' <- pprPmExprWithParens y
-                   return (x' <+> ppr cl <+> y')
-      -- can it be infix but have more than two arguments?
-      list   -> pprPanic "pprPmExprCon:" (ppr list)
-  | null args = return (ppr cl)
-  | otherwise = do args' <- mapM pprPmExprWithParens args
-                   return (fsep (ppr cl : args'))
-
 instance Outputable PmLit where
   ppr (PmSLit     l) = pmPprHsLit l
   ppr (PmOLit neg l) = (if neg then char '-' else empty) <> ppr l
 
--- not really useful for pmexprs per se
 instance Outputable PmExpr where
-  ppr e = fst $ runPmPprM (pprPmExpr e) []
+  ppr = go (0 :: Int)
+    where
+      go _    (PmExprLit l)       = ppr l
+      go _    (PmExprVar v)       = ppr v
+      go _    (PmExprOther e)     = angleBrackets (ppr e)
+      go _    (PmExprCon (RealDataCon dc) args)
+        | isTupleDataCon dc = parens $ comma_sep $ map ppr args
+        | dc == consDataCon = brackets $ comma_sep $ map ppr (list_cells args)
+        where
+          comma_sep = fsep . punctuate comma
+          list_cells (hd:tl) = hd : list_cells tl
+          list_cells _       = []
+      go prec (PmExprCon cl args)
+        = cparen (null args || prec > 0) (hcat (ppr cl:map (go 1) args))
diff --git a/compiler/ghci/LinkerTypes.hs b/compiler/ghci/LinkerTypes.hs
--- a/compiler/ghci/LinkerTypes.hs
+++ b/compiler/ghci/LinkerTypes.hs
@@ -28,7 +28,7 @@
 import Name                    ( Name )
 import GHCi.RemoteTypes        ( ForeignHValue )
 
-type ClosureEnv = NameEnv (Name, ForeignHValue) 
+type ClosureEnv = NameEnv (Name, ForeignHValue)
 
 newtype DynLinker =
   DynLinker { dl_mpls :: MVar (Maybe PersistentLinkerState) }
diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs
--- a/compiler/hsSyn/HsBinds.hs
+++ b/compiler/hsSyn/HsBinds.hs
@@ -8,6 +8,7 @@
 -}
 
 {-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE UndecidableInstances #-} -- Note [Pass sensitive types]
@@ -1262,7 +1263,7 @@
       , recordPatSynPatVar :: a
       -- Filled in by renamer, the name used internally
       -- by the pattern
-      } deriving Data
+      } deriving (Data, Functor)
 
 
 
@@ -1287,12 +1288,6 @@
 the distinction between the two names clear
 
 -}
-instance Functor RecordPatSynField where
-    fmap f (RecordPatSynField { recordPatSynSelectorId = visible
-                              , recordPatSynPatVar = hidden })
-      = RecordPatSynField { recordPatSynSelectorId = f visible
-                          , recordPatSynPatVar = f hidden }
-
 instance Outputable a => Outputable (RecordPatSynField a) where
     ppr (RecordPatSynField { recordPatSynSelectorId = v }) = ppr v
 
diff --git a/compiler/hsSyn/HsDecls.hs b/compiler/hsSyn/HsDecls.hs
--- a/compiler/hsSyn/HsDecls.hs
+++ b/compiler/hsSyn/HsDecls.hs
@@ -302,6 +302,7 @@
              if isEmptyValBinds val_decls
                 then Nothing
                 else Just (ppr val_decls),
+             ppr_ds (tyClGroupRoleDecls tycl_decls),
              ppr_ds (tyClGroupTyClDecls tycl_decls),
              ppr_ds (tyClGroupInstDecls tycl_decls),
              ppr_ds deriv_decls,
@@ -550,6 +551,7 @@
 
 data DataDeclRn = DataDeclRn
              { tcdDataCusk :: Bool    -- ^ does this have a CUSK?
+                 -- See Note [CUSKs: complete user-supplied kind signatures]
              , tcdFVs      :: NameSet }
   deriving Data
 
@@ -864,6 +866,10 @@
 
     This last point is much more debatable than the others; see
     #15142 comment:22
+
+    Because this is fiddly to check, there is a field in the DataDeclRn
+    structure (included in a DataDecl after the renamer) that stores whether
+    or not the declaration has a CUSK.
 -}
 
 
diff --git a/compiler/hsSyn/HsTypes.hs b/compiler/hsSyn/HsTypes.hs
--- a/compiler/hsSyn/HsTypes.hs
+++ b/compiler/hsSyn/HsTypes.hs
@@ -62,6 +62,7 @@
         mkHsOpTy, mkHsAppTy, mkHsAppTys, mkHsAppKindTy,
         ignoreParens, hsSigType, hsSigWcType,
         hsLTyVarBndrToType, hsLTyVarBndrsToTypes,
+        hsConDetailsArgs,
 
         -- Printing
         pprHsType, pprHsForAll, pprHsForAllExtra, pprHsExplicitForAll,
@@ -911,6 +912,14 @@
   ppr (PrefixCon args) = text "PrefixCon" <+> ppr args
   ppr (RecCon rec)     = text "RecCon:" <+> ppr rec
   ppr (InfixCon l r)   = text "InfixCon:" <+> ppr [l, r]
+
+hsConDetailsArgs ::
+     HsConDetails (LHsType a) (Located [LConDeclField a])
+  -> [LHsType a]
+hsConDetailsArgs details = case details of
+  InfixCon a b -> [a,b]
+  PrefixCon xs -> xs
+  RecCon r -> map (cd_fld_type . unLoc) (unLoc r)
 
 {-
 Note [ConDeclField passs]
diff --git a/compiler/main/Annotations.hs b/compiler/main/Annotations.hs
--- a/compiler/main/Annotations.hs
+++ b/compiler/main/Annotations.hs
@@ -4,6 +4,7 @@
 -- (c) The University of Glasgow 2006
 -- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 --
+{-# LANGUAGE DeriveFunctor #-}
 module Annotations (
         -- * Main Annotation data types
         Annotation(..), AnnPayload,
@@ -49,13 +50,10 @@
   = NamedTarget name          -- ^ We are annotating something with a name:
                               --      a type or identifier
   | ModuleTarget Module       -- ^ We are annotating a particular module
+  deriving (Functor)
 
 -- | The kind of annotation target found in the middle end of the compiler
 type CoreAnnTarget = AnnTarget Name
-
-instance Functor AnnTarget where
-    fmap f (NamedTarget nm) = NamedTarget (f nm)
-    fmap _ (ModuleTarget mod) = ModuleTarget mod
 
 -- | Get the 'name' of an annotation target if it exists.
 getAnnTargetName_maybe :: AnnTarget name -> Maybe name
diff --git a/compiler/main/CmdLineParser.hs b/compiler/main/CmdLineParser.hs
--- a/compiler/main/CmdLineParser.hs
+++ b/compiler/main/CmdLineParser.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
 
 -------------------------------------------------------------------------------
 --
@@ -166,9 +167,7 @@
 
 -- (CmdLineP s) typically instantiates the 'm' in (EwM m) and (OptKind m)
 newtype CmdLineP s a = CmdLineP { runCmdLine :: s -> (a, s) }
-
-instance Functor (CmdLineP s) where
-    fmap = liftM
+    deriving (Functor)
 
 instance Applicative (CmdLineP s) where
     pure a = CmdLineP $ \s -> (a, s)
diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -44,7 +44,7 @@
 
 import {-# SOURCE #-} DynFlags
 import Outputable
-import Platform
+import GHC.Platform
 import System.FilePath
 import Binary
 import Util
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -219,6 +219,7 @@
         -- * SSE and AVX
         isSseEnabled,
         isSse2Enabled,
+        isSse4_1Enabled,
         isSse4_2Enabled,
         isBmiEnabled,
         isBmi2Enabled,
@@ -248,7 +249,7 @@
 
 import GhcPrelude
 
-import Platform
+import GHC.Platform
 import PlatformConstants
 import Module
 import PackageConfig
@@ -320,8 +321,9 @@
 import GHC.Foreign (withCString, peekCString)
 import qualified GHC.LanguageExtensions as LangExt
 
-#if defined(GHCI)
-import Foreign (Ptr) -- needed for 2nd stage
+#if 0
+-- used by SHARED_GLOBAL_VAR
+import Foreign (Ptr)
 #endif
 
 -- Note [Updating flag description in the User's Guide]
@@ -911,6 +913,9 @@
    | Opt_WarnSpaceAfterBang
    | Opt_WarnMissingDerivingStrategies    -- Since 8.8
    | Opt_WarnPrepositiveQualifiedModule   -- Since TBD
+   | Opt_WarnUnusedPackages               -- Since 8.10
+   | Opt_WarnInferredSafeImports          -- Since 8.10
+   | Opt_WarnMissingSafeHaskellMode       -- Since 8.10
    deriving (Eq, Show, Enum)
 
 data Language = Haskell98 | Haskell2010
@@ -921,11 +926,12 @@
 
 -- | The various Safe Haskell modes
 data SafeHaskellMode
-   = Sf_None
-   | Sf_Unsafe
-   | Sf_Trustworthy
-   | Sf_Safe
-   | Sf_Ignore
+   = Sf_None          -- ^ inferred unsafe
+   | Sf_Unsafe        -- ^ declared and checked
+   | Sf_Trustworthy   -- ^ declared and checked
+   | Sf_Safe          -- ^ declared and checked
+   | Sf_SafeInferred  -- ^ inferred as safe
+   | Sf_Ignore        -- ^ @-fno-safe-haskell@ state
    deriving (Eq)
 
 instance Show SafeHaskellMode where
@@ -933,6 +939,7 @@
     show Sf_Unsafe       = "Unsafe"
     show Sf_Trustworthy  = "Trustworthy"
     show Sf_Safe         = "Safe"
+    show Sf_SafeInferred = "Safe-Inferred"
     show Sf_Ignore       = "Ignore"
 
 instance Outputable SafeHaskellMode where
@@ -1420,7 +1427,7 @@
 pgm_P dflags = toolSettings_pgm_P $ toolSettings dflags
 pgm_F                 :: DynFlags -> String
 pgm_F dflags = toolSettings_pgm_F $ toolSettings dflags
-pgm_c                 :: DynFlags -> (String,[Option])
+pgm_c                 :: DynFlags -> String
 pgm_c dflags = toolSettings_pgm_c $ toolSettings dflags
 pgm_a                 :: DynFlags -> (String,[Option])
 pgm_a dflags = toolSettings_pgm_a $ toolSettings dflags
@@ -2760,7 +2767,7 @@
 -- Parsing the dynamic flags.
 
 
--- | Parse dynamic flags from a list of command line arguments.  Returns the
+-- | Parse dynamic flags from a list of command line arguments.  Returns
 -- the parsed 'DynFlags', the left-over arguments, and a list of warnings.
 -- Throws a 'UsageError' if errors occurred during parsing (such as unknown
 -- flags or missing arguments).
@@ -3048,7 +3055,7 @@
       $ hasArg $ \f -> alterToolSettings $ \s -> s { toolSettings_pgm_F   = f }
   , make_ord_flag defFlag "pgmc"
       $ hasArg $ \f -> alterToolSettings $ \s -> s
-         { toolSettings_pgm_c   = (f,[])
+         { toolSettings_pgm_c   = f
          , -- Don't pass -no-pie with -pgmc
            -- (see #15319)
            toolSettings_ccSupportsNoPie = False
@@ -3757,6 +3764,8 @@
   , make_ord_flag defFlag "fno-safe-infer"   (noArg (\d ->
                                                     d { safeInfer = False }))
   , make_ord_flag defFlag "fno-safe-haskell" (NoArg (setSafeHaskell Sf_Ignore))
+
+        ------ position independent flags  ----------------------------------
   , make_ord_flag defGhcFlag "fPIC"          (NoArg (setGeneralFlag Opt_PIC))
   , make_ord_flag defGhcFlag "fno-PIC"       (NoArg (unSetGeneralFlag Opt_PIC))
   , make_ord_flag defGhcFlag "fPIE"          (NoArg (setGeneralFlag Opt_PIC))
@@ -4075,6 +4084,8 @@
   flagSpec "all-missed-specializations"  Opt_WarnAllMissedSpecs,
   flagSpec' "safe"                       Opt_WarnSafe setWarnSafe,
   flagSpec "trustworthy-safe"            Opt_WarnTrustworthySafe,
+  flagSpec "inferred-safe-imports"       Opt_WarnInferredSafeImports,
+  flagSpec "missing-safe-haskell-mode"   Opt_WarnMissingSafeHaskellMode,
   flagSpec "tabs"                        Opt_WarnTabs,
   flagSpec "type-defaults"               Opt_WarnTypeDefaults,
   flagSpec "typed-holes"                 Opt_WarnTypedHoles,
@@ -4110,7 +4121,8 @@
   flagSpec "missing-space-after-bang"    Opt_WarnSpaceAfterBang,
   flagSpec "partial-fields"              Opt_WarnPartialFields,
   flagSpec "prepositive-qualified-module"
-                                         Opt_WarnPrepositiveQualifiedModule
+                                         Opt_WarnPrepositiveQualifiedModule,
+  flagSpec "unused-packages"             Opt_WarnUnusedPackages
  ]
 
 -- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@
@@ -4340,7 +4352,7 @@
 supportedExtensions = concatMap toFlagSpecNamePair xFlags
   where
     toFlagSpecNamePair flg
-#if !defined(GHCI)
+#if !defined(HAVE_INTERPRETER)
       -- IMPORTANT! Make sure that `ghc --supported-extensions` omits
       -- "TemplateHaskell"/"QuasiQuotes" when it's known not to work out of the
       -- box. See also GHC #11102 and #16331 for more details about
@@ -4525,6 +4537,7 @@
   flagSpec "UndecidableSuperClasses"          LangExt.UndecidableSuperClasses,
   flagSpec "UnicodeSyntax"                    LangExt.UnicodeSyntax,
   flagSpec "UnliftedFFITypes"                 LangExt.UnliftedFFITypes,
+  flagSpec "UnliftedNewtypes"                 LangExt.UnliftedNewtypes,
   flagSpec "ViewPatterns"                     LangExt.ViewPatterns
   ]
 
@@ -5661,10 +5674,6 @@
        ("Have interpreter",            showBool $ platformMisc_ghcWithInterpreter $ platformMisc dflags),
        ("Object splitting supported",  showBool False),
        ("Have native code generator",  showBool $ platformMisc_ghcWithNativeCodeGen $ platformMisc dflags),
-       ("Support SMP",                 showBool $ platformMisc_ghcWithSMP $ platformMisc dflags),
-       ("Tables next to code",         showBool $ platformMisc_tablesNextToCode $ platformMisc dflags),
-       ("RTS ways",                    platformMisc_ghcRTSWays $ platformMisc dflags),
-       ("RTS expects libdw",           showBool $ platformMisc_ghcRtsWithLibdw $ platformMisc dflags),
        -- Whether or not we support @-dynamic-too@
        ("Support dynamic-too",         showBool $ not isWindows),
        -- Whether or not we support the @-j@ flag with @--make@.
@@ -5691,7 +5700,6 @@
        ("GHC Dynamic",                 showBool dynamicGhc),
        -- Whether or not GHC was compiled using -prof
        ("GHC Profiled",                showBool rtsIsProfiled),
-       ("Leading underscore",          showBool $ platformMisc_leadingUnderscore $ platformMisc dflags),
        ("Debug on",                    show debugIsOn),
        ("LibDir",                      topDir dflags),
        -- The path of the global package database used by GHC
@@ -5901,6 +5909,8 @@
     ArchX86    -> True
     _          -> False
 
+isSse4_1Enabled :: DynFlags -> Bool
+isSse4_1Enabled dflags = sseVersion dflags >= Just SSE4
 
 isSse4_2Enabled :: DynFlags -> Bool
 isSse4_2Enabled dflags = sseVersion dflags >= Just SSE42
diff --git a/compiler/main/DynFlags.hs-boot b/compiler/main/DynFlags.hs-boot
--- a/compiler/main/DynFlags.hs-boot
+++ b/compiler/main/DynFlags.hs-boot
@@ -1,7 +1,7 @@
 module DynFlags where
 
 import GhcPrelude
-import Platform
+import GHC.Platform
 
 data DynFlags
 data DumpFlag
diff --git a/compiler/main/GhcMonad.hs b/compiler/main/GhcMonad.hs
--- a/compiler/main/GhcMonad.hs
+++ b/compiler/main/GhcMonad.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, RankNTypes #-}
+{-# LANGUAGE CPP, DeriveFunctor, RankNTypes #-}
 {-# OPTIONS_GHC -funbox-strict-fields #-}
 -- -----------------------------------------------------------------------------
 --
@@ -90,7 +90,7 @@
 -- | A minimal implementation of a 'GhcMonad'.  If you need a custom monad,
 -- e.g., to maintain additional state consider wrapping this monad or using
 -- 'GhcT'.
-newtype Ghc a = Ghc { unGhc :: Session -> IO a }
+newtype Ghc a = Ghc { unGhc :: Session -> IO a } deriving (Functor)
 
 -- | The Session is a handle to the complete state of a compilation
 -- session.  A compilation session consists of a set of modules
@@ -98,9 +98,6 @@
 -- interactive evaluation, and various caches.
 data Session = Session !(IORef HscEnv)
 
-instance Functor Ghc where
-  fmap f m = Ghc $ \s -> f `fmap` unGhc m s
-
 instance Applicative Ghc where
   pure a = Ghc $ \_ -> return a
   g <*> m = do f <- g; a <- m; return (f a)
@@ -158,12 +155,10 @@
 --
 -- Note that the wrapped monad must support IO and handling of exceptions.
 newtype GhcT m a = GhcT { unGhcT :: Session -> m a }
+    deriving (Functor)
 
 liftGhcT :: m a -> GhcT m a
 liftGhcT m = GhcT $ \_ -> m
-
-instance Functor m => Functor (GhcT m) where
-  fmap f m = GhcT $ \s -> f `fmap` unGhcT m s
 
 instance Applicative m => Applicative (GhcT m) where
   pure x  = GhcT $ \_ -> pure x
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -5,6 +5,7 @@
 -}
 
 {-# LANGUAGE CPP, ScopedTypeVariables #-}
+{-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE ViewPatterns #-}
 
@@ -200,7 +201,7 @@
 import Binary
 import ErrUtils
 import NameCache
-import Platform
+import GHC.Platform
 import Util
 import UniqDSet
 import GHC.Serialized   ( Serialized )
@@ -231,9 +232,7 @@
 -- The Hsc monad: Passing an environment and warning state
 
 newtype Hsc a = Hsc (HscEnv -> WarningMessages -> IO (a, WarningMessages))
-
-instance Functor Hsc where
-    fmap = liftM
+    deriving (Functor)
 
 instance Applicative Hsc where
     pure a = Hsc $ \_ w -> return (a, w)
@@ -443,7 +442,7 @@
                 -- time it is needed.
 
         , hsc_dynLinker :: DynLinker
-                -- ^ dynamic linker. 
+                -- ^ dynamic linker.
 
  }
 
@@ -2949,6 +2948,7 @@
             Sf_Unsafe       -> 1
             Sf_Trustworthy  -> 2
             Sf_Safe         -> 3
+            Sf_SafeInferred -> 4
             Sf_Ignore       -> 0
 
 numToTrustInfo :: Word8 -> IfaceTrustInfo
@@ -2956,9 +2956,7 @@
 numToTrustInfo 1 = setSafeMode Sf_Unsafe
 numToTrustInfo 2 = setSafeMode Sf_Trustworthy
 numToTrustInfo 3 = setSafeMode Sf_Safe
-numToTrustInfo 4 = setSafeMode Sf_Safe -- retained for backwards compat, used
-                                       -- to be Sf_SafeInfered but we no longer
-                                       -- differentiate.
+numToTrustInfo 4 = setSafeMode Sf_SafeInferred
 numToTrustInfo n = error $ "numToTrustInfo: bad input number! (" ++ show n ++ ")"
 
 instance Outputable IfaceTrustInfo where
@@ -2967,6 +2965,7 @@
     ppr (TrustInfo Sf_Unsafe)        = text "unsafe"
     ppr (TrustInfo Sf_Trustworthy)   = text "trustworthy"
     ppr (TrustInfo Sf_Safe)          = text "safe"
+    ppr (TrustInfo Sf_SafeInferred)  = text "safe-inferred"
 
 instance Binary IfaceTrustInfo where
     put_ bh iftrust = putByte bh $ trustInfoToNum iftrust
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -77,7 +77,7 @@
 import Module
 import Util
 import Panic
-import Platform
+import GHC.Platform
 import Outputable
 import Maybes
 
@@ -559,13 +559,15 @@
                       "can't find a package database at " ++ conf_file
 
   let
+      -- Fix #16360: remove trailing slash from conf_file before calculting pkgroot
+      conf_file' = dropTrailingPathSeparator conf_file
       top_dir = topDir dflags
-      pkgroot = takeDirectory conf_file
+      pkgroot = takeDirectory conf_file'
       pkg_configs1 = map (mungePackageConfig top_dir pkgroot)
                          proto_pkg_configs
       pkg_configs2 = setBatchPackageFlags dflags pkg_configs1
   --
-  return (conf_file, pkg_configs2)
+  return (conf_file', pkg_configs2)
   where
     readDirStylePackageConfig conf_dir = do
       let filename = conf_dir </> "package.cache"
@@ -1470,8 +1472,8 @@
             _  -> unit'
       addIfMorePreferable m unit = addToUDFM_C preferLater m (fsPackageName unit) unit
       -- This is the set of maximally preferable packages. In fact, it is a set of
-      -- most preferable *units* keyed by package name, which act as stand-ins in 
-      -- for "a package in a database". We use units here because we don't have 
+      -- most preferable *units* keyed by package name, which act as stand-ins in
+      -- for "a package in a database". We use units here because we don't have
       -- "a package in a database" as a type currently.
       mostPreferablePackageReps = if gopt Opt_HideAllPackages dflags
                     then emptyUDFM
@@ -1481,7 +1483,7 @@
       -- with the most preferable unit for package. Being equi-preferable means that
       -- they must be in the same database, with the same version, and the same pacakge name.
       --
-      -- We must take care to consider all these units and not just the most 
+      -- We must take care to consider all these units and not just the most
       -- preferable one, otherwise we can end up with problems like #16228.
       mostPreferable u =
         case lookupUDFM mostPreferablePackageReps (fsPackageName u) of
diff --git a/compiler/main/PipelineMonad.hs b/compiler/main/PipelineMonad.hs
--- a/compiler/main/PipelineMonad.hs
+++ b/compiler/main/PipelineMonad.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE NamedFieldPuns #-}
 -- | The CompPipeline monad and associated ops
 --
@@ -22,12 +23,10 @@
 import Control.Monad
 
 newtype CompPipeline a = P { unP :: PipeEnv -> PipeState -> IO (PipeState, a) }
+    deriving (Functor)
 
 evalP :: CompPipeline a -> PipeEnv -> PipeState -> IO a
 evalP f env st = liftM snd $ unP f env st
-
-instance Functor CompPipeline where
-    fmap = liftM
 
 instance Applicative CompPipeline where
     pure a = P $ \_env state -> return (state, a)
diff --git a/compiler/main/Plugins.hs b/compiler/main/Plugins.hs
--- a/compiler/main/Plugins.hs
+++ b/compiler/main/Plugins.hs
@@ -30,6 +30,10 @@
       -- - access to loaded interface files with 'interfaceLoadAction'
       --
     , keepRenamedSource
+      -- ** Hole fit plugins
+      -- | hole fit plugins allow plugins to change the behavior of valid hole
+      -- fit suggestions
+    , HoleFitPluginR
 
       -- * Internal
     , PluginWithArgs(..), plugins, pluginRecompile'
@@ -42,7 +46,8 @@
 
 import {-# SOURCE #-} CoreMonad ( CoreToDo, CoreM )
 import qualified TcRnTypes
-import TcRnTypes ( TcGblEnv, IfM, TcM, tcg_rn_decls, tcg_rn_exports )
+import TcRnTypes ( TcGblEnv, IfM, TcM, tcg_rn_decls, tcg_rn_exports  )
+import TcHoleFitTypes ( HoleFitPluginR )
 import HsSyn
 import DynFlags
 import HscTypes
@@ -79,6 +84,9 @@
   , tcPlugin :: TcPlugin
     -- ^ An optional typechecker plugin, which may modify the
     -- behaviour of the constraint solver.
+  , holeFitPlugin :: HoleFitPlugin
+    -- ^ An optional plugin to handle hole fits, which may re-order
+    --   or change the list of valid hole fits and refinement hole fits.
   , pluginRecompile :: [CommandLineOption] -> IO PluginRecompile
     -- ^ Specify how the plugin should affect recompilation.
   , parsedResultAction :: [CommandLineOption] -> ModSummary -> HsParsedModule
@@ -169,6 +177,7 @@
 
 type CorePlugin = [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
 type TcPlugin = [CommandLineOption] -> Maybe TcRnTypes.TcPlugin
+type HoleFitPlugin = [CommandLineOption] -> Maybe HoleFitPluginR
 
 purePlugin, impurePlugin, flagRecompile :: [CommandLineOption] -> IO PluginRecompile
 purePlugin _args = return NoForceRecompile
@@ -186,7 +195,8 @@
 defaultPlugin = Plugin {
         installCoreToDos      = const return
       , tcPlugin              = const Nothing
-      , pluginRecompile  = impurePlugin
+      , holeFitPlugin         = const Nothing
+      , pluginRecompile       = impurePlugin
       , renamedResultAction   = \_ env grp -> return (env, grp)
       , parsedResultAction    = \_ _ -> return
       , typeCheckResultAction = \_ _ -> return
diff --git a/compiler/main/Settings.hs b/compiler/main/Settings.hs
--- a/compiler/main/Settings.hs
+++ b/compiler/main/Settings.hs
@@ -64,7 +64,7 @@
 import Fingerprint
 import FileSettings
 import GhcNameVersion
-import Platform
+import GHC.Platform
 import PlatformConstants
 import ToolSettings
 
@@ -119,7 +119,7 @@
 sPgm_P = toolSettings_pgm_P . sToolSettings
 sPgm_F :: Settings -> String
 sPgm_F = toolSettings_pgm_F . sToolSettings
-sPgm_c :: Settings -> (String, [Option])
+sPgm_c :: Settings -> String
 sPgm_c = toolSettings_pgm_c . sToolSettings
 sPgm_a :: Settings -> (String, [Option])
 sPgm_a = toolSettings_pgm_a . sToolSettings
diff --git a/compiler/main/SysTools/BaseDir.hs b/compiler/main/SysTools/BaseDir.hs
--- a/compiler/main/SysTools/BaseDir.hs
+++ b/compiler/main/SysTools/BaseDir.hs
@@ -20,20 +20,16 @@
 
 import GhcPrelude
 
+-- See note [Base Dir] for why some of this logic is shared with ghc-pkg.
+import GHC.BaseDir
+
 import Panic
 
 import System.Environment (lookupEnv)
 import System.FilePath
-import Data.List
 
--- POSIX
-#if defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS)
-import System.Environment (getExecutablePath)
-#endif
-
 -- Windows
 #if defined(mingw32_HOST_OS)
-import System.Environment (getExecutablePath)
 import System.Directory (doesDirectoryExist)
 #endif
 
@@ -79,10 +75,6 @@
 
 -}
 
--- | Expand occurrences of the @$topdir@ interpolation in a string.
-expandTopDir :: FilePath -> String -> String
-expandTopDir = expandPathVar "topdir"
-
 -- | Expand occurrences of the @$tooldir@ interpolation in a string
 -- on Windows, leave the string untouched otherwise.
 expandToolDir :: Maybe FilePath -> String -> String
@@ -93,17 +85,6 @@
 expandToolDir _ s = s
 #endif
 
--- | @expandPathVar var value str@
---
---   replaces occurences of variable @$var@ with @value@ in str.
-expandPathVar :: String -> FilePath -> String -> String
-expandPathVar var value str
-  | Just str' <- stripPrefix ('$':var) str
-  , null str' || isPathSeparator (head str')
-  = value ++ expandPathVar var value str'
-expandPathVar var value (x:xs) = x : expandPathVar var value xs
-expandPathVar _ _ [] = []
-
 -- | Returns a Unix-format path pointing to TopDir.
 findTopDir :: Maybe String -- Maybe TopDir path (without the '-B' prefix).
            -> IO String    -- TopDir (in Unix format '/' separated)
@@ -125,40 +106,6 @@
                          InstallationError "missing -B<dir> option"
                      Just dir -> return dir
 
-getBaseDir :: IO (Maybe String)
-
-#if defined(mingw32_HOST_OS)
-
--- locate the "base dir" when given the path
--- to the real ghc executable (as opposed to symlink)
--- that is running this function.
-rootDir :: FilePath -> FilePath
-rootDir = takeDirectory . takeDirectory . normalise
-
-getBaseDir = Just . (\p -> p </> "lib") . rootDir <$> getExecutablePath
-#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS)
--- on unix, this is a bit more confusing.
--- The layout right now is something like
---
---   /bin/ghc-X.Y.Z <- wrapper script (1)
---   /bin/ghc       <- symlink to wrapper script (2)
---   /lib/ghc-X.Y.Z/bin/ghc <- ghc executable (3)
---   /lib/ghc-X.Y.Z <- $topdir (4)
---
--- As such, we first need to find the absolute location to the
--- binary.
---
--- getExecutablePath will return (3). One takeDirectory will
--- give use /lib/ghc-X.Y.Z/bin, and another will give us (4).
---
--- This of course only works due to the current layout. If
--- the layout is changed, such that we have ghc-X.Y.Z/{bin,lib}
--- this would need to be changed accordingly.
---
-getBaseDir = Just . (\p -> p </> "lib") . takeDirectory . takeDirectory <$> getExecutablePath
-#else
-getBaseDir = return Nothing
-#endif
 
 -- See Note [tooldir: How GHC finds mingw and perl on Windows]
 -- Returns @Nothing@ when not on Windows.
diff --git a/compiler/main/ToolSettings.hs b/compiler/main/ToolSettings.hs
--- a/compiler/main/ToolSettings.hs
+++ b/compiler/main/ToolSettings.hs
@@ -22,7 +22,7 @@
   , toolSettings_pgm_L       :: String
   , toolSettings_pgm_P       :: (String, [Option])
   , toolSettings_pgm_F       :: String
-  , toolSettings_pgm_c       :: (String, [Option])
+  , toolSettings_pgm_c       :: String
   , toolSettings_pgm_a       :: (String, [Option])
   , toolSettings_pgm_l       :: (String, [Option])
   , toolSettings_pgm_dll     :: (String, [Option])
diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs
--- a/compiler/prelude/PrelNames.hs
+++ b/compiler/prelude/PrelNames.hs
@@ -498,7 +498,8 @@
 pRELUDE         = mkBaseModule_ pRELUDE_NAME
 
 gHC_PRIM, gHC_TYPES, gHC_GENERICS, gHC_MAGIC,
-    gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_GHCI, gHC_CSTRING,
+    gHC_CLASSES, gHC_PRIMOPWRAPPERS, gHC_BASE, gHC_ENUM,
+    gHC_GHCI, gHC_GHCI_HELPERS, gHC_CSTRING,
     gHC_SHOW, gHC_READ, gHC_NUM, gHC_MAYBE, gHC_INTEGER_TYPE, gHC_NATURAL,
     gHC_LIST, gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING,
     dATA_FOLDABLE, dATA_TRAVERSABLE,
@@ -516,10 +517,12 @@
 gHC_MAGIC       = mkPrimModule (fsLit "GHC.Magic")
 gHC_CSTRING     = mkPrimModule (fsLit "GHC.CString")
 gHC_CLASSES     = mkPrimModule (fsLit "GHC.Classes")
+gHC_PRIMOPWRAPPERS = mkPrimModule (fsLit "GHC.PrimopWrappers")
 
 gHC_BASE        = mkBaseModule (fsLit "GHC.Base")
 gHC_ENUM        = mkBaseModule (fsLit "GHC.Enum")
 gHC_GHCI        = mkBaseModule (fsLit "GHC.GHCi")
+gHC_GHCI_HELPERS= mkBaseModule (fsLit "GHC.GHCi.Helpers")
 gHC_SHOW        = mkBaseModule (fsLit "GHC.Show")
 gHC_READ        = mkBaseModule (fsLit "GHC.Read")
 gHC_NUM         = mkBaseModule (fsLit "GHC.Num")
diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs
--- a/compiler/prelude/PrelRules.hs
+++ b/compiler/prelude/PrelRules.hs
@@ -12,7 +12,8 @@
    (i1 + i2) only if it results in a valid Float.
 -}
 
-{-# LANGUAGE CPP, RankNTypes, PatternSynonyms, ViewPatterns, RecordWildCards #-}
+{-# LANGUAGE CPP, RankNTypes, PatternSynonyms, ViewPatterns, RecordWildCards,
+    DeriveFunctor #-}
 {-# OPTIONS_GHC -optc-DNON_POSIX_SOURCE #-}
 
 module PrelRules
@@ -41,7 +42,7 @@
                    , isNewTyCon, unwrapNewTyCon_maybe, tyConDataCons
                    , tyConFamilySize )
 import DataCon     ( dataConTagZ, dataConTyCon, dataConWorkId )
-import CoreUtils   ( cheapEqExpr, exprIsHNF, exprType )
+import CoreUtils   ( cheapEqExpr, cheapEqExpr', exprIsHNF, exprType, stripTicksTop, stripTicksTopT, mkTicks )
 import CoreUnfold  ( exprIsConApp_maybe )
 import Type
 import OccName     ( occNameFS )
@@ -52,7 +53,7 @@
 import FastString
 import BasicTypes
 import DynFlags
-import Platform
+import GHC.Platform
 import Util
 import Coercion     (mkUnbranchedAxInstCo,mkSymCo,Role(..))
 
@@ -475,8 +476,7 @@
              -> return e1
              -- See Note [Guarding against silly shifts]
              | shift_len < 0 || shift_len > wordSizeInBits dflags
-             -> return $ mkRuntimeErrorApp rUNTIME_ERROR_ID wordPrimTy
-                           ("Bad shift length " ++ show shift_len)
+             -> return $ Lit $ mkLitNumberWrap dflags LitNumInt 0 (exprType e1)
 
            -- Do the shift at type Integer, but shift length is Int
            Lit (LitNumber nt x t)
@@ -701,8 +701,28 @@
      Error: operand type mismatch for `shl'
 
 So the best thing to do is to rewrite the shift with a call to error,
-when the second arg is stupid.
+when the second arg is large. However, in general we cannot do this; consider
+this case
 
+    let x = I# (uncheckedIShiftL# n 80)
+    in ...
+
+Here x contains an invalid shift and consequently we would like to rewrite it
+as follows:
+
+    let x = I# (error "invalid shift)
+    in ...
+
+This was originally done in the fix to #16449 but this breaks the let/app
+invariant (see Note [CoreSyn let/app invariant] in CoreSyn) as noted in #16742.
+For the reasons discussed in Note [Checking versus non-checking primops] (in
+the PrimOp module) there is no safe way rewrite the argument of I# such that
+it bottoms.
+
+Consequently we instead take advantage of the fact that large shifts are
+undefined behavior (see associated documentation in primops.txt.pp) and
+transform the invalid shift into an "obviously incorrect" value.
+
 There are two cases:
 
 - Shifting fixed-width things: the primops ISll, Sll, etc
@@ -739,9 +759,7 @@
 
 newtype RuleM r = RuleM
   { runRuleM :: DynFlags -> InScopeEnv -> [CoreExpr] -> Maybe r }
-
-instance Functor RuleM where
-    fmap = liftM
+  deriving (Functor)
 
 instance Applicative RuleM where
     pure x = RuleM $ \_ _ _ -> Just x
@@ -1368,20 +1386,27 @@
         [ Type ty1
         , lit1
         , c1
-        , Var unpk `App` Type ty2
-                   `App` lit2
-                   `App` c2
-                   `App` n
+        , e2
         ]
-  | unpk `hasKey` unpackCStringFoldrIdKey &&
-    c1 `cheapEqExpr` c2
+  -- N.B. Ensure that we strip off any ticks (e.g. source notes) from the
+  -- `lit` and `c` arguments, lest this may fail to fire when building with
+  -- -g3. See #16740.
+  | (strTicks, Var unpk `App` Type ty2
+                        `App` lit2
+                        `App` c2
+                        `App` n) <- stripTicksTop tickishFloatable e2
+  , unpk `hasKey` unpackCStringFoldrIdKey
+  , cheapEqExpr' tickishFloatable c1 c2
+  , (c1Ticks, c1') <- stripTicksTop tickishFloatable c1
+  , c2Ticks <- stripTicksTopT tickishFloatable c2
   , Just (LitString s1) <- exprIsLiteral_maybe id_unf lit1
   , Just (LitString s2) <- exprIsLiteral_maybe id_unf lit2
   = ASSERT( ty1 `eqType` ty2 )
-    Just (Var unpk `App` Type ty1
-                   `App` Lit (LitString (s1 `BS.append` s2))
-                   `App` c1
-                   `App` n)
+    Just $ mkTicks strTicks
+         $ Var unpk `App` Type ty1
+                    `App` Lit (LitString (s1 `BS.append` s2))
+                    `App` mkTicks (c1Ticks ++ c2Ticks) c1'
+                    `App` n
 
 match_append_lit _ _ _ _ = Nothing
 
diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs
--- a/compiler/prelude/PrimOp.hs
+++ b/compiler/prelude/PrimOp.hs
@@ -13,6 +13,7 @@
         PrimOp(..), PrimOpVecCat(..), allThePrimOps,
         primOpType, primOpSig,
         primOpTag, maxPrimOpTag, primOpOcc,
+        primOpWrapperId,
 
         tagToEnumKey,
 
@@ -34,14 +35,18 @@
 
 import CmmType
 import Demand
-import OccName          ( OccName, pprOccName, mkVarOccFS )
+import Id               ( Id, mkVanillaGlobalWithInfo )
+import IdInfo           ( vanillaIdInfo, setCafInfo, CafInfo(NoCafRefs) )
+import Name
+import PrelNames        ( gHC_PRIMOPWRAPPERS )
 import TyCon            ( TyCon, isPrimTyCon, PrimRep(..) )
 import Type
 import RepType          ( typePrimRep1, tyConPrimRep1 )
 import BasicTypes       ( Arity, Fixity(..), FixityDirection(..), Boxity(..),
                           SourceText(..) )
+import SrcLoc           ( wiredInSrcSpan )
 import ForeignCall      ( CLabelString )
-import Unique           ( Unique, mkPrimOpIdUnique )
+import Unique           ( Unique, mkPrimOpIdUnique, mkPrimOpWrapperUnique )
 import Outputable
 import FastString
 import Module           ( UnitId )
@@ -304,6 +309,27 @@
 *                                                                      *
 ************************************************************************
 
+Note [Checking versus non-checking primops]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+  In GHC primops break down into two classes:
+
+   a. Checking primops behave, for instance, like division. In this
+      case the primop may throw an exception (e.g. division-by-zero)
+      and is consequently is marked with the can_fail flag described below.
+      The ability to fail comes at the expense of precluding some optimizations.
+
+   b. Non-checking primops behavior, for instance, like addition. While
+      addition can overflow it does not produce an exception. So can_fail is
+      set to False, and we get more optimisation opportunities.  But we must
+      never throw an exception, so we cannot rewrite to a call to error.
+
+  It is important that a non-checking primop never be transformed in a way that
+  would cause it to bottom. Doing so would violate Core's let/app invariant
+  (see Note [CoreSyn let/app invariant] in CoreSyn) which is critical to
+  the simplifier's ability to float without fear of changing program meaning.
+
+
 Note [PrimOp can_fail and has_side_effects]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Both can_fail and has_side_effects mean that the primop has
@@ -550,6 +576,47 @@
                Monadic   occ _     -> occ
                Compare   occ _     -> occ
                GenPrimOp occ _ _ _ -> occ
+
+{- Note [Primop wrappers]
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Previously hasNoBinding would claim that PrimOpIds didn't have a curried
+function definition. This caused quite some trouble as we would be forced to
+eta expand unsaturated primop applications very late in the Core pipeline. Not
+only would this produce unnecessary thunks, but it would also result in nasty
+inconsistencies in CAFfy-ness determinations (see #16846 and
+Note [CAFfyness inconsistencies due to late eta expansion] in TidyPgm).
+
+However, it was quite unnecessary for hasNoBinding to claim this; primops in
+fact *do* have curried definitions which are found in GHC.PrimopWrappers, which
+is auto-generated by utils/genprimops from prelude/primops.txt.pp. These wrappers
+are standard Haskell functions mirroring the types of the primops they wrap.
+For instance, in the case of plusInt# we would have:
+
+    module GHC.PrimopWrappers where
+    import GHC.Prim as P
+    plusInt# a b = P.plusInt# a b
+
+We now take advantage of these curried definitions by letting hasNoBinding
+claim that PrimOpIds have a curried definition and then rewrite any unsaturated
+PrimOpId applications that we find during CoreToStg as applications of the
+associated wrapper (e.g. `GHC.Prim.plusInt# 3#` will get rewritten to
+`GHC.PrimopWrappers.plusInt# 3#`).` The Id of the wrapper for a primop can be
+found using 'PrimOp.primOpWrapperId'.
+
+Nota Bene: GHC.PrimopWrappers is needed *regardless*, because it's
+used by GHCi, which does not implement primops direct at all.
+
+-}
+
+-- | Returns the 'Id' of the wrapper associated with the given 'PrimOp'.
+-- See Note [Primop wrappers].
+primOpWrapperId :: PrimOp -> Id
+primOpWrapperId op = mkVanillaGlobalWithInfo name ty info
+  where
+    info = setCafInfo vanillaIdInfo NoCafRefs
+    name = mkExternalName uniq gHC_PRIMOPWRAPPERS (primOpOcc op) wiredInSrcSpan
+    uniq = mkPrimOpWrapperUnique (primOpTag op)
+    ty   = primOpType op
 
 isComparisonPrimOp :: PrimOp -> Bool
 isComparisonPrimOp op = case primOpInfo op of
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -13,7 +13,7 @@
         mkPrimTyConName, -- For implicit parameters in TysWiredIn only
 
         mkTemplateKindVars, mkTemplateTyVars, mkTemplateTyVarsFrom,
-        mkTemplateKiTyVars,
+        mkTemplateKiTyVars, mkTemplateKiTyVar,
 
         mkTemplateTyConBinders, mkTemplateKindTyConBinders,
         mkTemplateAnonTyConBinders,
@@ -251,14 +251,15 @@
         ["a", "b", ..., "z", "t1", "t2", ... ]
 -}
 
+mkTemplateKindVar :: Kind -> TyVar
+mkTemplateKindVar = mkTyVar (mk_tv_name 0 "k")
+
 mkTemplateKindVars :: [Kind] -> [TyVar]
 -- k0  with unique (mkAlphaTyVarUnique 0)
 -- k1  with unique (mkAlphaTyVarUnique 1)
 -- ... etc
-mkTemplateKindVars [kind]
-  = [mkTyVar (mk_tv_name 0 "k") kind]
-    -- Special case for one kind: just "k"
-
+mkTemplateKindVars [kind] = [mkTemplateKindVar kind]
+  -- Special case for one kind: just "k"
 mkTemplateKindVars kinds
   = [ mkTyVar (mk_tv_name u ('k' : show u)) kind
     | (kind, u) <- kinds `zip` [0..] ]
@@ -307,13 +308,28 @@
     -> [TyVar]   -- [kv1:k1, ..., kvn:kn, av1:ak1, ..., avm:akm]
 -- Example: if you want the tyvars for
 --   forall (r:RuntimeRep) (a:TYPE r) (b:*). blah
--- call mkTemplateKiTyVars [RuntimeRep] (\[r]. [TYPE r, *)
+-- call mkTemplateKiTyVars [RuntimeRep] (\[r] -> [TYPE r, *])
 mkTemplateKiTyVars kind_var_kinds mk_arg_kinds
   = kv_bndrs ++ tv_bndrs
   where
     kv_bndrs   = mkTemplateKindVars kind_var_kinds
     anon_kinds = mk_arg_kinds (mkTyVarTys kv_bndrs)
     tv_bndrs   = mkTemplateTyVarsFrom (length kv_bndrs) anon_kinds
+
+mkTemplateKiTyVar
+    :: Kind                  -- [k1, .., kn]   Kind of kind-forall'd var
+    -> (Kind -> [Kind])      -- Arg is kv1:k1
+                             -- Result is anon arg kinds [ak1, .., akm]
+    -> [TyVar]   -- [kv1:k1, ..., kvn:kn, av1:ak1, ..., avm:akm]
+-- Example: if you want the tyvars for
+--   forall (r:RuntimeRep) (a:TYPE r) (b:*). blah
+-- call mkTemplateKiTyVar RuntimeRep (\r -> [TYPE r, *])
+mkTemplateKiTyVar kind mk_arg_kinds
+  = kv_bndr : tv_bndrs
+  where
+    kv_bndr    = mkTemplateKindVar kind
+    anon_kinds = mk_arg_kinds (mkTyVarTy kv_bndr)
+    tv_bndrs   = mkTemplateTyVarsFrom 1 anon_kinds
 
 mkTemplateKindTyConBinders :: [Kind] -> [TyConBinder]
 -- Makes named, Specified binders
diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs
--- a/compiler/simplCore/CoreMonad.hs
+++ b/compiler/simplCore/CoreMonad.hs
@@ -5,6 +5,7 @@
 -}
 
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
 
 module CoreMonad (
     -- * Configuration of the core-to-core passes
@@ -35,7 +36,6 @@
 
     -- ** Lifting into the monad
     liftIO, liftIOWithCount,
-    liftIO1, liftIO2, liftIO3, liftIO4,
 
     -- ** Dealing with annotations
     getAnnotations, getFirstAnnotations,
@@ -582,9 +582,7 @@
 -- | The monad used by Core-to-Core passes to access common state, register simplification
 -- statistics and so on
 newtype CoreM a = CoreM { unCoreM :: CoreState -> CoreIOEnv (a, CoreState, CoreWriter) }
-
-instance Functor CoreM where
-    fmap = liftM
+    deriving (Functor)
 
 instance Monad CoreM where
     mx >>= f = CoreM $ \s -> do
diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs
--- a/compiler/typecheck/TcEvidence.hs
+++ b/compiler/typecheck/TcEvidence.hs
@@ -8,7 +8,8 @@
   HsWrapper(..),
   (<.>), mkWpTyApps, mkWpEvApps, mkWpEvVarApps, mkWpTyLams,
   mkWpLams, mkWpLet, mkWpCastN, mkWpCastR, collectHsWrapBinders,
-  mkWpFun, mkWpFuns, idHsWrapper, isIdHsWrapper, pprHsWrapper,
+  mkWpFun, idHsWrapper, isIdHsWrapper, isErasableHsWrapper,
+  pprHsWrapper,
 
   -- Evidence bindings
   TcEvBinds(..), EvBindsVar(..),
@@ -29,6 +30,7 @@
 
   -- TcCoercion
   TcCoercion, TcCoercionR, TcCoercionN, TcCoercionP, CoercionHole,
+  TcMCoercion,
   Role(..), LeftOrRight(..), pickLR,
   mkTcReflCo, mkTcNomReflCo, mkTcRepReflCo,
   mkTcTyConAppCo, mkTcAppCo, mkTcFunCo,
@@ -41,7 +43,7 @@
   mkTcKindCo,
   tcCoercionKind, coVarsOfTcCo,
   mkTcCoVarCo,
-  isTcReflCo, isTcReflexiveCo,
+  isTcReflCo, isTcReflexiveCo, isTcGReflMCo, tcCoToMCo,
   tcCoercionRole,
   unwrapIP, wrapIP
   ) where
@@ -97,6 +99,7 @@
 type TcCoercionN = CoercionN    -- A Nominal          coercion ~N
 type TcCoercionR = CoercionR    -- A Representational coercion ~R
 type TcCoercionP = CoercionP    -- a phantom coercion
+type TcMCoercion = MCoercion
 
 mkTcReflCo             :: Role -> TcType -> TcCoercion
 mkTcSymCo              :: TcCoercion -> TcCoercion
@@ -132,6 +135,7 @@
 tcCoercionRole         :: TcCoercion -> Role
 coVarsOfTcCo           :: TcCoercion -> TcTyCoVarSet
 isTcReflCo             :: TcCoercion -> Bool
+isTcGReflMCo           :: TcMCoercion -> Bool
 
 -- | This version does a slow check, calculating the related types and seeing
 -- if they are equal.
@@ -167,8 +171,12 @@
 tcCoercionRole         = coercionRole
 coVarsOfTcCo           = coVarsOfCo
 isTcReflCo             = isReflCo
+isTcGReflMCo           = isGReflMCo
 isTcReflexiveCo        = isReflexiveCo
 
+tcCoToMCo :: TcCoercion -> TcMCoercion
+tcCoToMCo = coToMCo
+
 {-
 %************************************************************************
 %*                                                                      *
@@ -292,21 +300,6 @@
 mkWpFun (WpCast co1) (WpCast co2) _  _  _ = WpCast (mkTcFunCo Representational (mkTcSymCo co1) co2)
 mkWpFun co1          co2          t1 _  d = WpFun co1 co2 t1 d
 
--- | @mkWpFuns [(ty1, wrap1), (ty2, wrap2)] ty_res wrap_res@,
--- where @wrap1 :: ty1 "->" ty1'@ and @wrap2 :: ty2 "->" ty2'@,
--- @wrap3 :: ty3 "->" ty3'@ and @ty_res@ is /either/ @ty3@ or @ty3'@,
--- gives a wrapper @(ty1' -> ty2' -> ty3) "->" (ty1 -> ty2 -> ty3')@.
--- Notice that the result wrapper goes the other way round to all
--- the others. This is a result of sub-typing contravariance.
--- The SDoc is a description of what you were doing when you called mkWpFuns.
-mkWpFuns :: [(TcType, HsWrapper)] -> TcType -> HsWrapper -> SDoc -> HsWrapper
-mkWpFuns args res_ty res_wrap doc = snd $ go args res_ty res_wrap
-  where
-    go [] res_ty res_wrap = (res_ty, res_wrap)
-    go ((arg_ty, arg_wrap) : args) res_ty res_wrap
-      = let (tail_ty, tail_wrap) = go args res_ty res_wrap in
-        (arg_ty `mkVisFunTy` tail_ty, mkWpFun arg_wrap tail_wrap arg_ty tail_ty doc)
-
 mkWpCastR :: TcCoercionR -> HsWrapper
 mkWpCastR co
   | isTcReflCo co = WpHole
@@ -354,6 +347,21 @@
 isIdHsWrapper :: HsWrapper -> Bool
 isIdHsWrapper WpHole = True
 isIdHsWrapper _      = False
+
+-- | Is the wrapper erasable, i.e., will not affect runtime semantics?
+isErasableHsWrapper :: HsWrapper -> Bool
+isErasableHsWrapper = go
+  where
+    go WpHole                  = True
+    go (WpCompose wrap1 wrap2) = go wrap1 && go wrap2
+    -- not so sure about WpFun. But it eta-expands, so...
+    go WpFun{}                 = False
+    go WpCast{}                = True
+    go WpEvLam{}               = False -- case in point
+    go WpEvApp{}               = False
+    go WpTyLam{}               = True
+    go WpTyApp{}               = True
+    go WpLet{}                 = False
 
 collectHsWrapBinders :: HsWrapper -> ([Var], HsWrapper)
 -- Collect the outer lambda binders of a HsWrapper,
diff --git a/compiler/typecheck/TcHoleFitTypes.hs b/compiler/typecheck/TcHoleFitTypes.hs
new file mode 100644
--- /dev/null
+++ b/compiler/typecheck/TcHoleFitTypes.hs
@@ -0,0 +1,144 @@
+{-# LANGUAGE ExistentialQuantification #-}
+module TcHoleFitTypes (
+  TypedHole (..), HoleFit (..), HoleFitCandidate (..),
+  CandPlugin, FitPlugin, HoleFitPlugin (..), HoleFitPluginR (..),
+  hfIsLcl, pprHoleFitCand
+  ) where
+
+import GhcPrelude
+
+import TcRnTypes
+import TcType
+
+import RdrName
+
+import HsDoc
+import Id
+
+import Outputable
+import Name
+
+import Data.Function ( on )
+
+data TypedHole = TyH { tyHRelevantCts :: Cts
+                       -- ^ Any relevant Cts to the hole
+                     , tyHImplics :: [Implication]
+                       -- ^ The nested implications of the hole with the
+                       --   innermost implication first.
+                     , tyHCt :: Maybe Ct
+                       -- ^ The hole constraint itself, if available.
+                     }
+
+instance Outputable TypedHole where
+  ppr (TyH rels implics ct)
+    = hang (text "TypedHole") 2
+        (ppr rels $+$ ppr implics $+$ ppr ct)
+
+
+-- | HoleFitCandidates are passed to hole fit plugins and then
+-- checked whether they fit a given typed-hole.
+data HoleFitCandidate = IdHFCand Id             -- An id, like locals.
+                      | NameHFCand Name         -- A name, like built-in syntax.
+                      | GreHFCand GlobalRdrElt  -- A global, like imported ids.
+                      deriving (Eq)
+
+instance Outputable HoleFitCandidate where
+  ppr = pprHoleFitCand
+
+pprHoleFitCand :: HoleFitCandidate -> SDoc
+pprHoleFitCand (IdHFCand cid) = text "Id HFC: " <> ppr cid
+pprHoleFitCand (NameHFCand cname) = text "Name HFC: " <> ppr cname
+pprHoleFitCand (GreHFCand cgre) = text "Gre HFC: " <> ppr cgre
+
+
+
+
+instance NamedThing HoleFitCandidate where
+  getName hfc = case hfc of
+                     IdHFCand cid -> idName cid
+                     NameHFCand cname -> cname
+                     GreHFCand cgre -> gre_name cgre
+  getOccName hfc = case hfc of
+                     IdHFCand cid -> occName cid
+                     NameHFCand cname -> occName cname
+                     GreHFCand cgre -> occName (gre_name cgre)
+
+instance HasOccName HoleFitCandidate where
+  occName = getOccName
+
+instance Ord HoleFitCandidate where
+  compare = compare `on` getName
+
+-- | HoleFit is the type we use for valid hole fits. It contains the
+-- element that was checked, the Id of that element as found by `tcLookup`,
+-- and the refinement level of the fit, which is the number of extra argument
+-- holes that this fit uses (e.g. if hfRefLvl is 2, the fit is for `Id _ _`).
+data HoleFit =
+  HoleFit { hfId   :: Id       -- ^ The elements id in the TcM
+          , hfCand :: HoleFitCandidate  -- ^ The candidate that was checked.
+          , hfType :: TcType -- ^ The type of the id, possibly zonked.
+          , hfRefLvl :: Int  -- ^ The number of holes in this fit.
+          , hfWrap :: [TcType] -- ^ The wrapper for the match.
+          , hfMatches :: [TcType]
+          -- ^ What the refinement variables got matched with, if anything
+          , hfDoc :: Maybe HsDocString
+          -- ^ Documentation of this HoleFit, if available.
+          }
+ | RawHoleFit SDoc
+ -- ^ A fit that is just displayed as is. Here so thatHoleFitPlugins
+ --   can inject any fit they want.
+
+-- We define an Eq and Ord instance to be able to build a graph.
+instance Eq HoleFit where
+   (==) = (==) `on` hfId
+
+instance Outputable HoleFit where
+  ppr (RawHoleFit sd) = sd
+  ppr (HoleFit _ cand ty _ _ mtchs _) =
+    hang (name <+> holes) 2 (text "where" <+> name <+> dcolon <+> (ppr ty))
+    where name = ppr $ getName cand
+          holes = sep $ map (parens . (text "_" <+> dcolon <+>) . ppr) mtchs
+
+-- We compare HoleFits by their name instead of their Id, since we don't
+-- want our tests to be affected by the non-determinism of `nonDetCmpVar`,
+-- which is used to compare Ids. When comparing, we want HoleFits with a lower
+-- refinement level to come first.
+instance Ord HoleFit where
+  compare (RawHoleFit _) (RawHoleFit _) = EQ
+  compare (RawHoleFit _) _ = LT
+  compare _ (RawHoleFit _) = GT
+  compare a@(HoleFit {}) b@(HoleFit {}) = cmp a b
+    where cmp  = if hfRefLvl a == hfRefLvl b
+                 then compare `on` (getName . hfCand)
+                 else compare `on` hfRefLvl
+
+hfIsLcl :: HoleFit -> Bool
+hfIsLcl hf@(HoleFit {}) = case hfCand hf of
+                            IdHFCand _    -> True
+                            NameHFCand _  -> False
+                            GreHFCand gre -> gre_lcl gre
+hfIsLcl _ = False
+
+
+-- | A plugin for modifying the candidate hole fits *before* they're checked.
+type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate]
+
+-- | A plugin for modifying hole fits  *after* they've been found.
+type FitPlugin =  TypedHole -> [HoleFit] -> TcM [HoleFit]
+
+-- | A HoleFitPlugin is a pair of candidate and fit plugins.
+data HoleFitPlugin = HoleFitPlugin
+  { candPlugin :: CandPlugin
+  , fitPlugin :: FitPlugin }
+
+-- | HoleFitPluginR adds a TcRef to hole fit plugins so that plugins can
+-- track internal state. Note the existential quantification, ensuring that
+-- the state cannot be modified from outside the plugin.
+data HoleFitPluginR = forall s. HoleFitPluginR
+  { hfPluginInit :: TcM (TcRef s)
+    -- ^ Initializes the TcRef to be passed to the plugin
+  , hfPluginRun :: TcRef s -> HoleFitPlugin
+    -- ^ The function defining the plugin itself
+  , hfPluginStop :: TcRef s -> TcM ()
+    -- ^ Cleanup of state, guaranteed to be called even on error
+  }
diff --git a/compiler/typecheck/TcHoleFitTypes.hs-boot b/compiler/typecheck/TcHoleFitTypes.hs-boot
new file mode 100644
--- /dev/null
+++ b/compiler/typecheck/TcHoleFitTypes.hs-boot
@@ -0,0 +1,10 @@
+-- This boot file is in place to break the loop where:
+-- + TcRnTypes needs 'HoleFitPlugin',
+-- + which needs 'TcHoleFitTypes'
+-- + which needs 'TcRnTypes'
+module TcHoleFitTypes where
+
+-- Build ordering
+import GHC.Base()
+
+data HoleFitPlugin
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -16,7 +16,7 @@
 of the stack mechanism), you should use a TcRef (= IORef) to store them.
 -}
 
-{-# LANGUAGE CPP, ExistentialQuantification, GeneralizedNewtypeDeriving,
+{-# LANGUAGE CPP, DeriveFunctor, ExistentialQuantification, GeneralizedNewtypeDeriving,
              ViewPatterns #-}
 
 module TcRnTypes(
@@ -195,7 +195,7 @@
 import PrelNames ( isUnboundName )
 import CostCentreState
 
-import Control.Monad (ap, liftM, msum)
+import Control.Monad (ap, msum)
 import qualified Control.Monad.Fail as MonadFail
 import Data.Set      ( Set )
 import qualified Data.Set as S
@@ -208,6 +208,8 @@
 import GHCi.Message
 import GHCi.RemoteTypes
 
+import {-# SOURCE #-} TcHoleFitTypes ( HoleFitPlugin )
+
 import qualified Language.Haskell.TH as TH
 
 -- | A 'NameShape' is a substitution on 'Name's that can be used
@@ -391,7 +393,7 @@
         -- These two fields are augmented as we walk inwards,
         -- through each patttern match in turn
         dsl_dicts   :: Bag EvVar,     -- Constraints from GADT pattern-matching
-        dsl_tm_cs   :: Bag SimpleEq,  -- Constraints form term-level pattern matching
+        dsl_tm_cs   :: Bag TmVarCt,      -- Constraints form term-level pattern matching
 
         dsl_pm_iter :: IORef Int  -- Number of iterations for pmcheck so far
                                   -- We fail if this gets too big
@@ -685,6 +687,8 @@
 
         tcg_tc_plugins :: [TcPluginSolver],
         -- ^ A list of user-defined plugins for the constraint solver.
+        tcg_hf_plugins :: [HoleFitPlugin],
+        -- ^ A list of user-defined plugins for hole fit suggestions.
 
         tcg_top_loc :: RealSrcSpan,
         -- ^ The RealSrcSpan this module came from
@@ -1020,7 +1024,7 @@
 'RunSplice' is needed to provide a reference where 'addModFinalizer' can insert
 the finalizer (see Note [Delaying modFinalizers in untyped splices]), and
 'addModFinalizer' runs when doing Q things. Therefore, It doesn't make sense to
-set 'RunSplice' when renaming or typechecking the splice, where 'Splice', 
+set 'RunSplice' when renaming or typechecking the splice, where 'Splice',
 'Brack' or 'Comp' are used instead.
 
 -}
@@ -1542,6 +1546,10 @@
                -- No need to keep track of whether they are truly lexically
                --   scoped because the renamer has named them uniquely
                -- See Note [Binding scoped type variables] in TcSigs
+               --
+               -- NB: The order of sig_inst_skols is irrelevant
+               --     for a CompleteSig, but for a PartialSig see
+               --     Note [Quantified varaibles in partial type signatures]
 
          , sig_inst_theta  :: TcThetaType
                -- Instantiated theta.  In the case of a
@@ -1553,15 +1561,15 @@
 
          -- Relevant for partial signature only
          , sig_inst_wcs   :: [(Name, TcTyVar)]
-               -- Like sig_inst_skols, but for wildcards.  The named
-               -- wildcards scope over the binding, and hence their
-               -- Names may appear in type signatures in the binding
+               -- Like sig_inst_skols, but for /named/ wildcards (_a etc).
+               -- The named wildcards scope over the binding, and hence
+               -- their Names may appear in type signatures in the binding
 
          , sig_inst_wcx   :: Maybe TcType
                -- Extra-constraints wildcard to fill in, if any
                -- If this exists, it is surely of the form (meta_tv |> co)
                -- (where the co might be reflexive). This is filled in
-               -- only from the return value of TcHsType.tcWildCardOcc
+               -- only from the return value of TcHsType.tcAnonWildCardOcc
          }
 
 {- Note [sig_inst_tau may be polymorphic]
@@ -1572,6 +1580,26 @@
 But that's ok: tcMatchesFun (called by tcRhs) can deal with that
 It happens, too!  See Note [Polymorphic methods] in TcClassDcl.
 
+Note [Quantified varaibles in partial type signatures]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Consider
+   f :: forall a b. _ -> a -> _ -> b
+   f (x,y) p q = q
+
+Then we expect f's final type to be
+  f :: forall {x,y}. forall a b. (x,y) -> a -> b -> b
+
+Note that x,y are Inferred, and can't be use for visible type
+application (VTA).  But a,b are Specified, and remain Specified
+in the final type, so we can use VTA for them.  (Exception: if
+it turns out that a's kind mentions b we need to reorder them
+with scopedSort.)
+
+The sig_inst_skols of the TISI from a partial signature records
+that original order, and is used to get the variables of f's
+final type in the correct order.
+
+
 Note [Wildcards in partial signatures]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 The wildcards in psig_wcs may stand for a type mentioning
@@ -2090,6 +2118,16 @@
    [D] Int ~ Bool, and we don't want to report that because it's
    incomprehensible. That is why we don't rewrite wanteds with wanteds!
 
+ * We might float out some Wanteds from an implication, leaving behind
+   their insoluble Deriveds. For example:
+
+   forall a[2]. [W] alpha[1] ~ Int
+                [W] alpha[1] ~ Bool
+                [D] Int ~ Bool
+
+   The Derived is insoluble, but we very much want to drop it when floating
+   out.
+
 But (tiresomely) we do keep *some* Derived constraints:
 
  * Type holes are derived constraints, because they have no evidence
@@ -2098,8 +2136,7 @@
  * Insoluble kind equalities (e.g. [D] * ~ (* -> *)), with
    KindEqOrigin, may arise from a type equality a ~ Int#, say.  See
    Note [Equalities with incompatible kinds] in TcCanonical.
-   These need to be kept because the kind equalities might have different
-   source locations and hence different error messages.
+   Keeping these around produces better error messages, in practice.
    E.g., test case dependent/should_fail/T11471
 
  * We keep most derived equalities arising from functional dependencies
@@ -3823,10 +3860,7 @@
                    -> [Ct]    -- wanted
                    -> TcPluginM TcPluginResult
 
-newtype TcPluginM a = TcPluginM (EvBindsVar -> TcM a)
-
-instance Functor TcPluginM where
-  fmap = liftM
+newtype TcPluginM a = TcPluginM (EvBindsVar -> TcM a) deriving (Functor)
 
 instance Applicative TcPluginM where
   pure x = TcPluginM (const $ pure x)
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -522,6 +522,17 @@
                   -- The choice of level number here is a bit dodgy, but
                   -- topTcLevel works in the places that vanillaSkolemTv is used
 
+instance Outputable TcTyVarDetails where
+  ppr = pprTcTyVarDetails
+
+pprTcTyVarDetails :: TcTyVarDetails -> SDoc
+-- For debugging
+pprTcTyVarDetails (RuntimeUnk {})      = text "rt"
+pprTcTyVarDetails (SkolemTv lvl True)  = text "ssk" <> colon <> ppr lvl
+pprTcTyVarDetails (SkolemTv lvl False) = text "sk"  <> colon <> ppr lvl
+pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl })
+  = ppr info <> colon <> ppr tclvl
+
 -----------------------------
 data MetaDetails
   = Flexi  -- Flexi type variables unify to become Indirects
@@ -550,20 +561,11 @@
   ppr Flexi         = text "Flexi"
   ppr (Indirect ty) = text "Indirect" <+> ppr ty
 
-pprTcTyVarDetails :: TcTyVarDetails -> SDoc
--- For debugging
-pprTcTyVarDetails (RuntimeUnk {})      = text "rt"
-pprTcTyVarDetails (SkolemTv lvl True)  = text "ssk" <> colon <> ppr lvl
-pprTcTyVarDetails (SkolemTv lvl False) = text "sk"  <> colon <> ppr lvl
-pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl })
-  = pp_info <> colon <> ppr tclvl
-  where
-    pp_info = case info of
-                TauTv      -> text "tau"
-                TyVarTv    -> text "tyv"
-                FlatMetaTv -> text "fmv"
-                FlatSkolTv -> text "fsk"
-
+instance Outputable MetaInfo where
+  ppr TauTv         = text "tau"
+  ppr TyVarTv       = text "tyv"
+  ppr FlatMetaTv    = text "fmv"
+  ppr FlatSkolTv    = text "fsk"
 
 {- *********************************************************************
 *                                                                      *
@@ -801,10 +803,10 @@
 checkTcLevelInvariant (TcLevel ctxt_tclvl) (TcLevel tv_tclvl)
   = ctxt_tclvl >= tv_tclvl
 
+-- Returns topTcLevel for non-TcTyVars
 tcTyVarLevel :: TcTyVar -> TcLevel
 tcTyVarLevel tv
-  = ASSERT2( tcIsTcTyVar tv, ppr tv )
-    case tcTyVarDetails tv of
+  = case tcTyVarDetails tv of
           MetaTv { mtv_tclvl = tv_lvl } -> tv_lvl
           SkolemTv tv_lvl _             -> tv_lvl
           RuntimeUnk                    -> topTcLevel
@@ -1793,11 +1795,14 @@
        Nothing      -> False
 
 evVarPred :: EvVar -> PredType
-evVarPred var
-  = ASSERT2( isEvVarType var_ty, ppr var <+> dcolon <+> ppr var_ty )
-    var_ty
- where
-    var_ty = varType var
+evVarPred var = varType var
+  -- Historical note: I used to have an ASSERT here,
+  -- checking (isEvVarType (varType var)).  But with something like
+  --   f :: c => _ -> _
+  -- we end up with (c :: kappa), and (kappa ~ Constraint).  Until
+  -- we solve and zonk (which there is no particular reason to do for
+  -- partial signatures, (isEvVarType kappa) will return False. But
+  -- nothing is wrong.  So I just removed the ASSERT.
 
 ------------------
 -- | When inferring types, should we quantify over a given predicate?
diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs
--- a/compiler/types/Coercion.hs
+++ b/compiler/types/Coercion.hs
@@ -62,7 +62,7 @@
         pickLR,
 
         isGReflCo, isReflCo, isReflCo_maybe, isGReflCo_maybe, isReflexiveCo, isReflexiveCo_maybe,
-        isReflCoVar_maybe,
+        isReflCoVar_maybe, isGReflMCo, coToMCo,
 
         -- ** Coercion variables
         mkCoVar, isCoVar, coVarName, setCoVarName, setCoVarUnique,
@@ -591,6 +591,11 @@
   | otherwise
   = Nothing
   where (Pair ty1 ty2, r) = coercionKindRole co
+
+coToMCo :: Coercion -> MCoercion
+coToMCo c = if isReflCo c
+  then MRefl
+  else MCo c
 
 {-
 %************************************************************************
diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs
--- a/compiler/types/FamInstEnv.hs
+++ b/compiler/types/FamInstEnv.hs
@@ -2,7 +2,8 @@
 --
 -- FamInstEnv: Type checked family instance declarations
 
-{-# LANGUAGE CPP, GADTs, ScopedTypeVariables, BangPatterns, TupleSections #-}
+{-# LANGUAGE CPP, GADTs, ScopedTypeVariables, BangPatterns, TupleSections,
+    DeriveFunctor #-}
 
 module FamInstEnv (
         FamInst(..), FamFlavor(..), famInstAxiom, famInstTyCon, famInstRHS,
@@ -1501,6 +1502,7 @@
 -- a 'LiftingContext', and a 'Role'.
 newtype NormM a = NormM { runNormM ::
                             FamInstEnvs -> LiftingContext -> Role -> a }
+    deriving (Functor)
 
 initNormM :: FamInstEnvs -> Role
           -> TyCoVarSet   -- the in-scope variables
@@ -1531,8 +1533,6 @@
                let a = runNormM ma env lc r in
                runNormM (fmb a) env lc r
 
-instance Functor NormM where
-  fmap = liftM
 instance Applicative NormM where
   pure x = NormM $ \ _ _ _ -> x
   (<*>)  = ap
diff --git a/compiler/types/InstEnv.hs b/compiler/types/InstEnv.hs
--- a/compiler/types/InstEnv.hs
+++ b/compiler/types/InstEnv.hs
@@ -14,14 +14,14 @@
         OverlapFlag(..), OverlapMode(..), setOverlapModeMaybe,
         ClsInst(..), DFunInstType, pprInstance, pprInstanceHdr, pprInstances,
         instanceHead, instanceSig, mkLocalInstance, mkImportedInstance,
-        instanceDFunId, tidyClsInstDFun, instanceRoughTcs,
+        instanceDFunId, updateClsInstDFun, instanceRoughTcs,
         fuzzyClsInstCmp, orphNamesOfClsInst,
 
         InstEnvs(..), VisibleOrphanModules, InstEnv,
         emptyInstEnv, extendInstEnv,
         deleteFromInstEnv, deleteDFunFromInstEnv,
         identicalClsInstHead,
-        extendInstEnvList, lookupUniqueInstEnv, lookupInstEnv, instEnvElts,
+        extendInstEnvList, lookupUniqueInstEnv, lookupInstEnv, instEnvElts, instEnvClasses,
         memberInstEnv,
         instIsVisible,
         classInstances, instanceBindFun,
@@ -199,8 +199,8 @@
 instanceDFunId :: ClsInst -> DFunId
 instanceDFunId = is_dfun
 
-tidyClsInstDFun :: (DFunId -> DFunId) -> ClsInst -> ClsInst
-tidyClsInstDFun tidy_dfun ispec
+updateClsInstDFun :: (DFunId -> DFunId) -> ClsInst -> ClsInst
+updateClsInstDFun tidy_dfun ispec
   = ispec { is_dfun = tidy_dfun (is_dfun ispec) }
 
 instanceRoughTcs :: ClsInst -> [Maybe Name]
@@ -426,6 +426,9 @@
 instEnvElts :: InstEnv -> [ClsInst]
 instEnvElts ie = [elt | ClsIE elts <- eltsUDFM ie, elt <- elts]
   -- See Note [InstEnv determinism]
+
+instEnvClasses :: InstEnv -> [Class]
+instEnvClasses ie = [is_cls e | ClsIE (e : _) <- eltsUDFM ie]
 
 -- | Test if an instance is visible, by checking that its origin module
 -- is in 'VisibleOrphanModules'.
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -59,6 +59,7 @@
         getRuntimeRep_maybe, kindRep_maybe, kindRep,
 
         mkCastTy, mkCoercionTy, splitCastTy_maybe,
+        discardCast,
 
         userTypeError_maybe, pprUserTypeErrorTy,
 
@@ -137,6 +138,7 @@
         -- ** Finding the kind of a type
         typeKind, tcTypeKind, isTypeLevPoly, resultIsLevPoly,
         tcIsLiftedTypeKind, tcIsConstraintKind, tcReturnsConstraintKind,
+        tcIsRuntimeTypeKind,
 
         -- ** Common Kind
         liftedTypeKind,
@@ -156,8 +158,8 @@
         typeSize, occCheckExpand,
 
         -- * Well-scoped lists of variables
-        dVarSetElemsWellScoped, scopedSort, tyCoVarsOfTypeWellScoped,
-        tyCoVarsOfTypesWellScoped, tyCoVarsOfBindersWellScoped,
+        scopedSort, tyCoVarsOfTypeWellScoped,
+        tyCoVarsOfTypesWellScoped,
 
         -- * Type comparison
         eqType, eqTypeX, eqTypes, nonDetCmpType, nonDetCmpTypes, nonDetCmpTypeX,
@@ -248,7 +250,7 @@
 import Class
 import TyCon
 import TysPrim
-import {-# SOURCE #-} TysWiredIn ( listTyCon, typeNatKind, unitTy
+import {-# SOURCE #-} TysWiredIn ( listTyCon, typeNatKind
                                  , typeSymbolKind, liftedTypeKind
                                  , constraintKind )
 import PrelNames
@@ -1277,6 +1279,21 @@
     to_tyb (Bndr tv (NamedTCB vis)) = Named (Bndr tv vis)
     to_tyb (Bndr tv (AnonTCB af))   = Anon af (varType tv)
 
+-- | Drop the cast on a type, if any. If there is no
+-- cast, just return the original type. This is rarely what
+-- you want. The CastTy data constructor (in TyCoRep) has the
+-- invariant that another CastTy is not inside. See the
+-- data constructor for a full description of this invariant.
+-- Since CastTy cannot be nested, the result of discardCast
+-- cannot be a CastTy.
+discardCast :: Type -> Type
+discardCast (CastTy ty _) = ASSERT(not (isCastTy ty)) ty
+  where
+  isCastTy CastTy{} = True
+  isCastTy _        = False
+discardCast ty            = ty
+
+
 {-
 --------------------------------------------------------------------
                             CoercionTy
@@ -1827,6 +1844,17 @@
   | otherwise
   = False
 
+-- | Is this kind equivalent to @TYPE r@ (for some unknown r)?
+--
+-- This considers 'Constraint' to be distinct from @*@.
+tcIsRuntimeTypeKind :: Kind -> Bool
+tcIsRuntimeTypeKind ty
+  | Just (tc, _) <- tcSplitTyConApp_maybe ty    -- Note: tcSplit here
+  , tc `hasKey` tYPETyConKey
+  = True
+  | otherwise
+  = False
+
 tcReturnsConstraintKind :: Kind -> Bool
 -- True <=> the Kind ultimately returns a Constraint
 --   E.g.  * -> Constraint
@@ -2171,15 +2199,6 @@
        -- lists not in correspondence
     insert _ _ _ = panic "scopedSort"
 
--- | Extract a well-scoped list of variables from a deterministic set of
--- variables. The result is deterministic.
--- NB: There used to exist varSetElemsWellScoped :: VarSet -> [Var] which
--- took a non-deterministic set and produced a non-deterministic
--- well-scoped list. If you care about the list being well-scoped you also
--- most likely care about it being in deterministic order.
-dVarSetElemsWellScoped :: DVarSet -> [Var]
-dVarSetElemsWellScoped = scopedSort . dVarSetElems
-
 -- | Get the free vars of a type in scoped order
 tyCoVarsOfTypeWellScoped :: Type -> [TyVar]
 tyCoVarsOfTypeWellScoped = scopedSort . tyCoVarsOfTypeList
@@ -2187,12 +2206,6 @@
 -- | Get the free vars of types in scoped order
 tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar]
 tyCoVarsOfTypesWellScoped = scopedSort . tyCoVarsOfTypesList
-
--- | Given the suffix of a telescope, returns the prefix.
--- Ex: given [(k :: j), (a :: Proxy k)], returns [(j :: *)].
-tyCoVarsOfBindersWellScoped :: [TyVar] -> [TyVar]
-tyCoVarsOfBindersWellScoped tvs
-  = tyCoVarsOfTypeWellScoped (mkInvForAllTys tvs unitTy)
 
 ------------- Closing over kinds -----------------
 
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -1206,9 +1206,7 @@
                    , um_cv_env   :: CvSubstEnv }
 
 newtype UM a = UM { unUM :: UMState -> UnifyResultM (UMState, a) }
-
-instance Functor UM where
-      fmap = liftM
+    deriving (Functor)
 
 instance Applicative UM where
       pure a = UM (\s -> pure (s, a))
diff --git a/compiler/utils/Bag.hs b/compiler/utils/Bag.hs
--- a/compiler/utils/Bag.hs
+++ b/compiler/utils/Bag.hs
@@ -6,7 +6,7 @@
 Bag: an unordered collection with duplicates
 -}
 
-{-# LANGUAGE ScopedTypeVariables, CPP #-}
+{-# LANGUAGE ScopedTypeVariables, CPP, DeriveFunctor #-}
 
 module Bag (
         Bag, -- abstract type
@@ -45,6 +45,7 @@
   | UnitBag a
   | TwoBags (Bag a) (Bag a) -- INVARIANT: neither branch is empty
   | ListBag [a]             -- INVARIANT: the list is non-empty
+  deriving (Functor)
 
 emptyBag :: Bag a
 emptyBag = EmptyBag
@@ -221,10 +222,7 @@
 foldlBagM k z (ListBag xs)    = foldlM k z xs
 
 mapBag :: (a -> b) -> Bag a -> Bag b
-mapBag _ EmptyBag        = EmptyBag
-mapBag f (UnitBag x)     = UnitBag (f x)
-mapBag f (TwoBags b1 b2) = TwoBags (mapBag f b1) (mapBag f b2)
-mapBag f (ListBag xs)    = ListBag (map f xs)
+mapBag = fmap
 
 concatMapBag :: (a -> Bag b) -> Bag a -> Bag b
 concatMapBag _ EmptyBag        = EmptyBag
@@ -343,9 +341,6 @@
   gunfold _ _  = error "gunfold"
   dataTypeOf _ = mkNoRepType "Bag"
   dataCast1 x  = gcast1 x
-
-instance Functor Bag where
-    fmap = mapBag
 
 instance Foldable.Foldable Bag where
     foldr = foldrBag
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
 --
 -- (c) The University of Glasgow 2002-2006
 --
@@ -51,7 +52,7 @@
 ----------------------------------------------------------------------
 
 
-newtype IOEnv env a = IOEnv (env -> IO a)
+newtype IOEnv env a = IOEnv (env -> IO a) deriving (Functor)
 
 unIOEnv :: IOEnv env a -> (env -> IO a)
 unIOEnv (IOEnv m) = m
@@ -70,9 +71,6 @@
     pure = returnM
     IOEnv f <*> IOEnv x = IOEnv (\ env -> f env <*> x env )
     (*>) = thenM_
-
-instance Functor (IOEnv m) where
-    fmap f (IOEnv m) = IOEnv (\ env -> fmap f (m env))
 
 returnM :: a -> IOEnv env a
 returnM a = IOEnv (\ _ -> return a)
diff --git a/compiler/utils/ListSetOps.hs b/compiler/utils/ListSetOps.hs
--- a/compiler/utils/ListSetOps.hs
+++ b/compiler/utils/ListSetOps.hs
@@ -14,7 +14,7 @@
         Assoc, assoc, assocMaybe, assocUsing, assocDefault, assocDefaultUsing,
 
         -- Duplicate handling
-        hasNoDups, removeDups, findDupsEq,
+        hasNoDups, removeDups, findDupsEq, insertNoDup,
         equivClasses,
 
         -- Indexing
@@ -169,3 +169,10 @@
 findDupsEq eq (x:xs) | null eq_xs  = findDupsEq eq xs
                      | otherwise   = (x :| eq_xs) : findDupsEq eq neq_xs
     where (eq_xs, neq_xs) = partition (eq x) xs
+
+-- | \( O(n) \). @'insertNoDup' x xs@ treats @xs@ as a set, inserting @x@ only
+-- when an equal element couldn't be found in @xs@.
+insertNoDup :: (Eq a) => a -> [a] -> [a]
+insertNoDup x set
+  | elem x set = set
+  | otherwise  = x:set
diff --git a/compiler/utils/Maybes.hs b/compiler/utils/Maybes.hs
--- a/compiler/utils/Maybes.hs
+++ b/compiler/utils/Maybes.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE CPP #-}
 {-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE KindSignatures #-}
 {-# LANGUAGE FlexibleContexts #-}
 
@@ -95,9 +96,7 @@
 -}
 
 data MaybeErr err val = Succeeded val | Failed err
-
-instance Functor (MaybeErr err) where
-  fmap = liftM
+    deriving (Functor)
 
 instance Applicative (MaybeErr err) where
   pure  = Succeeded
diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs
--- a/compiler/utils/MonadUtils.hs
+++ b/compiler/utils/MonadUtils.hs
@@ -8,8 +8,6 @@
         , MonadFix(..)
         , MonadIO(..)
 
-        , liftIO1, liftIO2, liftIO3, liftIO4
-
         , zipWith3M, zipWith3M_, zipWith4M, zipWithAndUnzipM
         , mapAndUnzipM, mapAndUnzip3M, mapAndUnzip4M, mapAndUnzip5M
         , mapAccumLM
@@ -36,27 +34,6 @@
 import Control.Monad.IO.Class
 import Data.Foldable (sequenceA_)
 import Data.List (unzip4, unzip5, zipWith4)
-
--------------------------------------------------------------------------------
--- Lift combinators
---  These are used throughout the compiler
--------------------------------------------------------------------------------
-
--- | Lift an 'IO' operation with 1 argument into another monad
-liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b
-liftIO1 = (.) liftIO
-
--- | Lift an 'IO' operation with 2 arguments into another monad
-liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
-liftIO2 = ((.).(.)) liftIO
-
--- | Lift an 'IO' operation with 3 arguments into another monad
-liftIO3 :: MonadIO m => (a -> b -> c -> IO d) -> a -> b -> c -> m d
-liftIO3 = ((.).((.).(.))) liftIO
-
--- | Lift an 'IO' operation with 4 arguments into another monad
-liftIO4 :: MonadIO m => (a -> b -> c -> d -> IO e) -> a -> b -> c -> d -> m e
-liftIO4 = (((.).(.)).((.).(.))) liftIO
 
 -------------------------------------------------------------------------------
 -- Common functions
diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs
--- a/compiler/utils/OrdList.hs
+++ b/compiler/utils/OrdList.hs
@@ -8,6 +8,7 @@
 Provide trees (of instructions), so that lists of instructions
 can be appended in linear time.
 -}
+{-# LANGUAGE DeriveFunctor #-}
 
 module OrdList (
         OrdList,
@@ -34,6 +35,7 @@
   | Snoc (OrdList a) a
   | Two (OrdList a) -- Invariant: non-empty
         (OrdList a) -- Invariant: non-empty
+  deriving (Functor)
 
 instance Outputable a => Outputable (OrdList a) where
   ppr ol = ppr (fromOL ol)  -- Convert to list and print that
@@ -46,9 +48,6 @@
   mappend = (Semigroup.<>)
   mconcat = concatOL
 
-instance Functor OrdList where
-  fmap = mapOL
-
 instance Foldable OrdList where
   foldr = foldrOL
 
@@ -117,12 +116,7 @@
         go (Many xs)  acc = reverse xs ++ acc
 
 mapOL :: (a -> b) -> OrdList a -> OrdList b
-mapOL _ None = None
-mapOL f (One x) = One (f x)
-mapOL f (Cons x xs) = Cons (f x) (mapOL f xs)
-mapOL f (Snoc xs x) = Snoc (mapOL f xs) (f x)
-mapOL f (Two x y) = Two (mapOL f x) (mapOL f y)
-mapOL f (Many xs) = Many (map f xs)
+mapOL = fmap
 
 foldrOL :: (a->b->b) -> b -> OrdList a -> b
 foldrOL _ z None        = z
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -101,7 +101,7 @@
 import FastString
 import qualified Pretty
 import Util
-import Platform
+import GHC.Platform
 import qualified PprColour as Col
 import Pretty           ( Doc, Mode(..) )
 import Panic
@@ -812,6 +812,12 @@
 
 instance Outputable Word where
     ppr n = integer $ fromIntegral n
+
+instance Outputable Float where
+    ppr f = float f
+
+instance Outputable Double where
+    ppr f = double f
 
 instance Outputable () where
     ppr _ = text "()"
diff --git a/compiler/utils/Pair.hs b/compiler/utils/Pair.hs
--- a/compiler/utils/Pair.hs
+++ b/compiler/utils/Pair.hs
@@ -4,6 +4,7 @@
 -}
 
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
 
 module Pair ( Pair(..), unPair, toPair, swap, pLiftFst, pLiftSnd ) where
 
@@ -15,14 +16,13 @@
 import qualified Data.Semigroup as Semi
 
 data Pair a = Pair { pFst :: a, pSnd :: a }
+  deriving (Functor)
 -- Note that Pair is a *unary* type constructor
 -- whereas (,) is binary
 
 -- The important thing about Pair is that it has a *homogeneous*
 -- Functor instance, so you can easily apply the same function
 -- to both components
-instance Functor Pair where
-  fmap f (Pair x y) = Pair (f x) (f y)
 
 instance Applicative Pair where
   pure x = Pair x x
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
deleted file mode 100644
--- a/compiler/utils/Platform.hs
+++ /dev/null
@@ -1,190 +0,0 @@
-
--- | A description of the platform we're compiling for.
---
-module Platform (
-        Platform(..),
-        Arch(..),
-        OS(..),
-        ArmISA(..),
-        ArmISAExt(..),
-        ArmABI(..),
-        PPC_64ABI(..),
-
-        target32Bit,
-        isARM,
-        osElfTarget,
-        osMachOTarget,
-        osSubsectionsViaSymbols,
-        platformUsesFrameworks,
-
-        PlatformMisc(..),
-        IntegerLibrary(..),
-)
-
-where
-
-import GhcPrelude
-
--- | Contains enough information for the native code generator to emit
---      code for this platform.
-data Platform
-        = Platform {
-              platformArch                     :: Arch,
-              platformOS                       :: OS,
-              -- Word size in bytes (i.e. normally 4 or 8,
-              -- for 32bit and 64bit platforms respectively)
-              platformWordSize                 :: {-# UNPACK #-} !Int,
-              platformUnregisterised           :: Bool,
-              platformHasGnuNonexecStack       :: Bool,
-              platformHasIdentDirective        :: Bool,
-              platformHasSubsectionsViaSymbols :: Bool,
-              platformIsCrossCompiling         :: Bool
-          }
-        deriving (Read, Show, Eq)
-
-
--- | Architectures that the native code generator knows about.
---      TODO: It might be nice to extend these constructors with information
---      about what instruction set extensions an architecture might support.
---
-data Arch
-        = ArchUnknown
-        | ArchX86
-        | ArchX86_64
-        | ArchPPC
-        | ArchPPC_64
-          { ppc_64ABI :: PPC_64ABI
-          }
-        | ArchSPARC
-        | ArchSPARC64
-        | ArchARM
-          { armISA    :: ArmISA
-          , armISAExt :: [ArmISAExt]
-          , armABI    :: ArmABI
-          }
-        | ArchARM64
-        | ArchAlpha
-        | ArchMipseb
-        | ArchMipsel
-        | ArchJavaScript
-        deriving (Read, Show, Eq)
-
-isARM :: Arch -> Bool
-isARM (ArchARM {}) = True
-isARM ArchARM64    = True
-isARM _ = False
-
--- | Operating systems that the native code generator knows about.
---      Having OSUnknown should produce a sensible default, but no promises.
-data OS
-        = OSUnknown
-        | OSLinux
-        | OSDarwin
-        | OSSolaris2
-        | OSMinGW32
-        | OSFreeBSD
-        | OSDragonFly
-        | OSOpenBSD
-        | OSNetBSD
-        | OSKFreeBSD
-        | OSHaiku
-        | OSQNXNTO
-        | OSAIX
-        | OSHurd
-        deriving (Read, Show, Eq)
-
--- | ARM Instruction Set Architecture, Extensions and ABI
---
-data ArmISA
-    = ARMv5
-    | ARMv6
-    | ARMv7
-    deriving (Read, Show, Eq)
-
-data ArmISAExt
-    = VFPv2
-    | VFPv3
-    | VFPv3D16
-    | NEON
-    | IWMMX2
-    deriving (Read, Show, Eq)
-
-data ArmABI
-    = SOFT
-    | SOFTFP
-    | HARD
-    deriving (Read, Show, Eq)
-
--- | PowerPC 64-bit ABI
---
-data PPC_64ABI
-    = ELF_V1
-    | ELF_V2
-    deriving (Read, Show, Eq)
-
--- | This predicate tells us whether the platform is 32-bit.
-target32Bit :: Platform -> Bool
-target32Bit p = platformWordSize p == 4
-
--- | This predicate tells us whether the OS supports ELF-like shared libraries.
-osElfTarget :: OS -> Bool
-osElfTarget OSLinux     = True
-osElfTarget OSFreeBSD   = True
-osElfTarget OSDragonFly = True
-osElfTarget OSOpenBSD   = True
-osElfTarget OSNetBSD    = True
-osElfTarget OSSolaris2  = True
-osElfTarget OSDarwin    = False
-osElfTarget OSMinGW32   = False
-osElfTarget OSKFreeBSD  = True
-osElfTarget OSHaiku     = True
-osElfTarget OSQNXNTO    = False
-osElfTarget OSAIX       = False
-osElfTarget OSHurd      = True
-osElfTarget OSUnknown   = False
- -- Defaulting to False is safe; it means don't rely on any
- -- ELF-specific functionality.  It is important to have a default for
- -- portability, otherwise we have to answer this question for every
- -- new platform we compile on (even unreg).
-
--- | This predicate tells us whether the OS support Mach-O shared libraries.
-osMachOTarget :: OS -> Bool
-osMachOTarget OSDarwin = True
-osMachOTarget _ = False
-
-osUsesFrameworks :: OS -> Bool
-osUsesFrameworks OSDarwin = True
-osUsesFrameworks _        = False
-
-platformUsesFrameworks :: Platform -> Bool
-platformUsesFrameworks = osUsesFrameworks . platformOS
-
-osSubsectionsViaSymbols :: OS -> Bool
-osSubsectionsViaSymbols OSDarwin = True
-osSubsectionsViaSymbols _        = False
-
--- | Platform-specific settings formerly hard-coded in Config.hs.
---
--- These should probably be all be triaged whether they can be computed from
--- other settings or belong in another another place (like 'Platform' above).
-data PlatformMisc = PlatformMisc
-  { -- TODO Recalculate string from richer info?
-    platformMisc_targetPlatformString :: String
-  , platformMisc_integerLibrary       :: String
-  , platformMisc_integerLibraryType   :: IntegerLibrary
-  , platformMisc_ghcWithInterpreter   :: Bool
-  , platformMisc_ghcWithNativeCodeGen :: Bool
-  , platformMisc_ghcWithSMP           :: Bool
-  , platformMisc_ghcRTSWays           :: String
-  , platformMisc_tablesNextToCode     :: Bool
-  , platformMisc_leadingUnderscore    :: Bool
-  , platformMisc_libFFI               :: Bool
-  , platformMisc_ghcThreaded          :: Bool
-  , platformMisc_ghcDebugged          :: Bool
-  , platformMisc_ghcRtsWithLibdw      :: Bool
-  }
-
-data IntegerLibrary
-    = IntegerGMP
-    | IntegerSimple
-    deriving (Read, Show, Eq)
diff --git a/compiler/utils/UniqDFM.hs b/compiler/utils/UniqDFM.hs
--- a/compiler/utils/UniqDFM.hs
+++ b/compiler/utils/UniqDFM.hs
@@ -116,7 +116,7 @@
   TaggedVal
     val
     {-# UNPACK #-} !Int -- ^ insertion time
-  deriving Data
+  deriving (Data, Functor)
 
 taggedFst :: TaggedVal val -> val
 taggedFst (TaggedVal v _) = v
@@ -126,9 +126,6 @@
 
 instance Eq val => Eq (TaggedVal val) where
   (TaggedVal v1 _) == (TaggedVal v2 _) = v1 == v2
-
-instance Functor TaggedVal where
-  fmap f (TaggedVal val i) = TaggedVal (f val) i
 
 -- | Type of unique deterministic finite maps
 data UniqDFM ele =
diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs
--- a/compiler/utils/Util.hs
+++ b/compiler/utils/Util.hs
@@ -92,9 +92,6 @@
         readRational,
         readHexRational,
 
-        -- * read helpers
-        maybeRead, maybeReadFuzzy,
-
         -- * IO-ish utilities
         doesDirNameExist,
         getModificationUTCTime,
@@ -188,7 +185,7 @@
 -}
 
 ghciSupported :: Bool
-#if defined(GHCI)
+#if defined(HAVE_INTERNAL_INTERPRETER)
 ghciSupported = True
 #else
 ghciSupported = False
@@ -1253,25 +1250,6 @@
             | otherwise =  ([],xs)
 
 readHexRational__ _ = Nothing
-
-
-
-
------------------------------------------------------------------------------
--- read helpers
-
-maybeRead :: Read a => String -> Maybe a
-maybeRead str = case reads str of
-                [(x, "")] -> Just x
-                _         -> Nothing
-
-maybeReadFuzzy :: Read a => String -> Maybe a
-maybeReadFuzzy str = case reads str of
-                     [(x, s)]
-                      | all isSpace s ->
-                         Just x
-                     _ ->
-                         Nothing
 
 -----------------------------------------------------------------------------
 -- Verify that the 'dirname' portion of a FilePath exists.
diff --git a/ghc-lib-parser.cabal b/ghc-lib-parser.cabal
--- a/ghc-lib-parser.cabal
+++ b/ghc-lib-parser.cabal
@@ -1,7 +1,7 @@
 cabal-version: >=1.22
 build-type: Simple
 name: ghc-lib-parser
-version: 0.20190603
+version: 0.20190703
 license: BSD3
 license-file: LICENSE
 category: Development
@@ -41,6 +41,7 @@
     ghc-lib/stage1/compiler/build/primop-vector-tys-exports.hs-incl
     ghc-lib/stage1/compiler/build/primop-vector-tys.hs-incl
     ghc-lib/stage1/compiler/build/primop-vector-uniques.hs-incl
+    ghc-lib/stage0/compiler/build/Fingerprint.hs
     ghc-lib/stage1/compiler/build/Config.hs
     ghc-lib/stage0/compiler/build/Parser.hs
     ghc-lib/stage0/compiler/build/Lexer.hs
@@ -68,7 +69,7 @@
         compiler/utils
     ghc-options: -fobject-code -package=ghc-boot-th -optc-DTHREADED_RTS
     cc-options: -DTHREADED_RTS
-    cpp-options: -DSTAGE=2 -DTHREADED_RTS -DGHCI -DGHC_IN_GHCI
+    cpp-options: -DSTAGE=2 -DTHREADED_RTS -DHAVE_INTERPRETER -DGHC_IN_GHCI
     if !os(windows)
         build-depends: unix
     else
@@ -126,33 +127,35 @@
         compiler/cbits/genSym.c
         compiler/parser/cutils.c
     hs-source-dirs:
-        compiler
-        compiler/backpack
+        ghc-lib/stage0/libraries/ghc-heap/build
+        ghc-lib/stage0/libraries/ghci/build
+        ghc-lib/stage0/compiler/build
+        ghc-lib/stage1/compiler/build
+        libraries/template-haskell
+        libraries/ghc-boot-th
         compiler/basicTypes
-        compiler/cmm
-        compiler/coreSyn
-        compiler/deSugar
-        compiler/ghci
-        compiler/hsSyn
-        compiler/iface
-        compiler/main
+        compiler/specialise
+        libraries/ghc-heap
+        libraries/ghc-boot
         compiler/nativeGen
-        compiler/parser
-        compiler/prelude
         compiler/profiling
         compiler/simplCore
-        compiler/simplStg
-        compiler/specialise
         compiler/typecheck
+        compiler/backpack
+        compiler/simplStg
+        compiler/coreSyn
+        compiler/deSugar
+        compiler/prelude
+        compiler/parser
+        libraries/ghci
+        compiler/hsSyn
+        compiler/iface
         compiler/types
         compiler/utils
-        ghc-lib/stage0/compiler/build
-        ghc-lib/stage1/compiler/build
-        libraries/ghc-boot
-        libraries/ghc-boot-th
-        libraries/ghc-heap
-        libraries/ghci
-        libraries/template-haskell
+        compiler/ghci
+        compiler/main
+        compiler/cmm
+        compiler
     autogen-modules:
         Lexer
         Parser
@@ -168,8 +171,8 @@
         BooleanFormula
         BufWrite
         ByteCodeTypes
-        CliOption
         Class
+        CliOption
         CmdLineParser
         CmmType
         CoAxiom
@@ -213,7 +216,7 @@
         Fingerprint
         FiniteMap
         ForeignCall
-        GhcNameVersion
+        GHC.BaseDir
         GHC.Exts.Heap
         GHC.Exts.Heap.ClosureTypes
         GHC.Exts.Heap.Closures
@@ -228,6 +231,7 @@
         GHC.LanguageExtensions.Type
         GHC.Lexeme
         GHC.PackageDb
+        GHC.Platform
         GHC.Serialized
         GHCi.BreakArray
         GHCi.FFI
@@ -235,6 +239,7 @@
         GHCi.RemoteTypes
         GHCi.TH.Binary
         GhcMonad
+        GhcNameVersion
         GhcPrelude
         HaddockUtils
         HeaderInfo
@@ -298,7 +303,6 @@
         PipelineMonad
         PlaceHolder
         PlainPanic
-        Platform
         PlatformConstants
         Plugins
         PmExpr
@@ -319,6 +323,7 @@
         SysTools.BaseDir
         SysTools.Terminal
         TcEvidence
+        TcHoleFitTypes
         TcRnTypes
         TcType
         ToIface
diff --git a/ghc-lib/generated/ghcautoconf.h b/ghc-lib/generated/ghcautoconf.h
--- a/ghc-lib/generated/ghcautoconf.h
+++ b/ghc-lib/generated/ghcautoconf.h
@@ -1,4 +1,4 @@
-#ifndef __GHCAUTOCONF_H__
+#if !defined(__GHCAUTOCONF_H__)
 #define __GHCAUTOCONF_H__
 /* mk/config.h.  Generated from config.h.in by configure.  */
 /* mk/config.h.in.  Generated from configure.ac by autoheader.  */
@@ -526,7 +526,7 @@
 /* #undef pid_t */
 
 /* The supported LLVM version number */
-#define sUPPORTED_LLVM_VERSION (7,0)
+#define sUPPORTED_LLVM_VERSION (7)
 
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 /* #undef size_t */
diff --git a/ghc-lib/generated/ghcplatform.h b/ghc-lib/generated/ghcplatform.h
--- a/ghc-lib/generated/ghcplatform.h
+++ b/ghc-lib/generated/ghcplatform.h
@@ -1,4 +1,4 @@
-#ifndef __GHCPLATFORM_H__
+#if !defined(__GHCPLATFORM_H__)
 #define __GHCPLATFORM_H__
 
 #define BuildPlatform_TYPE  x86_64_apple_darwin
diff --git a/ghc-lib/generated/ghcversion.h b/ghc-lib/generated/ghcversion.h
--- a/ghc-lib/generated/ghcversion.h
+++ b/ghc-lib/generated/ghcversion.h
@@ -1,12 +1,12 @@
-#ifndef __GHCVERSION_H__
+#if !defined(__GHCVERSION_H__)
 #define __GHCVERSION_H__
 
-#ifndef __GLASGOW_HASKELL__
+#if !defined(__GLASGOW_HASKELL__)
 # define __GLASGOW_HASKELL__ 809
 #endif
 
 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 0
-#define __GLASGOW_HASKELL_PATCHLEVEL2__ 20190603
+#define __GLASGOW_HASKELL_PATCHLEVEL2__ 20190703
 
 #define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) (\
    ((ma)*100+(mi)) <  __GLASGOW_HASKELL__ || \
diff --git a/ghc-lib/stage0/compiler/build/Fingerprint.hs b/ghc-lib/stage0/compiler/build/Fingerprint.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/compiler/build/Fingerprint.hs
@@ -0,0 +1,48 @@
+{-# LINE 1 "compiler/utils/Fingerprint.hsc" #-}
+{-# LANGUAGE CPP #-}
+
+-- ----------------------------------------------------------------------------
+--
+--  (c) The University of Glasgow 2006
+--
+-- Fingerprints for recompilation checking and ABI versioning.
+--
+-- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/recompilation-avoidance
+--
+-- ----------------------------------------------------------------------------
+
+module Fingerprint (
+        readHexFingerprint,
+        fingerprintByteString,
+        -- * Re-exported from GHC.Fingerprint
+        Fingerprint(..), fingerprint0,
+        fingerprintFingerprints,
+        fingerprintData,
+        fingerprintString,
+        getFileHash
+   ) where
+
+
+#include "HsVersions.h"
+
+import GhcPrelude
+
+import Foreign
+import GHC.IO
+import Numeric          ( readHex )
+
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Unsafe as BS
+
+import GHC.Fingerprint
+
+-- useful for parsing the output of 'md5sum', should we want to do that.
+readHexFingerprint :: String -> Fingerprint
+readHexFingerprint s = Fingerprint w1 w2
+ where (s1,s2) = splitAt 16 s
+       [(w1,"")] = readHex s1
+       [(w2,"")] = readHex (take 16 s2)
+
+fingerprintByteString :: BS.ByteString -> Fingerprint
+fingerprintByteString bs = unsafeDupablePerformIO $
+  BS.unsafeUseAsCStringLen bs $ \(ptr, len) -> fingerprintData (castPtr ptr) len
diff --git a/ghc-lib/stage0/compiler/build/Parser.hs b/ghc-lib/stage0/compiler/build/Parser.hs
--- a/ghc-lib/stage0/compiler/build/Parser.hs
+++ b/ghc-lib/stage0/compiler/build/Parser.hs
@@ -92,7 +92,7 @@
 import Control.Applicative(Applicative(..))
 import Control.Monad (ap)
 
--- parser produced by Happy Version 1.19.10
+-- parser produced by Happy Version 1.19.11
 
 newtype HappyAbsSyn  = HappyAbsSyn HappyAny
 #if __GLASGOW_HASKELL__ >= 607
@@ -12744,7 +12744,487 @@
 
 
 {-# LINE 19 "<built-in>" #-}
-{-# LINE 1 "/var/folders/f_/bb4zyb7d2_z9bqm3hrqrjgp40000gn/T/ghc66386_0/ghc_2.h" #-}
+{-# LINE 1 "/var/folders/kc/bjk2hzwx6bv07jz_s80wjh7w0000gn/T/ghc91361_0/ghc_2.h" #-}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/Constants.hs b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/Constants.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/Constants.hs
@@ -0,0 +1,21 @@
+{-# LINE 1 "libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc" #-}
+{-# LANGUAGE CPP #-}
+
+module GHC.Exts.Heap.Constants
+    ( wORD_SIZE
+    , tAG_MASK
+    , wORD_SIZE_IN_BITS
+    ) where
+
+
+
+import Prelude -- See note [Why do we import Prelude here?]
+import Data.Bits
+
+wORD_SIZE, tAG_MASK, wORD_SIZE_IN_BITS :: Int
+wORD_SIZE = 8
+{-# LINE 16 "libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc" #-}
+wORD_SIZE_IN_BITS = 64
+{-# LINE 17 "libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc" #-}
+tAG_MASK = (1 `shift` 3) - 1
+{-# LINE 18 "libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc" #-}
diff --git a/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTable.hs b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTable.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTable.hs
@@ -0,0 +1,90 @@
+{-# LINE 1 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+module GHC.Exts.Heap.InfoTable
+    ( module GHC.Exts.Heap.InfoTable.Types
+    , itblSize
+    , peekItbl
+    , pokeItbl
+    ) where
+
+
+
+import Prelude -- See note [Why do we import Prelude here?]
+import GHC.Exts.Heap.InfoTable.Types
+
+{-# LINE 16 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+import Foreign
+
+-------------------------------------------------------------------------
+-- Profiling specific code
+--
+-- The functions that follow all rely on PROFILING. They are duplicated in
+-- ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc where PROFILING is defined. This
+-- allows hsc2hs to generate values for both profiling and non-profiling builds.
+
+-- | Read an InfoTable from the heap into a haskell type.
+-- WARNING: This code assumes it is passed a pointer to a "standard" info
+-- table. If tables_next_to_code is enabled, it will look 1 byte before the
+-- start for the entry field.
+peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
+peekItbl a0 = do
+
+{-# LINE 35 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  let ptr = a0
+      entry' = Nothing
+
+{-# LINE 38 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  ptrs'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
+{-# LINE 39 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  nptrs'  <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
+{-# LINE 40 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  tipe'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
+{-# LINE 41 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+
+{-# LINE 42 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  srtlen' <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) a0
+{-# LINE 43 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+
+{-# LINE 46 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  return StgInfoTable
+    { entry  = entry'
+    , ptrs   = ptrs'
+    , nptrs  = nptrs'
+    , tipe   = toEnum (fromIntegral (tipe' :: HalfWord))
+    , srtlen = srtlen'
+    , code   = Nothing
+    }
+
+pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
+pokeItbl a0 itbl = do
+
+{-# LINE 60 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) a0 (ptrs itbl)
+{-# LINE 61 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) a0 (nptrs itbl)
+{-# LINE 62 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) a0 (toHalfWord (fromEnum (tipe itbl)))
+{-# LINE 63 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+
+{-# LINE 64 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) a0 (srtlen itbl)
+{-# LINE 65 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+
+{-# LINE 68 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+
+{-# LINE 69 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  let code_offset = a0 `plusPtr` ((16))
+{-# LINE 70 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  case code itbl of
+    Nothing -> return ()
+    Just (Left xs) -> pokeArray code_offset xs
+    Just (Right xs) -> pokeArray code_offset xs
+
+{-# LINE 75 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
+  where
+    toHalfWord :: Int -> HalfWord
+    toHalfWord i = fromIntegral i
+
+-- | Size in bytes of a standard InfoTable
+itblSize :: Int
+itblSize = ((16))
+{-# LINE 82 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc" #-}
diff --git a/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTable/Types.hs b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTable/Types.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTable/Types.hs
@@ -0,0 +1,39 @@
+{-# LINE 1 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc" #-}
+{-# LANGUAGE DeriveGeneric #-}
+module GHC.Exts.Heap.InfoTable.Types
+    ( StgInfoTable(..)
+    , EntryFunPtr
+    , HalfWord
+    , ItblCodes
+    ) where
+
+
+
+import Prelude -- See note [Why do we import Prelude here?]
+import GHC.Generics
+import GHC.Exts.Heap.ClosureTypes
+import Foreign
+
+type ItblCodes = Either [Word8] [Word32]
+
+
+-- Ultra-minimalist version specially for constructors
+
+{-# LINE 21 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc" #-}
+type HalfWord = Word32
+
+{-# LINE 27 "libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc" #-}
+
+type EntryFunPtr = FunPtr (Ptr () -> IO (Ptr ()))
+
+-- | This is a somewhat faithful representation of an info table. See
+-- <https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/storage/InfoTables.h>
+-- for more details on this data structure.
+data StgInfoTable = StgInfoTable {
+   entry  :: Maybe EntryFunPtr, -- Just <=> not ghciTablesNextToCode
+   ptrs   :: HalfWord,
+   nptrs  :: HalfWord,
+   tipe   :: ClosureType,
+   srtlen :: HalfWord,
+   code   :: Maybe ItblCodes -- Just <=> ghciTablesNextToCode
+  } deriving (Show, Generic)
diff --git a/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTableProf.hs b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTableProf.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/InfoTableProf.hs
@@ -0,0 +1,84 @@
+{-# OPTIONS_GHC -optc-DPROFILING #-}
+{-# LINE 1 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+module GHC.Exts.Heap.InfoTableProf
+    ( module GHC.Exts.Heap.InfoTable.Types
+    , itblSize
+    , peekItbl
+    , pokeItbl
+    ) where
+
+-- This file overrides InfoTable.hsc's implementation of peekItbl and pokeItbl.
+-- Manually defining PROFILING gives the #peek and #poke macros an accurate
+-- representation of StgInfoTable_ when hsc2hs runs.
+
+
+
+import Prelude -- See note [Why do we import Prelude here?]
+import GHC.Exts.Heap.InfoTable.Types
+
+{-# LINE 20 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+import Foreign
+
+-- | Read an InfoTable from the heap into a haskell type.
+-- WARNING: This code assumes it is passed a pointer to a "standard" info
+-- table. If tables_next_to_code is enabled, it will look 1 byte before the
+-- start for the entry field.
+peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
+peekItbl a0 = do
+
+{-# LINE 32 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  let ptr = a0
+      entry' = Nothing
+
+{-# LINE 35 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  ptrs'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
+{-# LINE 36 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  nptrs'  <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
+{-# LINE 37 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  tipe'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
+{-# LINE 38 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+
+{-# LINE 39 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  srtlen' <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) a0
+{-# LINE 40 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+
+{-# LINE 43 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  return StgInfoTable
+    { entry  = entry'
+    , ptrs   = ptrs'
+    , nptrs  = nptrs'
+    , tipe   = toEnum (fromIntegral (tipe' :: HalfWord))
+    , srtlen = srtlen'
+    , code   = Nothing
+    }
+
+pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
+pokeItbl a0 itbl = do
+
+{-# LINE 57 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) a0 (ptrs itbl)
+{-# LINE 58 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) a0 (nptrs itbl)
+{-# LINE 59 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) a0 (fromEnum (tipe itbl))
+{-# LINE 60 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+
+{-# LINE 61 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) a0 (srtlen itbl)
+{-# LINE 62 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+
+{-# LINE 65 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+
+{-# LINE 66 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  let code_offset = a0 `plusPtr` ((32))
+{-# LINE 67 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+  case code itbl of
+    Nothing -> return ()
+    Just (Left xs) -> pokeArray code_offset xs
+    Just (Right xs) -> pokeArray code_offset xs
+
+{-# LINE 72 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
+
+itblSize :: Int
+itblSize = ((32))
+{-# LINE 75 "libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc" #-}
diff --git a/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/Utils.hs b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/Utils.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/libraries/ghc-heap/build/GHC/Exts/Heap/Utils.hs
@@ -0,0 +1,130 @@
+{-# LINE 1 "libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc" #-}
+{-# LANGUAGE CPP, MagicHash #-}
+
+module GHC.Exts.Heap.Utils (
+    dataConNames
+    ) where
+
+
+
+import Prelude -- See note [Why do we import Prelude here?]
+import GHC.Exts.Heap.Constants
+import GHC.Exts.Heap.InfoTable
+
+import Data.Char
+import Data.List
+import Foreign
+import GHC.CString
+import GHC.Exts
+
+{- To find the string in the constructor's info table we need to consider
+      the layout of info tables relative to the entry code for a closure.
+
+      An info table can be next to the entry code for the closure, or it can
+      be separate. The former (faster) is used in registerised versions of ghc,
+      and the latter (portable) is for non-registerised versions.
+
+      The diagrams below show where the string is to be found relative to
+      the normal info table of the closure.
+
+      1) Tables next to code:
+
+         --------------
+         |            |   <- pointer to the start of the string
+         --------------
+         |            |   <- the (start of the) info table structure
+         |            |
+         |            |
+         --------------
+         | entry code |
+         |    ....    |
+
+         In this case the pointer to the start of the string can be found in
+         the memory location _one word before_ the first entry in the normal info
+         table.
+
+      2) Tables NOT next to code:
+
+                                 --------------
+         info table structure -> |     *------------------> --------------
+                                 |            |             | entry code |
+                                 |            |             |    ....    |
+                                 --------------
+         ptr to start of str ->  |            |
+                                 --------------
+
+         In this case the pointer to the start of the string can be found
+         in the memory location: info_table_ptr + info_table_size
+-}
+
+-- Given a ptr to an 'StgInfoTable' for a data constructor
+-- return (Package, Module, Name)
+dataConNames :: Ptr StgInfoTable -> IO (String, String, String)
+dataConNames ptr = do
+    conDescAddress <- getConDescAddress
+    pure $ parse conDescAddress
+  where
+    -- Retrieve the con_desc field address pointing to
+    -- 'Package:Module.Name' string
+    getConDescAddress :: IO (Ptr Word8)
+    getConDescAddress
+
+{-# LINE 71 "libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc" #-}
+      = do
+        offsetToString <- peek (ptr `plusPtr` negate wORD_SIZE)
+        pure $ (ptr `plusPtr` stdInfoTableSizeB)
+                    `plusPtr` fromIntegral (offsetToString :: Int32)
+
+{-# LINE 78 "libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc" #-}
+
+    stdInfoTableSizeW :: Int
+    -- The size of a standard info table varies with profiling/ticky etc,
+    -- so we can't get it from Constants
+    -- It must vary in sync with mkStdInfoTable
+    stdInfoTableSizeW
+      = size_fixed + size_prof
+      where
+        size_fixed = 2  -- layout, type
+#if defined(PROFILING)
+        size_prof = 2
+#else
+        size_prof = 0
+#endif
+
+    stdInfoTableSizeB :: Int
+    stdInfoTableSizeB = stdInfoTableSizeW * wORD_SIZE
+
+-- parsing names is a little bit fiddly because we have a string in the form:
+-- pkg:A.B.C.foo, and we want to split it into three parts: ("pkg", "A.B.C", "foo").
+-- Thus we split at the leftmost colon and the rightmost occurrence of the dot.
+-- It would be easier if the string was in the form pkg:A.B.C:foo, but alas
+-- this is not the conventional way of writing Haskell names. We stick with
+-- convention, even though it makes the parsing code more troublesome.
+-- Warning: this code assumes that the string is well formed.
+parse :: Ptr Word8 -> (String, String, String)
+parse (Ptr addr) = if not . all (>0) . fmap length $ [p,m,occ]
+                     then ([], [], input)
+                     else (p, m, occ)
+  where
+    input = unpackCStringUtf8# addr
+    (p, rest1) = break (== ':') input
+    (m, occ)
+        = (intercalate "." $ reverse modWords, occWord)
+        where
+        (modWords, occWord) =
+            if length rest1 < 1 --  XXXXXXXXx YUKX
+                --then error "getConDescAddress:parse:length rest1 < 1"
+                then parseModOcc [] []
+                else parseModOcc [] (tail rest1)
+    -- We only look for dots if str could start with a module name,
+    -- i.e. if it starts with an upper case character.
+    -- Otherwise we might think that "X.:->" is the module name in
+    -- "X.:->.+", whereas actually "X" is the module name and
+    -- ":->.+" is a constructor name.
+    parseModOcc :: [String] -> String -> ([String], String)
+    parseModOcc acc str@(c : _)
+        | isUpper c =
+            case break (== '.') str of
+                (top, []) -> (acc, top)
+                (top, _:bot) -> parseModOcc (top : acc) bot
+    parseModOcc acc str = (acc, str)
diff --git a/ghc-lib/stage0/libraries/ghci/build/GHCi/FFI.hs b/ghc-lib/stage0/libraries/ghci/build/GHCi/FFI.hs
new file mode 100644
--- /dev/null
+++ b/ghc-lib/stage0/libraries/ghci/build/GHCi/FFI.hs
@@ -0,0 +1,155 @@
+{-# LINE 1 "libraries/ghci/GHCi/FFI.hsc" #-}
+-----------------------------------------------------------------------------
+--
+-- libffi bindings
+--
+-- (c) The University of Glasgow 2008
+--
+-----------------------------------------------------------------------------
+
+
+
+{-# LANGUAGE CPP, DeriveGeneric, DeriveAnyClass #-}
+module GHCi.FFI
+  ( FFIType(..)
+  , FFIConv(..)
+  , C_ffi_cif
+  , prepForeignCall
+  , freeForeignCallInfo
+  ) where
+
+import Prelude -- See note [Why do we import Prelude here?]
+import Control.Exception
+import Data.Binary
+import GHC.Generics
+import Foreign
+import Foreign.C
+
+data FFIType
+  = FFIVoid
+  | FFIPointer
+  | FFIFloat
+  | FFIDouble
+  | FFISInt8
+  | FFISInt16
+  | FFISInt32
+  | FFISInt64
+  | FFIUInt8
+  | FFIUInt16
+  | FFIUInt32
+  | FFIUInt64
+  deriving (Show, Generic, Binary)
+
+data FFIConv
+  = FFICCall
+  | FFIStdCall
+  deriving (Show, Generic, Binary)
+
+
+prepForeignCall
+    :: FFIConv
+    -> [FFIType]          -- arg types
+    -> FFIType            -- result type
+    -> IO (Ptr C_ffi_cif) -- token for making calls (must be freed by caller)
+
+prepForeignCall cconv arg_types result_type = do
+  let n_args = length arg_types
+  arg_arr <- mallocArray n_args
+  pokeArray arg_arr (map ffiType arg_types)
+  cif <- mallocBytes (32)
+{-# LINE 59 "libraries/ghci/GHCi/FFI.hsc" #-}
+  let abi = convToABI cconv
+  r <- ffi_prep_cif cif abi (fromIntegral n_args) (ffiType result_type) arg_arr
+  if (r /= fFI_OK)
+     then throwIO (ErrorCall ("prepForeignCallFailed: " ++ show r))
+     else return (castPtr cif)
+
+freeForeignCallInfo :: Ptr C_ffi_cif -> IO ()
+freeForeignCallInfo p = do
+  free (((\hsc_ptr -> hsc_ptr `plusPtr` 8)) p)
+{-# LINE 68 "libraries/ghci/GHCi/FFI.hsc" #-}
+  free p
+
+convToABI :: FFIConv -> C_ffi_abi
+convToABI FFICCall  = fFI_DEFAULT_ABI
+
+{-# LINE 75 "libraries/ghci/GHCi/FFI.hsc" #-}
+-- unknown conventions are mapped to the default, (#3336)
+convToABI _           = fFI_DEFAULT_ABI
+
+ffiType :: FFIType -> Ptr C_ffi_type
+ffiType FFIVoid     = ffi_type_void
+ffiType FFIPointer  = ffi_type_pointer
+ffiType FFIFloat    = ffi_type_float
+ffiType FFIDouble   = ffi_type_double
+ffiType FFISInt8    = ffi_type_sint8
+ffiType FFISInt16   = ffi_type_sint16
+ffiType FFISInt32   = ffi_type_sint32
+ffiType FFISInt64   = ffi_type_sint64
+ffiType FFIUInt8    = ffi_type_uint8
+ffiType FFIUInt16   = ffi_type_uint16
+ffiType FFIUInt32   = ffi_type_uint32
+ffiType FFIUInt64   = ffi_type_uint64
+
+data C_ffi_type
+data C_ffi_cif
+
+type C_ffi_status = (Word32)
+{-# LINE 96 "libraries/ghci/GHCi/FFI.hsc" #-}
+type C_ffi_abi    = (Word32)
+{-# LINE 97 "libraries/ghci/GHCi/FFI.hsc" #-}
+
+foreign import ccall "&ffi_type_void"   ffi_type_void    :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_uint8"  ffi_type_uint8   :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_sint8"  ffi_type_sint8   :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_uint16" ffi_type_uint16  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_sint16" ffi_type_sint16  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_uint32" ffi_type_uint32  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_sint32" ffi_type_sint32  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_uint64" ffi_type_uint64  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_sint64" ffi_type_sint64  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_float"  ffi_type_float   :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_double" ffi_type_double  :: Ptr C_ffi_type
+foreign import ccall "&ffi_type_pointer"ffi_type_pointer :: Ptr C_ffi_type
+
+fFI_OK            :: C_ffi_status
+fFI_OK            = (0)
+{-# LINE 113 "libraries/ghci/GHCi/FFI.hsc" #-}
+--fFI_BAD_ABI     :: C_ffi_status
+--fFI_BAD_ABI     = (#const FFI_BAD_ABI)
+--fFI_BAD_TYPEDEF :: C_ffi_status
+--fFI_BAD_TYPEDEF = (#const FFI_BAD_TYPEDEF)
+
+fFI_DEFAULT_ABI :: C_ffi_abi
+fFI_DEFAULT_ABI = (2)
+{-# LINE 120 "libraries/ghci/GHCi/FFI.hsc" #-}
+
+{-# LINE 124 "libraries/ghci/GHCi/FFI.hsc" #-}
+
+-- ffi_status ffi_prep_cif(ffi_cif *cif,
+--                         ffi_abi abi,
+--                         unsigned int nargs,
+--                         ffi_type *rtype,
+--                         ffi_type **atypes);
+
+foreign import ccall "ffi_prep_cif"
+  ffi_prep_cif :: Ptr C_ffi_cif         -- cif
+               -> C_ffi_abi             -- abi
+               -> CUInt                 -- nargs
+               -> Ptr C_ffi_type        -- result type
+               -> Ptr (Ptr C_ffi_type)  -- arg types
+               -> IO C_ffi_status
+
+-- Currently unused:
+
+-- void ffi_call(ffi_cif *cif,
+--               void (*fn)(),
+--               void *rvalue,
+--               void **avalue);
+
+-- foreign import ccall "ffi_call"
+--   ffi_call :: Ptr C_ffi_cif             -- cif
+--            -> FunPtr (IO ())            -- function to call
+--            -> Ptr ()                    -- put result here
+--            -> Ptr (Ptr ())              -- arg values
+--            -> IO ()
diff --git a/ghc-lib/stage1/compiler/build/Config.hs b/ghc-lib/stage1/compiler/build/Config.hs
--- a/ghc-lib/stage1/compiler/build/Config.hs
+++ b/ghc-lib/stage1/compiler/build/Config.hs
@@ -13,17 +13,17 @@
 cProjectName          :: String
 cProjectName          = "The Glorious Glasgow Haskell Compilation System"
 cProjectGitCommitId   :: String
-cProjectGitCommitId   = "799b1d26977b5841aa580e07c8f8e65356eed785"
+cProjectGitCommitId   = "a25f6f55eaca0d3ec36afb574d5fa9326ea09d55"
 cProjectVersion       :: String
-cProjectVersion       = "8.9.0.20190603"
+cProjectVersion       = "8.9.0.20190703"
 cProjectVersionInt    :: String
 cProjectVersionInt    = "809"
 cProjectPatchLevel    :: String
-cProjectPatchLevel    = "020190603"
+cProjectPatchLevel    = "020190703"
 cProjectPatchLevel1   :: String
 cProjectPatchLevel1   = "0"
 cProjectPatchLevel2   :: String
-cProjectPatchLevel2   = "20190603"
+cProjectPatchLevel2   = "20190703"
 cBooterVersion        :: String
 cBooterVersion        = "8.6.5"
 cStage                :: String
diff --git a/ghc-lib/stage1/compiler/build/ghc_boot_platform.h b/ghc-lib/stage1/compiler/build/ghc_boot_platform.h
--- a/ghc-lib/stage1/compiler/build/ghc_boot_platform.h
+++ b/ghc-lib/stage1/compiler/build/ghc_boot_platform.h
@@ -1,4 +1,4 @@
-#ifndef __PLATFORM_H__
+#if !defined(__PLATFORM_H__)
 #define __PLATFORM_H__
 
 #define BuildPlatform_NAME  "x86_64-apple-darwin"
diff --git a/ghc-lib/stage1/compiler/build/primop-can-fail.hs-incl b/ghc-lib/stage1/compiler/build/primop-can-fail.hs-incl
--- a/ghc-lib/stage1/compiler/build/primop-can-fail.hs-incl
+++ b/ghc-lib/stage1/compiler/build/primop-can-fail.hs-incl
@@ -19,10 +19,12 @@
 primOpCanFail WordQuotRem2Op = True
 primOpCanFail DoubleDivOp = True
 primOpCanFail DoubleLogOp = True
+primOpCanFail DoubleLog1POp = True
 primOpCanFail DoubleAsinOp = True
 primOpCanFail DoubleAcosOp = True
 primOpCanFail FloatDivOp = True
 primOpCanFail FloatLogOp = True
+primOpCanFail FloatLog1POp = True
 primOpCanFail FloatAsinOp = True
 primOpCanFail FloatAcosOp = True
 primOpCanFail ReadArrayOp = True
diff --git a/ghc-lib/stage1/compiler/build/primop-code-size.hs-incl b/ghc-lib/stage1/compiler/build/primop-code-size.hs-incl
--- a/ghc-lib/stage1/compiler/build/primop-code-size.hs-incl
+++ b/ghc-lib/stage1/compiler/build/primop-code-size.hs-incl
@@ -8,7 +8,9 @@
 primOpCodeSize WordAdd2Op = 2
 primOpCodeSize Word2IntOp = 0
 primOpCodeSize DoubleExpOp =  primOpCodeSizeForeignCall 
+primOpCodeSize DoubleExpM1Op =  primOpCodeSizeForeignCall 
 primOpCodeSize DoubleLogOp =  primOpCodeSizeForeignCall 
+primOpCodeSize DoubleLog1POp =  primOpCodeSizeForeignCall 
 primOpCodeSize DoubleSqrtOp =  primOpCodeSizeForeignCall 
 primOpCodeSize DoubleSinOp =  primOpCodeSizeForeignCall 
 primOpCodeSize DoubleCosOp =  primOpCodeSizeForeignCall 
@@ -24,7 +26,9 @@
 primOpCodeSize DoubleAtanhOp =  primOpCodeSizeForeignCall 
 primOpCodeSize DoublePowerOp =  primOpCodeSizeForeignCall 
 primOpCodeSize FloatExpOp =  primOpCodeSizeForeignCall 
+primOpCodeSize FloatExpM1Op =  primOpCodeSizeForeignCall 
 primOpCodeSize FloatLogOp =  primOpCodeSizeForeignCall 
+primOpCodeSize FloatLog1POp =  primOpCodeSizeForeignCall 
 primOpCodeSize FloatSqrtOp =  primOpCodeSizeForeignCall 
 primOpCodeSize FloatSinOp =  primOpCodeSizeForeignCall 
 primOpCodeSize FloatCosOp =  primOpCodeSizeForeignCall 
diff --git a/ghc-lib/stage1/compiler/build/primop-data-decl.hs-incl b/ghc-lib/stage1/compiler/build/primop-data-decl.hs-incl
--- a/ghc-lib/stage1/compiler/build/primop-data-decl.hs-incl
+++ b/ghc-lib/stage1/compiler/build/primop-data-decl.hs-incl
@@ -174,7 +174,9 @@
    | Double2IntOp
    | Double2FloatOp
    | DoubleExpOp
+   | DoubleExpM1Op
    | DoubleLogOp
+   | DoubleLog1POp
    | DoubleSqrtOp
    | DoubleSinOp
    | DoubleCosOp
@@ -205,7 +207,9 @@
    | FloatFabsOp
    | Float2IntOp
    | FloatExpOp
+   | FloatExpM1Op
    | FloatLogOp
+   | FloatLog1POp
    | FloatSqrtOp
    | FloatSinOp
    | FloatCosOp
diff --git a/ghc-lib/stage1/compiler/build/primop-list.hs-incl b/ghc-lib/stage1/compiler/build/primop-list.hs-incl
--- a/ghc-lib/stage1/compiler/build/primop-list.hs-incl
+++ b/ghc-lib/stage1/compiler/build/primop-list.hs-incl
@@ -173,7 +173,9 @@
    , Double2IntOp
    , Double2FloatOp
    , DoubleExpOp
+   , DoubleExpM1Op
    , DoubleLogOp
+   , DoubleLog1POp
    , DoubleSqrtOp
    , DoubleSinOp
    , DoubleCosOp
@@ -204,7 +206,9 @@
    , FloatFabsOp
    , Float2IntOp
    , FloatExpOp
+   , FloatExpM1Op
    , FloatLogOp
+   , FloatLog1POp
    , FloatSqrtOp
    , FloatSinOp
    , FloatCosOp
diff --git a/ghc-lib/stage1/compiler/build/primop-primop-info.hs-incl b/ghc-lib/stage1/compiler/build/primop-primop-info.hs-incl
--- a/ghc-lib/stage1/compiler/build/primop-primop-info.hs-incl
+++ b/ghc-lib/stage1/compiler/build/primop-primop-info.hs-incl
@@ -173,7 +173,9 @@
 primOpInfo Double2IntOp = mkGenPrimOp (fsLit "double2Int#")  [] [doublePrimTy] (intPrimTy)
 primOpInfo Double2FloatOp = mkGenPrimOp (fsLit "double2Float#")  [] [doublePrimTy] (floatPrimTy)
 primOpInfo DoubleExpOp = mkMonadic (fsLit "expDouble#") doublePrimTy
+primOpInfo DoubleExpM1Op = mkMonadic (fsLit "expm1Double#") doublePrimTy
 primOpInfo DoubleLogOp = mkMonadic (fsLit "logDouble#") doublePrimTy
+primOpInfo DoubleLog1POp = mkMonadic (fsLit "log1pDouble#") doublePrimTy
 primOpInfo DoubleSqrtOp = mkMonadic (fsLit "sqrtDouble#") doublePrimTy
 primOpInfo DoubleSinOp = mkMonadic (fsLit "sinDouble#") doublePrimTy
 primOpInfo DoubleCosOp = mkMonadic (fsLit "cosDouble#") doublePrimTy
@@ -204,7 +206,9 @@
 primOpInfo FloatFabsOp = mkMonadic (fsLit "fabsFloat#") floatPrimTy
 primOpInfo Float2IntOp = mkGenPrimOp (fsLit "float2Int#")  [] [floatPrimTy] (intPrimTy)
 primOpInfo FloatExpOp = mkMonadic (fsLit "expFloat#") floatPrimTy
+primOpInfo FloatExpM1Op = mkMonadic (fsLit "expm1Float#") floatPrimTy
 primOpInfo FloatLogOp = mkMonadic (fsLit "logFloat#") floatPrimTy
+primOpInfo FloatLog1POp = mkMonadic (fsLit "log1pFloat#") floatPrimTy
 primOpInfo FloatSqrtOp = mkMonadic (fsLit "sqrtFloat#") floatPrimTy
 primOpInfo FloatSinOp = mkMonadic (fsLit "sinFloat#") floatPrimTy
 primOpInfo FloatCosOp = mkMonadic (fsLit "cosFloat#") floatPrimTy
diff --git a/ghc-lib/stage1/compiler/build/primop-tag.hs-incl b/ghc-lib/stage1/compiler/build/primop-tag.hs-incl
--- a/ghc-lib/stage1/compiler/build/primop-tag.hs-incl
+++ b/ghc-lib/stage1/compiler/build/primop-tag.hs-incl
@@ -1,1201 +1,1205 @@
 maxPrimOpTag :: Int
-maxPrimOpTag = 1198
-primOpTag :: PrimOp -> Int
-primOpTag CharGtOp = 1
-primOpTag CharGeOp = 2
-primOpTag CharEqOp = 3
-primOpTag CharNeOp = 4
-primOpTag CharLtOp = 5
-primOpTag CharLeOp = 6
-primOpTag OrdOp = 7
-primOpTag IntAddOp = 8
-primOpTag IntSubOp = 9
-primOpTag IntMulOp = 10
-primOpTag IntMulMayOfloOp = 11
-primOpTag IntQuotOp = 12
-primOpTag IntRemOp = 13
-primOpTag IntQuotRemOp = 14
-primOpTag AndIOp = 15
-primOpTag OrIOp = 16
-primOpTag XorIOp = 17
-primOpTag NotIOp = 18
-primOpTag IntNegOp = 19
-primOpTag IntAddCOp = 20
-primOpTag IntSubCOp = 21
-primOpTag IntGtOp = 22
-primOpTag IntGeOp = 23
-primOpTag IntEqOp = 24
-primOpTag IntNeOp = 25
-primOpTag IntLtOp = 26
-primOpTag IntLeOp = 27
-primOpTag ChrOp = 28
-primOpTag Int2WordOp = 29
-primOpTag Int2FloatOp = 30
-primOpTag Int2DoubleOp = 31
-primOpTag Word2FloatOp = 32
-primOpTag Word2DoubleOp = 33
-primOpTag ISllOp = 34
-primOpTag ISraOp = 35
-primOpTag ISrlOp = 36
-primOpTag Int8Extend = 37
-primOpTag Int8Narrow = 38
-primOpTag Int8NegOp = 39
-primOpTag Int8AddOp = 40
-primOpTag Int8SubOp = 41
-primOpTag Int8MulOp = 42
-primOpTag Int8QuotOp = 43
-primOpTag Int8RemOp = 44
-primOpTag Int8QuotRemOp = 45
-primOpTag Int8EqOp = 46
-primOpTag Int8GeOp = 47
-primOpTag Int8GtOp = 48
-primOpTag Int8LeOp = 49
-primOpTag Int8LtOp = 50
-primOpTag Int8NeOp = 51
-primOpTag Word8Extend = 52
-primOpTag Word8Narrow = 53
-primOpTag Word8NotOp = 54
-primOpTag Word8AddOp = 55
-primOpTag Word8SubOp = 56
-primOpTag Word8MulOp = 57
-primOpTag Word8QuotOp = 58
-primOpTag Word8RemOp = 59
-primOpTag Word8QuotRemOp = 60
-primOpTag Word8EqOp = 61
-primOpTag Word8GeOp = 62
-primOpTag Word8GtOp = 63
-primOpTag Word8LeOp = 64
-primOpTag Word8LtOp = 65
-primOpTag Word8NeOp = 66
-primOpTag Int16Extend = 67
-primOpTag Int16Narrow = 68
-primOpTag Int16NegOp = 69
-primOpTag Int16AddOp = 70
-primOpTag Int16SubOp = 71
-primOpTag Int16MulOp = 72
-primOpTag Int16QuotOp = 73
-primOpTag Int16RemOp = 74
-primOpTag Int16QuotRemOp = 75
-primOpTag Int16EqOp = 76
-primOpTag Int16GeOp = 77
-primOpTag Int16GtOp = 78
-primOpTag Int16LeOp = 79
-primOpTag Int16LtOp = 80
-primOpTag Int16NeOp = 81
-primOpTag Word16Extend = 82
-primOpTag Word16Narrow = 83
-primOpTag Word16NotOp = 84
-primOpTag Word16AddOp = 85
-primOpTag Word16SubOp = 86
-primOpTag Word16MulOp = 87
-primOpTag Word16QuotOp = 88
-primOpTag Word16RemOp = 89
-primOpTag Word16QuotRemOp = 90
-primOpTag Word16EqOp = 91
-primOpTag Word16GeOp = 92
-primOpTag Word16GtOp = 93
-primOpTag Word16LeOp = 94
-primOpTag Word16LtOp = 95
-primOpTag Word16NeOp = 96
-primOpTag WordAddOp = 97
-primOpTag WordAddCOp = 98
-primOpTag WordSubCOp = 99
-primOpTag WordAdd2Op = 100
-primOpTag WordSubOp = 101
-primOpTag WordMulOp = 102
-primOpTag WordMul2Op = 103
-primOpTag WordQuotOp = 104
-primOpTag WordRemOp = 105
-primOpTag WordQuotRemOp = 106
-primOpTag WordQuotRem2Op = 107
-primOpTag AndOp = 108
-primOpTag OrOp = 109
-primOpTag XorOp = 110
-primOpTag NotOp = 111
-primOpTag SllOp = 112
-primOpTag SrlOp = 113
-primOpTag Word2IntOp = 114
-primOpTag WordGtOp = 115
-primOpTag WordGeOp = 116
-primOpTag WordEqOp = 117
-primOpTag WordNeOp = 118
-primOpTag WordLtOp = 119
-primOpTag WordLeOp = 120
-primOpTag PopCnt8Op = 121
-primOpTag PopCnt16Op = 122
-primOpTag PopCnt32Op = 123
-primOpTag PopCnt64Op = 124
-primOpTag PopCntOp = 125
-primOpTag Pdep8Op = 126
-primOpTag Pdep16Op = 127
-primOpTag Pdep32Op = 128
-primOpTag Pdep64Op = 129
-primOpTag PdepOp = 130
-primOpTag Pext8Op = 131
-primOpTag Pext16Op = 132
-primOpTag Pext32Op = 133
-primOpTag Pext64Op = 134
-primOpTag PextOp = 135
-primOpTag Clz8Op = 136
-primOpTag Clz16Op = 137
-primOpTag Clz32Op = 138
-primOpTag Clz64Op = 139
-primOpTag ClzOp = 140
-primOpTag Ctz8Op = 141
-primOpTag Ctz16Op = 142
-primOpTag Ctz32Op = 143
-primOpTag Ctz64Op = 144
-primOpTag CtzOp = 145
-primOpTag BSwap16Op = 146
-primOpTag BSwap32Op = 147
-primOpTag BSwap64Op = 148
-primOpTag BSwapOp = 149
-primOpTag BRev8Op = 150
-primOpTag BRev16Op = 151
-primOpTag BRev32Op = 152
-primOpTag BRev64Op = 153
-primOpTag BRevOp = 154
-primOpTag Narrow8IntOp = 155
-primOpTag Narrow16IntOp = 156
-primOpTag Narrow32IntOp = 157
-primOpTag Narrow8WordOp = 158
-primOpTag Narrow16WordOp = 159
-primOpTag Narrow32WordOp = 160
-primOpTag DoubleGtOp = 161
-primOpTag DoubleGeOp = 162
-primOpTag DoubleEqOp = 163
-primOpTag DoubleNeOp = 164
-primOpTag DoubleLtOp = 165
-primOpTag DoubleLeOp = 166
-primOpTag DoubleAddOp = 167
-primOpTag DoubleSubOp = 168
-primOpTag DoubleMulOp = 169
-primOpTag DoubleDivOp = 170
-primOpTag DoubleNegOp = 171
-primOpTag DoubleFabsOp = 172
-primOpTag Double2IntOp = 173
-primOpTag Double2FloatOp = 174
-primOpTag DoubleExpOp = 175
-primOpTag DoubleLogOp = 176
-primOpTag DoubleSqrtOp = 177
-primOpTag DoubleSinOp = 178
-primOpTag DoubleCosOp = 179
-primOpTag DoubleTanOp = 180
-primOpTag DoubleAsinOp = 181
-primOpTag DoubleAcosOp = 182
-primOpTag DoubleAtanOp = 183
-primOpTag DoubleSinhOp = 184
-primOpTag DoubleCoshOp = 185
-primOpTag DoubleTanhOp = 186
-primOpTag DoubleAsinhOp = 187
-primOpTag DoubleAcoshOp = 188
-primOpTag DoubleAtanhOp = 189
-primOpTag DoublePowerOp = 190
-primOpTag DoubleDecode_2IntOp = 191
-primOpTag DoubleDecode_Int64Op = 192
-primOpTag FloatGtOp = 193
-primOpTag FloatGeOp = 194
-primOpTag FloatEqOp = 195
-primOpTag FloatNeOp = 196
-primOpTag FloatLtOp = 197
-primOpTag FloatLeOp = 198
-primOpTag FloatAddOp = 199
-primOpTag FloatSubOp = 200
-primOpTag FloatMulOp = 201
-primOpTag FloatDivOp = 202
-primOpTag FloatNegOp = 203
-primOpTag FloatFabsOp = 204
-primOpTag Float2IntOp = 205
-primOpTag FloatExpOp = 206
-primOpTag FloatLogOp = 207
-primOpTag FloatSqrtOp = 208
-primOpTag FloatSinOp = 209
-primOpTag FloatCosOp = 210
-primOpTag FloatTanOp = 211
-primOpTag FloatAsinOp = 212
-primOpTag FloatAcosOp = 213
-primOpTag FloatAtanOp = 214
-primOpTag FloatSinhOp = 215
-primOpTag FloatCoshOp = 216
-primOpTag FloatTanhOp = 217
-primOpTag FloatAsinhOp = 218
-primOpTag FloatAcoshOp = 219
-primOpTag FloatAtanhOp = 220
-primOpTag FloatPowerOp = 221
-primOpTag Float2DoubleOp = 222
-primOpTag FloatDecode_IntOp = 223
-primOpTag NewArrayOp = 224
-primOpTag SameMutableArrayOp = 225
-primOpTag ReadArrayOp = 226
-primOpTag WriteArrayOp = 227
-primOpTag SizeofArrayOp = 228
-primOpTag SizeofMutableArrayOp = 229
-primOpTag IndexArrayOp = 230
-primOpTag UnsafeFreezeArrayOp = 231
-primOpTag UnsafeThawArrayOp = 232
-primOpTag CopyArrayOp = 233
-primOpTag CopyMutableArrayOp = 234
-primOpTag CloneArrayOp = 235
-primOpTag CloneMutableArrayOp = 236
-primOpTag FreezeArrayOp = 237
-primOpTag ThawArrayOp = 238
-primOpTag CasArrayOp = 239
-primOpTag NewSmallArrayOp = 240
-primOpTag SameSmallMutableArrayOp = 241
-primOpTag ReadSmallArrayOp = 242
-primOpTag WriteSmallArrayOp = 243
-primOpTag SizeofSmallArrayOp = 244
-primOpTag SizeofSmallMutableArrayOp = 245
-primOpTag IndexSmallArrayOp = 246
-primOpTag UnsafeFreezeSmallArrayOp = 247
-primOpTag UnsafeThawSmallArrayOp = 248
-primOpTag CopySmallArrayOp = 249
-primOpTag CopySmallMutableArrayOp = 250
-primOpTag CloneSmallArrayOp = 251
-primOpTag CloneSmallMutableArrayOp = 252
-primOpTag FreezeSmallArrayOp = 253
-primOpTag ThawSmallArrayOp = 254
-primOpTag CasSmallArrayOp = 255
-primOpTag NewByteArrayOp_Char = 256
-primOpTag NewPinnedByteArrayOp_Char = 257
-primOpTag NewAlignedPinnedByteArrayOp_Char = 258
-primOpTag MutableByteArrayIsPinnedOp = 259
-primOpTag ByteArrayIsPinnedOp = 260
-primOpTag ByteArrayContents_Char = 261
-primOpTag SameMutableByteArrayOp = 262
-primOpTag ShrinkMutableByteArrayOp_Char = 263
-primOpTag ResizeMutableByteArrayOp_Char = 264
-primOpTag UnsafeFreezeByteArrayOp = 265
-primOpTag SizeofByteArrayOp = 266
-primOpTag SizeofMutableByteArrayOp = 267
-primOpTag GetSizeofMutableByteArrayOp = 268
-primOpTag IndexByteArrayOp_Char = 269
-primOpTag IndexByteArrayOp_WideChar = 270
-primOpTag IndexByteArrayOp_Int = 271
-primOpTag IndexByteArrayOp_Word = 272
-primOpTag IndexByteArrayOp_Addr = 273
-primOpTag IndexByteArrayOp_Float = 274
-primOpTag IndexByteArrayOp_Double = 275
-primOpTag IndexByteArrayOp_StablePtr = 276
-primOpTag IndexByteArrayOp_Int8 = 277
-primOpTag IndexByteArrayOp_Int16 = 278
-primOpTag IndexByteArrayOp_Int32 = 279
-primOpTag IndexByteArrayOp_Int64 = 280
-primOpTag IndexByteArrayOp_Word8 = 281
-primOpTag IndexByteArrayOp_Word16 = 282
-primOpTag IndexByteArrayOp_Word32 = 283
-primOpTag IndexByteArrayOp_Word64 = 284
-primOpTag IndexByteArrayOp_Word8AsChar = 285
-primOpTag IndexByteArrayOp_Word8AsWideChar = 286
-primOpTag IndexByteArrayOp_Word8AsAddr = 287
-primOpTag IndexByteArrayOp_Word8AsFloat = 288
-primOpTag IndexByteArrayOp_Word8AsDouble = 289
-primOpTag IndexByteArrayOp_Word8AsStablePtr = 290
-primOpTag IndexByteArrayOp_Word8AsInt16 = 291
-primOpTag IndexByteArrayOp_Word8AsInt32 = 292
-primOpTag IndexByteArrayOp_Word8AsInt64 = 293
-primOpTag IndexByteArrayOp_Word8AsInt = 294
-primOpTag IndexByteArrayOp_Word8AsWord16 = 295
-primOpTag IndexByteArrayOp_Word8AsWord32 = 296
-primOpTag IndexByteArrayOp_Word8AsWord64 = 297
-primOpTag IndexByteArrayOp_Word8AsWord = 298
-primOpTag ReadByteArrayOp_Char = 299
-primOpTag ReadByteArrayOp_WideChar = 300
-primOpTag ReadByteArrayOp_Int = 301
-primOpTag ReadByteArrayOp_Word = 302
-primOpTag ReadByteArrayOp_Addr = 303
-primOpTag ReadByteArrayOp_Float = 304
-primOpTag ReadByteArrayOp_Double = 305
-primOpTag ReadByteArrayOp_StablePtr = 306
-primOpTag ReadByteArrayOp_Int8 = 307
-primOpTag ReadByteArrayOp_Int16 = 308
-primOpTag ReadByteArrayOp_Int32 = 309
-primOpTag ReadByteArrayOp_Int64 = 310
-primOpTag ReadByteArrayOp_Word8 = 311
-primOpTag ReadByteArrayOp_Word16 = 312
-primOpTag ReadByteArrayOp_Word32 = 313
-primOpTag ReadByteArrayOp_Word64 = 314
-primOpTag ReadByteArrayOp_Word8AsChar = 315
-primOpTag ReadByteArrayOp_Word8AsWideChar = 316
-primOpTag ReadByteArrayOp_Word8AsAddr = 317
-primOpTag ReadByteArrayOp_Word8AsFloat = 318
-primOpTag ReadByteArrayOp_Word8AsDouble = 319
-primOpTag ReadByteArrayOp_Word8AsStablePtr = 320
-primOpTag ReadByteArrayOp_Word8AsInt16 = 321
-primOpTag ReadByteArrayOp_Word8AsInt32 = 322
-primOpTag ReadByteArrayOp_Word8AsInt64 = 323
-primOpTag ReadByteArrayOp_Word8AsInt = 324
-primOpTag ReadByteArrayOp_Word8AsWord16 = 325
-primOpTag ReadByteArrayOp_Word8AsWord32 = 326
-primOpTag ReadByteArrayOp_Word8AsWord64 = 327
-primOpTag ReadByteArrayOp_Word8AsWord = 328
-primOpTag WriteByteArrayOp_Char = 329
-primOpTag WriteByteArrayOp_WideChar = 330
-primOpTag WriteByteArrayOp_Int = 331
-primOpTag WriteByteArrayOp_Word = 332
-primOpTag WriteByteArrayOp_Addr = 333
-primOpTag WriteByteArrayOp_Float = 334
-primOpTag WriteByteArrayOp_Double = 335
-primOpTag WriteByteArrayOp_StablePtr = 336
-primOpTag WriteByteArrayOp_Int8 = 337
-primOpTag WriteByteArrayOp_Int16 = 338
-primOpTag WriteByteArrayOp_Int32 = 339
-primOpTag WriteByteArrayOp_Int64 = 340
-primOpTag WriteByteArrayOp_Word8 = 341
-primOpTag WriteByteArrayOp_Word16 = 342
-primOpTag WriteByteArrayOp_Word32 = 343
-primOpTag WriteByteArrayOp_Word64 = 344
-primOpTag WriteByteArrayOp_Word8AsChar = 345
-primOpTag WriteByteArrayOp_Word8AsWideChar = 346
-primOpTag WriteByteArrayOp_Word8AsAddr = 347
-primOpTag WriteByteArrayOp_Word8AsFloat = 348
-primOpTag WriteByteArrayOp_Word8AsDouble = 349
-primOpTag WriteByteArrayOp_Word8AsStablePtr = 350
-primOpTag WriteByteArrayOp_Word8AsInt16 = 351
-primOpTag WriteByteArrayOp_Word8AsInt32 = 352
-primOpTag WriteByteArrayOp_Word8AsInt64 = 353
-primOpTag WriteByteArrayOp_Word8AsInt = 354
-primOpTag WriteByteArrayOp_Word8AsWord16 = 355
-primOpTag WriteByteArrayOp_Word8AsWord32 = 356
-primOpTag WriteByteArrayOp_Word8AsWord64 = 357
-primOpTag WriteByteArrayOp_Word8AsWord = 358
-primOpTag CompareByteArraysOp = 359
-primOpTag CopyByteArrayOp = 360
-primOpTag CopyMutableByteArrayOp = 361
-primOpTag CopyByteArrayToAddrOp = 362
-primOpTag CopyMutableByteArrayToAddrOp = 363
-primOpTag CopyAddrToByteArrayOp = 364
-primOpTag SetByteArrayOp = 365
-primOpTag AtomicReadByteArrayOp_Int = 366
-primOpTag AtomicWriteByteArrayOp_Int = 367
-primOpTag CasByteArrayOp_Int = 368
-primOpTag FetchAddByteArrayOp_Int = 369
-primOpTag FetchSubByteArrayOp_Int = 370
-primOpTag FetchAndByteArrayOp_Int = 371
-primOpTag FetchNandByteArrayOp_Int = 372
-primOpTag FetchOrByteArrayOp_Int = 373
-primOpTag FetchXorByteArrayOp_Int = 374
-primOpTag NewArrayArrayOp = 375
-primOpTag SameMutableArrayArrayOp = 376
-primOpTag UnsafeFreezeArrayArrayOp = 377
-primOpTag SizeofArrayArrayOp = 378
-primOpTag SizeofMutableArrayArrayOp = 379
-primOpTag IndexArrayArrayOp_ByteArray = 380
-primOpTag IndexArrayArrayOp_ArrayArray = 381
-primOpTag ReadArrayArrayOp_ByteArray = 382
-primOpTag ReadArrayArrayOp_MutableByteArray = 383
-primOpTag ReadArrayArrayOp_ArrayArray = 384
-primOpTag ReadArrayArrayOp_MutableArrayArray = 385
-primOpTag WriteArrayArrayOp_ByteArray = 386
-primOpTag WriteArrayArrayOp_MutableByteArray = 387
-primOpTag WriteArrayArrayOp_ArrayArray = 388
-primOpTag WriteArrayArrayOp_MutableArrayArray = 389
-primOpTag CopyArrayArrayOp = 390
-primOpTag CopyMutableArrayArrayOp = 391
-primOpTag AddrAddOp = 392
-primOpTag AddrSubOp = 393
-primOpTag AddrRemOp = 394
-primOpTag Addr2IntOp = 395
-primOpTag Int2AddrOp = 396
-primOpTag AddrGtOp = 397
-primOpTag AddrGeOp = 398
-primOpTag AddrEqOp = 399
-primOpTag AddrNeOp = 400
-primOpTag AddrLtOp = 401
-primOpTag AddrLeOp = 402
-primOpTag IndexOffAddrOp_Char = 403
-primOpTag IndexOffAddrOp_WideChar = 404
-primOpTag IndexOffAddrOp_Int = 405
-primOpTag IndexOffAddrOp_Word = 406
-primOpTag IndexOffAddrOp_Addr = 407
-primOpTag IndexOffAddrOp_Float = 408
-primOpTag IndexOffAddrOp_Double = 409
-primOpTag IndexOffAddrOp_StablePtr = 410
-primOpTag IndexOffAddrOp_Int8 = 411
-primOpTag IndexOffAddrOp_Int16 = 412
-primOpTag IndexOffAddrOp_Int32 = 413
-primOpTag IndexOffAddrOp_Int64 = 414
-primOpTag IndexOffAddrOp_Word8 = 415
-primOpTag IndexOffAddrOp_Word16 = 416
-primOpTag IndexOffAddrOp_Word32 = 417
-primOpTag IndexOffAddrOp_Word64 = 418
-primOpTag ReadOffAddrOp_Char = 419
-primOpTag ReadOffAddrOp_WideChar = 420
-primOpTag ReadOffAddrOp_Int = 421
-primOpTag ReadOffAddrOp_Word = 422
-primOpTag ReadOffAddrOp_Addr = 423
-primOpTag ReadOffAddrOp_Float = 424
-primOpTag ReadOffAddrOp_Double = 425
-primOpTag ReadOffAddrOp_StablePtr = 426
-primOpTag ReadOffAddrOp_Int8 = 427
-primOpTag ReadOffAddrOp_Int16 = 428
-primOpTag ReadOffAddrOp_Int32 = 429
-primOpTag ReadOffAddrOp_Int64 = 430
-primOpTag ReadOffAddrOp_Word8 = 431
-primOpTag ReadOffAddrOp_Word16 = 432
-primOpTag ReadOffAddrOp_Word32 = 433
-primOpTag ReadOffAddrOp_Word64 = 434
-primOpTag WriteOffAddrOp_Char = 435
-primOpTag WriteOffAddrOp_WideChar = 436
-primOpTag WriteOffAddrOp_Int = 437
-primOpTag WriteOffAddrOp_Word = 438
-primOpTag WriteOffAddrOp_Addr = 439
-primOpTag WriteOffAddrOp_Float = 440
-primOpTag WriteOffAddrOp_Double = 441
-primOpTag WriteOffAddrOp_StablePtr = 442
-primOpTag WriteOffAddrOp_Int8 = 443
-primOpTag WriteOffAddrOp_Int16 = 444
-primOpTag WriteOffAddrOp_Int32 = 445
-primOpTag WriteOffAddrOp_Int64 = 446
-primOpTag WriteOffAddrOp_Word8 = 447
-primOpTag WriteOffAddrOp_Word16 = 448
-primOpTag WriteOffAddrOp_Word32 = 449
-primOpTag WriteOffAddrOp_Word64 = 450
-primOpTag NewMutVarOp = 451
-primOpTag ReadMutVarOp = 452
-primOpTag WriteMutVarOp = 453
-primOpTag SameMutVarOp = 454
-primOpTag AtomicModifyMutVar2Op = 455
-primOpTag AtomicModifyMutVar_Op = 456
-primOpTag CasMutVarOp = 457
-primOpTag CatchOp = 458
-primOpTag RaiseOp = 459
-primOpTag RaiseIOOp = 460
-primOpTag MaskAsyncExceptionsOp = 461
-primOpTag MaskUninterruptibleOp = 462
-primOpTag UnmaskAsyncExceptionsOp = 463
-primOpTag MaskStatus = 464
-primOpTag AtomicallyOp = 465
-primOpTag RetryOp = 466
-primOpTag CatchRetryOp = 467
-primOpTag CatchSTMOp = 468
-primOpTag NewTVarOp = 469
-primOpTag ReadTVarOp = 470
-primOpTag ReadTVarIOOp = 471
-primOpTag WriteTVarOp = 472
-primOpTag SameTVarOp = 473
-primOpTag NewMVarOp = 474
-primOpTag TakeMVarOp = 475
-primOpTag TryTakeMVarOp = 476
-primOpTag PutMVarOp = 477
-primOpTag TryPutMVarOp = 478
-primOpTag ReadMVarOp = 479
-primOpTag TryReadMVarOp = 480
-primOpTag SameMVarOp = 481
-primOpTag IsEmptyMVarOp = 482
-primOpTag DelayOp = 483
-primOpTag WaitReadOp = 484
-primOpTag WaitWriteOp = 485
-primOpTag ForkOp = 486
-primOpTag ForkOnOp = 487
-primOpTag KillThreadOp = 488
-primOpTag YieldOp = 489
-primOpTag MyThreadIdOp = 490
-primOpTag LabelThreadOp = 491
-primOpTag IsCurrentThreadBoundOp = 492
-primOpTag NoDuplicateOp = 493
-primOpTag ThreadStatusOp = 494
-primOpTag MkWeakOp = 495
-primOpTag MkWeakNoFinalizerOp = 496
-primOpTag AddCFinalizerToWeakOp = 497
-primOpTag DeRefWeakOp = 498
-primOpTag FinalizeWeakOp = 499
-primOpTag TouchOp = 500
-primOpTag MakeStablePtrOp = 501
-primOpTag DeRefStablePtrOp = 502
-primOpTag EqStablePtrOp = 503
-primOpTag MakeStableNameOp = 504
-primOpTag EqStableNameOp = 505
-primOpTag StableNameToIntOp = 506
-primOpTag CompactNewOp = 507
-primOpTag CompactResizeOp = 508
-primOpTag CompactContainsOp = 509
-primOpTag CompactContainsAnyOp = 510
-primOpTag CompactGetFirstBlockOp = 511
-primOpTag CompactGetNextBlockOp = 512
-primOpTag CompactAllocateBlockOp = 513
-primOpTag CompactFixupPointersOp = 514
-primOpTag CompactAdd = 515
-primOpTag CompactAddWithSharing = 516
-primOpTag CompactSize = 517
-primOpTag ReallyUnsafePtrEqualityOp = 518
-primOpTag ParOp = 519
-primOpTag SparkOp = 520
-primOpTag SeqOp = 521
-primOpTag GetSparkOp = 522
-primOpTag NumSparks = 523
-primOpTag DataToTagOp = 524
-primOpTag TagToEnumOp = 525
-primOpTag AddrToAnyOp = 526
-primOpTag AnyToAddrOp = 527
-primOpTag MkApUpd0_Op = 528
-primOpTag NewBCOOp = 529
-primOpTag UnpackClosureOp = 530
-primOpTag ClosureSizeOp = 531
-primOpTag GetApStackValOp = 532
-primOpTag GetCCSOfOp = 533
-primOpTag GetCurrentCCSOp = 534
-primOpTag ClearCCSOp = 535
-primOpTag TraceEventOp = 536
-primOpTag TraceEventBinaryOp = 537
-primOpTag TraceMarkerOp = 538
-primOpTag GetThreadAllocationCounter = 539
-primOpTag SetThreadAllocationCounter = 540
-primOpTag (VecBroadcastOp IntVec 16 W8) = 541
-primOpTag (VecBroadcastOp IntVec 8 W16) = 542
-primOpTag (VecBroadcastOp IntVec 4 W32) = 543
-primOpTag (VecBroadcastOp IntVec 2 W64) = 544
-primOpTag (VecBroadcastOp IntVec 32 W8) = 545
-primOpTag (VecBroadcastOp IntVec 16 W16) = 546
-primOpTag (VecBroadcastOp IntVec 8 W32) = 547
-primOpTag (VecBroadcastOp IntVec 4 W64) = 548
-primOpTag (VecBroadcastOp IntVec 64 W8) = 549
-primOpTag (VecBroadcastOp IntVec 32 W16) = 550
-primOpTag (VecBroadcastOp IntVec 16 W32) = 551
-primOpTag (VecBroadcastOp IntVec 8 W64) = 552
-primOpTag (VecBroadcastOp WordVec 16 W8) = 553
-primOpTag (VecBroadcastOp WordVec 8 W16) = 554
-primOpTag (VecBroadcastOp WordVec 4 W32) = 555
-primOpTag (VecBroadcastOp WordVec 2 W64) = 556
-primOpTag (VecBroadcastOp WordVec 32 W8) = 557
-primOpTag (VecBroadcastOp WordVec 16 W16) = 558
-primOpTag (VecBroadcastOp WordVec 8 W32) = 559
-primOpTag (VecBroadcastOp WordVec 4 W64) = 560
-primOpTag (VecBroadcastOp WordVec 64 W8) = 561
-primOpTag (VecBroadcastOp WordVec 32 W16) = 562
-primOpTag (VecBroadcastOp WordVec 16 W32) = 563
-primOpTag (VecBroadcastOp WordVec 8 W64) = 564
-primOpTag (VecBroadcastOp FloatVec 4 W32) = 565
-primOpTag (VecBroadcastOp FloatVec 2 W64) = 566
-primOpTag (VecBroadcastOp FloatVec 8 W32) = 567
-primOpTag (VecBroadcastOp FloatVec 4 W64) = 568
-primOpTag (VecBroadcastOp FloatVec 16 W32) = 569
-primOpTag (VecBroadcastOp FloatVec 8 W64) = 570
-primOpTag (VecPackOp IntVec 16 W8) = 571
-primOpTag (VecPackOp IntVec 8 W16) = 572
-primOpTag (VecPackOp IntVec 4 W32) = 573
-primOpTag (VecPackOp IntVec 2 W64) = 574
-primOpTag (VecPackOp IntVec 32 W8) = 575
-primOpTag (VecPackOp IntVec 16 W16) = 576
-primOpTag (VecPackOp IntVec 8 W32) = 577
-primOpTag (VecPackOp IntVec 4 W64) = 578
-primOpTag (VecPackOp IntVec 64 W8) = 579
-primOpTag (VecPackOp IntVec 32 W16) = 580
-primOpTag (VecPackOp IntVec 16 W32) = 581
-primOpTag (VecPackOp IntVec 8 W64) = 582
-primOpTag (VecPackOp WordVec 16 W8) = 583
-primOpTag (VecPackOp WordVec 8 W16) = 584
-primOpTag (VecPackOp WordVec 4 W32) = 585
-primOpTag (VecPackOp WordVec 2 W64) = 586
-primOpTag (VecPackOp WordVec 32 W8) = 587
-primOpTag (VecPackOp WordVec 16 W16) = 588
-primOpTag (VecPackOp WordVec 8 W32) = 589
-primOpTag (VecPackOp WordVec 4 W64) = 590
-primOpTag (VecPackOp WordVec 64 W8) = 591
-primOpTag (VecPackOp WordVec 32 W16) = 592
-primOpTag (VecPackOp WordVec 16 W32) = 593
-primOpTag (VecPackOp WordVec 8 W64) = 594
-primOpTag (VecPackOp FloatVec 4 W32) = 595
-primOpTag (VecPackOp FloatVec 2 W64) = 596
-primOpTag (VecPackOp FloatVec 8 W32) = 597
-primOpTag (VecPackOp FloatVec 4 W64) = 598
-primOpTag (VecPackOp FloatVec 16 W32) = 599
-primOpTag (VecPackOp FloatVec 8 W64) = 600
-primOpTag (VecUnpackOp IntVec 16 W8) = 601
-primOpTag (VecUnpackOp IntVec 8 W16) = 602
-primOpTag (VecUnpackOp IntVec 4 W32) = 603
-primOpTag (VecUnpackOp IntVec 2 W64) = 604
-primOpTag (VecUnpackOp IntVec 32 W8) = 605
-primOpTag (VecUnpackOp IntVec 16 W16) = 606
-primOpTag (VecUnpackOp IntVec 8 W32) = 607
-primOpTag (VecUnpackOp IntVec 4 W64) = 608
-primOpTag (VecUnpackOp IntVec 64 W8) = 609
-primOpTag (VecUnpackOp IntVec 32 W16) = 610
-primOpTag (VecUnpackOp IntVec 16 W32) = 611
-primOpTag (VecUnpackOp IntVec 8 W64) = 612
-primOpTag (VecUnpackOp WordVec 16 W8) = 613
-primOpTag (VecUnpackOp WordVec 8 W16) = 614
-primOpTag (VecUnpackOp WordVec 4 W32) = 615
-primOpTag (VecUnpackOp WordVec 2 W64) = 616
-primOpTag (VecUnpackOp WordVec 32 W8) = 617
-primOpTag (VecUnpackOp WordVec 16 W16) = 618
-primOpTag (VecUnpackOp WordVec 8 W32) = 619
-primOpTag (VecUnpackOp WordVec 4 W64) = 620
-primOpTag (VecUnpackOp WordVec 64 W8) = 621
-primOpTag (VecUnpackOp WordVec 32 W16) = 622
-primOpTag (VecUnpackOp WordVec 16 W32) = 623
-primOpTag (VecUnpackOp WordVec 8 W64) = 624
-primOpTag (VecUnpackOp FloatVec 4 W32) = 625
-primOpTag (VecUnpackOp FloatVec 2 W64) = 626
-primOpTag (VecUnpackOp FloatVec 8 W32) = 627
-primOpTag (VecUnpackOp FloatVec 4 W64) = 628
-primOpTag (VecUnpackOp FloatVec 16 W32) = 629
-primOpTag (VecUnpackOp FloatVec 8 W64) = 630
-primOpTag (VecInsertOp IntVec 16 W8) = 631
-primOpTag (VecInsertOp IntVec 8 W16) = 632
-primOpTag (VecInsertOp IntVec 4 W32) = 633
-primOpTag (VecInsertOp IntVec 2 W64) = 634
-primOpTag (VecInsertOp IntVec 32 W8) = 635
-primOpTag (VecInsertOp IntVec 16 W16) = 636
-primOpTag (VecInsertOp IntVec 8 W32) = 637
-primOpTag (VecInsertOp IntVec 4 W64) = 638
-primOpTag (VecInsertOp IntVec 64 W8) = 639
-primOpTag (VecInsertOp IntVec 32 W16) = 640
-primOpTag (VecInsertOp IntVec 16 W32) = 641
-primOpTag (VecInsertOp IntVec 8 W64) = 642
-primOpTag (VecInsertOp WordVec 16 W8) = 643
-primOpTag (VecInsertOp WordVec 8 W16) = 644
-primOpTag (VecInsertOp WordVec 4 W32) = 645
-primOpTag (VecInsertOp WordVec 2 W64) = 646
-primOpTag (VecInsertOp WordVec 32 W8) = 647
-primOpTag (VecInsertOp WordVec 16 W16) = 648
-primOpTag (VecInsertOp WordVec 8 W32) = 649
-primOpTag (VecInsertOp WordVec 4 W64) = 650
-primOpTag (VecInsertOp WordVec 64 W8) = 651
-primOpTag (VecInsertOp WordVec 32 W16) = 652
-primOpTag (VecInsertOp WordVec 16 W32) = 653
-primOpTag (VecInsertOp WordVec 8 W64) = 654
-primOpTag (VecInsertOp FloatVec 4 W32) = 655
-primOpTag (VecInsertOp FloatVec 2 W64) = 656
-primOpTag (VecInsertOp FloatVec 8 W32) = 657
-primOpTag (VecInsertOp FloatVec 4 W64) = 658
-primOpTag (VecInsertOp FloatVec 16 W32) = 659
-primOpTag (VecInsertOp FloatVec 8 W64) = 660
-primOpTag (VecAddOp IntVec 16 W8) = 661
-primOpTag (VecAddOp IntVec 8 W16) = 662
-primOpTag (VecAddOp IntVec 4 W32) = 663
-primOpTag (VecAddOp IntVec 2 W64) = 664
-primOpTag (VecAddOp IntVec 32 W8) = 665
-primOpTag (VecAddOp IntVec 16 W16) = 666
-primOpTag (VecAddOp IntVec 8 W32) = 667
-primOpTag (VecAddOp IntVec 4 W64) = 668
-primOpTag (VecAddOp IntVec 64 W8) = 669
-primOpTag (VecAddOp IntVec 32 W16) = 670
-primOpTag (VecAddOp IntVec 16 W32) = 671
-primOpTag (VecAddOp IntVec 8 W64) = 672
-primOpTag (VecAddOp WordVec 16 W8) = 673
-primOpTag (VecAddOp WordVec 8 W16) = 674
-primOpTag (VecAddOp WordVec 4 W32) = 675
-primOpTag (VecAddOp WordVec 2 W64) = 676
-primOpTag (VecAddOp WordVec 32 W8) = 677
-primOpTag (VecAddOp WordVec 16 W16) = 678
-primOpTag (VecAddOp WordVec 8 W32) = 679
-primOpTag (VecAddOp WordVec 4 W64) = 680
-primOpTag (VecAddOp WordVec 64 W8) = 681
-primOpTag (VecAddOp WordVec 32 W16) = 682
-primOpTag (VecAddOp WordVec 16 W32) = 683
-primOpTag (VecAddOp WordVec 8 W64) = 684
-primOpTag (VecAddOp FloatVec 4 W32) = 685
-primOpTag (VecAddOp FloatVec 2 W64) = 686
-primOpTag (VecAddOp FloatVec 8 W32) = 687
-primOpTag (VecAddOp FloatVec 4 W64) = 688
-primOpTag (VecAddOp FloatVec 16 W32) = 689
-primOpTag (VecAddOp FloatVec 8 W64) = 690
-primOpTag (VecSubOp IntVec 16 W8) = 691
-primOpTag (VecSubOp IntVec 8 W16) = 692
-primOpTag (VecSubOp IntVec 4 W32) = 693
-primOpTag (VecSubOp IntVec 2 W64) = 694
-primOpTag (VecSubOp IntVec 32 W8) = 695
-primOpTag (VecSubOp IntVec 16 W16) = 696
-primOpTag (VecSubOp IntVec 8 W32) = 697
-primOpTag (VecSubOp IntVec 4 W64) = 698
-primOpTag (VecSubOp IntVec 64 W8) = 699
-primOpTag (VecSubOp IntVec 32 W16) = 700
-primOpTag (VecSubOp IntVec 16 W32) = 701
-primOpTag (VecSubOp IntVec 8 W64) = 702
-primOpTag (VecSubOp WordVec 16 W8) = 703
-primOpTag (VecSubOp WordVec 8 W16) = 704
-primOpTag (VecSubOp WordVec 4 W32) = 705
-primOpTag (VecSubOp WordVec 2 W64) = 706
-primOpTag (VecSubOp WordVec 32 W8) = 707
-primOpTag (VecSubOp WordVec 16 W16) = 708
-primOpTag (VecSubOp WordVec 8 W32) = 709
-primOpTag (VecSubOp WordVec 4 W64) = 710
-primOpTag (VecSubOp WordVec 64 W8) = 711
-primOpTag (VecSubOp WordVec 32 W16) = 712
-primOpTag (VecSubOp WordVec 16 W32) = 713
-primOpTag (VecSubOp WordVec 8 W64) = 714
-primOpTag (VecSubOp FloatVec 4 W32) = 715
-primOpTag (VecSubOp FloatVec 2 W64) = 716
-primOpTag (VecSubOp FloatVec 8 W32) = 717
-primOpTag (VecSubOp FloatVec 4 W64) = 718
-primOpTag (VecSubOp FloatVec 16 W32) = 719
-primOpTag (VecSubOp FloatVec 8 W64) = 720
-primOpTag (VecMulOp IntVec 16 W8) = 721
-primOpTag (VecMulOp IntVec 8 W16) = 722
-primOpTag (VecMulOp IntVec 4 W32) = 723
-primOpTag (VecMulOp IntVec 2 W64) = 724
-primOpTag (VecMulOp IntVec 32 W8) = 725
-primOpTag (VecMulOp IntVec 16 W16) = 726
-primOpTag (VecMulOp IntVec 8 W32) = 727
-primOpTag (VecMulOp IntVec 4 W64) = 728
-primOpTag (VecMulOp IntVec 64 W8) = 729
-primOpTag (VecMulOp IntVec 32 W16) = 730
-primOpTag (VecMulOp IntVec 16 W32) = 731
-primOpTag (VecMulOp IntVec 8 W64) = 732
-primOpTag (VecMulOp WordVec 16 W8) = 733
-primOpTag (VecMulOp WordVec 8 W16) = 734
-primOpTag (VecMulOp WordVec 4 W32) = 735
-primOpTag (VecMulOp WordVec 2 W64) = 736
-primOpTag (VecMulOp WordVec 32 W8) = 737
-primOpTag (VecMulOp WordVec 16 W16) = 738
-primOpTag (VecMulOp WordVec 8 W32) = 739
-primOpTag (VecMulOp WordVec 4 W64) = 740
-primOpTag (VecMulOp WordVec 64 W8) = 741
-primOpTag (VecMulOp WordVec 32 W16) = 742
-primOpTag (VecMulOp WordVec 16 W32) = 743
-primOpTag (VecMulOp WordVec 8 W64) = 744
-primOpTag (VecMulOp FloatVec 4 W32) = 745
-primOpTag (VecMulOp FloatVec 2 W64) = 746
-primOpTag (VecMulOp FloatVec 8 W32) = 747
-primOpTag (VecMulOp FloatVec 4 W64) = 748
-primOpTag (VecMulOp FloatVec 16 W32) = 749
-primOpTag (VecMulOp FloatVec 8 W64) = 750
-primOpTag (VecDivOp FloatVec 4 W32) = 751
-primOpTag (VecDivOp FloatVec 2 W64) = 752
-primOpTag (VecDivOp FloatVec 8 W32) = 753
-primOpTag (VecDivOp FloatVec 4 W64) = 754
-primOpTag (VecDivOp FloatVec 16 W32) = 755
-primOpTag (VecDivOp FloatVec 8 W64) = 756
-primOpTag (VecQuotOp IntVec 16 W8) = 757
-primOpTag (VecQuotOp IntVec 8 W16) = 758
-primOpTag (VecQuotOp IntVec 4 W32) = 759
-primOpTag (VecQuotOp IntVec 2 W64) = 760
-primOpTag (VecQuotOp IntVec 32 W8) = 761
-primOpTag (VecQuotOp IntVec 16 W16) = 762
-primOpTag (VecQuotOp IntVec 8 W32) = 763
-primOpTag (VecQuotOp IntVec 4 W64) = 764
-primOpTag (VecQuotOp IntVec 64 W8) = 765
-primOpTag (VecQuotOp IntVec 32 W16) = 766
-primOpTag (VecQuotOp IntVec 16 W32) = 767
-primOpTag (VecQuotOp IntVec 8 W64) = 768
-primOpTag (VecQuotOp WordVec 16 W8) = 769
-primOpTag (VecQuotOp WordVec 8 W16) = 770
-primOpTag (VecQuotOp WordVec 4 W32) = 771
-primOpTag (VecQuotOp WordVec 2 W64) = 772
-primOpTag (VecQuotOp WordVec 32 W8) = 773
-primOpTag (VecQuotOp WordVec 16 W16) = 774
-primOpTag (VecQuotOp WordVec 8 W32) = 775
-primOpTag (VecQuotOp WordVec 4 W64) = 776
-primOpTag (VecQuotOp WordVec 64 W8) = 777
-primOpTag (VecQuotOp WordVec 32 W16) = 778
-primOpTag (VecQuotOp WordVec 16 W32) = 779
-primOpTag (VecQuotOp WordVec 8 W64) = 780
-primOpTag (VecRemOp IntVec 16 W8) = 781
-primOpTag (VecRemOp IntVec 8 W16) = 782
-primOpTag (VecRemOp IntVec 4 W32) = 783
-primOpTag (VecRemOp IntVec 2 W64) = 784
-primOpTag (VecRemOp IntVec 32 W8) = 785
-primOpTag (VecRemOp IntVec 16 W16) = 786
-primOpTag (VecRemOp IntVec 8 W32) = 787
-primOpTag (VecRemOp IntVec 4 W64) = 788
-primOpTag (VecRemOp IntVec 64 W8) = 789
-primOpTag (VecRemOp IntVec 32 W16) = 790
-primOpTag (VecRemOp IntVec 16 W32) = 791
-primOpTag (VecRemOp IntVec 8 W64) = 792
-primOpTag (VecRemOp WordVec 16 W8) = 793
-primOpTag (VecRemOp WordVec 8 W16) = 794
-primOpTag (VecRemOp WordVec 4 W32) = 795
-primOpTag (VecRemOp WordVec 2 W64) = 796
-primOpTag (VecRemOp WordVec 32 W8) = 797
-primOpTag (VecRemOp WordVec 16 W16) = 798
-primOpTag (VecRemOp WordVec 8 W32) = 799
-primOpTag (VecRemOp WordVec 4 W64) = 800
-primOpTag (VecRemOp WordVec 64 W8) = 801
-primOpTag (VecRemOp WordVec 32 W16) = 802
-primOpTag (VecRemOp WordVec 16 W32) = 803
-primOpTag (VecRemOp WordVec 8 W64) = 804
-primOpTag (VecNegOp IntVec 16 W8) = 805
-primOpTag (VecNegOp IntVec 8 W16) = 806
-primOpTag (VecNegOp IntVec 4 W32) = 807
-primOpTag (VecNegOp IntVec 2 W64) = 808
-primOpTag (VecNegOp IntVec 32 W8) = 809
-primOpTag (VecNegOp IntVec 16 W16) = 810
-primOpTag (VecNegOp IntVec 8 W32) = 811
-primOpTag (VecNegOp IntVec 4 W64) = 812
-primOpTag (VecNegOp IntVec 64 W8) = 813
-primOpTag (VecNegOp IntVec 32 W16) = 814
-primOpTag (VecNegOp IntVec 16 W32) = 815
-primOpTag (VecNegOp IntVec 8 W64) = 816
-primOpTag (VecNegOp FloatVec 4 W32) = 817
-primOpTag (VecNegOp FloatVec 2 W64) = 818
-primOpTag (VecNegOp FloatVec 8 W32) = 819
-primOpTag (VecNegOp FloatVec 4 W64) = 820
-primOpTag (VecNegOp FloatVec 16 W32) = 821
-primOpTag (VecNegOp FloatVec 8 W64) = 822
-primOpTag (VecIndexByteArrayOp IntVec 16 W8) = 823
-primOpTag (VecIndexByteArrayOp IntVec 8 W16) = 824
-primOpTag (VecIndexByteArrayOp IntVec 4 W32) = 825
-primOpTag (VecIndexByteArrayOp IntVec 2 W64) = 826
-primOpTag (VecIndexByteArrayOp IntVec 32 W8) = 827
-primOpTag (VecIndexByteArrayOp IntVec 16 W16) = 828
-primOpTag (VecIndexByteArrayOp IntVec 8 W32) = 829
-primOpTag (VecIndexByteArrayOp IntVec 4 W64) = 830
-primOpTag (VecIndexByteArrayOp IntVec 64 W8) = 831
-primOpTag (VecIndexByteArrayOp IntVec 32 W16) = 832
-primOpTag (VecIndexByteArrayOp IntVec 16 W32) = 833
-primOpTag (VecIndexByteArrayOp IntVec 8 W64) = 834
-primOpTag (VecIndexByteArrayOp WordVec 16 W8) = 835
-primOpTag (VecIndexByteArrayOp WordVec 8 W16) = 836
-primOpTag (VecIndexByteArrayOp WordVec 4 W32) = 837
-primOpTag (VecIndexByteArrayOp WordVec 2 W64) = 838
-primOpTag (VecIndexByteArrayOp WordVec 32 W8) = 839
-primOpTag (VecIndexByteArrayOp WordVec 16 W16) = 840
-primOpTag (VecIndexByteArrayOp WordVec 8 W32) = 841
-primOpTag (VecIndexByteArrayOp WordVec 4 W64) = 842
-primOpTag (VecIndexByteArrayOp WordVec 64 W8) = 843
-primOpTag (VecIndexByteArrayOp WordVec 32 W16) = 844
-primOpTag (VecIndexByteArrayOp WordVec 16 W32) = 845
-primOpTag (VecIndexByteArrayOp WordVec 8 W64) = 846
-primOpTag (VecIndexByteArrayOp FloatVec 4 W32) = 847
-primOpTag (VecIndexByteArrayOp FloatVec 2 W64) = 848
-primOpTag (VecIndexByteArrayOp FloatVec 8 W32) = 849
-primOpTag (VecIndexByteArrayOp FloatVec 4 W64) = 850
-primOpTag (VecIndexByteArrayOp FloatVec 16 W32) = 851
-primOpTag (VecIndexByteArrayOp FloatVec 8 W64) = 852
-primOpTag (VecReadByteArrayOp IntVec 16 W8) = 853
-primOpTag (VecReadByteArrayOp IntVec 8 W16) = 854
-primOpTag (VecReadByteArrayOp IntVec 4 W32) = 855
-primOpTag (VecReadByteArrayOp IntVec 2 W64) = 856
-primOpTag (VecReadByteArrayOp IntVec 32 W8) = 857
-primOpTag (VecReadByteArrayOp IntVec 16 W16) = 858
-primOpTag (VecReadByteArrayOp IntVec 8 W32) = 859
-primOpTag (VecReadByteArrayOp IntVec 4 W64) = 860
-primOpTag (VecReadByteArrayOp IntVec 64 W8) = 861
-primOpTag (VecReadByteArrayOp IntVec 32 W16) = 862
-primOpTag (VecReadByteArrayOp IntVec 16 W32) = 863
-primOpTag (VecReadByteArrayOp IntVec 8 W64) = 864
-primOpTag (VecReadByteArrayOp WordVec 16 W8) = 865
-primOpTag (VecReadByteArrayOp WordVec 8 W16) = 866
-primOpTag (VecReadByteArrayOp WordVec 4 W32) = 867
-primOpTag (VecReadByteArrayOp WordVec 2 W64) = 868
-primOpTag (VecReadByteArrayOp WordVec 32 W8) = 869
-primOpTag (VecReadByteArrayOp WordVec 16 W16) = 870
-primOpTag (VecReadByteArrayOp WordVec 8 W32) = 871
-primOpTag (VecReadByteArrayOp WordVec 4 W64) = 872
-primOpTag (VecReadByteArrayOp WordVec 64 W8) = 873
-primOpTag (VecReadByteArrayOp WordVec 32 W16) = 874
-primOpTag (VecReadByteArrayOp WordVec 16 W32) = 875
-primOpTag (VecReadByteArrayOp WordVec 8 W64) = 876
-primOpTag (VecReadByteArrayOp FloatVec 4 W32) = 877
-primOpTag (VecReadByteArrayOp FloatVec 2 W64) = 878
-primOpTag (VecReadByteArrayOp FloatVec 8 W32) = 879
-primOpTag (VecReadByteArrayOp FloatVec 4 W64) = 880
-primOpTag (VecReadByteArrayOp FloatVec 16 W32) = 881
-primOpTag (VecReadByteArrayOp FloatVec 8 W64) = 882
-primOpTag (VecWriteByteArrayOp IntVec 16 W8) = 883
-primOpTag (VecWriteByteArrayOp IntVec 8 W16) = 884
-primOpTag (VecWriteByteArrayOp IntVec 4 W32) = 885
-primOpTag (VecWriteByteArrayOp IntVec 2 W64) = 886
-primOpTag (VecWriteByteArrayOp IntVec 32 W8) = 887
-primOpTag (VecWriteByteArrayOp IntVec 16 W16) = 888
-primOpTag (VecWriteByteArrayOp IntVec 8 W32) = 889
-primOpTag (VecWriteByteArrayOp IntVec 4 W64) = 890
-primOpTag (VecWriteByteArrayOp IntVec 64 W8) = 891
-primOpTag (VecWriteByteArrayOp IntVec 32 W16) = 892
-primOpTag (VecWriteByteArrayOp IntVec 16 W32) = 893
-primOpTag (VecWriteByteArrayOp IntVec 8 W64) = 894
-primOpTag (VecWriteByteArrayOp WordVec 16 W8) = 895
-primOpTag (VecWriteByteArrayOp WordVec 8 W16) = 896
-primOpTag (VecWriteByteArrayOp WordVec 4 W32) = 897
-primOpTag (VecWriteByteArrayOp WordVec 2 W64) = 898
-primOpTag (VecWriteByteArrayOp WordVec 32 W8) = 899
-primOpTag (VecWriteByteArrayOp WordVec 16 W16) = 900
-primOpTag (VecWriteByteArrayOp WordVec 8 W32) = 901
-primOpTag (VecWriteByteArrayOp WordVec 4 W64) = 902
-primOpTag (VecWriteByteArrayOp WordVec 64 W8) = 903
-primOpTag (VecWriteByteArrayOp WordVec 32 W16) = 904
-primOpTag (VecWriteByteArrayOp WordVec 16 W32) = 905
-primOpTag (VecWriteByteArrayOp WordVec 8 W64) = 906
-primOpTag (VecWriteByteArrayOp FloatVec 4 W32) = 907
-primOpTag (VecWriteByteArrayOp FloatVec 2 W64) = 908
-primOpTag (VecWriteByteArrayOp FloatVec 8 W32) = 909
-primOpTag (VecWriteByteArrayOp FloatVec 4 W64) = 910
-primOpTag (VecWriteByteArrayOp FloatVec 16 W32) = 911
-primOpTag (VecWriteByteArrayOp FloatVec 8 W64) = 912
-primOpTag (VecIndexOffAddrOp IntVec 16 W8) = 913
-primOpTag (VecIndexOffAddrOp IntVec 8 W16) = 914
-primOpTag (VecIndexOffAddrOp IntVec 4 W32) = 915
-primOpTag (VecIndexOffAddrOp IntVec 2 W64) = 916
-primOpTag (VecIndexOffAddrOp IntVec 32 W8) = 917
-primOpTag (VecIndexOffAddrOp IntVec 16 W16) = 918
-primOpTag (VecIndexOffAddrOp IntVec 8 W32) = 919
-primOpTag (VecIndexOffAddrOp IntVec 4 W64) = 920
-primOpTag (VecIndexOffAddrOp IntVec 64 W8) = 921
-primOpTag (VecIndexOffAddrOp IntVec 32 W16) = 922
-primOpTag (VecIndexOffAddrOp IntVec 16 W32) = 923
-primOpTag (VecIndexOffAddrOp IntVec 8 W64) = 924
-primOpTag (VecIndexOffAddrOp WordVec 16 W8) = 925
-primOpTag (VecIndexOffAddrOp WordVec 8 W16) = 926
-primOpTag (VecIndexOffAddrOp WordVec 4 W32) = 927
-primOpTag (VecIndexOffAddrOp WordVec 2 W64) = 928
-primOpTag (VecIndexOffAddrOp WordVec 32 W8) = 929
-primOpTag (VecIndexOffAddrOp WordVec 16 W16) = 930
-primOpTag (VecIndexOffAddrOp WordVec 8 W32) = 931
-primOpTag (VecIndexOffAddrOp WordVec 4 W64) = 932
-primOpTag (VecIndexOffAddrOp WordVec 64 W8) = 933
-primOpTag (VecIndexOffAddrOp WordVec 32 W16) = 934
-primOpTag (VecIndexOffAddrOp WordVec 16 W32) = 935
-primOpTag (VecIndexOffAddrOp WordVec 8 W64) = 936
-primOpTag (VecIndexOffAddrOp FloatVec 4 W32) = 937
-primOpTag (VecIndexOffAddrOp FloatVec 2 W64) = 938
-primOpTag (VecIndexOffAddrOp FloatVec 8 W32) = 939
-primOpTag (VecIndexOffAddrOp FloatVec 4 W64) = 940
-primOpTag (VecIndexOffAddrOp FloatVec 16 W32) = 941
-primOpTag (VecIndexOffAddrOp FloatVec 8 W64) = 942
-primOpTag (VecReadOffAddrOp IntVec 16 W8) = 943
-primOpTag (VecReadOffAddrOp IntVec 8 W16) = 944
-primOpTag (VecReadOffAddrOp IntVec 4 W32) = 945
-primOpTag (VecReadOffAddrOp IntVec 2 W64) = 946
-primOpTag (VecReadOffAddrOp IntVec 32 W8) = 947
-primOpTag (VecReadOffAddrOp IntVec 16 W16) = 948
-primOpTag (VecReadOffAddrOp IntVec 8 W32) = 949
-primOpTag (VecReadOffAddrOp IntVec 4 W64) = 950
-primOpTag (VecReadOffAddrOp IntVec 64 W8) = 951
-primOpTag (VecReadOffAddrOp IntVec 32 W16) = 952
-primOpTag (VecReadOffAddrOp IntVec 16 W32) = 953
-primOpTag (VecReadOffAddrOp IntVec 8 W64) = 954
-primOpTag (VecReadOffAddrOp WordVec 16 W8) = 955
-primOpTag (VecReadOffAddrOp WordVec 8 W16) = 956
-primOpTag (VecReadOffAddrOp WordVec 4 W32) = 957
-primOpTag (VecReadOffAddrOp WordVec 2 W64) = 958
-primOpTag (VecReadOffAddrOp WordVec 32 W8) = 959
-primOpTag (VecReadOffAddrOp WordVec 16 W16) = 960
-primOpTag (VecReadOffAddrOp WordVec 8 W32) = 961
-primOpTag (VecReadOffAddrOp WordVec 4 W64) = 962
-primOpTag (VecReadOffAddrOp WordVec 64 W8) = 963
-primOpTag (VecReadOffAddrOp WordVec 32 W16) = 964
-primOpTag (VecReadOffAddrOp WordVec 16 W32) = 965
-primOpTag (VecReadOffAddrOp WordVec 8 W64) = 966
-primOpTag (VecReadOffAddrOp FloatVec 4 W32) = 967
-primOpTag (VecReadOffAddrOp FloatVec 2 W64) = 968
-primOpTag (VecReadOffAddrOp FloatVec 8 W32) = 969
-primOpTag (VecReadOffAddrOp FloatVec 4 W64) = 970
-primOpTag (VecReadOffAddrOp FloatVec 16 W32) = 971
-primOpTag (VecReadOffAddrOp FloatVec 8 W64) = 972
-primOpTag (VecWriteOffAddrOp IntVec 16 W8) = 973
-primOpTag (VecWriteOffAddrOp IntVec 8 W16) = 974
-primOpTag (VecWriteOffAddrOp IntVec 4 W32) = 975
-primOpTag (VecWriteOffAddrOp IntVec 2 W64) = 976
-primOpTag (VecWriteOffAddrOp IntVec 32 W8) = 977
-primOpTag (VecWriteOffAddrOp IntVec 16 W16) = 978
-primOpTag (VecWriteOffAddrOp IntVec 8 W32) = 979
-primOpTag (VecWriteOffAddrOp IntVec 4 W64) = 980
-primOpTag (VecWriteOffAddrOp IntVec 64 W8) = 981
-primOpTag (VecWriteOffAddrOp IntVec 32 W16) = 982
-primOpTag (VecWriteOffAddrOp IntVec 16 W32) = 983
-primOpTag (VecWriteOffAddrOp IntVec 8 W64) = 984
-primOpTag (VecWriteOffAddrOp WordVec 16 W8) = 985
-primOpTag (VecWriteOffAddrOp WordVec 8 W16) = 986
-primOpTag (VecWriteOffAddrOp WordVec 4 W32) = 987
-primOpTag (VecWriteOffAddrOp WordVec 2 W64) = 988
-primOpTag (VecWriteOffAddrOp WordVec 32 W8) = 989
-primOpTag (VecWriteOffAddrOp WordVec 16 W16) = 990
-primOpTag (VecWriteOffAddrOp WordVec 8 W32) = 991
-primOpTag (VecWriteOffAddrOp WordVec 4 W64) = 992
-primOpTag (VecWriteOffAddrOp WordVec 64 W8) = 993
-primOpTag (VecWriteOffAddrOp WordVec 32 W16) = 994
-primOpTag (VecWriteOffAddrOp WordVec 16 W32) = 995
-primOpTag (VecWriteOffAddrOp WordVec 8 W64) = 996
-primOpTag (VecWriteOffAddrOp FloatVec 4 W32) = 997
-primOpTag (VecWriteOffAddrOp FloatVec 2 W64) = 998
-primOpTag (VecWriteOffAddrOp FloatVec 8 W32) = 999
-primOpTag (VecWriteOffAddrOp FloatVec 4 W64) = 1000
-primOpTag (VecWriteOffAddrOp FloatVec 16 W32) = 1001
-primOpTag (VecWriteOffAddrOp FloatVec 8 W64) = 1002
-primOpTag (VecIndexScalarByteArrayOp IntVec 16 W8) = 1003
-primOpTag (VecIndexScalarByteArrayOp IntVec 8 W16) = 1004
-primOpTag (VecIndexScalarByteArrayOp IntVec 4 W32) = 1005
-primOpTag (VecIndexScalarByteArrayOp IntVec 2 W64) = 1006
-primOpTag (VecIndexScalarByteArrayOp IntVec 32 W8) = 1007
-primOpTag (VecIndexScalarByteArrayOp IntVec 16 W16) = 1008
-primOpTag (VecIndexScalarByteArrayOp IntVec 8 W32) = 1009
-primOpTag (VecIndexScalarByteArrayOp IntVec 4 W64) = 1010
-primOpTag (VecIndexScalarByteArrayOp IntVec 64 W8) = 1011
-primOpTag (VecIndexScalarByteArrayOp IntVec 32 W16) = 1012
-primOpTag (VecIndexScalarByteArrayOp IntVec 16 W32) = 1013
-primOpTag (VecIndexScalarByteArrayOp IntVec 8 W64) = 1014
-primOpTag (VecIndexScalarByteArrayOp WordVec 16 W8) = 1015
-primOpTag (VecIndexScalarByteArrayOp WordVec 8 W16) = 1016
-primOpTag (VecIndexScalarByteArrayOp WordVec 4 W32) = 1017
-primOpTag (VecIndexScalarByteArrayOp WordVec 2 W64) = 1018
-primOpTag (VecIndexScalarByteArrayOp WordVec 32 W8) = 1019
-primOpTag (VecIndexScalarByteArrayOp WordVec 16 W16) = 1020
-primOpTag (VecIndexScalarByteArrayOp WordVec 8 W32) = 1021
-primOpTag (VecIndexScalarByteArrayOp WordVec 4 W64) = 1022
-primOpTag (VecIndexScalarByteArrayOp WordVec 64 W8) = 1023
-primOpTag (VecIndexScalarByteArrayOp WordVec 32 W16) = 1024
-primOpTag (VecIndexScalarByteArrayOp WordVec 16 W32) = 1025
-primOpTag (VecIndexScalarByteArrayOp WordVec 8 W64) = 1026
-primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W32) = 1027
-primOpTag (VecIndexScalarByteArrayOp FloatVec 2 W64) = 1028
-primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W32) = 1029
-primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W64) = 1030
-primOpTag (VecIndexScalarByteArrayOp FloatVec 16 W32) = 1031
-primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W64) = 1032
-primOpTag (VecReadScalarByteArrayOp IntVec 16 W8) = 1033
-primOpTag (VecReadScalarByteArrayOp IntVec 8 W16) = 1034
-primOpTag (VecReadScalarByteArrayOp IntVec 4 W32) = 1035
-primOpTag (VecReadScalarByteArrayOp IntVec 2 W64) = 1036
-primOpTag (VecReadScalarByteArrayOp IntVec 32 W8) = 1037
-primOpTag (VecReadScalarByteArrayOp IntVec 16 W16) = 1038
-primOpTag (VecReadScalarByteArrayOp IntVec 8 W32) = 1039
-primOpTag (VecReadScalarByteArrayOp IntVec 4 W64) = 1040
-primOpTag (VecReadScalarByteArrayOp IntVec 64 W8) = 1041
-primOpTag (VecReadScalarByteArrayOp IntVec 32 W16) = 1042
-primOpTag (VecReadScalarByteArrayOp IntVec 16 W32) = 1043
-primOpTag (VecReadScalarByteArrayOp IntVec 8 W64) = 1044
-primOpTag (VecReadScalarByteArrayOp WordVec 16 W8) = 1045
-primOpTag (VecReadScalarByteArrayOp WordVec 8 W16) = 1046
-primOpTag (VecReadScalarByteArrayOp WordVec 4 W32) = 1047
-primOpTag (VecReadScalarByteArrayOp WordVec 2 W64) = 1048
-primOpTag (VecReadScalarByteArrayOp WordVec 32 W8) = 1049
-primOpTag (VecReadScalarByteArrayOp WordVec 16 W16) = 1050
-primOpTag (VecReadScalarByteArrayOp WordVec 8 W32) = 1051
-primOpTag (VecReadScalarByteArrayOp WordVec 4 W64) = 1052
-primOpTag (VecReadScalarByteArrayOp WordVec 64 W8) = 1053
-primOpTag (VecReadScalarByteArrayOp WordVec 32 W16) = 1054
-primOpTag (VecReadScalarByteArrayOp WordVec 16 W32) = 1055
-primOpTag (VecReadScalarByteArrayOp WordVec 8 W64) = 1056
-primOpTag (VecReadScalarByteArrayOp FloatVec 4 W32) = 1057
-primOpTag (VecReadScalarByteArrayOp FloatVec 2 W64) = 1058
-primOpTag (VecReadScalarByteArrayOp FloatVec 8 W32) = 1059
-primOpTag (VecReadScalarByteArrayOp FloatVec 4 W64) = 1060
-primOpTag (VecReadScalarByteArrayOp FloatVec 16 W32) = 1061
-primOpTag (VecReadScalarByteArrayOp FloatVec 8 W64) = 1062
-primOpTag (VecWriteScalarByteArrayOp IntVec 16 W8) = 1063
-primOpTag (VecWriteScalarByteArrayOp IntVec 8 W16) = 1064
-primOpTag (VecWriteScalarByteArrayOp IntVec 4 W32) = 1065
-primOpTag (VecWriteScalarByteArrayOp IntVec 2 W64) = 1066
-primOpTag (VecWriteScalarByteArrayOp IntVec 32 W8) = 1067
-primOpTag (VecWriteScalarByteArrayOp IntVec 16 W16) = 1068
-primOpTag (VecWriteScalarByteArrayOp IntVec 8 W32) = 1069
-primOpTag (VecWriteScalarByteArrayOp IntVec 4 W64) = 1070
-primOpTag (VecWriteScalarByteArrayOp IntVec 64 W8) = 1071
-primOpTag (VecWriteScalarByteArrayOp IntVec 32 W16) = 1072
-primOpTag (VecWriteScalarByteArrayOp IntVec 16 W32) = 1073
-primOpTag (VecWriteScalarByteArrayOp IntVec 8 W64) = 1074
-primOpTag (VecWriteScalarByteArrayOp WordVec 16 W8) = 1075
-primOpTag (VecWriteScalarByteArrayOp WordVec 8 W16) = 1076
-primOpTag (VecWriteScalarByteArrayOp WordVec 4 W32) = 1077
-primOpTag (VecWriteScalarByteArrayOp WordVec 2 W64) = 1078
-primOpTag (VecWriteScalarByteArrayOp WordVec 32 W8) = 1079
-primOpTag (VecWriteScalarByteArrayOp WordVec 16 W16) = 1080
-primOpTag (VecWriteScalarByteArrayOp WordVec 8 W32) = 1081
-primOpTag (VecWriteScalarByteArrayOp WordVec 4 W64) = 1082
-primOpTag (VecWriteScalarByteArrayOp WordVec 64 W8) = 1083
-primOpTag (VecWriteScalarByteArrayOp WordVec 32 W16) = 1084
-primOpTag (VecWriteScalarByteArrayOp WordVec 16 W32) = 1085
-primOpTag (VecWriteScalarByteArrayOp WordVec 8 W64) = 1086
-primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W32) = 1087
-primOpTag (VecWriteScalarByteArrayOp FloatVec 2 W64) = 1088
-primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W32) = 1089
-primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W64) = 1090
-primOpTag (VecWriteScalarByteArrayOp FloatVec 16 W32) = 1091
-primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W64) = 1092
-primOpTag (VecIndexScalarOffAddrOp IntVec 16 W8) = 1093
-primOpTag (VecIndexScalarOffAddrOp IntVec 8 W16) = 1094
-primOpTag (VecIndexScalarOffAddrOp IntVec 4 W32) = 1095
-primOpTag (VecIndexScalarOffAddrOp IntVec 2 W64) = 1096
-primOpTag (VecIndexScalarOffAddrOp IntVec 32 W8) = 1097
-primOpTag (VecIndexScalarOffAddrOp IntVec 16 W16) = 1098
-primOpTag (VecIndexScalarOffAddrOp IntVec 8 W32) = 1099
-primOpTag (VecIndexScalarOffAddrOp IntVec 4 W64) = 1100
-primOpTag (VecIndexScalarOffAddrOp IntVec 64 W8) = 1101
-primOpTag (VecIndexScalarOffAddrOp IntVec 32 W16) = 1102
-primOpTag (VecIndexScalarOffAddrOp IntVec 16 W32) = 1103
-primOpTag (VecIndexScalarOffAddrOp IntVec 8 W64) = 1104
-primOpTag (VecIndexScalarOffAddrOp WordVec 16 W8) = 1105
-primOpTag (VecIndexScalarOffAddrOp WordVec 8 W16) = 1106
-primOpTag (VecIndexScalarOffAddrOp WordVec 4 W32) = 1107
-primOpTag (VecIndexScalarOffAddrOp WordVec 2 W64) = 1108
-primOpTag (VecIndexScalarOffAddrOp WordVec 32 W8) = 1109
-primOpTag (VecIndexScalarOffAddrOp WordVec 16 W16) = 1110
-primOpTag (VecIndexScalarOffAddrOp WordVec 8 W32) = 1111
-primOpTag (VecIndexScalarOffAddrOp WordVec 4 W64) = 1112
-primOpTag (VecIndexScalarOffAddrOp WordVec 64 W8) = 1113
-primOpTag (VecIndexScalarOffAddrOp WordVec 32 W16) = 1114
-primOpTag (VecIndexScalarOffAddrOp WordVec 16 W32) = 1115
-primOpTag (VecIndexScalarOffAddrOp WordVec 8 W64) = 1116
-primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W32) = 1117
-primOpTag (VecIndexScalarOffAddrOp FloatVec 2 W64) = 1118
-primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W32) = 1119
-primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W64) = 1120
-primOpTag (VecIndexScalarOffAddrOp FloatVec 16 W32) = 1121
-primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W64) = 1122
-primOpTag (VecReadScalarOffAddrOp IntVec 16 W8) = 1123
-primOpTag (VecReadScalarOffAddrOp IntVec 8 W16) = 1124
-primOpTag (VecReadScalarOffAddrOp IntVec 4 W32) = 1125
-primOpTag (VecReadScalarOffAddrOp IntVec 2 W64) = 1126
-primOpTag (VecReadScalarOffAddrOp IntVec 32 W8) = 1127
-primOpTag (VecReadScalarOffAddrOp IntVec 16 W16) = 1128
-primOpTag (VecReadScalarOffAddrOp IntVec 8 W32) = 1129
-primOpTag (VecReadScalarOffAddrOp IntVec 4 W64) = 1130
-primOpTag (VecReadScalarOffAddrOp IntVec 64 W8) = 1131
-primOpTag (VecReadScalarOffAddrOp IntVec 32 W16) = 1132
-primOpTag (VecReadScalarOffAddrOp IntVec 16 W32) = 1133
-primOpTag (VecReadScalarOffAddrOp IntVec 8 W64) = 1134
-primOpTag (VecReadScalarOffAddrOp WordVec 16 W8) = 1135
-primOpTag (VecReadScalarOffAddrOp WordVec 8 W16) = 1136
-primOpTag (VecReadScalarOffAddrOp WordVec 4 W32) = 1137
-primOpTag (VecReadScalarOffAddrOp WordVec 2 W64) = 1138
-primOpTag (VecReadScalarOffAddrOp WordVec 32 W8) = 1139
-primOpTag (VecReadScalarOffAddrOp WordVec 16 W16) = 1140
-primOpTag (VecReadScalarOffAddrOp WordVec 8 W32) = 1141
-primOpTag (VecReadScalarOffAddrOp WordVec 4 W64) = 1142
-primOpTag (VecReadScalarOffAddrOp WordVec 64 W8) = 1143
-primOpTag (VecReadScalarOffAddrOp WordVec 32 W16) = 1144
-primOpTag (VecReadScalarOffAddrOp WordVec 16 W32) = 1145
-primOpTag (VecReadScalarOffAddrOp WordVec 8 W64) = 1146
-primOpTag (VecReadScalarOffAddrOp FloatVec 4 W32) = 1147
-primOpTag (VecReadScalarOffAddrOp FloatVec 2 W64) = 1148
-primOpTag (VecReadScalarOffAddrOp FloatVec 8 W32) = 1149
-primOpTag (VecReadScalarOffAddrOp FloatVec 4 W64) = 1150
-primOpTag (VecReadScalarOffAddrOp FloatVec 16 W32) = 1151
-primOpTag (VecReadScalarOffAddrOp FloatVec 8 W64) = 1152
-primOpTag (VecWriteScalarOffAddrOp IntVec 16 W8) = 1153
-primOpTag (VecWriteScalarOffAddrOp IntVec 8 W16) = 1154
-primOpTag (VecWriteScalarOffAddrOp IntVec 4 W32) = 1155
-primOpTag (VecWriteScalarOffAddrOp IntVec 2 W64) = 1156
-primOpTag (VecWriteScalarOffAddrOp IntVec 32 W8) = 1157
-primOpTag (VecWriteScalarOffAddrOp IntVec 16 W16) = 1158
-primOpTag (VecWriteScalarOffAddrOp IntVec 8 W32) = 1159
-primOpTag (VecWriteScalarOffAddrOp IntVec 4 W64) = 1160
-primOpTag (VecWriteScalarOffAddrOp IntVec 64 W8) = 1161
-primOpTag (VecWriteScalarOffAddrOp IntVec 32 W16) = 1162
-primOpTag (VecWriteScalarOffAddrOp IntVec 16 W32) = 1163
-primOpTag (VecWriteScalarOffAddrOp IntVec 8 W64) = 1164
-primOpTag (VecWriteScalarOffAddrOp WordVec 16 W8) = 1165
-primOpTag (VecWriteScalarOffAddrOp WordVec 8 W16) = 1166
-primOpTag (VecWriteScalarOffAddrOp WordVec 4 W32) = 1167
-primOpTag (VecWriteScalarOffAddrOp WordVec 2 W64) = 1168
-primOpTag (VecWriteScalarOffAddrOp WordVec 32 W8) = 1169
-primOpTag (VecWriteScalarOffAddrOp WordVec 16 W16) = 1170
-primOpTag (VecWriteScalarOffAddrOp WordVec 8 W32) = 1171
-primOpTag (VecWriteScalarOffAddrOp WordVec 4 W64) = 1172
-primOpTag (VecWriteScalarOffAddrOp WordVec 64 W8) = 1173
-primOpTag (VecWriteScalarOffAddrOp WordVec 32 W16) = 1174
-primOpTag (VecWriteScalarOffAddrOp WordVec 16 W32) = 1175
-primOpTag (VecWriteScalarOffAddrOp WordVec 8 W64) = 1176
-primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W32) = 1177
-primOpTag (VecWriteScalarOffAddrOp FloatVec 2 W64) = 1178
-primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W32) = 1179
-primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W64) = 1180
-primOpTag (VecWriteScalarOffAddrOp FloatVec 16 W32) = 1181
-primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W64) = 1182
-primOpTag PrefetchByteArrayOp3 = 1183
-primOpTag PrefetchMutableByteArrayOp3 = 1184
-primOpTag PrefetchAddrOp3 = 1185
-primOpTag PrefetchValueOp3 = 1186
-primOpTag PrefetchByteArrayOp2 = 1187
-primOpTag PrefetchMutableByteArrayOp2 = 1188
-primOpTag PrefetchAddrOp2 = 1189
-primOpTag PrefetchValueOp2 = 1190
-primOpTag PrefetchByteArrayOp1 = 1191
-primOpTag PrefetchMutableByteArrayOp1 = 1192
-primOpTag PrefetchAddrOp1 = 1193
-primOpTag PrefetchValueOp1 = 1194
-primOpTag PrefetchByteArrayOp0 = 1195
-primOpTag PrefetchMutableByteArrayOp0 = 1196
-primOpTag PrefetchAddrOp0 = 1197
-primOpTag PrefetchValueOp0 = 1198
+maxPrimOpTag = 1202
+primOpTag :: PrimOp -> Int
+primOpTag CharGtOp = 1
+primOpTag CharGeOp = 2
+primOpTag CharEqOp = 3
+primOpTag CharNeOp = 4
+primOpTag CharLtOp = 5
+primOpTag CharLeOp = 6
+primOpTag OrdOp = 7
+primOpTag IntAddOp = 8
+primOpTag IntSubOp = 9
+primOpTag IntMulOp = 10
+primOpTag IntMulMayOfloOp = 11
+primOpTag IntQuotOp = 12
+primOpTag IntRemOp = 13
+primOpTag IntQuotRemOp = 14
+primOpTag AndIOp = 15
+primOpTag OrIOp = 16
+primOpTag XorIOp = 17
+primOpTag NotIOp = 18
+primOpTag IntNegOp = 19
+primOpTag IntAddCOp = 20
+primOpTag IntSubCOp = 21
+primOpTag IntGtOp = 22
+primOpTag IntGeOp = 23
+primOpTag IntEqOp = 24
+primOpTag IntNeOp = 25
+primOpTag IntLtOp = 26
+primOpTag IntLeOp = 27
+primOpTag ChrOp = 28
+primOpTag Int2WordOp = 29
+primOpTag Int2FloatOp = 30
+primOpTag Int2DoubleOp = 31
+primOpTag Word2FloatOp = 32
+primOpTag Word2DoubleOp = 33
+primOpTag ISllOp = 34
+primOpTag ISraOp = 35
+primOpTag ISrlOp = 36
+primOpTag Int8Extend = 37
+primOpTag Int8Narrow = 38
+primOpTag Int8NegOp = 39
+primOpTag Int8AddOp = 40
+primOpTag Int8SubOp = 41
+primOpTag Int8MulOp = 42
+primOpTag Int8QuotOp = 43
+primOpTag Int8RemOp = 44
+primOpTag Int8QuotRemOp = 45
+primOpTag Int8EqOp = 46
+primOpTag Int8GeOp = 47
+primOpTag Int8GtOp = 48
+primOpTag Int8LeOp = 49
+primOpTag Int8LtOp = 50
+primOpTag Int8NeOp = 51
+primOpTag Word8Extend = 52
+primOpTag Word8Narrow = 53
+primOpTag Word8NotOp = 54
+primOpTag Word8AddOp = 55
+primOpTag Word8SubOp = 56
+primOpTag Word8MulOp = 57
+primOpTag Word8QuotOp = 58
+primOpTag Word8RemOp = 59
+primOpTag Word8QuotRemOp = 60
+primOpTag Word8EqOp = 61
+primOpTag Word8GeOp = 62
+primOpTag Word8GtOp = 63
+primOpTag Word8LeOp = 64
+primOpTag Word8LtOp = 65
+primOpTag Word8NeOp = 66
+primOpTag Int16Extend = 67
+primOpTag Int16Narrow = 68
+primOpTag Int16NegOp = 69
+primOpTag Int16AddOp = 70
+primOpTag Int16SubOp = 71
+primOpTag Int16MulOp = 72
+primOpTag Int16QuotOp = 73
+primOpTag Int16RemOp = 74
+primOpTag Int16QuotRemOp = 75
+primOpTag Int16EqOp = 76
+primOpTag Int16GeOp = 77
+primOpTag Int16GtOp = 78
+primOpTag Int16LeOp = 79
+primOpTag Int16LtOp = 80
+primOpTag Int16NeOp = 81
+primOpTag Word16Extend = 82
+primOpTag Word16Narrow = 83
+primOpTag Word16NotOp = 84
+primOpTag Word16AddOp = 85
+primOpTag Word16SubOp = 86
+primOpTag Word16MulOp = 87
+primOpTag Word16QuotOp = 88
+primOpTag Word16RemOp = 89
+primOpTag Word16QuotRemOp = 90
+primOpTag Word16EqOp = 91
+primOpTag Word16GeOp = 92
+primOpTag Word16GtOp = 93
+primOpTag Word16LeOp = 94
+primOpTag Word16LtOp = 95
+primOpTag Word16NeOp = 96
+primOpTag WordAddOp = 97
+primOpTag WordAddCOp = 98
+primOpTag WordSubCOp = 99
+primOpTag WordAdd2Op = 100
+primOpTag WordSubOp = 101
+primOpTag WordMulOp = 102
+primOpTag WordMul2Op = 103
+primOpTag WordQuotOp = 104
+primOpTag WordRemOp = 105
+primOpTag WordQuotRemOp = 106
+primOpTag WordQuotRem2Op = 107
+primOpTag AndOp = 108
+primOpTag OrOp = 109
+primOpTag XorOp = 110
+primOpTag NotOp = 111
+primOpTag SllOp = 112
+primOpTag SrlOp = 113
+primOpTag Word2IntOp = 114
+primOpTag WordGtOp = 115
+primOpTag WordGeOp = 116
+primOpTag WordEqOp = 117
+primOpTag WordNeOp = 118
+primOpTag WordLtOp = 119
+primOpTag WordLeOp = 120
+primOpTag PopCnt8Op = 121
+primOpTag PopCnt16Op = 122
+primOpTag PopCnt32Op = 123
+primOpTag PopCnt64Op = 124
+primOpTag PopCntOp = 125
+primOpTag Pdep8Op = 126
+primOpTag Pdep16Op = 127
+primOpTag Pdep32Op = 128
+primOpTag Pdep64Op = 129
+primOpTag PdepOp = 130
+primOpTag Pext8Op = 131
+primOpTag Pext16Op = 132
+primOpTag Pext32Op = 133
+primOpTag Pext64Op = 134
+primOpTag PextOp = 135
+primOpTag Clz8Op = 136
+primOpTag Clz16Op = 137
+primOpTag Clz32Op = 138
+primOpTag Clz64Op = 139
+primOpTag ClzOp = 140
+primOpTag Ctz8Op = 141
+primOpTag Ctz16Op = 142
+primOpTag Ctz32Op = 143
+primOpTag Ctz64Op = 144
+primOpTag CtzOp = 145
+primOpTag BSwap16Op = 146
+primOpTag BSwap32Op = 147
+primOpTag BSwap64Op = 148
+primOpTag BSwapOp = 149
+primOpTag BRev8Op = 150
+primOpTag BRev16Op = 151
+primOpTag BRev32Op = 152
+primOpTag BRev64Op = 153
+primOpTag BRevOp = 154
+primOpTag Narrow8IntOp = 155
+primOpTag Narrow16IntOp = 156
+primOpTag Narrow32IntOp = 157
+primOpTag Narrow8WordOp = 158
+primOpTag Narrow16WordOp = 159
+primOpTag Narrow32WordOp = 160
+primOpTag DoubleGtOp = 161
+primOpTag DoubleGeOp = 162
+primOpTag DoubleEqOp = 163
+primOpTag DoubleNeOp = 164
+primOpTag DoubleLtOp = 165
+primOpTag DoubleLeOp = 166
+primOpTag DoubleAddOp = 167
+primOpTag DoubleSubOp = 168
+primOpTag DoubleMulOp = 169
+primOpTag DoubleDivOp = 170
+primOpTag DoubleNegOp = 171
+primOpTag DoubleFabsOp = 172
+primOpTag Double2IntOp = 173
+primOpTag Double2FloatOp = 174
+primOpTag DoubleExpOp = 175
+primOpTag DoubleExpM1Op = 176
+primOpTag DoubleLogOp = 177
+primOpTag DoubleLog1POp = 178
+primOpTag DoubleSqrtOp = 179
+primOpTag DoubleSinOp = 180
+primOpTag DoubleCosOp = 181
+primOpTag DoubleTanOp = 182
+primOpTag DoubleAsinOp = 183
+primOpTag DoubleAcosOp = 184
+primOpTag DoubleAtanOp = 185
+primOpTag DoubleSinhOp = 186
+primOpTag DoubleCoshOp = 187
+primOpTag DoubleTanhOp = 188
+primOpTag DoubleAsinhOp = 189
+primOpTag DoubleAcoshOp = 190
+primOpTag DoubleAtanhOp = 191
+primOpTag DoublePowerOp = 192
+primOpTag DoubleDecode_2IntOp = 193
+primOpTag DoubleDecode_Int64Op = 194
+primOpTag FloatGtOp = 195
+primOpTag FloatGeOp = 196
+primOpTag FloatEqOp = 197
+primOpTag FloatNeOp = 198
+primOpTag FloatLtOp = 199
+primOpTag FloatLeOp = 200
+primOpTag FloatAddOp = 201
+primOpTag FloatSubOp = 202
+primOpTag FloatMulOp = 203
+primOpTag FloatDivOp = 204
+primOpTag FloatNegOp = 205
+primOpTag FloatFabsOp = 206
+primOpTag Float2IntOp = 207
+primOpTag FloatExpOp = 208
+primOpTag FloatExpM1Op = 209
+primOpTag FloatLogOp = 210
+primOpTag FloatLog1POp = 211
+primOpTag FloatSqrtOp = 212
+primOpTag FloatSinOp = 213
+primOpTag FloatCosOp = 214
+primOpTag FloatTanOp = 215
+primOpTag FloatAsinOp = 216
+primOpTag FloatAcosOp = 217
+primOpTag FloatAtanOp = 218
+primOpTag FloatSinhOp = 219
+primOpTag FloatCoshOp = 220
+primOpTag FloatTanhOp = 221
+primOpTag FloatAsinhOp = 222
+primOpTag FloatAcoshOp = 223
+primOpTag FloatAtanhOp = 224
+primOpTag FloatPowerOp = 225
+primOpTag Float2DoubleOp = 226
+primOpTag FloatDecode_IntOp = 227
+primOpTag NewArrayOp = 228
+primOpTag SameMutableArrayOp = 229
+primOpTag ReadArrayOp = 230
+primOpTag WriteArrayOp = 231
+primOpTag SizeofArrayOp = 232
+primOpTag SizeofMutableArrayOp = 233
+primOpTag IndexArrayOp = 234
+primOpTag UnsafeFreezeArrayOp = 235
+primOpTag UnsafeThawArrayOp = 236
+primOpTag CopyArrayOp = 237
+primOpTag CopyMutableArrayOp = 238
+primOpTag CloneArrayOp = 239
+primOpTag CloneMutableArrayOp = 240
+primOpTag FreezeArrayOp = 241
+primOpTag ThawArrayOp = 242
+primOpTag CasArrayOp = 243
+primOpTag NewSmallArrayOp = 244
+primOpTag SameSmallMutableArrayOp = 245
+primOpTag ReadSmallArrayOp = 246
+primOpTag WriteSmallArrayOp = 247
+primOpTag SizeofSmallArrayOp = 248
+primOpTag SizeofSmallMutableArrayOp = 249
+primOpTag IndexSmallArrayOp = 250
+primOpTag UnsafeFreezeSmallArrayOp = 251
+primOpTag UnsafeThawSmallArrayOp = 252
+primOpTag CopySmallArrayOp = 253
+primOpTag CopySmallMutableArrayOp = 254
+primOpTag CloneSmallArrayOp = 255
+primOpTag CloneSmallMutableArrayOp = 256
+primOpTag FreezeSmallArrayOp = 257
+primOpTag ThawSmallArrayOp = 258
+primOpTag CasSmallArrayOp = 259
+primOpTag NewByteArrayOp_Char = 260
+primOpTag NewPinnedByteArrayOp_Char = 261
+primOpTag NewAlignedPinnedByteArrayOp_Char = 262
+primOpTag MutableByteArrayIsPinnedOp = 263
+primOpTag ByteArrayIsPinnedOp = 264
+primOpTag ByteArrayContents_Char = 265
+primOpTag SameMutableByteArrayOp = 266
+primOpTag ShrinkMutableByteArrayOp_Char = 267
+primOpTag ResizeMutableByteArrayOp_Char = 268
+primOpTag UnsafeFreezeByteArrayOp = 269
+primOpTag SizeofByteArrayOp = 270
+primOpTag SizeofMutableByteArrayOp = 271
+primOpTag GetSizeofMutableByteArrayOp = 272
+primOpTag IndexByteArrayOp_Char = 273
+primOpTag IndexByteArrayOp_WideChar = 274
+primOpTag IndexByteArrayOp_Int = 275
+primOpTag IndexByteArrayOp_Word = 276
+primOpTag IndexByteArrayOp_Addr = 277
+primOpTag IndexByteArrayOp_Float = 278
+primOpTag IndexByteArrayOp_Double = 279
+primOpTag IndexByteArrayOp_StablePtr = 280
+primOpTag IndexByteArrayOp_Int8 = 281
+primOpTag IndexByteArrayOp_Int16 = 282
+primOpTag IndexByteArrayOp_Int32 = 283
+primOpTag IndexByteArrayOp_Int64 = 284
+primOpTag IndexByteArrayOp_Word8 = 285
+primOpTag IndexByteArrayOp_Word16 = 286
+primOpTag IndexByteArrayOp_Word32 = 287
+primOpTag IndexByteArrayOp_Word64 = 288
+primOpTag IndexByteArrayOp_Word8AsChar = 289
+primOpTag IndexByteArrayOp_Word8AsWideChar = 290
+primOpTag IndexByteArrayOp_Word8AsAddr = 291
+primOpTag IndexByteArrayOp_Word8AsFloat = 292
+primOpTag IndexByteArrayOp_Word8AsDouble = 293
+primOpTag IndexByteArrayOp_Word8AsStablePtr = 294
+primOpTag IndexByteArrayOp_Word8AsInt16 = 295
+primOpTag IndexByteArrayOp_Word8AsInt32 = 296
+primOpTag IndexByteArrayOp_Word8AsInt64 = 297
+primOpTag IndexByteArrayOp_Word8AsInt = 298
+primOpTag IndexByteArrayOp_Word8AsWord16 = 299
+primOpTag IndexByteArrayOp_Word8AsWord32 = 300
+primOpTag IndexByteArrayOp_Word8AsWord64 = 301
+primOpTag IndexByteArrayOp_Word8AsWord = 302
+primOpTag ReadByteArrayOp_Char = 303
+primOpTag ReadByteArrayOp_WideChar = 304
+primOpTag ReadByteArrayOp_Int = 305
+primOpTag ReadByteArrayOp_Word = 306
+primOpTag ReadByteArrayOp_Addr = 307
+primOpTag ReadByteArrayOp_Float = 308
+primOpTag ReadByteArrayOp_Double = 309
+primOpTag ReadByteArrayOp_StablePtr = 310
+primOpTag ReadByteArrayOp_Int8 = 311
+primOpTag ReadByteArrayOp_Int16 = 312
+primOpTag ReadByteArrayOp_Int32 = 313
+primOpTag ReadByteArrayOp_Int64 = 314
+primOpTag ReadByteArrayOp_Word8 = 315
+primOpTag ReadByteArrayOp_Word16 = 316
+primOpTag ReadByteArrayOp_Word32 = 317
+primOpTag ReadByteArrayOp_Word64 = 318
+primOpTag ReadByteArrayOp_Word8AsChar = 319
+primOpTag ReadByteArrayOp_Word8AsWideChar = 320
+primOpTag ReadByteArrayOp_Word8AsAddr = 321
+primOpTag ReadByteArrayOp_Word8AsFloat = 322
+primOpTag ReadByteArrayOp_Word8AsDouble = 323
+primOpTag ReadByteArrayOp_Word8AsStablePtr = 324
+primOpTag ReadByteArrayOp_Word8AsInt16 = 325
+primOpTag ReadByteArrayOp_Word8AsInt32 = 326
+primOpTag ReadByteArrayOp_Word8AsInt64 = 327
+primOpTag ReadByteArrayOp_Word8AsInt = 328
+primOpTag ReadByteArrayOp_Word8AsWord16 = 329
+primOpTag ReadByteArrayOp_Word8AsWord32 = 330
+primOpTag ReadByteArrayOp_Word8AsWord64 = 331
+primOpTag ReadByteArrayOp_Word8AsWord = 332
+primOpTag WriteByteArrayOp_Char = 333
+primOpTag WriteByteArrayOp_WideChar = 334
+primOpTag WriteByteArrayOp_Int = 335
+primOpTag WriteByteArrayOp_Word = 336
+primOpTag WriteByteArrayOp_Addr = 337
+primOpTag WriteByteArrayOp_Float = 338
+primOpTag WriteByteArrayOp_Double = 339
+primOpTag WriteByteArrayOp_StablePtr = 340
+primOpTag WriteByteArrayOp_Int8 = 341
+primOpTag WriteByteArrayOp_Int16 = 342
+primOpTag WriteByteArrayOp_Int32 = 343
+primOpTag WriteByteArrayOp_Int64 = 344
+primOpTag WriteByteArrayOp_Word8 = 345
+primOpTag WriteByteArrayOp_Word16 = 346
+primOpTag WriteByteArrayOp_Word32 = 347
+primOpTag WriteByteArrayOp_Word64 = 348
+primOpTag WriteByteArrayOp_Word8AsChar = 349
+primOpTag WriteByteArrayOp_Word8AsWideChar = 350
+primOpTag WriteByteArrayOp_Word8AsAddr = 351
+primOpTag WriteByteArrayOp_Word8AsFloat = 352
+primOpTag WriteByteArrayOp_Word8AsDouble = 353
+primOpTag WriteByteArrayOp_Word8AsStablePtr = 354
+primOpTag WriteByteArrayOp_Word8AsInt16 = 355
+primOpTag WriteByteArrayOp_Word8AsInt32 = 356
+primOpTag WriteByteArrayOp_Word8AsInt64 = 357
+primOpTag WriteByteArrayOp_Word8AsInt = 358
+primOpTag WriteByteArrayOp_Word8AsWord16 = 359
+primOpTag WriteByteArrayOp_Word8AsWord32 = 360
+primOpTag WriteByteArrayOp_Word8AsWord64 = 361
+primOpTag WriteByteArrayOp_Word8AsWord = 362
+primOpTag CompareByteArraysOp = 363
+primOpTag CopyByteArrayOp = 364
+primOpTag CopyMutableByteArrayOp = 365
+primOpTag CopyByteArrayToAddrOp = 366
+primOpTag CopyMutableByteArrayToAddrOp = 367
+primOpTag CopyAddrToByteArrayOp = 368
+primOpTag SetByteArrayOp = 369
+primOpTag AtomicReadByteArrayOp_Int = 370
+primOpTag AtomicWriteByteArrayOp_Int = 371
+primOpTag CasByteArrayOp_Int = 372
+primOpTag FetchAddByteArrayOp_Int = 373
+primOpTag FetchSubByteArrayOp_Int = 374
+primOpTag FetchAndByteArrayOp_Int = 375
+primOpTag FetchNandByteArrayOp_Int = 376
+primOpTag FetchOrByteArrayOp_Int = 377
+primOpTag FetchXorByteArrayOp_Int = 378
+primOpTag NewArrayArrayOp = 379
+primOpTag SameMutableArrayArrayOp = 380
+primOpTag UnsafeFreezeArrayArrayOp = 381
+primOpTag SizeofArrayArrayOp = 382
+primOpTag SizeofMutableArrayArrayOp = 383
+primOpTag IndexArrayArrayOp_ByteArray = 384
+primOpTag IndexArrayArrayOp_ArrayArray = 385
+primOpTag ReadArrayArrayOp_ByteArray = 386
+primOpTag ReadArrayArrayOp_MutableByteArray = 387
+primOpTag ReadArrayArrayOp_ArrayArray = 388
+primOpTag ReadArrayArrayOp_MutableArrayArray = 389
+primOpTag WriteArrayArrayOp_ByteArray = 390
+primOpTag WriteArrayArrayOp_MutableByteArray = 391
+primOpTag WriteArrayArrayOp_ArrayArray = 392
+primOpTag WriteArrayArrayOp_MutableArrayArray = 393
+primOpTag CopyArrayArrayOp = 394
+primOpTag CopyMutableArrayArrayOp = 395
+primOpTag AddrAddOp = 396
+primOpTag AddrSubOp = 397
+primOpTag AddrRemOp = 398
+primOpTag Addr2IntOp = 399
+primOpTag Int2AddrOp = 400
+primOpTag AddrGtOp = 401
+primOpTag AddrGeOp = 402
+primOpTag AddrEqOp = 403
+primOpTag AddrNeOp = 404
+primOpTag AddrLtOp = 405
+primOpTag AddrLeOp = 406
+primOpTag IndexOffAddrOp_Char = 407
+primOpTag IndexOffAddrOp_WideChar = 408
+primOpTag IndexOffAddrOp_Int = 409
+primOpTag IndexOffAddrOp_Word = 410
+primOpTag IndexOffAddrOp_Addr = 411
+primOpTag IndexOffAddrOp_Float = 412
+primOpTag IndexOffAddrOp_Double = 413
+primOpTag IndexOffAddrOp_StablePtr = 414
+primOpTag IndexOffAddrOp_Int8 = 415
+primOpTag IndexOffAddrOp_Int16 = 416
+primOpTag IndexOffAddrOp_Int32 = 417
+primOpTag IndexOffAddrOp_Int64 = 418
+primOpTag IndexOffAddrOp_Word8 = 419
+primOpTag IndexOffAddrOp_Word16 = 420
+primOpTag IndexOffAddrOp_Word32 = 421
+primOpTag IndexOffAddrOp_Word64 = 422
+primOpTag ReadOffAddrOp_Char = 423
+primOpTag ReadOffAddrOp_WideChar = 424
+primOpTag ReadOffAddrOp_Int = 425
+primOpTag ReadOffAddrOp_Word = 426
+primOpTag ReadOffAddrOp_Addr = 427
+primOpTag ReadOffAddrOp_Float = 428
+primOpTag ReadOffAddrOp_Double = 429
+primOpTag ReadOffAddrOp_StablePtr = 430
+primOpTag ReadOffAddrOp_Int8 = 431
+primOpTag ReadOffAddrOp_Int16 = 432
+primOpTag ReadOffAddrOp_Int32 = 433
+primOpTag ReadOffAddrOp_Int64 = 434
+primOpTag ReadOffAddrOp_Word8 = 435
+primOpTag ReadOffAddrOp_Word16 = 436
+primOpTag ReadOffAddrOp_Word32 = 437
+primOpTag ReadOffAddrOp_Word64 = 438
+primOpTag WriteOffAddrOp_Char = 439
+primOpTag WriteOffAddrOp_WideChar = 440
+primOpTag WriteOffAddrOp_Int = 441
+primOpTag WriteOffAddrOp_Word = 442
+primOpTag WriteOffAddrOp_Addr = 443
+primOpTag WriteOffAddrOp_Float = 444
+primOpTag WriteOffAddrOp_Double = 445
+primOpTag WriteOffAddrOp_StablePtr = 446
+primOpTag WriteOffAddrOp_Int8 = 447
+primOpTag WriteOffAddrOp_Int16 = 448
+primOpTag WriteOffAddrOp_Int32 = 449
+primOpTag WriteOffAddrOp_Int64 = 450
+primOpTag WriteOffAddrOp_Word8 = 451
+primOpTag WriteOffAddrOp_Word16 = 452
+primOpTag WriteOffAddrOp_Word32 = 453
+primOpTag WriteOffAddrOp_Word64 = 454
+primOpTag NewMutVarOp = 455
+primOpTag ReadMutVarOp = 456
+primOpTag WriteMutVarOp = 457
+primOpTag SameMutVarOp = 458
+primOpTag AtomicModifyMutVar2Op = 459
+primOpTag AtomicModifyMutVar_Op = 460
+primOpTag CasMutVarOp = 461
+primOpTag CatchOp = 462
+primOpTag RaiseOp = 463
+primOpTag RaiseIOOp = 464
+primOpTag MaskAsyncExceptionsOp = 465
+primOpTag MaskUninterruptibleOp = 466
+primOpTag UnmaskAsyncExceptionsOp = 467
+primOpTag MaskStatus = 468
+primOpTag AtomicallyOp = 469
+primOpTag RetryOp = 470
+primOpTag CatchRetryOp = 471
+primOpTag CatchSTMOp = 472
+primOpTag NewTVarOp = 473
+primOpTag ReadTVarOp = 474
+primOpTag ReadTVarIOOp = 475
+primOpTag WriteTVarOp = 476
+primOpTag SameTVarOp = 477
+primOpTag NewMVarOp = 478
+primOpTag TakeMVarOp = 479
+primOpTag TryTakeMVarOp = 480
+primOpTag PutMVarOp = 481
+primOpTag TryPutMVarOp = 482
+primOpTag ReadMVarOp = 483
+primOpTag TryReadMVarOp = 484
+primOpTag SameMVarOp = 485
+primOpTag IsEmptyMVarOp = 486
+primOpTag DelayOp = 487
+primOpTag WaitReadOp = 488
+primOpTag WaitWriteOp = 489
+primOpTag ForkOp = 490
+primOpTag ForkOnOp = 491
+primOpTag KillThreadOp = 492
+primOpTag YieldOp = 493
+primOpTag MyThreadIdOp = 494
+primOpTag LabelThreadOp = 495
+primOpTag IsCurrentThreadBoundOp = 496
+primOpTag NoDuplicateOp = 497
+primOpTag ThreadStatusOp = 498
+primOpTag MkWeakOp = 499
+primOpTag MkWeakNoFinalizerOp = 500
+primOpTag AddCFinalizerToWeakOp = 501
+primOpTag DeRefWeakOp = 502
+primOpTag FinalizeWeakOp = 503
+primOpTag TouchOp = 504
+primOpTag MakeStablePtrOp = 505
+primOpTag DeRefStablePtrOp = 506
+primOpTag EqStablePtrOp = 507
+primOpTag MakeStableNameOp = 508
+primOpTag EqStableNameOp = 509
+primOpTag StableNameToIntOp = 510
+primOpTag CompactNewOp = 511
+primOpTag CompactResizeOp = 512
+primOpTag CompactContainsOp = 513
+primOpTag CompactContainsAnyOp = 514
+primOpTag CompactGetFirstBlockOp = 515
+primOpTag CompactGetNextBlockOp = 516
+primOpTag CompactAllocateBlockOp = 517
+primOpTag CompactFixupPointersOp = 518
+primOpTag CompactAdd = 519
+primOpTag CompactAddWithSharing = 520
+primOpTag CompactSize = 521
+primOpTag ReallyUnsafePtrEqualityOp = 522
+primOpTag ParOp = 523
+primOpTag SparkOp = 524
+primOpTag SeqOp = 525
+primOpTag GetSparkOp = 526
+primOpTag NumSparks = 527
+primOpTag DataToTagOp = 528
+primOpTag TagToEnumOp = 529
+primOpTag AddrToAnyOp = 530
+primOpTag AnyToAddrOp = 531
+primOpTag MkApUpd0_Op = 532
+primOpTag NewBCOOp = 533
+primOpTag UnpackClosureOp = 534
+primOpTag ClosureSizeOp = 535
+primOpTag GetApStackValOp = 536
+primOpTag GetCCSOfOp = 537
+primOpTag GetCurrentCCSOp = 538
+primOpTag ClearCCSOp = 539
+primOpTag TraceEventOp = 540
+primOpTag TraceEventBinaryOp = 541
+primOpTag TraceMarkerOp = 542
+primOpTag GetThreadAllocationCounter = 543
+primOpTag SetThreadAllocationCounter = 544
+primOpTag (VecBroadcastOp IntVec 16 W8) = 545
+primOpTag (VecBroadcastOp IntVec 8 W16) = 546
+primOpTag (VecBroadcastOp IntVec 4 W32) = 547
+primOpTag (VecBroadcastOp IntVec 2 W64) = 548
+primOpTag (VecBroadcastOp IntVec 32 W8) = 549
+primOpTag (VecBroadcastOp IntVec 16 W16) = 550
+primOpTag (VecBroadcastOp IntVec 8 W32) = 551
+primOpTag (VecBroadcastOp IntVec 4 W64) = 552
+primOpTag (VecBroadcastOp IntVec 64 W8) = 553
+primOpTag (VecBroadcastOp IntVec 32 W16) = 554
+primOpTag (VecBroadcastOp IntVec 16 W32) = 555
+primOpTag (VecBroadcastOp IntVec 8 W64) = 556
+primOpTag (VecBroadcastOp WordVec 16 W8) = 557
+primOpTag (VecBroadcastOp WordVec 8 W16) = 558
+primOpTag (VecBroadcastOp WordVec 4 W32) = 559
+primOpTag (VecBroadcastOp WordVec 2 W64) = 560
+primOpTag (VecBroadcastOp WordVec 32 W8) = 561
+primOpTag (VecBroadcastOp WordVec 16 W16) = 562
+primOpTag (VecBroadcastOp WordVec 8 W32) = 563
+primOpTag (VecBroadcastOp WordVec 4 W64) = 564
+primOpTag (VecBroadcastOp WordVec 64 W8) = 565
+primOpTag (VecBroadcastOp WordVec 32 W16) = 566
+primOpTag (VecBroadcastOp WordVec 16 W32) = 567
+primOpTag (VecBroadcastOp WordVec 8 W64) = 568
+primOpTag (VecBroadcastOp FloatVec 4 W32) = 569
+primOpTag (VecBroadcastOp FloatVec 2 W64) = 570
+primOpTag (VecBroadcastOp FloatVec 8 W32) = 571
+primOpTag (VecBroadcastOp FloatVec 4 W64) = 572
+primOpTag (VecBroadcastOp FloatVec 16 W32) = 573
+primOpTag (VecBroadcastOp FloatVec 8 W64) = 574
+primOpTag (VecPackOp IntVec 16 W8) = 575
+primOpTag (VecPackOp IntVec 8 W16) = 576
+primOpTag (VecPackOp IntVec 4 W32) = 577
+primOpTag (VecPackOp IntVec 2 W64) = 578
+primOpTag (VecPackOp IntVec 32 W8) = 579
+primOpTag (VecPackOp IntVec 16 W16) = 580
+primOpTag (VecPackOp IntVec 8 W32) = 581
+primOpTag (VecPackOp IntVec 4 W64) = 582
+primOpTag (VecPackOp IntVec 64 W8) = 583
+primOpTag (VecPackOp IntVec 32 W16) = 584
+primOpTag (VecPackOp IntVec 16 W32) = 585
+primOpTag (VecPackOp IntVec 8 W64) = 586
+primOpTag (VecPackOp WordVec 16 W8) = 587
+primOpTag (VecPackOp WordVec 8 W16) = 588
+primOpTag (VecPackOp WordVec 4 W32) = 589
+primOpTag (VecPackOp WordVec 2 W64) = 590
+primOpTag (VecPackOp WordVec 32 W8) = 591
+primOpTag (VecPackOp WordVec 16 W16) = 592
+primOpTag (VecPackOp WordVec 8 W32) = 593
+primOpTag (VecPackOp WordVec 4 W64) = 594
+primOpTag (VecPackOp WordVec 64 W8) = 595
+primOpTag (VecPackOp WordVec 32 W16) = 596
+primOpTag (VecPackOp WordVec 16 W32) = 597
+primOpTag (VecPackOp WordVec 8 W64) = 598
+primOpTag (VecPackOp FloatVec 4 W32) = 599
+primOpTag (VecPackOp FloatVec 2 W64) = 600
+primOpTag (VecPackOp FloatVec 8 W32) = 601
+primOpTag (VecPackOp FloatVec 4 W64) = 602
+primOpTag (VecPackOp FloatVec 16 W32) = 603
+primOpTag (VecPackOp FloatVec 8 W64) = 604
+primOpTag (VecUnpackOp IntVec 16 W8) = 605
+primOpTag (VecUnpackOp IntVec 8 W16) = 606
+primOpTag (VecUnpackOp IntVec 4 W32) = 607
+primOpTag (VecUnpackOp IntVec 2 W64) = 608
+primOpTag (VecUnpackOp IntVec 32 W8) = 609
+primOpTag (VecUnpackOp IntVec 16 W16) = 610
+primOpTag (VecUnpackOp IntVec 8 W32) = 611
+primOpTag (VecUnpackOp IntVec 4 W64) = 612
+primOpTag (VecUnpackOp IntVec 64 W8) = 613
+primOpTag (VecUnpackOp IntVec 32 W16) = 614
+primOpTag (VecUnpackOp IntVec 16 W32) = 615
+primOpTag (VecUnpackOp IntVec 8 W64) = 616
+primOpTag (VecUnpackOp WordVec 16 W8) = 617
+primOpTag (VecUnpackOp WordVec 8 W16) = 618
+primOpTag (VecUnpackOp WordVec 4 W32) = 619
+primOpTag (VecUnpackOp WordVec 2 W64) = 620
+primOpTag (VecUnpackOp WordVec 32 W8) = 621
+primOpTag (VecUnpackOp WordVec 16 W16) = 622
+primOpTag (VecUnpackOp WordVec 8 W32) = 623
+primOpTag (VecUnpackOp WordVec 4 W64) = 624
+primOpTag (VecUnpackOp WordVec 64 W8) = 625
+primOpTag (VecUnpackOp WordVec 32 W16) = 626
+primOpTag (VecUnpackOp WordVec 16 W32) = 627
+primOpTag (VecUnpackOp WordVec 8 W64) = 628
+primOpTag (VecUnpackOp FloatVec 4 W32) = 629
+primOpTag (VecUnpackOp FloatVec 2 W64) = 630
+primOpTag (VecUnpackOp FloatVec 8 W32) = 631
+primOpTag (VecUnpackOp FloatVec 4 W64) = 632
+primOpTag (VecUnpackOp FloatVec 16 W32) = 633
+primOpTag (VecUnpackOp FloatVec 8 W64) = 634
+primOpTag (VecInsertOp IntVec 16 W8) = 635
+primOpTag (VecInsertOp IntVec 8 W16) = 636
+primOpTag (VecInsertOp IntVec 4 W32) = 637
+primOpTag (VecInsertOp IntVec 2 W64) = 638
+primOpTag (VecInsertOp IntVec 32 W8) = 639
+primOpTag (VecInsertOp IntVec 16 W16) = 640
+primOpTag (VecInsertOp IntVec 8 W32) = 641
+primOpTag (VecInsertOp IntVec 4 W64) = 642
+primOpTag (VecInsertOp IntVec 64 W8) = 643
+primOpTag (VecInsertOp IntVec 32 W16) = 644
+primOpTag (VecInsertOp IntVec 16 W32) = 645
+primOpTag (VecInsertOp IntVec 8 W64) = 646
+primOpTag (VecInsertOp WordVec 16 W8) = 647
+primOpTag (VecInsertOp WordVec 8 W16) = 648
+primOpTag (VecInsertOp WordVec 4 W32) = 649
+primOpTag (VecInsertOp WordVec 2 W64) = 650
+primOpTag (VecInsertOp WordVec 32 W8) = 651
+primOpTag (VecInsertOp WordVec 16 W16) = 652
+primOpTag (VecInsertOp WordVec 8 W32) = 653
+primOpTag (VecInsertOp WordVec 4 W64) = 654
+primOpTag (VecInsertOp WordVec 64 W8) = 655
+primOpTag (VecInsertOp WordVec 32 W16) = 656
+primOpTag (VecInsertOp WordVec 16 W32) = 657
+primOpTag (VecInsertOp WordVec 8 W64) = 658
+primOpTag (VecInsertOp FloatVec 4 W32) = 659
+primOpTag (VecInsertOp FloatVec 2 W64) = 660
+primOpTag (VecInsertOp FloatVec 8 W32) = 661
+primOpTag (VecInsertOp FloatVec 4 W64) = 662
+primOpTag (VecInsertOp FloatVec 16 W32) = 663
+primOpTag (VecInsertOp FloatVec 8 W64) = 664
+primOpTag (VecAddOp IntVec 16 W8) = 665
+primOpTag (VecAddOp IntVec 8 W16) = 666
+primOpTag (VecAddOp IntVec 4 W32) = 667
+primOpTag (VecAddOp IntVec 2 W64) = 668
+primOpTag (VecAddOp IntVec 32 W8) = 669
+primOpTag (VecAddOp IntVec 16 W16) = 670
+primOpTag (VecAddOp IntVec 8 W32) = 671
+primOpTag (VecAddOp IntVec 4 W64) = 672
+primOpTag (VecAddOp IntVec 64 W8) = 673
+primOpTag (VecAddOp IntVec 32 W16) = 674
+primOpTag (VecAddOp IntVec 16 W32) = 675
+primOpTag (VecAddOp IntVec 8 W64) = 676
+primOpTag (VecAddOp WordVec 16 W8) = 677
+primOpTag (VecAddOp WordVec 8 W16) = 678
+primOpTag (VecAddOp WordVec 4 W32) = 679
+primOpTag (VecAddOp WordVec 2 W64) = 680
+primOpTag (VecAddOp WordVec 32 W8) = 681
+primOpTag (VecAddOp WordVec 16 W16) = 682
+primOpTag (VecAddOp WordVec 8 W32) = 683
+primOpTag (VecAddOp WordVec 4 W64) = 684
+primOpTag (VecAddOp WordVec 64 W8) = 685
+primOpTag (VecAddOp WordVec 32 W16) = 686
+primOpTag (VecAddOp WordVec 16 W32) = 687
+primOpTag (VecAddOp WordVec 8 W64) = 688
+primOpTag (VecAddOp FloatVec 4 W32) = 689
+primOpTag (VecAddOp FloatVec 2 W64) = 690
+primOpTag (VecAddOp FloatVec 8 W32) = 691
+primOpTag (VecAddOp FloatVec 4 W64) = 692
+primOpTag (VecAddOp FloatVec 16 W32) = 693
+primOpTag (VecAddOp FloatVec 8 W64) = 694
+primOpTag (VecSubOp IntVec 16 W8) = 695
+primOpTag (VecSubOp IntVec 8 W16) = 696
+primOpTag (VecSubOp IntVec 4 W32) = 697
+primOpTag (VecSubOp IntVec 2 W64) = 698
+primOpTag (VecSubOp IntVec 32 W8) = 699
+primOpTag (VecSubOp IntVec 16 W16) = 700
+primOpTag (VecSubOp IntVec 8 W32) = 701
+primOpTag (VecSubOp IntVec 4 W64) = 702
+primOpTag (VecSubOp IntVec 64 W8) = 703
+primOpTag (VecSubOp IntVec 32 W16) = 704
+primOpTag (VecSubOp IntVec 16 W32) = 705
+primOpTag (VecSubOp IntVec 8 W64) = 706
+primOpTag (VecSubOp WordVec 16 W8) = 707
+primOpTag (VecSubOp WordVec 8 W16) = 708
+primOpTag (VecSubOp WordVec 4 W32) = 709
+primOpTag (VecSubOp WordVec 2 W64) = 710
+primOpTag (VecSubOp WordVec 32 W8) = 711
+primOpTag (VecSubOp WordVec 16 W16) = 712
+primOpTag (VecSubOp WordVec 8 W32) = 713
+primOpTag (VecSubOp WordVec 4 W64) = 714
+primOpTag (VecSubOp WordVec 64 W8) = 715
+primOpTag (VecSubOp WordVec 32 W16) = 716
+primOpTag (VecSubOp WordVec 16 W32) = 717
+primOpTag (VecSubOp WordVec 8 W64) = 718
+primOpTag (VecSubOp FloatVec 4 W32) = 719
+primOpTag (VecSubOp FloatVec 2 W64) = 720
+primOpTag (VecSubOp FloatVec 8 W32) = 721
+primOpTag (VecSubOp FloatVec 4 W64) = 722
+primOpTag (VecSubOp FloatVec 16 W32) = 723
+primOpTag (VecSubOp FloatVec 8 W64) = 724
+primOpTag (VecMulOp IntVec 16 W8) = 725
+primOpTag (VecMulOp IntVec 8 W16) = 726
+primOpTag (VecMulOp IntVec 4 W32) = 727
+primOpTag (VecMulOp IntVec 2 W64) = 728
+primOpTag (VecMulOp IntVec 32 W8) = 729
+primOpTag (VecMulOp IntVec 16 W16) = 730
+primOpTag (VecMulOp IntVec 8 W32) = 731
+primOpTag (VecMulOp IntVec 4 W64) = 732
+primOpTag (VecMulOp IntVec 64 W8) = 733
+primOpTag (VecMulOp IntVec 32 W16) = 734
+primOpTag (VecMulOp IntVec 16 W32) = 735
+primOpTag (VecMulOp IntVec 8 W64) = 736
+primOpTag (VecMulOp WordVec 16 W8) = 737
+primOpTag (VecMulOp WordVec 8 W16) = 738
+primOpTag (VecMulOp WordVec 4 W32) = 739
+primOpTag (VecMulOp WordVec 2 W64) = 740
+primOpTag (VecMulOp WordVec 32 W8) = 741
+primOpTag (VecMulOp WordVec 16 W16) = 742
+primOpTag (VecMulOp WordVec 8 W32) = 743
+primOpTag (VecMulOp WordVec 4 W64) = 744
+primOpTag (VecMulOp WordVec 64 W8) = 745
+primOpTag (VecMulOp WordVec 32 W16) = 746
+primOpTag (VecMulOp WordVec 16 W32) = 747
+primOpTag (VecMulOp WordVec 8 W64) = 748
+primOpTag (VecMulOp FloatVec 4 W32) = 749
+primOpTag (VecMulOp FloatVec 2 W64) = 750
+primOpTag (VecMulOp FloatVec 8 W32) = 751
+primOpTag (VecMulOp FloatVec 4 W64) = 752
+primOpTag (VecMulOp FloatVec 16 W32) = 753
+primOpTag (VecMulOp FloatVec 8 W64) = 754
+primOpTag (VecDivOp FloatVec 4 W32) = 755
+primOpTag (VecDivOp FloatVec 2 W64) = 756
+primOpTag (VecDivOp FloatVec 8 W32) = 757
+primOpTag (VecDivOp FloatVec 4 W64) = 758
+primOpTag (VecDivOp FloatVec 16 W32) = 759
+primOpTag (VecDivOp FloatVec 8 W64) = 760
+primOpTag (VecQuotOp IntVec 16 W8) = 761
+primOpTag (VecQuotOp IntVec 8 W16) = 762
+primOpTag (VecQuotOp IntVec 4 W32) = 763
+primOpTag (VecQuotOp IntVec 2 W64) = 764
+primOpTag (VecQuotOp IntVec 32 W8) = 765
+primOpTag (VecQuotOp IntVec 16 W16) = 766
+primOpTag (VecQuotOp IntVec 8 W32) = 767
+primOpTag (VecQuotOp IntVec 4 W64) = 768
+primOpTag (VecQuotOp IntVec 64 W8) = 769
+primOpTag (VecQuotOp IntVec 32 W16) = 770
+primOpTag (VecQuotOp IntVec 16 W32) = 771
+primOpTag (VecQuotOp IntVec 8 W64) = 772
+primOpTag (VecQuotOp WordVec 16 W8) = 773
+primOpTag (VecQuotOp WordVec 8 W16) = 774
+primOpTag (VecQuotOp WordVec 4 W32) = 775
+primOpTag (VecQuotOp WordVec 2 W64) = 776
+primOpTag (VecQuotOp WordVec 32 W8) = 777
+primOpTag (VecQuotOp WordVec 16 W16) = 778
+primOpTag (VecQuotOp WordVec 8 W32) = 779
+primOpTag (VecQuotOp WordVec 4 W64) = 780
+primOpTag (VecQuotOp WordVec 64 W8) = 781
+primOpTag (VecQuotOp WordVec 32 W16) = 782
+primOpTag (VecQuotOp WordVec 16 W32) = 783
+primOpTag (VecQuotOp WordVec 8 W64) = 784
+primOpTag (VecRemOp IntVec 16 W8) = 785
+primOpTag (VecRemOp IntVec 8 W16) = 786
+primOpTag (VecRemOp IntVec 4 W32) = 787
+primOpTag (VecRemOp IntVec 2 W64) = 788
+primOpTag (VecRemOp IntVec 32 W8) = 789
+primOpTag (VecRemOp IntVec 16 W16) = 790
+primOpTag (VecRemOp IntVec 8 W32) = 791
+primOpTag (VecRemOp IntVec 4 W64) = 792
+primOpTag (VecRemOp IntVec 64 W8) = 793
+primOpTag (VecRemOp IntVec 32 W16) = 794
+primOpTag (VecRemOp IntVec 16 W32) = 795
+primOpTag (VecRemOp IntVec 8 W64) = 796
+primOpTag (VecRemOp WordVec 16 W8) = 797
+primOpTag (VecRemOp WordVec 8 W16) = 798
+primOpTag (VecRemOp WordVec 4 W32) = 799
+primOpTag (VecRemOp WordVec 2 W64) = 800
+primOpTag (VecRemOp WordVec 32 W8) = 801
+primOpTag (VecRemOp WordVec 16 W16) = 802
+primOpTag (VecRemOp WordVec 8 W32) = 803
+primOpTag (VecRemOp WordVec 4 W64) = 804
+primOpTag (VecRemOp WordVec 64 W8) = 805
+primOpTag (VecRemOp WordVec 32 W16) = 806
+primOpTag (VecRemOp WordVec 16 W32) = 807
+primOpTag (VecRemOp WordVec 8 W64) = 808
+primOpTag (VecNegOp IntVec 16 W8) = 809
+primOpTag (VecNegOp IntVec 8 W16) = 810
+primOpTag (VecNegOp IntVec 4 W32) = 811
+primOpTag (VecNegOp IntVec 2 W64) = 812
+primOpTag (VecNegOp IntVec 32 W8) = 813
+primOpTag (VecNegOp IntVec 16 W16) = 814
+primOpTag (VecNegOp IntVec 8 W32) = 815
+primOpTag (VecNegOp IntVec 4 W64) = 816
+primOpTag (VecNegOp IntVec 64 W8) = 817
+primOpTag (VecNegOp IntVec 32 W16) = 818
+primOpTag (VecNegOp IntVec 16 W32) = 819
+primOpTag (VecNegOp IntVec 8 W64) = 820
+primOpTag (VecNegOp FloatVec 4 W32) = 821
+primOpTag (VecNegOp FloatVec 2 W64) = 822
+primOpTag (VecNegOp FloatVec 8 W32) = 823
+primOpTag (VecNegOp FloatVec 4 W64) = 824
+primOpTag (VecNegOp FloatVec 16 W32) = 825
+primOpTag (VecNegOp FloatVec 8 W64) = 826
+primOpTag (VecIndexByteArrayOp IntVec 16 W8) = 827
+primOpTag (VecIndexByteArrayOp IntVec 8 W16) = 828
+primOpTag (VecIndexByteArrayOp IntVec 4 W32) = 829
+primOpTag (VecIndexByteArrayOp IntVec 2 W64) = 830
+primOpTag (VecIndexByteArrayOp IntVec 32 W8) = 831
+primOpTag (VecIndexByteArrayOp IntVec 16 W16) = 832
+primOpTag (VecIndexByteArrayOp IntVec 8 W32) = 833
+primOpTag (VecIndexByteArrayOp IntVec 4 W64) = 834
+primOpTag (VecIndexByteArrayOp IntVec 64 W8) = 835
+primOpTag (VecIndexByteArrayOp IntVec 32 W16) = 836
+primOpTag (VecIndexByteArrayOp IntVec 16 W32) = 837
+primOpTag (VecIndexByteArrayOp IntVec 8 W64) = 838
+primOpTag (VecIndexByteArrayOp WordVec 16 W8) = 839
+primOpTag (VecIndexByteArrayOp WordVec 8 W16) = 840
+primOpTag (VecIndexByteArrayOp WordVec 4 W32) = 841
+primOpTag (VecIndexByteArrayOp WordVec 2 W64) = 842
+primOpTag (VecIndexByteArrayOp WordVec 32 W8) = 843
+primOpTag (VecIndexByteArrayOp WordVec 16 W16) = 844
+primOpTag (VecIndexByteArrayOp WordVec 8 W32) = 845
+primOpTag (VecIndexByteArrayOp WordVec 4 W64) = 846
+primOpTag (VecIndexByteArrayOp WordVec 64 W8) = 847
+primOpTag (VecIndexByteArrayOp WordVec 32 W16) = 848
+primOpTag (VecIndexByteArrayOp WordVec 16 W32) = 849
+primOpTag (VecIndexByteArrayOp WordVec 8 W64) = 850
+primOpTag (VecIndexByteArrayOp FloatVec 4 W32) = 851
+primOpTag (VecIndexByteArrayOp FloatVec 2 W64) = 852
+primOpTag (VecIndexByteArrayOp FloatVec 8 W32) = 853
+primOpTag (VecIndexByteArrayOp FloatVec 4 W64) = 854
+primOpTag (VecIndexByteArrayOp FloatVec 16 W32) = 855
+primOpTag (VecIndexByteArrayOp FloatVec 8 W64) = 856
+primOpTag (VecReadByteArrayOp IntVec 16 W8) = 857
+primOpTag (VecReadByteArrayOp IntVec 8 W16) = 858
+primOpTag (VecReadByteArrayOp IntVec 4 W32) = 859
+primOpTag (VecReadByteArrayOp IntVec 2 W64) = 860
+primOpTag (VecReadByteArrayOp IntVec 32 W8) = 861
+primOpTag (VecReadByteArrayOp IntVec 16 W16) = 862
+primOpTag (VecReadByteArrayOp IntVec 8 W32) = 863
+primOpTag (VecReadByteArrayOp IntVec 4 W64) = 864
+primOpTag (VecReadByteArrayOp IntVec 64 W8) = 865
+primOpTag (VecReadByteArrayOp IntVec 32 W16) = 866
+primOpTag (VecReadByteArrayOp IntVec 16 W32) = 867
+primOpTag (VecReadByteArrayOp IntVec 8 W64) = 868
+primOpTag (VecReadByteArrayOp WordVec 16 W8) = 869
+primOpTag (VecReadByteArrayOp WordVec 8 W16) = 870
+primOpTag (VecReadByteArrayOp WordVec 4 W32) = 871
+primOpTag (VecReadByteArrayOp WordVec 2 W64) = 872
+primOpTag (VecReadByteArrayOp WordVec 32 W8) = 873
+primOpTag (VecReadByteArrayOp WordVec 16 W16) = 874
+primOpTag (VecReadByteArrayOp WordVec 8 W32) = 875
+primOpTag (VecReadByteArrayOp WordVec 4 W64) = 876
+primOpTag (VecReadByteArrayOp WordVec 64 W8) = 877
+primOpTag (VecReadByteArrayOp WordVec 32 W16) = 878
+primOpTag (VecReadByteArrayOp WordVec 16 W32) = 879
+primOpTag (VecReadByteArrayOp WordVec 8 W64) = 880
+primOpTag (VecReadByteArrayOp FloatVec 4 W32) = 881
+primOpTag (VecReadByteArrayOp FloatVec 2 W64) = 882
+primOpTag (VecReadByteArrayOp FloatVec 8 W32) = 883
+primOpTag (VecReadByteArrayOp FloatVec 4 W64) = 884
+primOpTag (VecReadByteArrayOp FloatVec 16 W32) = 885
+primOpTag (VecReadByteArrayOp FloatVec 8 W64) = 886
+primOpTag (VecWriteByteArrayOp IntVec 16 W8) = 887
+primOpTag (VecWriteByteArrayOp IntVec 8 W16) = 888
+primOpTag (VecWriteByteArrayOp IntVec 4 W32) = 889
+primOpTag (VecWriteByteArrayOp IntVec 2 W64) = 890
+primOpTag (VecWriteByteArrayOp IntVec 32 W8) = 891
+primOpTag (VecWriteByteArrayOp IntVec 16 W16) = 892
+primOpTag (VecWriteByteArrayOp IntVec 8 W32) = 893
+primOpTag (VecWriteByteArrayOp IntVec 4 W64) = 894
+primOpTag (VecWriteByteArrayOp IntVec 64 W8) = 895
+primOpTag (VecWriteByteArrayOp IntVec 32 W16) = 896
+primOpTag (VecWriteByteArrayOp IntVec 16 W32) = 897
+primOpTag (VecWriteByteArrayOp IntVec 8 W64) = 898
+primOpTag (VecWriteByteArrayOp WordVec 16 W8) = 899
+primOpTag (VecWriteByteArrayOp WordVec 8 W16) = 900
+primOpTag (VecWriteByteArrayOp WordVec 4 W32) = 901
+primOpTag (VecWriteByteArrayOp WordVec 2 W64) = 902
+primOpTag (VecWriteByteArrayOp WordVec 32 W8) = 903
+primOpTag (VecWriteByteArrayOp WordVec 16 W16) = 904
+primOpTag (VecWriteByteArrayOp WordVec 8 W32) = 905
+primOpTag (VecWriteByteArrayOp WordVec 4 W64) = 906
+primOpTag (VecWriteByteArrayOp WordVec 64 W8) = 907
+primOpTag (VecWriteByteArrayOp WordVec 32 W16) = 908
+primOpTag (VecWriteByteArrayOp WordVec 16 W32) = 909
+primOpTag (VecWriteByteArrayOp WordVec 8 W64) = 910
+primOpTag (VecWriteByteArrayOp FloatVec 4 W32) = 911
+primOpTag (VecWriteByteArrayOp FloatVec 2 W64) = 912
+primOpTag (VecWriteByteArrayOp FloatVec 8 W32) = 913
+primOpTag (VecWriteByteArrayOp FloatVec 4 W64) = 914
+primOpTag (VecWriteByteArrayOp FloatVec 16 W32) = 915
+primOpTag (VecWriteByteArrayOp FloatVec 8 W64) = 916
+primOpTag (VecIndexOffAddrOp IntVec 16 W8) = 917
+primOpTag (VecIndexOffAddrOp IntVec 8 W16) = 918
+primOpTag (VecIndexOffAddrOp IntVec 4 W32) = 919
+primOpTag (VecIndexOffAddrOp IntVec 2 W64) = 920
+primOpTag (VecIndexOffAddrOp IntVec 32 W8) = 921
+primOpTag (VecIndexOffAddrOp IntVec 16 W16) = 922
+primOpTag (VecIndexOffAddrOp IntVec 8 W32) = 923
+primOpTag (VecIndexOffAddrOp IntVec 4 W64) = 924
+primOpTag (VecIndexOffAddrOp IntVec 64 W8) = 925
+primOpTag (VecIndexOffAddrOp IntVec 32 W16) = 926
+primOpTag (VecIndexOffAddrOp IntVec 16 W32) = 927
+primOpTag (VecIndexOffAddrOp IntVec 8 W64) = 928
+primOpTag (VecIndexOffAddrOp WordVec 16 W8) = 929
+primOpTag (VecIndexOffAddrOp WordVec 8 W16) = 930
+primOpTag (VecIndexOffAddrOp WordVec 4 W32) = 931
+primOpTag (VecIndexOffAddrOp WordVec 2 W64) = 932
+primOpTag (VecIndexOffAddrOp WordVec 32 W8) = 933
+primOpTag (VecIndexOffAddrOp WordVec 16 W16) = 934
+primOpTag (VecIndexOffAddrOp WordVec 8 W32) = 935
+primOpTag (VecIndexOffAddrOp WordVec 4 W64) = 936
+primOpTag (VecIndexOffAddrOp WordVec 64 W8) = 937
+primOpTag (VecIndexOffAddrOp WordVec 32 W16) = 938
+primOpTag (VecIndexOffAddrOp WordVec 16 W32) = 939
+primOpTag (VecIndexOffAddrOp WordVec 8 W64) = 940
+primOpTag (VecIndexOffAddrOp FloatVec 4 W32) = 941
+primOpTag (VecIndexOffAddrOp FloatVec 2 W64) = 942
+primOpTag (VecIndexOffAddrOp FloatVec 8 W32) = 943
+primOpTag (VecIndexOffAddrOp FloatVec 4 W64) = 944
+primOpTag (VecIndexOffAddrOp FloatVec 16 W32) = 945
+primOpTag (VecIndexOffAddrOp FloatVec 8 W64) = 946
+primOpTag (VecReadOffAddrOp IntVec 16 W8) = 947
+primOpTag (VecReadOffAddrOp IntVec 8 W16) = 948
+primOpTag (VecReadOffAddrOp IntVec 4 W32) = 949
+primOpTag (VecReadOffAddrOp IntVec 2 W64) = 950
+primOpTag (VecReadOffAddrOp IntVec 32 W8) = 951
+primOpTag (VecReadOffAddrOp IntVec 16 W16) = 952
+primOpTag (VecReadOffAddrOp IntVec 8 W32) = 953
+primOpTag (VecReadOffAddrOp IntVec 4 W64) = 954
+primOpTag (VecReadOffAddrOp IntVec 64 W8) = 955
+primOpTag (VecReadOffAddrOp IntVec 32 W16) = 956
+primOpTag (VecReadOffAddrOp IntVec 16 W32) = 957
+primOpTag (VecReadOffAddrOp IntVec 8 W64) = 958
+primOpTag (VecReadOffAddrOp WordVec 16 W8) = 959
+primOpTag (VecReadOffAddrOp WordVec 8 W16) = 960
+primOpTag (VecReadOffAddrOp WordVec 4 W32) = 961
+primOpTag (VecReadOffAddrOp WordVec 2 W64) = 962
+primOpTag (VecReadOffAddrOp WordVec 32 W8) = 963
+primOpTag (VecReadOffAddrOp WordVec 16 W16) = 964
+primOpTag (VecReadOffAddrOp WordVec 8 W32) = 965
+primOpTag (VecReadOffAddrOp WordVec 4 W64) = 966
+primOpTag (VecReadOffAddrOp WordVec 64 W8) = 967
+primOpTag (VecReadOffAddrOp WordVec 32 W16) = 968
+primOpTag (VecReadOffAddrOp WordVec 16 W32) = 969
+primOpTag (VecReadOffAddrOp WordVec 8 W64) = 970
+primOpTag (VecReadOffAddrOp FloatVec 4 W32) = 971
+primOpTag (VecReadOffAddrOp FloatVec 2 W64) = 972
+primOpTag (VecReadOffAddrOp FloatVec 8 W32) = 973
+primOpTag (VecReadOffAddrOp FloatVec 4 W64) = 974
+primOpTag (VecReadOffAddrOp FloatVec 16 W32) = 975
+primOpTag (VecReadOffAddrOp FloatVec 8 W64) = 976
+primOpTag (VecWriteOffAddrOp IntVec 16 W8) = 977
+primOpTag (VecWriteOffAddrOp IntVec 8 W16) = 978
+primOpTag (VecWriteOffAddrOp IntVec 4 W32) = 979
+primOpTag (VecWriteOffAddrOp IntVec 2 W64) = 980
+primOpTag (VecWriteOffAddrOp IntVec 32 W8) = 981
+primOpTag (VecWriteOffAddrOp IntVec 16 W16) = 982
+primOpTag (VecWriteOffAddrOp IntVec 8 W32) = 983
+primOpTag (VecWriteOffAddrOp IntVec 4 W64) = 984
+primOpTag (VecWriteOffAddrOp IntVec 64 W8) = 985
+primOpTag (VecWriteOffAddrOp IntVec 32 W16) = 986
+primOpTag (VecWriteOffAddrOp IntVec 16 W32) = 987
+primOpTag (VecWriteOffAddrOp IntVec 8 W64) = 988
+primOpTag (VecWriteOffAddrOp WordVec 16 W8) = 989
+primOpTag (VecWriteOffAddrOp WordVec 8 W16) = 990
+primOpTag (VecWriteOffAddrOp WordVec 4 W32) = 991
+primOpTag (VecWriteOffAddrOp WordVec 2 W64) = 992
+primOpTag (VecWriteOffAddrOp WordVec 32 W8) = 993
+primOpTag (VecWriteOffAddrOp WordVec 16 W16) = 994
+primOpTag (VecWriteOffAddrOp WordVec 8 W32) = 995
+primOpTag (VecWriteOffAddrOp WordVec 4 W64) = 996
+primOpTag (VecWriteOffAddrOp WordVec 64 W8) = 997
+primOpTag (VecWriteOffAddrOp WordVec 32 W16) = 998
+primOpTag (VecWriteOffAddrOp WordVec 16 W32) = 999
+primOpTag (VecWriteOffAddrOp WordVec 8 W64) = 1000
+primOpTag (VecWriteOffAddrOp FloatVec 4 W32) = 1001
+primOpTag (VecWriteOffAddrOp FloatVec 2 W64) = 1002
+primOpTag (VecWriteOffAddrOp FloatVec 8 W32) = 1003
+primOpTag (VecWriteOffAddrOp FloatVec 4 W64) = 1004
+primOpTag (VecWriteOffAddrOp FloatVec 16 W32) = 1005
+primOpTag (VecWriteOffAddrOp FloatVec 8 W64) = 1006
+primOpTag (VecIndexScalarByteArrayOp IntVec 16 W8) = 1007
+primOpTag (VecIndexScalarByteArrayOp IntVec 8 W16) = 1008
+primOpTag (VecIndexScalarByteArrayOp IntVec 4 W32) = 1009
+primOpTag (VecIndexScalarByteArrayOp IntVec 2 W64) = 1010
+primOpTag (VecIndexScalarByteArrayOp IntVec 32 W8) = 1011
+primOpTag (VecIndexScalarByteArrayOp IntVec 16 W16) = 1012
+primOpTag (VecIndexScalarByteArrayOp IntVec 8 W32) = 1013
+primOpTag (VecIndexScalarByteArrayOp IntVec 4 W64) = 1014
+primOpTag (VecIndexScalarByteArrayOp IntVec 64 W8) = 1015
+primOpTag (VecIndexScalarByteArrayOp IntVec 32 W16) = 1016
+primOpTag (VecIndexScalarByteArrayOp IntVec 16 W32) = 1017
+primOpTag (VecIndexScalarByteArrayOp IntVec 8 W64) = 1018
+primOpTag (VecIndexScalarByteArrayOp WordVec 16 W8) = 1019
+primOpTag (VecIndexScalarByteArrayOp WordVec 8 W16) = 1020
+primOpTag (VecIndexScalarByteArrayOp WordVec 4 W32) = 1021
+primOpTag (VecIndexScalarByteArrayOp WordVec 2 W64) = 1022
+primOpTag (VecIndexScalarByteArrayOp WordVec 32 W8) = 1023
+primOpTag (VecIndexScalarByteArrayOp WordVec 16 W16) = 1024
+primOpTag (VecIndexScalarByteArrayOp WordVec 8 W32) = 1025
+primOpTag (VecIndexScalarByteArrayOp WordVec 4 W64) = 1026
+primOpTag (VecIndexScalarByteArrayOp WordVec 64 W8) = 1027
+primOpTag (VecIndexScalarByteArrayOp WordVec 32 W16) = 1028
+primOpTag (VecIndexScalarByteArrayOp WordVec 16 W32) = 1029
+primOpTag (VecIndexScalarByteArrayOp WordVec 8 W64) = 1030
+primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W32) = 1031
+primOpTag (VecIndexScalarByteArrayOp FloatVec 2 W64) = 1032
+primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W32) = 1033
+primOpTag (VecIndexScalarByteArrayOp FloatVec 4 W64) = 1034
+primOpTag (VecIndexScalarByteArrayOp FloatVec 16 W32) = 1035
+primOpTag (VecIndexScalarByteArrayOp FloatVec 8 W64) = 1036
+primOpTag (VecReadScalarByteArrayOp IntVec 16 W8) = 1037
+primOpTag (VecReadScalarByteArrayOp IntVec 8 W16) = 1038
+primOpTag (VecReadScalarByteArrayOp IntVec 4 W32) = 1039
+primOpTag (VecReadScalarByteArrayOp IntVec 2 W64) = 1040
+primOpTag (VecReadScalarByteArrayOp IntVec 32 W8) = 1041
+primOpTag (VecReadScalarByteArrayOp IntVec 16 W16) = 1042
+primOpTag (VecReadScalarByteArrayOp IntVec 8 W32) = 1043
+primOpTag (VecReadScalarByteArrayOp IntVec 4 W64) = 1044
+primOpTag (VecReadScalarByteArrayOp IntVec 64 W8) = 1045
+primOpTag (VecReadScalarByteArrayOp IntVec 32 W16) = 1046
+primOpTag (VecReadScalarByteArrayOp IntVec 16 W32) = 1047
+primOpTag (VecReadScalarByteArrayOp IntVec 8 W64) = 1048
+primOpTag (VecReadScalarByteArrayOp WordVec 16 W8) = 1049
+primOpTag (VecReadScalarByteArrayOp WordVec 8 W16) = 1050
+primOpTag (VecReadScalarByteArrayOp WordVec 4 W32) = 1051
+primOpTag (VecReadScalarByteArrayOp WordVec 2 W64) = 1052
+primOpTag (VecReadScalarByteArrayOp WordVec 32 W8) = 1053
+primOpTag (VecReadScalarByteArrayOp WordVec 16 W16) = 1054
+primOpTag (VecReadScalarByteArrayOp WordVec 8 W32) = 1055
+primOpTag (VecReadScalarByteArrayOp WordVec 4 W64) = 1056
+primOpTag (VecReadScalarByteArrayOp WordVec 64 W8) = 1057
+primOpTag (VecReadScalarByteArrayOp WordVec 32 W16) = 1058
+primOpTag (VecReadScalarByteArrayOp WordVec 16 W32) = 1059
+primOpTag (VecReadScalarByteArrayOp WordVec 8 W64) = 1060
+primOpTag (VecReadScalarByteArrayOp FloatVec 4 W32) = 1061
+primOpTag (VecReadScalarByteArrayOp FloatVec 2 W64) = 1062
+primOpTag (VecReadScalarByteArrayOp FloatVec 8 W32) = 1063
+primOpTag (VecReadScalarByteArrayOp FloatVec 4 W64) = 1064
+primOpTag (VecReadScalarByteArrayOp FloatVec 16 W32) = 1065
+primOpTag (VecReadScalarByteArrayOp FloatVec 8 W64) = 1066
+primOpTag (VecWriteScalarByteArrayOp IntVec 16 W8) = 1067
+primOpTag (VecWriteScalarByteArrayOp IntVec 8 W16) = 1068
+primOpTag (VecWriteScalarByteArrayOp IntVec 4 W32) = 1069
+primOpTag (VecWriteScalarByteArrayOp IntVec 2 W64) = 1070
+primOpTag (VecWriteScalarByteArrayOp IntVec 32 W8) = 1071
+primOpTag (VecWriteScalarByteArrayOp IntVec 16 W16) = 1072
+primOpTag (VecWriteScalarByteArrayOp IntVec 8 W32) = 1073
+primOpTag (VecWriteScalarByteArrayOp IntVec 4 W64) = 1074
+primOpTag (VecWriteScalarByteArrayOp IntVec 64 W8) = 1075
+primOpTag (VecWriteScalarByteArrayOp IntVec 32 W16) = 1076
+primOpTag (VecWriteScalarByteArrayOp IntVec 16 W32) = 1077
+primOpTag (VecWriteScalarByteArrayOp IntVec 8 W64) = 1078
+primOpTag (VecWriteScalarByteArrayOp WordVec 16 W8) = 1079
+primOpTag (VecWriteScalarByteArrayOp WordVec 8 W16) = 1080
+primOpTag (VecWriteScalarByteArrayOp WordVec 4 W32) = 1081
+primOpTag (VecWriteScalarByteArrayOp WordVec 2 W64) = 1082
+primOpTag (VecWriteScalarByteArrayOp WordVec 32 W8) = 1083
+primOpTag (VecWriteScalarByteArrayOp WordVec 16 W16) = 1084
+primOpTag (VecWriteScalarByteArrayOp WordVec 8 W32) = 1085
+primOpTag (VecWriteScalarByteArrayOp WordVec 4 W64) = 1086
+primOpTag (VecWriteScalarByteArrayOp WordVec 64 W8) = 1087
+primOpTag (VecWriteScalarByteArrayOp WordVec 32 W16) = 1088
+primOpTag (VecWriteScalarByteArrayOp WordVec 16 W32) = 1089
+primOpTag (VecWriteScalarByteArrayOp WordVec 8 W64) = 1090
+primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W32) = 1091
+primOpTag (VecWriteScalarByteArrayOp FloatVec 2 W64) = 1092
+primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W32) = 1093
+primOpTag (VecWriteScalarByteArrayOp FloatVec 4 W64) = 1094
+primOpTag (VecWriteScalarByteArrayOp FloatVec 16 W32) = 1095
+primOpTag (VecWriteScalarByteArrayOp FloatVec 8 W64) = 1096
+primOpTag (VecIndexScalarOffAddrOp IntVec 16 W8) = 1097
+primOpTag (VecIndexScalarOffAddrOp IntVec 8 W16) = 1098
+primOpTag (VecIndexScalarOffAddrOp IntVec 4 W32) = 1099
+primOpTag (VecIndexScalarOffAddrOp IntVec 2 W64) = 1100
+primOpTag (VecIndexScalarOffAddrOp IntVec 32 W8) = 1101
+primOpTag (VecIndexScalarOffAddrOp IntVec 16 W16) = 1102
+primOpTag (VecIndexScalarOffAddrOp IntVec 8 W32) = 1103
+primOpTag (VecIndexScalarOffAddrOp IntVec 4 W64) = 1104
+primOpTag (VecIndexScalarOffAddrOp IntVec 64 W8) = 1105
+primOpTag (VecIndexScalarOffAddrOp IntVec 32 W16) = 1106
+primOpTag (VecIndexScalarOffAddrOp IntVec 16 W32) = 1107
+primOpTag (VecIndexScalarOffAddrOp IntVec 8 W64) = 1108
+primOpTag (VecIndexScalarOffAddrOp WordVec 16 W8) = 1109
+primOpTag (VecIndexScalarOffAddrOp WordVec 8 W16) = 1110
+primOpTag (VecIndexScalarOffAddrOp WordVec 4 W32) = 1111
+primOpTag (VecIndexScalarOffAddrOp WordVec 2 W64) = 1112
+primOpTag (VecIndexScalarOffAddrOp WordVec 32 W8) = 1113
+primOpTag (VecIndexScalarOffAddrOp WordVec 16 W16) = 1114
+primOpTag (VecIndexScalarOffAddrOp WordVec 8 W32) = 1115
+primOpTag (VecIndexScalarOffAddrOp WordVec 4 W64) = 1116
+primOpTag (VecIndexScalarOffAddrOp WordVec 64 W8) = 1117
+primOpTag (VecIndexScalarOffAddrOp WordVec 32 W16) = 1118
+primOpTag (VecIndexScalarOffAddrOp WordVec 16 W32) = 1119
+primOpTag (VecIndexScalarOffAddrOp WordVec 8 W64) = 1120
+primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W32) = 1121
+primOpTag (VecIndexScalarOffAddrOp FloatVec 2 W64) = 1122
+primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W32) = 1123
+primOpTag (VecIndexScalarOffAddrOp FloatVec 4 W64) = 1124
+primOpTag (VecIndexScalarOffAddrOp FloatVec 16 W32) = 1125
+primOpTag (VecIndexScalarOffAddrOp FloatVec 8 W64) = 1126
+primOpTag (VecReadScalarOffAddrOp IntVec 16 W8) = 1127
+primOpTag (VecReadScalarOffAddrOp IntVec 8 W16) = 1128
+primOpTag (VecReadScalarOffAddrOp IntVec 4 W32) = 1129
+primOpTag (VecReadScalarOffAddrOp IntVec 2 W64) = 1130
+primOpTag (VecReadScalarOffAddrOp IntVec 32 W8) = 1131
+primOpTag (VecReadScalarOffAddrOp IntVec 16 W16) = 1132
+primOpTag (VecReadScalarOffAddrOp IntVec 8 W32) = 1133
+primOpTag (VecReadScalarOffAddrOp IntVec 4 W64) = 1134
+primOpTag (VecReadScalarOffAddrOp IntVec 64 W8) = 1135
+primOpTag (VecReadScalarOffAddrOp IntVec 32 W16) = 1136
+primOpTag (VecReadScalarOffAddrOp IntVec 16 W32) = 1137
+primOpTag (VecReadScalarOffAddrOp IntVec 8 W64) = 1138
+primOpTag (VecReadScalarOffAddrOp WordVec 16 W8) = 1139
+primOpTag (VecReadScalarOffAddrOp WordVec 8 W16) = 1140
+primOpTag (VecReadScalarOffAddrOp WordVec 4 W32) = 1141
+primOpTag (VecReadScalarOffAddrOp WordVec 2 W64) = 1142
+primOpTag (VecReadScalarOffAddrOp WordVec 32 W8) = 1143
+primOpTag (VecReadScalarOffAddrOp WordVec 16 W16) = 1144
+primOpTag (VecReadScalarOffAddrOp WordVec 8 W32) = 1145
+primOpTag (VecReadScalarOffAddrOp WordVec 4 W64) = 1146
+primOpTag (VecReadScalarOffAddrOp WordVec 64 W8) = 1147
+primOpTag (VecReadScalarOffAddrOp WordVec 32 W16) = 1148
+primOpTag (VecReadScalarOffAddrOp WordVec 16 W32) = 1149
+primOpTag (VecReadScalarOffAddrOp WordVec 8 W64) = 1150
+primOpTag (VecReadScalarOffAddrOp FloatVec 4 W32) = 1151
+primOpTag (VecReadScalarOffAddrOp FloatVec 2 W64) = 1152
+primOpTag (VecReadScalarOffAddrOp FloatVec 8 W32) = 1153
+primOpTag (VecReadScalarOffAddrOp FloatVec 4 W64) = 1154
+primOpTag (VecReadScalarOffAddrOp FloatVec 16 W32) = 1155
+primOpTag (VecReadScalarOffAddrOp FloatVec 8 W64) = 1156
+primOpTag (VecWriteScalarOffAddrOp IntVec 16 W8) = 1157
+primOpTag (VecWriteScalarOffAddrOp IntVec 8 W16) = 1158
+primOpTag (VecWriteScalarOffAddrOp IntVec 4 W32) = 1159
+primOpTag (VecWriteScalarOffAddrOp IntVec 2 W64) = 1160
+primOpTag (VecWriteScalarOffAddrOp IntVec 32 W8) = 1161
+primOpTag (VecWriteScalarOffAddrOp IntVec 16 W16) = 1162
+primOpTag (VecWriteScalarOffAddrOp IntVec 8 W32) = 1163
+primOpTag (VecWriteScalarOffAddrOp IntVec 4 W64) = 1164
+primOpTag (VecWriteScalarOffAddrOp IntVec 64 W8) = 1165
+primOpTag (VecWriteScalarOffAddrOp IntVec 32 W16) = 1166
+primOpTag (VecWriteScalarOffAddrOp IntVec 16 W32) = 1167
+primOpTag (VecWriteScalarOffAddrOp IntVec 8 W64) = 1168
+primOpTag (VecWriteScalarOffAddrOp WordVec 16 W8) = 1169
+primOpTag (VecWriteScalarOffAddrOp WordVec 8 W16) = 1170
+primOpTag (VecWriteScalarOffAddrOp WordVec 4 W32) = 1171
+primOpTag (VecWriteScalarOffAddrOp WordVec 2 W64) = 1172
+primOpTag (VecWriteScalarOffAddrOp WordVec 32 W8) = 1173
+primOpTag (VecWriteScalarOffAddrOp WordVec 16 W16) = 1174
+primOpTag (VecWriteScalarOffAddrOp WordVec 8 W32) = 1175
+primOpTag (VecWriteScalarOffAddrOp WordVec 4 W64) = 1176
+primOpTag (VecWriteScalarOffAddrOp WordVec 64 W8) = 1177
+primOpTag (VecWriteScalarOffAddrOp WordVec 32 W16) = 1178
+primOpTag (VecWriteScalarOffAddrOp WordVec 16 W32) = 1179
+primOpTag (VecWriteScalarOffAddrOp WordVec 8 W64) = 1180
+primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W32) = 1181
+primOpTag (VecWriteScalarOffAddrOp FloatVec 2 W64) = 1182
+primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W32) = 1183
+primOpTag (VecWriteScalarOffAddrOp FloatVec 4 W64) = 1184
+primOpTag (VecWriteScalarOffAddrOp FloatVec 16 W32) = 1185
+primOpTag (VecWriteScalarOffAddrOp FloatVec 8 W64) = 1186
+primOpTag PrefetchByteArrayOp3 = 1187
+primOpTag PrefetchMutableByteArrayOp3 = 1188
+primOpTag PrefetchAddrOp3 = 1189
+primOpTag PrefetchValueOp3 = 1190
+primOpTag PrefetchByteArrayOp2 = 1191
+primOpTag PrefetchMutableByteArrayOp2 = 1192
+primOpTag PrefetchAddrOp2 = 1193
+primOpTag PrefetchValueOp2 = 1194
+primOpTag PrefetchByteArrayOp1 = 1195
+primOpTag PrefetchMutableByteArrayOp1 = 1196
+primOpTag PrefetchAddrOp1 = 1197
+primOpTag PrefetchValueOp1 = 1198
+primOpTag PrefetchByteArrayOp0 = 1199
+primOpTag PrefetchMutableByteArrayOp0 = 1200
+primOpTag PrefetchAddrOp0 = 1201
+primOpTag PrefetchValueOp0 = 1202
diff --git a/ghc-lib/stage1/lib/llvm-targets b/ghc-lib/stage1/lib/llvm-targets
--- a/ghc-lib/stage1/lib/llvm-targets
+++ b/ghc-lib/stage1/lib/llvm-targets
@@ -6,6 +6,8 @@
 ,("armv6l-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
 ,("armv7-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
 ,("armv7a-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
+,("armv7a-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
+,("armv7l-unknown-linux-gnueabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
 ,("armv7l-unknown-linux-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
 ,("aarch64-unknown-linux-gnu", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
 ,("aarch64-unknown-linux", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
@@ -13,19 +15,21 @@
 ,("i386-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
 ,("x86_64-unknown-linux-gnu", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
 ,("x86_64-unknown-linux", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
+,("x86_64-unknown-linux-android", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "+sse4.2 +popcnt"))
 ,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
 ,("aarch64-unknown-linux-android", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
+,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", ""))
 ,("powerpc64le-unknown-linux", ("e-m:e-i64:64-n32:64", "ppc64le", ""))
-,("amd64-portbld-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
-,("x86_64-unknown-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
-,("arm-unknown-nto-qnx-eabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+strict-align"))
 ,("i386-apple-darwin", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
 ,("x86_64-apple-darwin", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
 ,("armv7-apple-ios", ("e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "generic", ""))
 ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
 ,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
 ,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
+,("amd64-portbld-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
+,("x86_64-unknown-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
 ,("aarch64-unknown-freebsd", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
 ,("armv6-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
 ,("armv7-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+strict-align"))
+,("arm-unknown-nto-qnx-eabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+strict-align"))
 ]
diff --git a/ghc-lib/stage1/lib/settings b/ghc-lib/stage1/lib/settings
--- a/ghc-lib/stage1/lib/settings
+++ b/ghc-lib/stage1/lib/settings
@@ -1,9 +1,10 @@
 [("GCC extra via C opts", "-fwrapv -fno-builtin")
-,("C compiler command", "gcc")
+,("C compiler command", "cc")
 ,("C compiler flags", "")
+,("C++ compiler flags", "")
 ,("C compiler link flags", "")
 ,("C compiler supports -no-pie", "NO")
-,("Haskell CPP command", "gcc")
+,("Haskell CPP command", "cc")
 ,("Haskell CPP flags", "-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs")
 ,("ld command", "ld")
 ,("ld flags", "")
diff --git a/includes/Cmm.h b/includes/Cmm.h
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -308,7 +308,9 @@
 #define ENTER_(ret,x)                                   \
  again:                                                 \
   W_ info;                                              \
-  LOAD_INFO(ret,x)                                       \
+  LOAD_INFO(ret,x)                                      \
+  /* See Note [Heap memory barriers] in SMP.h */        \
+  prim_read_barrier;                                    \
   switch [INVALID_OBJECT .. N_CLOSURE_TYPES]            \
          (TO_W_( %INFO_TYPE(%STD_INFO(info)) )) {       \
   case                                                  \
@@ -631,6 +633,14 @@
 #define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */
 #endif
 
+// Memory barriers.
+// For discussion of how these are used to fence heap object
+// accesses see Note [Heap memory barriers] in SMP.h.
+#if defined(THREADED_RTS)
+#define prim_read_barrier prim %read_barrier()
+#else
+#define prim_read_barrier /* nothing */
+#endif
 #if defined(THREADED_RTS)
 #define prim_write_barrier prim %write_barrier()
 #else
diff --git a/includes/CodeGen.Platform.hs b/includes/CodeGen.Platform.hs
--- a/includes/CodeGen.Platform.hs
+++ b/includes/CodeGen.Platform.hs
@@ -495,13 +495,13 @@
     ,DoubleReg 1
 #endif
 #if defined(REG_XMM1)
-    ,XmmReg 1
+    ,XmmReg 1 2 W64 Integer
 #endif
 #if defined(REG_YMM1)
-    ,YmmReg 1
+    ,YmmReg 1 4 W64 Integer
 #endif
 #if defined(REG_ZMM1)
-    ,ZmmReg 1
+    ,ZmmReg 1 8 W64 Integer
 #endif
 #if defined(REG_F2)
     ,FloatReg 2
@@ -510,13 +510,13 @@
     ,DoubleReg 2
 #endif
 #if defined(REG_XMM2)
-    ,XmmReg 2
+    ,XmmReg 2 2 W64 Integer
 #endif
 #if defined(REG_YMM2)
-    ,YmmReg 2
+    ,YmmReg 2 4 W64 Integer
 #endif
 #if defined(REG_ZMM2)
-    ,ZmmReg 2
+    ,ZmmReg 2 8 W64 Integer
 #endif
 #if defined(REG_F3)
     ,FloatReg 3
@@ -525,13 +525,13 @@
     ,DoubleReg 3
 #endif
 #if defined(REG_XMM3)
-    ,XmmReg 3
+    ,XmmReg 3 2 W64 Integer
 #endif
 #if defined(REG_YMM3)
-    ,YmmReg 3
+    ,YmmReg 3 4 W64 Integer
 #endif
 #if defined(REG_ZMM3)
-    ,ZmmReg 3
+    ,ZmmReg 3 8 W64 Integer
 #endif
 #if defined(REG_F4)
     ,FloatReg 4
@@ -540,13 +540,13 @@
     ,DoubleReg 4
 #endif
 #if defined(REG_XMM4)
-    ,XmmReg 4
+    ,XmmReg 4 2 W64 Integer
 #endif
 #if defined(REG_YMM4)
-    ,YmmReg 4
+    ,YmmReg 4 4 W64 Integer
 #endif
 #if defined(REG_ZMM4)
-    ,ZmmReg 4
+    ,ZmmReg 4 8 W64 Integer
 #endif
 #if defined(REG_F5)
     ,FloatReg 5
@@ -555,13 +555,13 @@
     ,DoubleReg 5
 #endif
 #if defined(REG_XMM5)
-    ,XmmReg 5
+    ,XmmReg 5 2 W64 Integer
 #endif
 #if defined(REG_YMM5)
-    ,YmmReg 5
+    ,YmmReg 5 4 W64 Integer
 #endif
 #if defined(REG_ZMM5)
-    ,ZmmReg 5
+    ,ZmmReg 5 8 W64 Integer
 #endif
 #if defined(REG_F6)
     ,FloatReg 6
@@ -570,13 +570,13 @@
     ,DoubleReg 6
 #endif
 #if defined(REG_XMM6)
-    ,XmmReg 6
+    ,XmmReg 6 2 W64 Integer
 #endif
 #if defined(REG_YMM6)
-    ,YmmReg 6
+    ,YmmReg 6 4 W64 Integer
 #endif
 #if defined(REG_ZMM6)
-    ,ZmmReg 6
+    ,ZmmReg 6 8 W64 Integer
 #endif
 #else /* MAX_REAL_XMM_REG == 0 */
 #if defined(REG_F1)
@@ -733,62 +733,62 @@
 # endif
 # if MAX_REAL_XMM_REG != 0
 #  if defined(REG_XMM1)
-globalRegMaybe (XmmReg 1)               = Just (RealRegSingle REG_XMM1)
+globalRegMaybe (XmmReg 1 _ _ _)         = Just (RealRegSingle REG_XMM1)
 #  endif
 #  if defined(REG_XMM2)
-globalRegMaybe (XmmReg 2)               = Just (RealRegSingle REG_XMM2)
+globalRegMaybe (XmmReg 2 _ _ _)         = Just (RealRegSingle REG_XMM2)
 #  endif
 #  if defined(REG_XMM3)
-globalRegMaybe (XmmReg 3)               = Just (RealRegSingle REG_XMM3)
+globalRegMaybe (XmmReg 3 _ _ _)         = Just (RealRegSingle REG_XMM3)
 #  endif
 #  if defined(REG_XMM4)
-globalRegMaybe (XmmReg 4)               = Just (RealRegSingle REG_XMM4)
+globalRegMaybe (XmmReg 4 _ _ _)         = Just (RealRegSingle REG_XMM4)
 #  endif
 #  if defined(REG_XMM5)
-globalRegMaybe (XmmReg 5)               = Just (RealRegSingle REG_XMM5)
+globalRegMaybe (XmmReg 5 _ _ _)         = Just (RealRegSingle REG_XMM5)
 #  endif
 #  if defined(REG_XMM6)
-globalRegMaybe (XmmReg 6)               = Just (RealRegSingle REG_XMM6)
+globalRegMaybe (XmmReg 6 _ _ _)         = Just (RealRegSingle REG_XMM6)
 #  endif
 # endif
 # if defined(MAX_REAL_YMM_REG) && MAX_REAL_YMM_REG != 0
 #  if defined(REG_YMM1)
-globalRegMaybe (YmmReg 1)               = Just (RealRegSingle REG_YMM1)
+globalRegMaybe (YmmReg 1 _ _ _)         = Just (RealRegSingle REG_YMM1)
 #  endif
 #  if defined(REG_YMM2)
-globalRegMaybe (YmmReg 2)               = Just (RealRegSingle REG_YMM2)
+globalRegMaybe (YmmReg 2 _ _ _)         = Just (RealRegSingle REG_YMM2)
 #  endif
 #  if defined(REG_YMM3)
-globalRegMaybe (YmmReg 3)               = Just (RealRegSingle REG_YMM3)
+globalRegMaybe (YmmReg 3 _ _ _)         = Just (RealRegSingle REG_YMM3)
 #  endif
 #  if defined(REG_YMM4)
-globalRegMaybe (YmmReg 4)               = Just (RealRegSingle REG_YMM4)
+globalRegMaybe (YmmReg 4 _ _ _)         = Just (RealRegSingle REG_YMM4)
 #  endif
 #  if defined(REG_YMM5)
-globalRegMaybe (YmmReg 5)               = Just (RealRegSingle REG_YMM5)
+globalRegMaybe (YmmReg 5 _ _ _)         = Just (RealRegSingle REG_YMM5)
 #  endif
 #  if defined(REG_YMM6)
-globalRegMaybe (YmmReg 6)               = Just (RealRegSingle REG_YMM6)
+globalRegMaybe (YmmReg 6 _ _ _)         = Just (RealRegSingle REG_YMM6)
 #  endif
 # endif
 # if defined(MAX_REAL_ZMM_REG) && MAX_REAL_ZMM_REG != 0
 #  if defined(REG_ZMM1)
-globalRegMaybe (ZmmReg 1)               = Just (RealRegSingle REG_ZMM1)
+globalRegMaybe (ZmmReg 1 _ _ _)         = Just (RealRegSingle REG_ZMM1)
 #  endif
 #  if defined(REG_ZMM2)
-globalRegMaybe (ZmmReg 2)               = Just (RealRegSingle REG_ZMM2)
+globalRegMaybe (ZmmReg 2 _ _ _)         = Just (RealRegSingle REG_ZMM2)
 #  endif
 #  if defined(REG_ZMM3)
-globalRegMaybe (ZmmReg 3)               = Just (RealRegSingle REG_ZMM3)
+globalRegMaybe (ZmmReg 3 _ _ _)         = Just (RealRegSingle REG_ZMM3)
 #  endif
 #  if defined(REG_ZMM4)
-globalRegMaybe (ZmmReg 4)               = Just (RealRegSingle REG_ZMM4)
+globalRegMaybe (ZmmReg 4 _ _ _)         = Just (RealRegSingle REG_ZMM4)
 #  endif
 #  if defined(REG_ZMM5)
-globalRegMaybe (ZmmReg 5)               = Just (RealRegSingle REG_ZMM5)
+globalRegMaybe (ZmmReg 5 _ _ _)         = Just (RealRegSingle REG_ZMM5)
 #  endif
 #  if defined(REG_ZMM6)
-globalRegMaybe (ZmmReg 6)               = Just (RealRegSingle REG_ZMM6)
+globalRegMaybe (ZmmReg 6 _ _ _)         = Just (RealRegSingle REG_ZMM6)
 #  endif
 # endif
 # if defined(REG_Sp)
diff --git a/includes/Rts.h b/includes/Rts.h
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -147,6 +147,14 @@
 #define USED_IF_NOT_THREADS
 #endif
 
+#if defined(PROFILING)
+#define USED_IF_PROFILING
+#define USED_IF_NOT_PROFILING STG_UNUSED
+#else
+#define USED_IF_PROFILING STG_UNUSED
+#define USED_IF_NOT_PROFILING
+#endif
+
 #define FMT_SizeT    "zu"
 #define FMT_HexSizeT "zx"
 
diff --git a/includes/rts/Config.h b/includes/rts/Config.h
--- a/includes/rts/Config.h
+++ b/includes/rts/Config.h
@@ -26,11 +26,15 @@
 #define USING_LIBBFD 1
 #endif
 
-/* DEBUG implies TRACING and TICKY_TICKY  */
-#if defined(DEBUG)
+/* DEBUG and PROFILING both imply TRACING */
+#if defined(DEBUG) || defined(PROFILING)
 #if !defined(TRACING)
 #define TRACING
 #endif
+#endif
+
+/* DEBUG implies TICKY_TICKY */
+#if defined(DEBUG)
 #if !defined(TICKY_TICKY)
 #define TICKY_TICKY
 #endif
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -178,6 +178,7 @@
 #define EVENT_HEAP_PROF_SAMPLE_BEGIN       162
 #define EVENT_HEAP_PROF_SAMPLE_COST_CENTRE 163
 #define EVENT_HEAP_PROF_SAMPLE_STRING      164
+#define EVENT_HEAP_PROF_SAMPLE_END         165
 
 #define EVENT_USER_BINARY_MSG              181
 
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -542,8 +542,10 @@
 
 EXTERN_INLINE void overwritingClosure_ (StgClosure *p,
                                         uint32_t offset /* in words */,
-                                        uint32_t size /* closure size, in words */);
-EXTERN_INLINE void overwritingClosure_ (StgClosure *p, uint32_t offset, uint32_t size)
+                                        uint32_t size /* closure size, in words */,
+                                        bool prim /* Whether to call LDV_recordDead */
+                                        );
+EXTERN_INLINE void overwritingClosure_ (StgClosure *p, uint32_t offset, uint32_t size, bool prim USED_IF_PROFILING)
 {
 #if ZERO_SLOP_FOR_LDV_PROF && !ZERO_SLOP_FOR_SANITY_CHECK
     // see Note [zeroing slop], also #8402
@@ -552,7 +554,7 @@
 
     // For LDV profiling, we need to record the closure as dead
 #if defined(PROFILING)
-    LDV_recordDead(p, size);
+    if (!prim) { LDV_recordDead(p, size); };
 #endif
 
     for (uint32_t i = offset; i < size; i++) {
@@ -563,7 +565,7 @@
 EXTERN_INLINE void overwritingClosure (StgClosure *p);
 EXTERN_INLINE void overwritingClosure (StgClosure *p)
 {
-    overwritingClosure_(p, sizeofW(StgThunkHeader), closure_sizeW(p));
+    overwritingClosure_(p, sizeofW(StgThunkHeader), closure_sizeW(p), false);
 }
 
 // Version of 'overwritingClosure' which overwrites only a suffix of a
@@ -576,12 +578,14 @@
 EXTERN_INLINE void overwritingClosureOfs (StgClosure *p, uint32_t offset);
 EXTERN_INLINE void overwritingClosureOfs (StgClosure *p, uint32_t offset)
 {
-    overwritingClosure_(p, offset, closure_sizeW(p));
+    // Set prim = true because only called on ARR_WORDS with the
+    // shrinkMutableByteArray# primop
+    overwritingClosure_(p, offset, closure_sizeW(p), true);
 }
 
 // Version of 'overwritingClosure' which takes closure size as argument.
 EXTERN_INLINE void overwritingClosureSize (StgClosure *p, uint32_t size /* in words */);
 EXTERN_INLINE void overwritingClosureSize (StgClosure *p, uint32_t size)
 {
-    overwritingClosure_(p, sizeofW(StgThunkHeader), size);
+    overwritingClosure_(p, sizeofW(StgThunkHeader), size, false);
 }
diff --git a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
--- a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
+++ b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
@@ -49,6 +49,7 @@
    | AllowAmbiguousTypes
    | UnboxedTuples
    | UnboxedSums
+   | UnliftedNewtypes
    | BangPatterns
    | TypeFamilies
    | TypeFamilyDependencies
diff --git a/libraries/ghc-boot/GHC/BaseDir.hs b/libraries/ghc-boot/GHC/BaseDir.hs
new file mode 100644
--- /dev/null
+++ b/libraries/ghc-boot/GHC/BaseDir.hs
@@ -0,0 +1,77 @@
+{-# LANGUAGE CPP #-}
+
+-- | Note [Base Dir]
+-- ~~~~~~~~~~~~~~~~~
+--
+-- GHC's base directory or top directory containers miscellaneous settings and
+-- the package database.  The main compiler of course needs this directory to
+-- read those settings and read and write packages. ghc-pkg uses it to find the
+-- global package database too.
+--
+-- In the interest of making GHC builds more relocatable, many settings also
+-- will expand `${top_dir}` inside strings so GHC doesn't need to know it's on
+-- installation location at build time. ghc-pkg also can expand those variables
+-- and so needs the top dir location to do that too.
+module GHC.BaseDir where
+
+import Prelude -- See Note [Why do we import Prelude here?]
+
+import Data.List
+import System.FilePath
+
+-- Windows
+#if defined(mingw32_HOST_OS)
+import System.Environment (getExecutablePath)
+-- POSIX
+#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS)
+import System.Environment (getExecutablePath)
+#endif
+
+-- | Expand occurrences of the @$topdir@ interpolation in a string.
+expandTopDir :: FilePath -> String -> String
+expandTopDir = expandPathVar "topdir"
+
+-- | @expandPathVar var value str@
+--
+--   replaces occurences of variable @$var@ with @value@ in str.
+expandPathVar :: String -> FilePath -> String -> String
+expandPathVar var value str
+  | Just str' <- stripPrefix ('$':var) str
+  , null str' || isPathSeparator (head str')
+  = value ++ expandPathVar var value str'
+expandPathVar var value (x:xs) = x : expandPathVar var value xs
+expandPathVar _ _ [] = []
+
+-- | Calculate the location of the base dir
+getBaseDir :: IO (Maybe String)
+#if defined(mingw32_HOST_OS)
+getBaseDir = Just . (\p -> p </> "lib") . rootDir <$> getExecutablePath
+  where
+    -- locate the "base dir" when given the path
+    -- to the real ghc executable (as opposed to symlink)
+    -- that is running this function.
+    rootDir :: FilePath -> FilePath
+    rootDir = takeDirectory . takeDirectory . normalise
+#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS)
+-- on unix, this is a bit more confusing.
+-- The layout right now is something like
+--
+--   /bin/ghc-X.Y.Z <- wrapper script (1)
+--   /bin/ghc       <- symlink to wrapper script (2)
+--   /lib/ghc-X.Y.Z/bin/ghc <- ghc executable (3)
+--   /lib/ghc-X.Y.Z <- $topdir (4)
+--
+-- As such, we first need to find the absolute location to the
+-- binary.
+--
+-- getExecutablePath will return (3). One takeDirectory will
+-- give use /lib/ghc-X.Y.Z/bin, and another will give us (4).
+--
+-- This of course only works due to the current layout. If
+-- the layout is changed, such that we have ghc-X.Y.Z/{bin,lib}
+-- this would need to be changed accordingly.
+--
+getBaseDir = Just . (\p -> p </> "lib") . takeDirectory . takeDirectory <$> getExecutablePath
+#else
+getBaseDir = return Nothing
+#endif
diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs
--- a/libraries/ghc-boot/GHC/PackageDb.hs
+++ b/libraries/ghc-boot/GHC/PackageDb.hs
@@ -387,6 +387,8 @@
                   IO (pkgs, DbOpenMode mode PackageDbLock)
 decodeFromFile file mode decoder = case mode of
   DbOpenReadOnly -> do
+  -- Note [Locking package database on Windows]
+  -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   -- When we open the package db in read only mode, there is no need to acquire
   -- shared lock on non-Windows platform because we update the database with an
   -- atomic rename, so readers will always see the database in a consistent
diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs
new file mode 100644
--- /dev/null
+++ b/libraries/ghc-boot/GHC/Platform.hs
@@ -0,0 +1,251 @@
+{-# LANGUAGE LambdaCase #-}
+
+-- | A description of the platform we're compiling for.
+--
+module GHC.Platform (
+        Platform(..),
+        Arch(..),
+        OS(..),
+        ArmISA(..),
+        ArmISAExt(..),
+        ArmABI(..),
+        PPC_64ABI(..),
+
+        target32Bit,
+        isARM,
+        osElfTarget,
+        osMachOTarget,
+        osSubsectionsViaSymbols,
+        platformUsesFrameworks,
+
+        PlatformMisc(..),
+        IntegerLibrary(..),
+
+        stringEncodeArch,
+        stringEncodeOS,
+)
+
+where
+
+import Prelude -- See Note [Why do we import Prelude here?]
+
+-- | Contains enough information for the native code generator to emit
+--      code for this platform.
+data Platform
+        = Platform {
+              platformArch                     :: Arch,
+              platformOS                       :: OS,
+              -- Word size in bytes (i.e. normally 4 or 8,
+              -- for 32bit and 64bit platforms respectively)
+              platformWordSize                 :: {-# UNPACK #-} !Int,
+              platformUnregisterised           :: Bool,
+              platformHasGnuNonexecStack       :: Bool,
+              platformHasIdentDirective        :: Bool,
+              platformHasSubsectionsViaSymbols :: Bool,
+              platformIsCrossCompiling         :: Bool
+          }
+        deriving (Read, Show, Eq)
+
+
+-- | Architectures that the native code generator knows about.
+--      TODO: It might be nice to extend these constructors with information
+--      about what instruction set extensions an architecture might support.
+--
+data Arch
+        = ArchUnknown
+        | ArchX86
+        | ArchX86_64
+        | ArchPPC
+        | ArchPPC_64
+          { ppc_64ABI :: PPC_64ABI
+          }
+        | ArchSPARC
+        | ArchSPARC64
+        | ArchARM
+          { armISA    :: ArmISA
+          , armISAExt :: [ArmISAExt]
+          , armABI    :: ArmABI
+          }
+        | ArchARM64
+        | ArchAlpha
+        | ArchMipseb
+        | ArchMipsel
+        | ArchJavaScript
+        deriving (Read, Show, Eq)
+
+-- Note [Platform Syntax]
+-- ~~~~~~~~~~~~~~~~~~~~~~
+-- There is a very loose encoding of platforms shared by many tools we are
+-- encoding to here. GNU Config (http://git.savannah.gnu.org/cgit/config.git),
+-- and LLVM's http://llvm.org/doxygen/classllvm_1_1Triple.html are perhaps the
+-- most definitional parsers. The basic syntax is a list of of '-'-separated
+-- components. The Unix 'uname' command syntax is related but briefer.
+--
+-- Those two parsers are quite forgiving, and even the 'config.sub'
+-- normalization is forgiving too. The "best" way to encode a platform is
+-- therefore somewhat a matter of taste.
+--
+-- The 'stringEncode*' functions here convert each part of GHC's structured
+-- notion of a platform into one dash-separated component.
+
+-- | See Note [Platform Syntax].
+stringEncodeArch :: Arch -> String
+stringEncodeArch = \case
+  ArchUnknown -> "unknown"
+  ArchX86 -> "i386"
+  ArchX86_64 -> "x86_64"
+  ArchPPC -> "powerpc"
+  ArchPPC_64 { ppc_64ABI = abi } -> case abi of
+    ELF_V1 -> "powerpc64"
+    ELF_V2 -> "powerpc64le"
+  ArchSPARC -> "sparc"
+  ArchSPARC64 -> "sparc64"
+  ArchARM { armISA = isa, armISAExt = _, armABI = _ } -> "arm" ++ vsuf
+    where
+      vsuf = case isa of
+        ARMv5 -> "v5"
+        ARMv6 -> "v6"
+        ARMv7 -> "v7"
+  ArchARM64 -> "aarch64"
+  ArchAlpha -> "alpha"
+  ArchMipseb -> "mipseb"
+  ArchMipsel -> "mipsel"
+  ArchJavaScript -> "js"
+
+isARM :: Arch -> Bool
+isARM (ArchARM {}) = True
+isARM ArchARM64    = True
+isARM _ = False
+
+-- | Operating systems that the native code generator knows about.
+--      Having OSUnknown should produce a sensible default, but no promises.
+data OS
+        = OSUnknown
+        | OSLinux
+        | OSDarwin
+        | OSSolaris2
+        | OSMinGW32
+        | OSFreeBSD
+        | OSDragonFly
+        | OSOpenBSD
+        | OSNetBSD
+        | OSKFreeBSD
+        | OSHaiku
+        | OSQNXNTO
+        | OSAIX
+        | OSHurd
+        deriving (Read, Show, Eq)
+
+-- | See Note [Platform Syntax].
+stringEncodeOS :: OS -> String
+stringEncodeOS = \case
+  OSUnknown -> "unknown"
+  OSLinux -> "linux"
+  OSDarwin -> "darwin"
+  OSSolaris2 -> "solaris2"
+  OSMinGW32 -> "mingw32"
+  OSFreeBSD -> "freebsd"
+  OSDragonFly -> "dragonfly"
+  OSOpenBSD -> "openbsd"
+  OSNetBSD -> "netbsd"
+  OSKFreeBSD -> "kfreebsdgnu"
+  OSHaiku -> "haiku"
+  OSQNXNTO -> "nto-qnx"
+  OSAIX -> "aix"
+  OSHurd -> "hurd"
+
+-- | ARM Instruction Set Architecture, Extensions and ABI
+--
+data ArmISA
+    = ARMv5
+    | ARMv6
+    | ARMv7
+    deriving (Read, Show, Eq)
+
+data ArmISAExt
+    = VFPv2
+    | VFPv3
+    | VFPv3D16
+    | NEON
+    | IWMMX2
+    deriving (Read, Show, Eq)
+
+data ArmABI
+    = SOFT
+    | SOFTFP
+    | HARD
+    deriving (Read, Show, Eq)
+
+-- | PowerPC 64-bit ABI
+--
+data PPC_64ABI
+    = ELF_V1
+    | ELF_V2
+    deriving (Read, Show, Eq)
+
+-- | This predicate tells us whether the platform is 32-bit.
+target32Bit :: Platform -> Bool
+target32Bit p = platformWordSize p == 4
+
+-- | This predicate tells us whether the OS supports ELF-like shared libraries.
+osElfTarget :: OS -> Bool
+osElfTarget OSLinux     = True
+osElfTarget OSFreeBSD   = True
+osElfTarget OSDragonFly = True
+osElfTarget OSOpenBSD   = True
+osElfTarget OSNetBSD    = True
+osElfTarget OSSolaris2  = True
+osElfTarget OSDarwin    = False
+osElfTarget OSMinGW32   = False
+osElfTarget OSKFreeBSD  = True
+osElfTarget OSHaiku     = True
+osElfTarget OSQNXNTO    = False
+osElfTarget OSAIX       = False
+osElfTarget OSHurd      = True
+osElfTarget OSUnknown   = False
+ -- Defaulting to False is safe; it means don't rely on any
+ -- ELF-specific functionality.  It is important to have a default for
+ -- portability, otherwise we have to answer this question for every
+ -- new platform we compile on (even unreg).
+
+-- | This predicate tells us whether the OS support Mach-O shared libraries.
+osMachOTarget :: OS -> Bool
+osMachOTarget OSDarwin = True
+osMachOTarget _ = False
+
+osUsesFrameworks :: OS -> Bool
+osUsesFrameworks OSDarwin = True
+osUsesFrameworks _        = False
+
+platformUsesFrameworks :: Platform -> Bool
+platformUsesFrameworks = osUsesFrameworks . platformOS
+
+osSubsectionsViaSymbols :: OS -> Bool
+osSubsectionsViaSymbols OSDarwin = True
+osSubsectionsViaSymbols _        = False
+
+-- | Platform-specific settings formerly hard-coded in Config.hs.
+--
+-- These should probably be all be triaged whether they can be computed from
+-- other settings or belong in another another place (like 'Platform' above).
+data PlatformMisc = PlatformMisc
+  { -- TODO Recalculate string from richer info?
+    platformMisc_targetPlatformString :: String
+  , platformMisc_integerLibrary       :: String
+  , platformMisc_integerLibraryType   :: IntegerLibrary
+  , platformMisc_ghcWithInterpreter   :: Bool
+  , platformMisc_ghcWithNativeCodeGen :: Bool
+  , platformMisc_ghcWithSMP           :: Bool
+  , platformMisc_ghcRTSWays           :: String
+  , platformMisc_tablesNextToCode     :: Bool
+  , platformMisc_leadingUnderscore    :: Bool
+  , platformMisc_libFFI               :: Bool
+  , platformMisc_ghcThreaded          :: Bool
+  , platformMisc_ghcDebugged          :: Bool
+  , platformMisc_ghcRtsWithLibdw      :: Bool
+  }
+
+data IntegerLibrary
+    = IntegerGMP
+    | IntegerSimple
+    deriving (Read, Show, Eq)
diff --git a/libraries/ghci/GHCi/BreakArray.hs b/libraries/ghci/GHCi/BreakArray.hs
--- a/libraries/ghci/GHCi/BreakArray.hs
+++ b/libraries/ghci/GHCi/BreakArray.hs
@@ -19,7 +19,7 @@
 module GHCi.BreakArray
     (
       BreakArray
-#ifdef GHCI
+#if defined(HAVE_INTERPRETER)
           (BA) -- constructor is exported only for ByteCodeGen
     , newBreakArray
     , getBreak
@@ -29,7 +29,7 @@
 #endif
     ) where
 
-#ifdef GHCI
+#if defined(HAVE_INTERPRETER)
 import Prelude -- See note [Why do we import Prelude here?]
 import Control.Monad
 import Data.Word
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
--- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
@@ -151,6 +151,9 @@
   , derivClause
   , standaloneDerivWithStrategyD
 
+  , tupE
+  , unboxedTupE
+
   , Role
   , InjectivityAnn
   )
@@ -319,3 +322,12 @@
    -> Word             -- ^ Number of bytes
    -> Bytes
 mkBytes = Bytes
+
+-------------------------------------------------------------------------------
+-- * Tuple expressions
+
+tupE :: [ExpQ] -> ExpQ
+tupE es = do { es1 <- sequence es; return (TupE $ map Just es1)}
+
+unboxedTupE :: [ExpQ] -> ExpQ
+unboxedTupE es = do { es1 <- sequence es; return (UnboxedTupE $ map Just es1)}
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
--- a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
@@ -286,11 +286,11 @@
 lamCaseE :: [MatchQ] -> ExpQ
 lamCaseE ms = sequence ms >>= return . LamCaseE
 
-tupE :: [ExpQ] -> ExpQ
-tupE es = do { es1 <- sequence es; return (TupE es1)}
+tupE :: [Maybe ExpQ] -> ExpQ
+tupE es = do { es1 <- traverse sequence es; return (TupE es1)}
 
-unboxedTupE :: [ExpQ] -> ExpQ
-unboxedTupE es = do { es1 <- sequence es; return (UnboxedTupE es1)}
+unboxedTupE :: [Maybe ExpQ] -> ExpQ
+unboxedTupE es = do { es1 <- traverse sequence es; return (UnboxedTupE es1)}
 
 unboxedSumE :: ExpQ -> SumAlt -> SumArity -> ExpQ
 unboxedSumE e alt arity = do { e1 <- e; return (UnboxedSumE e1 alt arity) }
diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
--- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
@@ -150,8 +150,8 @@
                                            <+> text "->" <+> ppr e
 pprExp i (LamCaseE ms) = parensIf (i > noPrec)
                        $ text "\\case" $$ nest nestDepth (ppr ms)
-pprExp _ (TupE es) = parens (commaSep es)
-pprExp _ (UnboxedTupE es) = hashParens (commaSep es)
+pprExp _ (TupE es) = parens (commaSepWith (pprMaybeExp noPrec) es)
+pprExp _ (UnboxedTupE es) = hashParens (commaSepWith (pprMaybeExp noPrec) es)
 pprExp _ (UnboxedSumE e alt arity) = unboxedSumBars (ppr e) alt arity
 -- Nesting in Cond is to avoid potential problems in do statements
 pprExp i (CondE guard true false)
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -846,35 +846,38 @@
 instance (Lift a, Lift b) => Lift (a, b) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (a, b)
-    = liftM TupE $ sequence [lift a, lift b]
+    = liftM TupE $ sequence $ map (fmap Just) [lift a, lift b]
 
 instance (Lift a, Lift b, Lift c) => Lift (a, b, c) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (a, b, c)
-    = liftM TupE $ sequence [lift a, lift b, lift c]
+    = liftM TupE $ sequence $ map (fmap Just) [lift a, lift b, lift c]
 
 instance (Lift a, Lift b, Lift c, Lift d) => Lift (a, b, c, d) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (a, b, c, d)
-    = liftM TupE $ sequence [lift a, lift b, lift c, lift d]
+    = liftM TupE $ sequence $ map (fmap Just) [lift a, lift b, lift c, lift d]
 
 instance (Lift a, Lift b, Lift c, Lift d, Lift e)
       => Lift (a, b, c, d, e) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (a, b, c, d, e)
-    = liftM TupE $ sequence [lift a, lift b, lift c, lift d, lift e]
+    = liftM TupE $ sequence $ map (fmap Just) [ lift a, lift b
+                                              , lift c, lift d, lift e ]
 
 instance (Lift a, Lift b, Lift c, Lift d, Lift e, Lift f)
       => Lift (a, b, c, d, e, f) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (a, b, c, d, e, f)
-    = liftM TupE $ sequence [lift a, lift b, lift c, lift d, lift e, lift f]
+    = liftM TupE $ sequence $ map (fmap Just) [ lift a, lift b, lift c
+                                              , lift d, lift e, lift f ]
 
 instance (Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g)
       => Lift (a, b, c, d, e, f, g) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (a, b, c, d, e, f, g)
-    = liftM TupE $ sequence [lift a, lift b, lift c, lift d, lift e, lift f, lift g]
+    = liftM TupE $ sequence $ map (fmap Just) [ lift a, lift b, lift c
+                                              , lift d, lift e, lift f, lift g ]
 
 -- | @since 2.16.0.0
 instance Lift (# #) where
@@ -885,48 +888,53 @@
 instance (Lift a) => Lift (# a #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a #)
-    = liftM UnboxedTupE $ sequence [lift a]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [lift a]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b) => Lift (# a, b #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a, b #)
-    = liftM UnboxedTupE $ sequence [lift a, lift b]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [lift a, lift b]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b, Lift c)
       => Lift (# a, b, c #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a, b, c #)
-    = liftM UnboxedTupE $ sequence [lift a, lift b, lift c]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [lift a, lift b, lift c]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b, Lift c, Lift d)
       => Lift (# a, b, c, d #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a, b, c, d #)
-    = liftM UnboxedTupE $ sequence [lift a, lift b, lift c, lift d]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [ lift a, lift b
+                                                     , lift c, lift d ]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b, Lift c, Lift d, Lift e)
       => Lift (# a, b, c, d, e #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a, b, c, d, e #)
-    = liftM UnboxedTupE $ sequence [lift a, lift b, lift c, lift d, lift e]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [ lift a, lift b
+                                                     , lift c, lift d, lift e ]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b, Lift c, Lift d, Lift e, Lift f)
       => Lift (# a, b, c, d, e, f #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a, b, c, d, e, f #)
-    = liftM UnboxedTupE $ sequence [lift a, lift b, lift c, lift d, lift e, lift f]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [ lift a, lift b, lift c
+                                                     , lift d, lift e, lift f ]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g)
       => Lift (# a, b, c, d, e, f, g #) where
   liftTyped x = unsafeTExpCoerce (lift x)
   lift (# a, b, c, d, e, f, g #)
-    = liftM UnboxedTupE $ sequence [lift a, lift b, lift c, lift d, lift e, lift f, lift g]
+    = liftM UnboxedTupE $ sequence $ map (fmap Just) [ lift a, lift b, lift c
+                                                     , lift d, lift e, lift f
+                                                     , lift g ]
 
 -- | @since 2.16.0.0
 instance (Lift a, Lift b) => Lift (# a | b #) where
@@ -1901,8 +1909,28 @@
                                        -- See "Language.Haskell.TH.Syntax#infix"
   | LamE [Pat] Exp                     -- ^ @{ \\ p1 p2 -> e }@
   | LamCaseE [Match]                   -- ^ @{ \\case m1; m2 }@
-  | TupE [Exp]                         -- ^ @{ (e1,e2) }  @
-  | UnboxedTupE [Exp]                  -- ^ @{ (\# e1,e2 \#) }  @
+  | TupE [Maybe Exp]                   -- ^ @{ (e1,e2) }  @
+                                       --
+                                       -- The 'Maybe' is necessary for handling
+                                       -- tuple sections.
+                                       --
+                                       -- > (1,)
+                                       --
+                                       -- translates to
+                                       --
+                                       -- > TupE [Just (LitE (IntegerL 1)),Nothing]
+
+  | UnboxedTupE [Maybe Exp]            -- ^ @{ (\# e1,e2 \#) }  @
+                                       --
+                                       -- The 'Maybe' is necessary for handling
+                                       -- tuple sections.
+                                       --
+                                       -- > (# 'c', #)
+                                       --
+                                       -- translates to
+                                       --
+                                       -- > UnboxedTupE [Just (LitE (CharL 'c')),Nothing]
+
   | UnboxedSumE Exp SumAlt SumArity    -- ^ @{ (\#|e|\#) }@
   | CondE Exp Exp Exp                  -- ^ @{ if e1 then e2 else e3 }@
   | MultiIfE [(Guard, Exp)]            -- ^ @{ if | g1 -> e1 | g2 -> e2 }@
