[Git][ghc/ghc][wip/T23479] Add tracing capabilities for GlobalOcc's

Serge S. Gulin (@gulin.serge) gitlab at gitlab.haskell.org
Fri Sep 27 18:21:37 UTC 2024



Serge S. Gulin pushed to branch wip/T23479 at Glasgow Haskell Compiler / GHC


Commits:
285413a0 by Serge S. Gulin at 2024-09-27T21:21:27+03:00
Add tracing capabilities for GlobalOcc's

- - - - -


1 changed file:

- compiler/GHC/StgToJS/Monad.hs


Changes:

=====================================
compiler/GHC/StgToJS/Monad.hs
=====================================
@@ -31,6 +31,7 @@ import GHC.JS.Transform
 import GHC.StgToJS.Types
 
 import GHC.Unit.Module
+import GHC.Utils.Outputable
 import GHC.Stg.Syntax
 
 import GHC.Types.SrcLoc
@@ -159,6 +160,13 @@ data GlobalOcc = GlobalOcc
   , global_count :: !Word
   }
 
+instance Outputable GlobalOcc where
+  ppr g = hang (text "GlobalOcc") 2 $ vcat
+            [ hcat [text "Ident: ", ppr (global_ident g)]
+            , hcat [text "Id:", ppr (global_id g)]
+            , hcat [text "Count:", ppr (global_count g)]
+            ]
+
 -- | Return number of occurrences of every global id used in the given JStgStat.
 -- Sort by increasing occurrence count.
 globalOccs :: JStgStat -> G [GlobalOcc]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/285413a01582a9621cc10a4d4d9dea4a276e6598

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/285413a01582a9621cc10a4d4d9dea4a276e6598
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240927/eed924ee/attachment-0001.html>


More information about the ghc-commits mailing list