ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.CostCentre

Synopsis

- data CostCentre
  - = NormalCC {
    - cc_flavour :: CCFlavour
    - cc_name :: CcName
    - cc_mod :: Module
    - cc_loc :: SrcSpan
    }
  - | AllCafsCC {
    - cc_mod :: Module
    - cc_loc :: SrcSpan
    }
- type CcName = FastString
- data CCFlavour
- mkCafFlavour :: CCFlavour
- mkExprCCFlavour :: CostCentreIndex -> CCFlavour
- mkDeclCCFlavour :: CostCentreIndex -> CCFlavour
- mkHpcCCFlavour :: CostCentreIndex -> CCFlavour
- mkLateCCFlavour :: CostCentreIndex -> CCFlavour
- mkCallerCCFlavour :: CostCentreIndex -> CCFlavour
- getAllCAFsCC :: Module -> (CostCentre, CostCentreStack)
- pprCostCentre :: IsLine doc => CostCentre -> doc
- data CostCentreStack
- pprCostCentreStack :: IsLine doc => CostCentreStack -> doc
- type CollectedCCs = ([CostCentre], [CostCentreStack])
- emptyCollectedCCs :: CollectedCCs
- collectCC :: CostCentre -> CostCentreStack -> CollectedCCs -> CollectedCCs
- currentCCS :: CostCentreStack
- dontCareCCS :: CostCentreStack
- isCurrentCCS :: CostCentreStack -> Bool
- maybeSingletonCCS :: CostCentreStack -> Maybe CostCentre
- mkUserCC :: FastString -> Module -> SrcSpan -> CCFlavour -> CostCentre
- mkAutoCC :: Id -> Module -> CostCentre
- mkAllCafsCC :: Module -> SrcSpan -> CostCentre
- mkSingletonCCS :: CostCentre -> CostCentreStack
- isCafCCS :: CostCentreStack -> Bool
- isCafCC :: CostCentre -> Bool
- isSccCountCC :: CostCentre -> Bool
- sccAbleCC :: CostCentre -> Bool
- ccFromThisModule :: CostCentre -> Module -> Bool
- pprCostCentreCore :: CostCentre -> SDoc
- costCentreUserName :: CostCentre -> String
- costCentreUserNameFS :: CostCentre -> FastString
- costCentreSrcSpan :: CostCentre -> SrcSpan
- cmpCostCentre :: CostCentre -> CostCentre -> Ordering

# Documentation

data CostCentre Source #

A Cost Centre is a single `{-# SCC #-}` annotation.

Constructors

NormalCC |

Fields

- cc_flavour :: CCFlavour

  Two cost centres may have the same name and module but different SrcSpans, so we need a way to distinguish them easily and give them different object-code labels. So every CostCentre has an associated flavour that indicates how it was generated, and flavours that allow multiple instances of the same name and module have a deterministic 0-based index.

- cc_name :: CcName

  Name of the cost centre itself

- cc_mod :: Module

  Name of module defining this CC.

- cc_loc :: SrcSpan

AllCafsCC |

Fields

- cc_mod :: Module

  Name of module defining this CC.

- cc_loc :: SrcSpan

#### Instances

Instances details

Data CostCentre Source # |

Instance details

Defined in GHC.Types.CostCentre

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CostCentre -> c CostCentre Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CostCentre Source #

toConstr :: CostCentre -> Constr Source #

dataTypeOf :: CostCentre -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CostCentre) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CostCentre) Source #

gmapT :: (forall b. Data b => b -> b) -> CostCentre -> CostCentre Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CostCentre -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CostCentre -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CostCentre -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CostCentre -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CostCentre -> m CostCentre Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CostCentre -> m CostCentre Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CostCentre -> m CostCentre Source #

Binary CostCentre Source # |
Instance details Defined in GHC.Types.CostCentre Methods put_ :: WriteBinHandle -> CostCentre -> IO () Source # put :: WriteBinHandle -> CostCentre -> IO (Bin CostCentre) Source # get :: ReadBinHandle -> IO CostCentre Source #
Outputable CostCentre Source # |
Instance details Defined in GHC.Types.CostCentre Methods ppr :: CostCentre -> SDoc Source #
Eq CostCentre Source # |
Instance details Defined in GHC.Types.CostCentre Methods (==) :: CostCentre -> CostCentre -> Bool Source # (/=) :: CostCentre -> CostCentre -> Bool Source #
Ord CostCentre Source # |

Instance details

Defined in GHC.Types.CostCentre

Methods

compare :: CostCentre -> CostCentre -> Ordering Source #

(<) :: CostCentre -> CostCentre -> Bool Source #

(<=) :: CostCentre -> CostCentre -> Bool Source #

(>) :: CostCentre -> CostCentre -> Bool Source #

(>=) :: CostCentre -> CostCentre -> Bool Source #

max :: CostCentre -> CostCentre -> CostCentre Source #

min :: CostCentre -> CostCentre -> CostCentre Source #

type CcName = FastString Source #

data CCFlavour Source #

The flavour of a cost centre.

Index fields represent 0-based indices giving source-code ordering of centres with the same module, name, and flavour.

#### Instances

Instances details

Data CCFlavour Source # |

Instance details

