summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/StgToCmm.hs')
-rw-r--r--compiler/GHC/StgToCmm.hs24
1 files changed, 23 insertions, 1 deletions
diff --git a/compiler/GHC/StgToCmm.hs b/compiler/GHC/StgToCmm.hs
index 1a4bd47439..43b3cfc635 100644
--- a/compiler/GHC/StgToCmm.hs
+++ b/compiler/GHC/StgToCmm.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE BangPatterns #-}
-----------------------------------------------------------------------------
--
@@ -25,6 +26,7 @@ import GHC.StgToCmm.Utils
import GHC.StgToCmm.Closure
import GHC.StgToCmm.Hpc
import GHC.StgToCmm.Ticky
+import GHC.StgToCmm.Types (ModuleLFInfos)
import GHC.Cmm
import GHC.Cmm.Utils
@@ -47,6 +49,8 @@ import GHC.Data.Stream
import GHC.Types.Basic
import GHC.Types.Var.Set ( isEmptyDVarSet )
import GHC.SysTools.FileCleanup
+import GHC.Types.Unique.FM
+import GHC.Types.Name.Env
import GHC.Data.OrdList
import GHC.Cmm.Graph
@@ -63,7 +67,8 @@ codeGen :: DynFlags
-> CollectedCCs -- (Local/global) cost-centres needing declaring/registering.
-> [CgStgTopBinding] -- Bindings to convert
-> HpcInfo
- -> Stream IO CmmGroup () -- Output as a stream, so codegen can
+ -> Stream IO CmmGroup ModuleLFInfos
+ -- Output as a stream, so codegen can
-- be interleaved with output
codeGen dflags this_mod data_tycons
@@ -105,6 +110,23 @@ codeGen dflags this_mod data_tycons
mapM_ (cg . cgDataCon) (tyConDataCons tycon)
; mapM_ do_tycon data_tycons
+
+ ; cg_id_infos <- cgs_binds <$> liftIO (readIORef cgref)
+
+ -- See Note [Conveying CAF-info and LFInfo between modules] in
+ -- GHC.StgToCmm.Types
+ ; let extractInfo info = (name, lf)
+ where
+ !name = idName (cg_id info)
+ !lf = cg_lf info
+
+ !generatedInfo
+ | gopt Opt_OmitInterfacePragmas dflags
+ = emptyNameEnv
+ | otherwise
+ = mkNameEnv (Prelude.map extractInfo (eltsUFM cg_id_infos))
+
+ ; return generatedInfo
}
---------------------------------------------------------------