summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm/Env.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-11-25 17:03:08 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-02 01:14:59 -0500
commit75caafaafca5a1941c276f95017c34f68da8d679 (patch)
tree58113d937239965d60a3221c99a82b3739ebec58 /compiler/GHC/StgToCmm/Env.hs
parent7aeb6d29313b23cd8d4da5d42cd9e740cca5c1df (diff)
downloadhaskell-75caafaafca5a1941c276f95017c34f68da8d679.tar.gz
Ticky profiling improvements.
This adds a number of changes to ticky-ticky profiling. When an executable is profiled with IPE profiling it's now possible to associate id-related ticky counters to their source location. This works by emitting the info table address as part of the counter which can be looked up in the IPE table. Add a `-ticky-ap-thunk` flag. This flag prevents the use of some standard thunks which are precompiled into the RTS. This means reduced cache locality and increased code size. But it allows better attribution of execution cost to specific source locations instead of simple attributing it to the standard thunk. ticky-ticky now uses the `arg` field to emit additional information about counters in json format. When ticky-ticky is used in combination with the eventlog eventlog2html can be used to generate a html table from the eventlog similar to the old text output for ticky-ticky.
Diffstat (limited to 'compiler/GHC/StgToCmm/Env.hs')
-rw-r--r--compiler/GHC/StgToCmm/Env.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/GHC/StgToCmm/Env.hs b/compiler/GHC/StgToCmm/Env.hs
index eef1420a72..4d1fff30df 100644
--- a/compiler/GHC/StgToCmm/Env.hs
+++ b/compiler/GHC/StgToCmm/Env.hs
@@ -17,7 +17,7 @@ module GHC.StgToCmm.Env (
bindArgsToRegs, bindToReg, rebindToReg,
bindArgToReg, idToReg,
- getCgIdInfo,
+ getCgIdInfo, getCgInfo_maybe,
maybeLetNoEscape,
) where
@@ -44,6 +44,9 @@ import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
+import GHC.Builtin.Names (getUnique)
+
+
-------------------------------------
-- Manipulating CgIdInfo
-------------------------------------
@@ -150,6 +153,12 @@ getCgIdInfo id
cgLookupPanic id -- Bug
}}}
+-- | Retrieve cg info for a name if it already exists.
+getCgInfo_maybe :: Name -> FCode (Maybe CgIdInfo)
+getCgInfo_maybe name
+ = do { local_binds <- getBinds -- Try local bindings first
+ ; return $ lookupVarEnv_Directly local_binds (getUnique name) }
+
cgLookupPanic :: Id -> FCode a
cgLookupPanic id
= do local_binds <- getBinds