
I assume that if cost-centre-profiling is off then
dsExpr (HsScc _ e) = dsExpr e
Looks like the dsExpr case for HsScc would need that test.
Simon
From: Alan & Kim Zimmerman [mailto:alan.zimm@gmail.com]
Sent: 03 December 2014 13:03
To: Simon Peyton Jones
Cc: ghc-devs@haskell.org
Subject: Re: API Annotations and HsSCC / HsTickPragma
If I look in DeSugar.lhs I see
-- Desugar the program
; let export_set = availsToNameSet exports
target = hscTarget dflags
hpcInfo = emptyHpcInfo other_hpc_info
want_ticks = gopt Opt_Hpc dflags
|| target == HscInterpreted
|| (gopt Opt_SccProfilingOn dflags
&& case profAuto dflags of
NoProfAuto -> False
_ -> True)
; (binds_cvr, ds_hpc_info, modBreaks)
<- if want_ticks && not (isHsBootOrSig hsc_src)
then addTicksToBinds dflags mod mod_loc export_set
(typeEnvTyCons type_env) binds
else return (binds, hpcInfo, emptyModBreaks)
So it looks like `addTicksToBinds` is only called when profiling is on.
But there is also DsExpr.lhs which does
dsExpr (HsSCC cc expr@(L loc _)) = do
mod_name <- getModule
count <- goptM Opt_ProfCountEntries
uniq <- newUnique
Tick (ProfNote (mkUserCC cc mod_name loc uniq) count True) <$> dsLExpr expr
I *think* that the dsExpr value is ignored if profiling is inactive, and I am hoping that all that needs changing is the parser to always emit HsSCC, instead of HsPar if Opt_SccProfilingOn is not set.
Is this correct?
Alan
On Wed, Dec 3, 2014 at 1:52 PM, Alan & Kim Zimmerman