summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/CgProf.hs6
-rw-r--r--compiler/codeGen/StgCmmProf.hs12
2 files changed, 15 insertions, 3 deletions
diff --git a/compiler/codeGen/CgProf.hs b/compiler/codeGen/CgProf.hs
index cac33eef90..a2e40d0f78 100644
--- a/compiler/codeGen/CgProf.hs
+++ b/compiler/codeGen/CgProf.hs
@@ -170,11 +170,15 @@ emitCostCentreDecl cc = do
-- All cost centres will be in the main package, since we
-- don't normally use -auto-all or add SCCs to other packages.
-- Hence don't emit the package name in the module here.
+ ; loc <- newByteStringCLit $ bytesFS $ mkFastString $
+ showSDoc (ppr (costCentreSrcSpan cc))
+ -- XXX going via FastString to get UTF-8 encoding is silly
; let
lits = [ zero, -- StgInt ccID,
label, -- char *label,
modl, -- char *module,
- zero, -- StgWord time_ticks
+ loc, -- char *srcloc,
+ zero, -- StgWord time_ticks
zero64, -- StgWord64 mem_alloc
is_caf, -- StgInt is_caf
zero -- struct _CostCentre *link
diff --git a/compiler/codeGen/StgCmmProf.hs b/compiler/codeGen/StgCmmProf.hs
index 115ef1f45e..88031dce48 100644
--- a/compiler/codeGen/StgCmmProf.hs
+++ b/compiler/codeGen/StgCmmProf.hs
@@ -58,6 +58,7 @@ import Constants -- Lots of field offsets
import Outputable
import Control.Monad
+import Data.Char (ord)
-----------------------------------------------------------------------------
--
@@ -217,18 +218,25 @@ emitCostCentreDecl cc = do
; modl <- newByteStringCLit (bytesFS $ Module.moduleNameFS
$ Module.moduleName
$ cc_mod cc)
+ ; loc <- newStringCLit (showSDoc (ppr (costCentreSrcSpan cc)))
+ -- XXX should UTF-8 encode
-- All cost centres will be in the main package, since we
-- don't normally use -auto-all or add SCCs to other packages.
-- Hence don't emit the package name in the module here.
; let lits = [ zero, -- StgInt ccID,
label, -- char *label,
- modl, -- char *module,
- zero, -- StgWord time_ticks
+ modl, -- char *module,
+ loc, -- char *srcloc,
+ zero, -- StgWord time_ticks
zero64, -- StgWord64 mem_alloc
+ is_caf, -- StgInt is_caf
zero -- struct _CostCentre *link
]
; emitDataLits (mkCCLabel cc) lits
}
+ where
+ is_caf | isCafCC cc = mkIntCLit (ord 'c') -- 'c' == is a CAF
+ | otherwise = zero
emitCostCentreStackDecl :: CostCentreStack -> FCode ()
emitCostCentreStackDecl ccs