Commit eb608235 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Module hierarchy (#13009): Stg

parent 0d42b287
Pipeline #14131 failed with stages
in 429 minutes and 32 seconds
......@@ -11,7 +11,7 @@
-- And, as we have the info in hand, we may convert some lets to
-- let-no-escapes.
module CoreToStg ( coreToStg ) where
module GHC.CoreToStg ( coreToStg ) where
#include "HsVersions.h"
......@@ -21,10 +21,10 @@ import CoreSyn
import CoreUtils ( exprType, findDefault, isJoinBind
, exprIsTickedString_maybe )
import CoreArity ( manifestArity )
import StgSyn
import GHC.Stg.Syntax
import Type
import RepType
import GHC.Types.RepType
import TyCon
import MkId ( coercionTokenId )
import Id
......
......@@ -7,7 +7,7 @@ Core pass to saturate constructors and PrimOps
{-# LANGUAGE BangPatterns, CPP, MultiWayIf #-}
module CorePrep (
module GHC.CoreToStg.Prep (
corePrepPgm, corePrepExpr, cvtLitInteger, cvtLitNatural,
lookupMkIntegerName, lookupIntegerSDataConName,
lookupMkNaturalName, lookupNaturalSDataConName
......
......@@ -84,13 +84,13 @@ Solution: do unarise first.
-}
module StgCse (stgCse) where
module GHC.Stg.CSE (stgCse) where
import GhcPrelude
import DataCon
import Id
import StgSyn
import GHC.Stg.Syntax
import Outputable
import VarEnv
import CoreSyn (AltCon(..))
......
-- | Free variable analysis on STG terms.
module StgFVs (
module GHC.Stg.FVs (
annTopBindingsFreeVars,
annBindingFreeVars
) where
import GhcPrelude
import StgSyn
import GHC.Stg.Syntax
import Id
import VarSet
import CoreSyn ( Tickish(Breakpoint) )
......
{-# LANGUAGE CPP #-}
-- | (Mostly) textbook instance of the lambda lifting transformation,
-- selecting which bindings to lambda lift by consulting 'goodToLift'.
module StgLiftLams.Transformation (stgLiftLams) where
-- | Implements a selective lambda lifter, running late in the optimisation
-- pipeline.
--
-- If you are interested in the cost model that is employed to decide whether
-- to lift a binding or not, look at "GHC.Stg.Lift.Analysis".
-- "GHC.Stg.Lift.Monad" contains the transformation monad that hides away some
-- plumbing of the transformation.
module GHC.Stg.Lift
(
-- * Late lambda lifting in STG
-- $note
stgLiftLams
)
where
#include "HsVersions.h"
......@@ -12,10 +23,10 @@ import BasicTypes
import DynFlags
import Id
import IdInfo
import StgFVs ( annBindingFreeVars )
import StgLiftLams.Analysis
import StgLiftLams.LiftM
import StgSyn
import GHC.Stg.FVs ( annBindingFreeVars )
import GHC.Stg.Lift.Analysis
import GHC.Stg.Lift.Monad
import GHC.Stg.Syntax
import Outputable
import UniqSupply
import Util
......@@ -23,7 +34,99 @@ import VarSet
import Control.Monad ( when )
import Data.Maybe ( isNothing )
-- Note [Late lambda lifting in STG]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- $note
-- See also the <https://gitlab.haskell.org/ghc/ghc/wikis/late-lam-lift wiki page>
-- and #9476.
--
-- The basic idea behind lambda lifting is to turn locally defined functions
-- into top-level functions. Free variables are then passed as additional
-- arguments at *call sites* instead of having a closure allocated for them at
-- *definition site*. Example:
--
-- @
-- let x = ...; y = ... in
-- let f = {x y} \a -> a + x + y in
-- let g = {f x} \b -> f b + x in
-- g 5
-- @
--
-- Lambda lifting @f@ would
--
-- 1. Turn @f@'s free variables into formal parameters
-- 2. Update @f@'s call site within @g@ to @f x y b@
-- 3. Update @g@'s closure: Add @y@ as an additional free variable, while
-- removing @f@, because @f@ no longer allocates and can be floated to
-- top-level.
-- 4. Actually float the binding of @f@ to top-level, eliminating the @let@
-- in the process.
--
-- This results in the following program (with free var annotations):
--
-- @
-- f x y a = a + x + y;
-- let x = ...; y = ... in
-- let g = {x y} \b -> f x y b + x in
-- g 5
-- @
--
-- This optimisation is all about lifting only when it is beneficial to do so.
-- The above seems like a worthwhile lift, judging from heap allocation:
-- We eliminate @f@'s closure, saving to allocate a closure with 2 words, while
-- not changing the size of @g@'s closure.
--
-- You can probably sense that there's some kind of cost model at play here.
-- And you are right! But we also employ a couple of other heuristics for the
-- lifting decision which are outlined in "GHC.Stg.Lift.Analysis#when".
--
-- The transformation is done in "GHC.Stg.Lift", which calls out to
-- 'GHC.Stg.Lift.Analysis.goodToLift' for its lifting decision. It relies on
-- "GHC.Stg.Lift.Monad", which abstracts some subtle STG invariants into a
-- monadic substrate.
--
-- Suffice to say: We trade heap allocation for stack allocation.
-- The additional arguments have to passed on the stack (or in registers,
-- depending on architecture) every time we call the function to save a single
-- heap allocation when entering the let binding. Nofib suggests a mean
-- improvement of about 1% for this pass, so it seems like a worthwhile thing to
-- do. Compile-times went up by 0.6%, so all in all a very modest change.
--
-- For a concrete example, look at @spectral/atom@. There's a call to 'zipWith'
-- that is ultimately compiled to something like this
-- (module desugaring/lowering to actual STG):
--
-- @
-- propagate dt = ...;
-- runExperiment ... =
-- let xs = ... in
-- let ys = ... in
-- let go = {dt go} \xs ys -> case (xs, ys) of
-- ([], []) -> []
-- (x:xs', y:ys') -> propagate dt x y : go xs' ys'
-- in go xs ys
-- @
--
-- This will lambda lift @go@ to top-level, speeding up the resulting program
-- by roughly one percent:
--
-- @
-- propagate dt = ...;
-- go dt xs ys = case (xs, ys) of
-- ([], []) -> []
-- (x:xs', y:ys') -> propagate dt x y : go dt xs' ys'
-- runExperiment ... =
-- let xs = ... in
-- let ys = ... in
-- in go dt xs ys
-- @
-- | Lambda lifts bindings to top-level deemed worth lifting (see 'goodToLift').
--
-- (Mostly) textbook instance of the lambda lifting transformation, selecting
-- which bindings to lambda lift by consulting 'goodToLift'.
stgLiftLams :: DynFlags -> UniqSupply -> [InStgTopBinding] -> [OutStgTopBinding]
stgLiftLams dflags us = runLiftM dflags us . foldr liftTopLvl (pure ())
......
......@@ -5,7 +5,7 @@
-- | Provides the heuristics for when it's beneficial to lambda lift bindings.
-- Most significantly, this employs a cost model to estimate impact on heap
-- allocations, by looking at an STG expression's 'Skeleton'.
module StgLiftLams.Analysis (
module GHC.Stg.Lift.Analysis (
-- * #when# When to lift
-- $when
......@@ -27,7 +27,7 @@ import Demand
import DynFlags
import Id
import SMRep ( WordOff )
import StgSyn
import GHC.Stg.Syntax
import qualified GHC.StgToCmm.ArgRep as StgToCmm.ArgRep
import qualified GHC.StgToCmm.Closure as StgToCmm.Closure
import qualified GHC.StgToCmm.Layout as StgToCmm.Layout
......@@ -45,7 +45,7 @@ import Data.Maybe ( mapMaybe )
-- 1. It tags the syntax tree with analysis information in the form of
-- 'BinderInfo' at each binder and 'Skeleton's at each let-binding
-- by 'tagSkeletonTopBind' and friends.
-- 2. The resulting syntax tree is treated by the "StgLiftLams.Transformation"
-- 2. The resulting syntax tree is treated by the "GHC.Stg.Lift"
-- module, calling out to 'goodToLift' to decide if a binding is worthwhile
-- to lift.
-- 'goodToLift' consults argument occurrence information in 'BinderInfo'
......@@ -78,7 +78,7 @@ import Data.Maybe ( mapMaybe )
-- [Closure growth] introduced when former free variables have to be available
-- at call sites may actually lead to an increase in overall allocations
-- resulting from a lift. Estimating closure growth is described in
-- "StgLiftLams.Analysis#clogro" and is what most of this module is ultimately
-- "GHC.Stg.Lift.Analysis#clogro" and is what most of this module is ultimately
-- concerned with.
--
-- There's a <https://gitlab.haskell.org/ghc/ghc/wikis/late-lam-lift wiki page> with
......@@ -145,7 +145,7 @@ data BinderInfo
= BindsClosure !Id !Bool -- ^ Let(-no-escape)-bound thing with a flag
-- indicating whether it occurs as an argument
-- or in a nullary application
-- (see "StgLiftLams.Analysis#arg_occs").
-- (see "GHC.Stg.Lift.Analysis#arg_occs").
| BoringBinder !Id -- ^ Every other kind of binder
-- | Gets the bound 'Id' out a 'BinderInfo'.
......@@ -214,7 +214,7 @@ tagSkeletonTopBind bind = bind'
-- | Tags binders of an 'StgExpr' with its 'BinderInfo' and let bindings with
-- their 'Skeleton's. Additionally, returns its 'Skeleton' and the set of binder
-- occurrences in argument and nullary application position
-- (cf. "StgLiftLams.Analysis#arg_occs").
-- (cf. "GHC.Stg.Lift.Analysis#arg_occs").
tagSkeletonExpr :: CgStgExpr -> (Skeleton, IdSet, LlStgExpr)
tagSkeletonExpr (StgLit lit)
= (NilSk, emptyVarSet, StgLit lit)
......@@ -227,7 +227,7 @@ tagSkeletonExpr (StgApp f args)
where
arg_occs
-- This checks for nullary applications, which we treat the same as
-- argument occurrences, see "StgLiftLams.Analysis#arg_occs".
-- argument occurrences, see "GHC.Stg.Lift.Analysis#arg_occs".
| null args = unitVarSet f
| otherwise = mkArgOccs args
tagSkeletonExpr (StgLam _ _) = pprPanic "stgLiftLams" (text "StgLam")
......@@ -352,13 +352,13 @@ tagSkeletonAlt (con, bndrs, rhs)
arg_occs = alt_arg_occs `delVarSetList` bndrs
-- | Combines several heuristics to decide whether to lambda-lift a given
-- @let@-binding to top-level. See "StgLiftLams.Analysis#when" for details.
-- @let@-binding to top-level. See "GHC.Stg.Lift.Analysis#when" for details.
goodToLift
:: DynFlags
-> TopLevelFlag
-> RecFlag
-> (DIdSet -> DIdSet) -- ^ An expander function, turning 'InId's into
-- 'OutId's. See 'StgLiftLams.LiftM.liftedIdsExpander'.
-- 'OutId's. See 'GHC.Stg.Lift.Monad.liftedIdsExpander'.
-> [(BinderInfo, LlStgRhs)]
-> Skeleton
-> Maybe DIdSet -- ^ @Just abs_ids@ <=> This binding is beneficial to
......@@ -507,7 +507,7 @@ idClosureFootprint dflags
-- | @closureGrowth expander sizer f fvs@ computes the closure growth in words
-- as a result of lifting @f@ to top-level. If there was any growing closure
-- under a multi-shot lambda, the result will be 'infinity'.
-- Also see "StgLiftLams.Analysis#clogro".
-- Also see "GHC.Stg.Lift.Analysis#clogro".
closureGrowth
:: (DIdSet -> DIdSet)
-- ^ Expands outer free ids that were lifted to their free vars
......
......@@ -4,7 +4,7 @@
-- | Hides away distracting bookkeeping while lambda lifting into a 'LiftM'
-- monad.
module StgLiftLams.LiftM (
module GHC.Stg.Lift.Monad (
decomposeStgBinding, mkStgBinding,
Env (..),
-- * #floats# Handling floats
......@@ -33,8 +33,8 @@ import IdInfo
import Name
import Outputable
import OrdList
import StgSubst
import StgSyn
import GHC.Stg.Subst
import GHC.Stg.Syntax
import Type
import UniqSupply
import Util
......@@ -137,7 +137,7 @@ emptyEnv dflags = Env dflags emptySubst emptyVarEnv False
-- business and will just manipulate it indirectly through actions in 'LiftM'.
-- | We need to detect when we are lifting something out of the RHS of a
-- recursive binding (c.f. "StgLiftLams.LiftM#floats"), in which case that
-- recursive binding (c.f. "GHC.Stg.Lift.Monad#floats"), in which case that
-- binding needs to be added to the same top-level recursive group. This
-- requires we detect a certain nesting structure, which is encoded by
-- 'StartBindingGroup' and 'EndBindingGroup'.
......
......@@ -35,11 +35,11 @@ basic properties listed above.
{-# LANGUAGE ScopedTypeVariables, FlexibleContexts, TypeFamilies,
DeriveFunctor #-}
module StgLint ( lintStgTopBindings ) where
module GHC.Stg.Lint ( lintStgTopBindings ) where
import GhcPrelude
import StgSyn
import GHC.Stg.Syntax
import DynFlags
import Bag ( Bag, emptyBag, isEmptyBag, snocBag, bagToList )
......@@ -52,7 +52,7 @@ import CoreSyn ( AltCon(..) )
import Name ( getSrcLoc, nameIsLocalOrFrom )
import ErrUtils ( MsgDoc, Severity(..), mkLocMessage )
import Type
import RepType
import GHC.Types.RepType
import SrcLoc
import Outputable
import Module ( Module )
......
......@@ -9,19 +9,19 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module SimplStg ( stg2stg ) where
module GHC.Stg.Pipeline ( stg2stg ) where
#include "HsVersions.h"
import GhcPrelude
import StgSyn
import GHC.Stg.Syntax
import StgLint ( lintStgTopBindings )
import StgStats ( showStgStats )
import UnariseStg ( unarise )
import StgCse ( stgCse )
import StgLiftLams ( stgLiftLams )
import GHC.Stg.Lint ( lintStgTopBindings )
import GHC.Stg.Stats ( showStgStats )
import GHC.Stg.Unarise ( unarise )
import GHC.Stg.CSE ( stgCse )
import GHC.Stg.Lift ( stgLiftLams )
import Module ( Module )
import DynFlags
......@@ -128,7 +128,7 @@ getStgToDo dflags =
filter (/= StgDoNothing)
[ mandatory StgUnarise
-- Important that unarisation comes first
-- See Note [StgCse after unarisation] in StgCse
-- See Note [StgCse after unarisation] in GHC.Stg.CSE
, optional Opt_StgCSE StgCSE
, optional Opt_StgLiftLams StgLiftLams
, optional Opt_StgStats StgStats
......
......@@ -23,13 +23,13 @@ The program gather statistics about
{-# LANGUAGE CPP #-}
module StgStats ( showStgStats ) where
module GHC.Stg.Stats ( showStgStats ) where
#include "HsVersions.h"
import GhcPrelude
import StgSyn
import GHC.Stg.Syntax
import Id (Id)
import Panic
......
{-# LANGUAGE CPP #-}
module StgSubst where
module GHC.Stg.Subst where
#include "HsVersions.h"
......
......@@ -19,7 +19,7 @@ generation.
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}
module StgSyn (
module GHC.Stg.Syntax (
StgArg(..),
GenStgTopBinding(..), GenStgBinding(..), GenStgExpr(..), GenStgRhs(..),
......@@ -81,7 +81,7 @@ import PprCore ( {- instances -} )
import PrimOp ( PrimOp, PrimCall )
import TyCon ( PrimRep(..), TyCon )
import Type ( Type )
import RepType ( typePrimRep1 )
import GHC.Types.RepType ( typePrimRep1 )
import Util
import Data.List.NonEmpty ( NonEmpty, toList )
......@@ -238,7 +238,7 @@ literals.
-- which can't be let-bound
| StgConApp DataCon
[StgArg] -- Saturated
[Type] -- See Note [Types in StgConApp] in UnariseStg
[Type] -- See Note [Types in StgConApp] in GHC.Stg.Unarise
| StgOpApp StgOp -- Primitive op or foreign call
[StgArg] -- Saturated.
......
......@@ -194,7 +194,7 @@ STG programs after unarisation have these invariants:
{-# LANGUAGE CPP, TupleSections #-}
module UnariseStg (unarise) where
module GHC.Stg.Unarise (unarise) where
#include "HsVersions.h"
......@@ -210,8 +210,8 @@ import MkCore (aBSENT_SUM_FIELD_ERROR_ID)
import MkId (voidPrimId, voidArgId)
import MonadUtils (mapAccumLM)
import Outputable
import RepType
import StgSyn
import GHC.Types.RepType
import GHC.Stg.Syntax
import Type
import TysPrim (intPrimTy,wordPrimTy,word64PrimTy)
import TysWiredIn
......@@ -353,7 +353,7 @@ unariseExpr rho (StgCase scrut bndr alt_ty alts)
alts' <- unariseAlts rho alt_ty bndr alts
return (StgCase scrut' bndr alt_ty alts')
-- bndr may have a unboxed sum/tuple type but it will be
-- dead after unarise (checked in StgLint)
-- dead after unarise (checked in GHC.Stg.Lint)
unariseExpr rho (StgLet ext bind e)
= StgLet ext <$> unariseBinding rho bind <*> unariseExpr rho e
......
......@@ -30,7 +30,7 @@ import Cmm
import CmmUtils
import CLabel
import StgSyn
import GHC.Stg.Syntax
import DynFlags
import ErrUtils
......@@ -38,7 +38,7 @@ import HscTypes
import CostCentre
import Id
import IdInfo
import RepType
import GHC.Types.RepType
import DataCon
import TyCon
import Module
......@@ -147,7 +147,7 @@ cgTopRhs :: DynFlags -> RecFlag -> Id -> CgStgRhs -> (CgIdInfo, FCode ())
cgTopRhs dflags _rec bndr (StgRhsCon _cc con args)
= cgTopRhsCon dflags bndr con (assertNonVoidStgArgs args)
-- con args are always non-void,
-- see Note [Post-unarisation invariants] in UnariseStg
-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise
cgTopRhs dflags rec bndr (StgRhsClosure fvs cc upd_flag args body)
= ASSERT(isEmptyDVarSet fvs) -- There should be no free variables
......
......@@ -36,7 +36,7 @@ import Cmm
import CmmInfo
import CmmUtils
import CLabel
import StgSyn
import GHC.Stg.Syntax
import CostCentre
import Id
import IdInfo
......@@ -206,7 +206,7 @@ cgRhs id (StgRhsCon cc con args)
= withNewTickyCounterCon (idName id) $
buildDynCon id True cc con (assertNonVoidStgArgs args)
-- con args are always non-void,
-- see Note [Post-unarisation invariants] in UnariseStg
-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise
{- See Note [GC recovery] in compiler/GHC.StgToCmm/Closure.hs -}
cgRhs id (StgRhsClosure fvs cc upd_flag args body)
......@@ -275,7 +275,7 @@ mkRhsClosure dflags bndr _cc
, let (_, _, params_w_offsets) = mkVirtConstrOffsets dflags (addIdReps (assertNonVoidIds params))
-- pattern binders are always non-void,
-- see Note [Post-unarisation invariants] in UnariseStg
-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise
, Just the_offset <- assocMaybe params_w_offsets (NonVoid selectee)
, let offset_into_int = bytesToWordsRoundUp dflags the_offset
......
module GHC.StgToCmm.Bind where
import GHC.StgToCmm.Monad( FCode )
import StgSyn( CgStgBinding )
import GHC.Stg.Syntax( CgStgBinding )
cgBind :: CgStgBinding -> FCode ()
......@@ -66,7 +66,7 @@ module GHC.StgToCmm.Closure (
import GhcPrelude
import StgSyn
import GHC.Stg.Syntax
import SMRep
import Cmm
import PprCmmExpr() -- For Outputable instances
......@@ -82,7 +82,7 @@ import Type
import TyCoRep
import TcType
import TyCon
import RepType
import GHC.Types.RepType
import BasicTypes
import Outputable
import DynFlags
......@@ -142,7 +142,7 @@ nonVoidIds ids = [NonVoid id | id <- ids, not (isVoidTy (idType id))]
-- | Used in places where some invariant ensures that all these Ids are
-- non-void; e.g. constructor field binders in case expressions.
-- See Note [Post-unarisation invariants] in UnariseStg.
-- See Note [Post-unarisation invariants] in GHC.Stg.Unarise.
assertNonVoidIds :: [Id] -> [NonVoid Id]
assertNonVoidIds ids = ASSERT(not (any (isVoidTy . idType) ids))
coerce ids
......@@ -152,7 +152,7 @@ nonVoidStgArgs args = [NonVoid arg | arg <- args, not (isVoidTy (stgArgType arg)
-- | Used in places where some invariant ensures that all these arguments are
-- non-void; e.g. constructor arguments.
-- See Note [Post-unarisation invariants] in UnariseStg.
-- See Note [Post-unarisation invariants] in GHC.Stg.Unarise.
assertNonVoidStgArgs :: [StgArg] -> [NonVoid StgArg]
assertNonVoidStgArgs args = ASSERT(not (any (isVoidTy . stgArgType) args))
coerce args
......@@ -169,7 +169,7 @@ assertNonVoidStgArgs args = ASSERT(not (any (isVoidTy . stgArgType) args))
-- See Note [Post-unarisation invariants]
idPrimRep :: Id -> PrimRep
idPrimRep id = typePrimRep1 (idType id)
-- See also Note [VoidRep] in RepType
-- See also Note [VoidRep] in GHC.Types.RepType
-- | Assumes that Ids have one PrimRep, which holds after unarisation.
-- See Note [Post-unarisation invariants]
......
......@@ -19,7 +19,7 @@ module GHC.StgToCmm.DataCon (
import GhcPrelude
import StgSyn
import GHC.Stg.Syntax
import CoreSyn ( AltCon(..) )
import GHC.StgToCmm.Monad
......@@ -40,7 +40,7 @@ import DataCon
import DynFlags
import FastString
import Id
import RepType (countConRepArgs)
import GHC.Types.RepType (countConRepArgs)
import Literal
import PrelInfo
import Outputable
......
......@@ -41,7 +41,7 @@ import Id
import MkGraph
import Name
import Outputable
import StgSyn
import GHC.Stg.Syntax
import Type
import TysPrim
import UniqFM
......
......@@ -28,7 +28,7 @@ import GHC.StgToCmm.Ticky
import GHC.StgToCmm.Utils
import GHC.StgToCmm.Closure
import StgSyn
import GHC.Stg.Syntax
import MkGraph
import BlockId
......@@ -42,7 +42,7 @@ import Id
import PrimOp
import TyCon
import Type ( isUnliftedType )
import RepType ( isVoidTy, countConRepArgs )
import GHC.Types.RepType ( isVoidTy, countConRepArgs )
import CostCentre ( CostCentreStack, currentCCS )
import Maybes
import Util
......@@ -585,7 +585,7 @@ isSimpleOp (StgPrimCallOp _) _ = return False
chooseReturnBndrs :: Id -> AltType -> [CgStgAlt] -> [NonVoid Id]
-- These are the binders of a case that are assigned by the evaluation of the
-- scrutinee.
-- They're non-void, see Note [Post-unarisation invariants] in UnariseStg.
-- They're non-void, see Note [Post-unarisation invariants] in GHC.Stg.Unarise.
chooseReturnBndrs bndr (PrimAlt _) _alts
= assertNonVoidIds [bndr]
......@@ -882,7 +882,7 @@ cgAltRhss gc_plan bndr alts = do
maybeAltHeapCheck gc_plan $
do { _ <- bindConArgs con base_reg (assertNonVoidIds bndrs)
-- alt binders are always non-void,
-- see Note [Post-unarisation invariants] in UnariseStg
-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise
; _ <- cgExpr rhs
; return con }
forkAlts (map cg_alt alts)
......@@ -910,7 +910,7 @@ cgConApp con stg_args
do { (idinfo, fcode_init) <- buildDynCon (dataConWorkId con) False
currentCCS con (assertNonVoidStgArgs stg_args)
-- con args are always non-void,
-- see Note [Post-unarisation invariants] in UnariseStg
-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise
-- The first "con" says that the name bound to this
-- closure is "con", which is a bit of a fudge, but
-- it only affects profiling (hence the False)
......
......@@ -20,7 +20,7 @@ module GHC.StgToCmm.Foreign (
import GhcPrelude hiding( succ, (<*>) )
import StgSyn
import GHC.Stg.Syntax
import GHC.StgToCmm.Prof (storeCurCCS, ccsType)
import GHC.StgToCmm.Env
import GHC.StgToCmm.Monad
......@@ -33,7 +33,7 @@ import Cmm
import CmmUtils
import MkGraph
import Type
import RepType
import GHC.Types.RepType
import CLabel
import SMRep
import ForeignCall
......
......@@ -22,7 +22,7 @@ module GHC.StgToCmm.Heap (
import GhcPrelude hiding ((<*>))
import StgSyn
import GHC.Stg.Syntax
import CLabel
import GHC.StgToCmm.Layout
import GHC.StgToCmm.Utils
......
......@@ -48,7 +48,7 @@ import Cmm
import CmmUtils
import CmmInfo
import CLabel
import StgSyn
import GHC.Stg.Syntax
import Id
import TyCon ( PrimRep(..), primRepSizeB )
import BasicTypes ( RepArity )
......
......@@ -40,7 +40,7 @@ import GHC.Platform
import BasicTypes
import BlockId
import MkGraph
import StgSyn
import GHC.Stg.Syntax
import Cmm
import Module ( rtsUnitId )
import Type ( Type, tyConAppTyCon )
......
......@@ -111,7 +111,7 @@ import GHC.StgToCmm.Closure
import GHC.StgToCmm.Utils
import GHC.StgToCmm.Monad
import StgSyn
import GHC.Stg.Syntax
import CmmExpr
import MkGraph
import CmmUtils
......
......@@ -75,7 +75,7 @@ import UniqSupply (MonadUnique(..))
import DynFlags
import FastString
import Outputable
import RepType
import GHC.Types.RepType
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as BS8
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
module RepType
module GHC.Types.RepType
(
-- * Code generator views onto Types
UnaryType, NvUnaryType, isNvUnaryType,
......@@ -133,7 +133,7 @@ isVoidTy = null . typePrimRep
{- **********************************************************************
* *
Unboxed sums
See Note [Translating unboxed sums to unboxed tuples] in UnariseStg.hs
See Note [Translating unboxed sums to unboxed tuples] in GHC.Stg.Unarise
* *
********************************************************************** -}
......@@ -366,7 +366,7 @@ data RuntimeRep = VecRep VecCount VecElem -- ^ a SIMD vector type
It's all in 1-1 correspondence with PrimRep except for TupleRep and SumRep,