[Git][ghc/ghc][wip/romes/12935] Tweaks

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Wed Jun 26 13:15:29 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/12935 at Glasgow Haskell Compiler / GHC


Commits:
5728e577 by Rodrigo Mesquita at 2024-06-26T14:15:01+01:00
Tweaks

- - - - -


3 changed files:

- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Pipeline.hs
- compiler/GHC/Cmm/UniqueRenamer.hs


Changes:

=====================================
compiler/GHC/Cmm/CLabel.hs
=====================================
@@ -1852,9 +1852,10 @@ returns True.
 -- Note that not all Uniques are mapped over. Only those that can be safely alpha
 -- renamed, eg uniques of local symbols or of system names.
 -- See Note [....TODO]
+-- ROMES:TODO: We can do less work here, like, do we really need to rename AsmTempLabel, SRTLabel, LocalBlockLabel?
 mapInternalNonDetUniques :: Applicative m => (Unique -> m Unique) -> CLabel -> m CLabel
 mapInternalNonDetUniques f = \case
-  il@(IdLabel name cafInfo idLabelInfo) -> IdLabel . setNameUnique name <$> f (nameUnique name) <*> pure cafInfo <*> pure idLabelInfo
+  IdLabel name cafInfo idLabelInfo -> IdLabel . setNameUnique name <$> f (nameUnique name) <*> pure cafInfo <*> pure idLabelInfo
   cl at CmmLabel{} -> pure cl
   -- ROMES:TODO: what about `RtsApFast NonDetFastString`?
   RtsLabel rtsLblInfo -> pure $ RtsLabel rtsLblInfo


=====================================
compiler/GHC/Cmm/Pipeline.hs
=====================================
@@ -78,7 +78,7 @@ cpsTop logger platform cfg proc =
       --
       CmmProc h l v g <- {-# SCC "cmmCfgOpts(1)" #-}
            return $ cmmCfgOptsProc splitting_proc_points proc
-      dump Opt_D_dump_cmm_cfg "Post control-flow optimisations" g
+      dump Opt_D_dump_cmm_cfg "Post control-flow optimisations (1)" g
 
       let !TopInfo {stack_info=StackInfo { arg_space = entry_off
                                          , do_layout = do_layout }} = h
@@ -168,7 +168,7 @@ cpsTop logger platform cfg proc =
                     else g
       g <- return $ map (removeUnreachableBlocksProc platform) g
            -- See Note [unreachable blocks]
-      dumps Opt_D_dump_cmm_cfg "Post control-flow optimisations" g
+      dumps Opt_D_dump_cmm_cfg "Post control-flow optimisations (2)" g
 
       return (Left (cafEnv, g))
 


=====================================
compiler/GHC/Cmm/UniqueRenamer.hs
=====================================
@@ -110,7 +110,9 @@ instance UniqRenamable CLabel where
   uniqRename = detRenameCLabel
 
 instance UniqRenamable LocalReg where
-  uniqRename (LocalReg uq t) = LocalReg <$> renameDetUniq uq <*> pure t
+  -- uniqRename (LocalReg uq t) = LocalReg <$> renameDetUniq uq <*> pure t
+  uniqRename (LocalReg uq t) = pure $ LocalReg uq t
+    -- ROMES:TODO: This has unique r1, we're debugging. this may still be a source of non determinism.
 
 instance UniqRenamable Label where
   uniqRename lbl = mkHooplLabel . getKey <$> renameDetUniq (getUnique lbl)
@@ -125,19 +127,6 @@ instance (UniqRenamable a, UniqRenamable b) => UniqRenamable (GenCmmDecl a b Cmm
   uniqRename (CmmData sec d)
     = CmmData <$> uniqRename sec <*> uniqRename d
 
--- instance UniqRenamable ModuleSRTInfo where
---   uniqRename
---     ModuleSRTInfo{thisModule, dedupSRTs, flatSRTs, moduleSRTMap}
---     -- ROMES:TODO: I feel like we don't really need to do this for all of these maps, and can shortcut some of this
---     -- Nonetheless, in order to produce a working prototype, I'm just always renaming them all. We can optimise later.
---       = ModuleSRTInfo thisModule <$> uniqRename dedupSRTs <*> uniqRename flatSRTs <*> uniqRename moduleSRTMap
-
--- instance UniqRenamable SRTEntry where
---   uniqRename (SRTEntry cl) = SRTEntry <$> uniqRename cl
-
--- instance UniqRenamable CAFfyLabel where
---   uniqRename (CAFfyLabel cl) = CAFfyLabel <$> uniqRename cl
-
 instance UniqRenamable CmmDataDecl where
   uniqRename (CmmData sec d)
     = CmmData <$> uniqRename sec <*> uniqRename d



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5728e577ad7636279b7ee1166aa1cb79dd9536dd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5728e577ad7636279b7ee1166aa1cb79dd9536dd
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/20240626/3ac9444b/attachment-0001.html>


More information about the ghc-commits mailing list