Defined in GHC.Types.CostCentre

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCFlavour -> c CCFlavour Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCFlavour Source #

toConstr :: CCFlavour -> Constr Source #

dataTypeOf :: CCFlavour -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCFlavour) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCFlavour) Source #

gmapT :: (forall b. Data b => b -> b) -> CCFlavour -> CCFlavour Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCFlavour -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCFlavour -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CCFlavour -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CCFlavour -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCFlavour -> m CCFlavour Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCFlavour -> m CCFlavour Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCFlavour -> m CCFlavour Source #

Binary CCFlavour Source # |
Instance details Defined in GHC.Types.CostCentre Methods put_ :: WriteBinHandle -> CCFlavour -> IO () Source # put :: WriteBinHandle -> CCFlavour -> IO (Bin CCFlavour) Source # get :: ReadBinHandle -> IO CCFlavour Source #
Eq CCFlavour Source # |
Instance details Defined in GHC.Types.CostCentre Methods (==) :: CCFlavour -> CCFlavour -> Bool Source # (/=) :: CCFlavour -> CCFlavour -> Bool Source #
Ord CCFlavour Source # |

Instance details

Defined in GHC.Types.CostCentre

Methods

compare :: CCFlavour -> CCFlavour -> Ordering Source #

(<) :: CCFlavour -> CCFlavour -> Bool Source #

(<=) :: CCFlavour -> CCFlavour -> Bool Source #

(>) :: CCFlavour -> CCFlavour -> Bool Source #

(>=) :: CCFlavour -> CCFlavour -> Bool Source #

max :: CCFlavour -> CCFlavour -> CCFlavour Source #

min :: CCFlavour -> CCFlavour -> CCFlavour Source #

mkCafFlavour :: CCFlavour Source #

mkExprCCFlavour :: CostCentreIndex -> CCFlavour Source #

mkDeclCCFlavour :: CostCentreIndex -> CCFlavour Source #

mkHpcCCFlavour :: CostCentreIndex -> CCFlavour Source #

mkLateCCFlavour :: CostCentreIndex -> CCFlavour Source #

mkCallerCCFlavour :: CostCentreIndex -> CCFlavour Source #

getAllCAFsCC :: Module -> (CostCentre, CostCentreStack) Source #

pprCostCentre :: IsLine doc => CostCentre -> doc Source #

data CostCentreStack Source #

A Cost Centre Stack is something that can be attached to a closure. This is either:

- the current cost centre stack (CCCS)
- a pre-defined cost centre stack (there are several pre-defined CCSs, see below).

#### Instances

Instances details

Outputable CostCentreStack Source # |
Instance details Defined in GHC.Types.CostCentre Methods ppr :: CostCentreStack -> SDoc Source #
Eq CostCentreStack Source # |
Instance details Defined in GHC.Types.CostCentre Methods (==) :: CostCentreStack -> CostCentreStack -> Bool Source # (/=) :: CostCentreStack -> CostCentreStack -> Bool Source #
Ord CostCentreStack Source # |

Instance details

Defined in GHC.Types.CostCentre

Methods

compare :: CostCentreStack -> CostCentreStack -> Ordering Source #

(<) :: CostCentreStack -> CostCentreStack -> Bool Source #

(<=) :: CostCentreStack -> CostCentreStack -> Bool Source #

(>) :: CostCentreStack -> CostCentreStack -> Bool Source #

(>=) :: CostCentreStack -> CostCentreStack -> Bool Source #

max :: CostCentreStack -> CostCentreStack -> CostCentreStack Source #

min :: CostCentreStack -> CostCentreStack -> CostCentreStack Source #

pprCostCentreStack :: IsLine doc => CostCentreStack -> doc Source #

type CollectedCCs = ([CostCentre], [CostCentreStack]) Source #

emptyCollectedCCs :: CollectedCCs Source #

collectCC :: CostCentre -> CostCentreStack -> CollectedCCs -> CollectedCCs Source #

currentCCS :: CostCentreStack Source #

dontCareCCS :: CostCentreStack Source #

isCurrentCCS :: CostCentreStack -> Bool Source #

maybeSingletonCCS :: CostCentreStack -> Maybe CostCentre Source #

mkUserCC :: FastString -> Module -> SrcSpan -> CCFlavour -> CostCentre Source #

mkAutoCC :: Id -> Module -> CostCentre Source #

mkAllCafsCC :: Module -> SrcSpan -> CostCentre Source #

mkSingletonCCS :: CostCentre -> CostCentreStack Source #

isCafCCS :: CostCentreStack -> Bool Source #

isCafCC :: CostCentre -> Bool Source #

isSccCountCC :: CostCentre -> Bool Source #

Is this a cost-centre which records scc counts

sccAbleCC :: CostCentre -> Bool Source #

Is this a cost-centre which can be sccd ?

ccFromThisModule :: CostCentre -> Module -> Bool Source #

pprCostCentreCore :: CostCentre -> SDoc Source #

Print a flavour in Core

costCentreUserName :: CostCentre -> String Source #

costCentreUserNameFS :: CostCentre -> FastString Source #

costCentreSrcSpan :: CostCentre -> SrcSpan Source #

cmpCostCentre :: CostCentre -> CostCentre -> Ordering Source #