GHC.Core.LateCC.Utils

ghc-9.10.0.20240426: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Core.LateCC.Utils

Contents

- Inserting cost centres
  - Helpers for defining insertion methods

Synopsis

- doLateCostCenters :: LateCCEnv -> LateCCState s -> (CoreBind -> LateCCM s CoreBind) -> CoreProgram -> (CoreProgram, LateCCState s)
- getCCFlavour :: FastString -> LateCCM s CCFlavour
- insertCC :: FastString -> SrcSpan -> CoreExpr -> LateCCM s CoreExpr

# Inserting cost centres

doLateCostCenters Source #

Arguments

:: LateCCEnv | Environment to run the insertion in
-> LateCCState s | Initial state to run the insertion with
-> (CoreBind -> LateCCM s CoreBind) | Insertion method
-> CoreProgram | Bindings to consider
-> (CoreProgram, LateCCState s) |

Insert cost centres into the `CoreProgram` using the provided environment, initial state, and insertion method.

## Helpers for defining insertion methods

getCCFlavour :: FastString -> LateCCM s CCFlavour Source #

Given the name of a cost centre, get its flavour

insertCC Source #

Arguments

:: FastString | Name of the cost centre to insert
-> SrcSpan | Source location to associate with the cost centre
-> CoreExpr | Expression to wrap in the cost centre
-> LateCCM s CoreExpr |

Insert a cost centre with the specified name and source span on the given expression. The inserted cost centre will be appropriately tracked in the late cost centre state.