- | noCostCentreAttached cc || currentOrSubsumedCosts cc
- -- Top level CAF without a cost centre attached: Collect
- -- cost centre with binder name, if collecting CAFs.
- = let
- (did_something, cc2)
- = if do_auto_sccs_on_cafs then
- (True, mkAutoCC binder mod_name grp_name IsCafCC)
- else
- (False, all_cafs_cc)
- in
- (if did_something
- then collectCC cc2
- else nopMM) `thenMM_`
- set_prevailing_cc cc2 (
- do_expr body
- ) `thenMM` \body2 ->
- returnMM (StgRhsClosure cc2 bi fv u [] body2)
-
- do_top_rhs binder (StgRhsClosure _ bi fv u args body@(StgSCC ty cc expr))
- -- We blindly use the cc off the _scc_
- = set_prevailing_cc cc (
- do_expr body
- ) `thenMM` \ body2 ->
- returnMM (StgRhsClosure cc bi fv u args body2)
-
- do_top_rhs binder (StgRhsClosure cc bi fv u args body)
- = let
- cc2 = if noCostCentreAttached cc
- then subsumedCosts -- it's not a thunk; it is top-level & arity > 0
- else cc
- in
- set_prevailing_cc cc2 (
- do_expr body
- ) `thenMM` \ body' ->
- returnMM (StgRhsClosure cc2 bi fv u args body')
+ -- Top level CAF with cost centre attached
+ -- Should this be a CAF cc ??? Does this ever occur ???
+ = pprPanic "SCCfinal: CAF with cc:" (ppr cc)
+
+ do_top_rhs binder (StgRhsClosure no_ccs bi fv u args body)
+ -- Top level function, probably subsumed
+ | noCCSAttached no_ccs
+ = set_lambda_cc (do_expr body) `thenMM` \ body' ->
+ returnMM (StgRhsClosure subsumedCCS bi fv u args body')