summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm/Prof.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-25 19:20:25 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-02 20:08:36 -0400
commitf08d6316d3d19b627550d99b4364e9bf0b45c329 (patch)
tree65e52dcc0b0fc940da95885e7e3e4ca5e585ce49 /compiler/GHC/StgToCmm/Prof.hs
parent4d90b3ff02002ea25460d087dde56f69a9641096 (diff)
downloadhaskell-f08d6316d3d19b627550d99b4364e9bf0b45c329.tar.gz
Replace Opt_SccProfilingOn flag with sccProfilingEnabled helper function
SCC profiling was enabled in a convoluted way: if WayProf was enabled, Opt_SccProfilingOn general flag was set (in `GHC.Driver.Ways.wayGeneralFlags`), and then this flag was queried in various places. There is no need to go via general flags, so this patch defines a `sccProfilingEnabled :: DynFlags -> Bool` helper function that just checks whether WayProf is enabled.
Diffstat (limited to 'compiler/GHC/StgToCmm/Prof.hs')
-rw-r--r--compiler/GHC/StgToCmm/Prof.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/GHC/StgToCmm/Prof.hs b/compiler/GHC/StgToCmm/Prof.hs
index 8de1445d21..1381617f89 100644
--- a/compiler/GHC/StgToCmm/Prof.hs
+++ b/compiler/GHC/StgToCmm/Prof.hs
@@ -76,15 +76,15 @@ costCentreFrom dflags cl = CmmLoad (cmmOffsetB platform cl (oFFSET_StgHeader_ccs
-- | The profiling header words in a static closure
staticProfHdr :: DynFlags -> CostCentreStack -> [CmmLit]
staticProfHdr dflags ccs
- | gopt Opt_SccProfilingOn dflags = [mkCCostCentreStack ccs, staticLdvInit platform]
- | otherwise = []
+ | sccProfilingEnabled dflags = [mkCCostCentreStack ccs, staticLdvInit platform]
+ | otherwise = []
where platform = targetPlatform dflags
-- | Profiling header words in a dynamic closure
dynProfHdr :: DynFlags -> CmmExpr -> [CmmExpr]
dynProfHdr dflags ccs
- | gopt Opt_SccProfilingOn dflags = [ccs, dynLdvInit dflags]
- | otherwise = []
+ | sccProfilingEnabled dflags = [ccs, dynLdvInit dflags]
+ | otherwise = []
-- | Initialise the profiling field of an update frame
initUpdFrameProf :: CmmExpr -> FCode ()
@@ -130,7 +130,7 @@ saveCurrentCostCentre :: FCode (Maybe LocalReg)
saveCurrentCostCentre
= do dflags <- getDynFlags
platform <- getPlatform
- if not (gopt Opt_SccProfilingOn dflags)
+ if not (sccProfilingEnabled dflags)
then return Nothing
else do local_cc <- newTemp (ccType platform)
emitAssign (CmmLocal local_cc) cccsExpr
@@ -195,7 +195,7 @@ enterCostCentreFun ccs closure =
ifProfiling :: FCode () -> FCode ()
ifProfiling code
= do dflags <- getDynFlags
- if gopt Opt_SccProfilingOn dflags
+ if sccProfilingEnabled dflags
then code
else return ()
@@ -207,7 +207,7 @@ initCostCentres :: CollectedCCs -> FCode ()
-- Emit the declarations
initCostCentres (local_CCs, singleton_CCSs)
= do dflags <- getDynFlags
- when (gopt Opt_SccProfilingOn dflags) $
+ when (sccProfilingEnabled dflags) $
do mapM_ emitCostCentreDecl local_CCs
mapM_ emitCostCentreStackDecl singleton_CCSs
@@ -277,7 +277,7 @@ emitSetCCC :: CostCentre -> Bool -> Bool -> FCode ()
emitSetCCC cc tick push
= do dflags <- getDynFlags
platform <- getPlatform
- if not (gopt Opt_SccProfilingOn dflags)
+ if not (sccProfilingEnabled dflags)
then return ()
else do tmp <- newTemp (ccsType platform)
pushCostCentre tmp cccsExpr cc