GHC.Types.Cpr

ghc-9.0.1: The GHC API

Safe Haskell | None
Language | Haskell2010

GHC.Types.Cpr

Description

Types for the Constructed Product Result lattice. GHC.Core.Opt.CprAnal and GHC.Core.Opt.WorkWrap.Utils are its primary customers via `idCprInfo`.

Synopsis

- data CprResult
- topCpr :: CprResult
- botCpr :: CprResult
- conCpr :: ConTag -> CprResult
- asConCpr :: CprResult -> Maybe ConTag
- data CprType = CprType {
  - ct_arty :: !Arity
  - ct_cpr :: !CprResult
  }
- topCprType :: CprType
- botCprType :: CprType
- conCprType :: ConTag -> CprType
- lubCprType :: CprType -> CprType -> CprType
- applyCprTy :: CprType -> CprType
- abstractCprTy :: CprType -> CprType
- ensureCprTyArity :: Arity -> CprType -> CprType
- trimCprTy :: CprType -> CprType
- newtype CprSig = CprSig {
  - getCprSig :: CprType
  }
- topCprSig :: CprSig
- mkCprSigForArity :: Arity -> CprType -> CprSig
- mkCprSig :: Arity -> CprResult -> CprSig
- seqCprSig :: CprSig -> ()

# Documentation

data CprResult Source #

The constructed product result lattice.

                       NoCPR
                         |
                    ConCPR ConTag
                         |
                       BotCPR

#### Instances

Instances details

Eq CprResult # |
Instance details Defined in GHC.Types.Cpr Methods (==) :: CprResult -> CprResult -> Bool # (/=) :: CprResult -> CprResult -> Bool #
Show CprResult # |
Instance details Defined in GHC.Types.Cpr Methods showsPrec :: Int -> CprResult -> ShowS Source # show :: CprResult -> String Source # showList :: [CprResult] -> ShowS Source #
Outputable CprResult # |
Instance details Defined in GHC.Types.Cpr Methods ppr :: CprResult -> SDoc Source # pprPrec :: Rational -> CprResult -> SDoc Source #
Binary CprResult # |
Instance details Defined in GHC.Types.Cpr Methods put_ :: BinHandle -> CprResult -> IO () Source # put :: BinHandle -> CprResult -> IO (Bin CprResult) Source # get :: BinHandle -> IO CprResult Source #

topCpr :: CprResult Source #

botCpr :: CprResult Source #

conCpr :: ConTag -> CprResult Source #

asConCpr :: CprResult -> Maybe ConTag Source #

data CprType Source #

The abstract domain \(A_t\) from the original 'CPR for Haskell' paper.

Constructors

CprType |
Fields ct_arty :: !Arity Number of value arguments the denoted expression eats before returning the `ct_cpr` ct_cpr :: !CprResult `CprResult` eventually unleashed when applied to `ct_arty` arguments

#### Instances

Instances details

Eq CprType # |
Instance details Defined in GHC.Types.Cpr Methods (==) :: CprType -> CprType -> Bool # (/=) :: CprType -> CprType -> Bool #
Outputable CprType # |
Instance details Defined in GHC.Types.Cpr Methods ppr :: CprType -> SDoc Source # pprPrec :: Rational -> CprType -> SDoc Source #
Binary CprType # |
Instance details Defined in GHC.Types.Cpr Methods put_ :: BinHandle -> CprType -> IO () Source # put :: BinHandle -> CprType -> IO (Bin CprType) Source # get :: BinHandle -> IO CprType Source #

topCprType :: CprType Source #

botCprType :: CprType Source #

conCprType :: ConTag -> CprType Source #

lubCprType :: CprType -> CprType -> CprType Source #

applyCprTy :: CprType -> CprType Source #

abstractCprTy :: CprType -> CprType Source #

ensureCprTyArity :: Arity -> CprType -> CprType Source #

trimCprTy :: CprType -> CprType Source #

newtype CprSig Source #

The arity of the wrapped `CprType` is the arity at which it is safe to unleash. See Note [Understanding DmdType and StrictSig] in GHC.Types.Demand

Constructors

CprSig |
Fields getCprSig :: CprType

#### Instances

Instances details

Eq CprSig # |
Instance details Defined in GHC.Types.Cpr Methods (==) :: CprSig -> CprSig -> Bool # (/=) :: CprSig -> CprSig -> Bool #
Outputable CprSig # | Only print the CPR result
Instance details Defined in GHC.Types.Cpr Methods ppr :: CprSig -> SDoc Source # pprPrec :: Rational -> CprSig -> SDoc Source #
Binary CprSig # |
Instance details Defined in GHC.Types.Cpr Methods put_ :: BinHandle -> CprSig -> IO () Source # put :: BinHandle -> CprSig -> IO (Bin CprSig) Source # get :: BinHandle -> IO CprSig Source #

topCprSig :: CprSig Source #

mkCprSigForArity :: Arity -> CprType -> CprSig Source #

Turns a `CprType` computed for the particular `Arity` into a `CprSig` unleashable at that arity. See Note [Understanding DmdType and StrictSig] in GHC.Types.Demand

mkCprSig :: Arity -> CprResult -> CprSig Source #

seqCprSig :: CprSig -> () Source #