GHC.Core.Opt.WorkWrap.Utils

ghc-9.2.0.20210331: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Core.Opt.WorkWrap.Utils

Synopsis

- mkWwBodies :: DynFlags -> FamInstEnvs -> VarSet -> Id -> [Demand] -> Cpr -> UniqSM (Maybe WwResult)
- mkWWstr :: DynFlags -> FamInstEnvs -> Bool -> [Var] -> UniqSM (Bool, [Var], CoreExpr -> CoreExpr, CoreExpr -> CoreExpr)
- mkWorkerArgs :: DynFlags -> [Var] -> Type -> ([Var], [Var])
- data DataConPatContext = DataConPatContext {
  - dcpc_dc :: !DataCon
  - dcpc_tc_args :: ![Type]
  - dcpc_co :: !Coercion
  }
- data UnboxingDecision s
  - = StopUnboxing
  - | Unbox !DataConPatContext [s]
- splitArgType_maybe :: FamInstEnvs -> Type -> Maybe DataConPatContext
- wantToUnbox :: FamInstEnvs -> Bool -> Type -> Demand -> UnboxingDecision Demand
- findTypeShape :: FamInstEnvs -> Type -> TypeShape
- isWorkerSmallEnough :: DynFlags -> Int -> [Var] -> Bool

# Documentation

mkWwBodies :: DynFlags -> FamInstEnvs -> VarSet -> Id -> [Demand] -> Cpr -> UniqSM (Maybe WwResult) Source #

mkWWstr :: DynFlags -> FamInstEnvs -> Bool -> [Var] -> UniqSM (Bool, [Var], CoreExpr -> CoreExpr, CoreExpr -> CoreExpr) Source #

mkWorkerArgs :: DynFlags -> [Var] -> Type -> ([Var], [Var]) Source #

data DataConPatContext Source #

The information needed to build a pattern for a DataCon to be unboxed. The pattern can be generated from `dcpc_dc` and `dcpc_tc_args` via `dataConRepInstPat`. The coercion `dcpc_co` is for newtype wrappers.

If we get `DataConPatContext dc tys co` for some type `ty` and `dataConRepInstPat ... dc tys = (exs, flds)`, then

- `dc` exs flds :: T tys@

-     co :: T tys ~ ty

Constructors

DataConPatContext |
Fields dcpc_dc :: !DataCon dcpc_tc_args :: ![Type] dcpc_co :: !Coercion

data UnboxingDecision s Source #

Describes the outer shape of an argument to be unboxed or left as-is Depending on how `s` is instantiated (e.g., `Demand`).

Constructors

StopUnboxing | We ran out of strictness info. Leave untouched.
Unbox !DataConPatContext [s] | The argument is used strictly or the returned product was constructed, so unbox it. The `DataConPatContext` carries the bits necessary for instantiation with `dataConRepInstPat`. The `[s]` carries the bits of information with which we can continue unboxing, e.g. `s` will be `Demand`.

splitArgType_maybe :: FamInstEnvs -> Type -> Maybe DataConPatContext Source #

If `splitArgType_maybe ty = Just (dc, tys, co)` then `dc @tys @_ex_tys (_args::_arg_tys) :: tc tys` and `co :: ty ~ tc tys` where underscore prefixes are holes, e.g. yet unspecified.

See Note [Which types are unboxed?].

wantToUnbox :: FamInstEnvs -> Bool -> Type -> Demand -> UnboxingDecision Demand Source #

findTypeShape :: FamInstEnvs -> Type -> TypeShape Source #

isWorkerSmallEnough :: DynFlags -> Int -> [Var] -> Bool Source #