ghc-9.12.0.20241114: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Core.LateCC.Utils

Synopsis

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.