- do_top_rhs binder (StgRhsClosure rhs_cc bi fv u [] (StgSCC ty cc (StgCon con args lvs)))
- -- top-level _scc_ around nothing but static data; toss it -- it's pointless
- = returnMM (StgRhsCon dontCareCostCentre con args)
-
- do_top_rhs binder (StgRhsClosure rhs_cc bi fv u [] (StgSCC ty cc expr))
- -- Top level CAF with explicit scc expression. Attach CAF
- -- cost centre to StgRhsClosure and collect.
- = let
- calved_cc = cafifyCC cc
- in
- collectCC calved_cc `thenMM_`
- set_prevailing_cc calved_cc (
- do_expr expr
- ) `thenMM` \ expr' ->
- returnMM (StgRhsClosure calved_cc bi fv u [] expr')
-
- do_top_rhs binder (StgRhsClosure cc bi fv u [] body)
- | 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')
+ do_top_rhs binder (StgRhsClosure _ bi fv u srt [] (StgSCC cc (StgConApp con args)))
+ | not (isSccCountCostCentre cc) && not (isDllConApp con args)
+ -- Trivial _scc_ around nothing but static data
+ -- Eliminate _scc_ ... and turn into StgRhsCon
+
+ -- isDllConApp checks for LitLit args too
+ = returnMM (StgRhsCon dontCareCCS con args)
+
+{- Can't do this one with cost-centre stacks: --SDM
+ do_top_rhs binder (StgRhsClosure no_cc bi fv u [] (StgSCC ty cc expr))
+ | (noCCSAttached no_cc || currentOrSubsumedCCS no_cc)
+ && not (isSccCountCostCentre cc)
+ -- Top level CAF without a cost centre attached
+ -- Attach and collect cc of trivial _scc_ in body
+ = collectCC cc `thenMM_`
+ set_prevailing_cc cc (do_expr expr) `thenMM` \ expr' ->
+ returnMM (StgRhsClosure cc bi fv u [] expr')
+-}