- | noCCSAttached no_cc || currentOrSubsumedCCS no_cc
- -- Top level CAF without a cost centre attached
- -- Attach CAF cc (collect if individual CAF ccs)
- = (if opt_AutoSccsOnIndividualCafs
- then let cc = mkAutoCC binder modl CafCC
- ccs = mkSingletonCCS cc
- -- careful: the binder might be :Main.main,
- -- which doesn't belong to module mod_name.
- -- bug #249, tests prof001, prof002
- modl | Just m <- nameModule_maybe (idName binder) = m
- | otherwise = mod_name
- in
- collectNewCC cc `thenMM_`
- collectCCS ccs `thenMM_`
- returnMM ccs
- else
- returnMM all_cafs_ccs) `thenMM` \ caf_ccs ->
- set_prevailing_cc caf_ccs (do_expr body) `thenMM` \ body' ->
- returnMM (StgRhsClosure caf_ccs bi fv u srt [] body')
-
- do_top_rhs binder (StgRhsClosure cc bi fv u srt [] body)
- -- Top level CAF with cost centre attached
- -- Should this be a CAF cc ??? Does this ever occur ???
+ | noCCSAttached no_cc || currentOrSubsumedCCS no_cc = do
+ -- Top level CAF without a cost centre attached
+ -- Attach CAF cc (collect if individual CAF ccs)
+ caf_ccs <- if dopt Opt_AutoSccsOnIndividualCafs dflags
+ then let cc = mkAutoCC binder modl CafCC
+ ccs = mkSingletonCCS cc
+ -- careful: the binder might be :Main.main,
+ -- which doesn't belong to module mod_name.
+ -- bug #249, tests prof001, prof002
+ modl | Just m <- nameModule_maybe (idName binder) = m
+ | otherwise = mod_name
+ in do
+ collectNewCC cc
+ collectCCS ccs
+ return ccs
+ else
+ return all_cafs_ccs
+ body' <- set_prevailing_cc caf_ccs (do_expr body)
+ return (StgRhsClosure caf_ccs bi fv u srt [] body')
+
+ do_top_rhs _ (StgRhsClosure cc _ _ _ _ [] _)
+ -- Top level CAF with cost centre attached
+ -- Should this be a CAF cc ??? Does this ever occur ???