summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-02-25 14:51:47 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-28 19:17:12 -0500
commit4f0208e53444d32c7f3795b3ac15acbfc75bf58c (patch)
treed06a70f2bd3b00503ba87666fcbe12cc525aa462 /compiler/GHC/Cmm
parentadfddf7de3a9c1f757cbf027815a4b4f6ee86a7e (diff)
downloadhaskell-4f0208e53444d32c7f3795b3ac15acbfc75bf58c.tar.gz
CLabel cleanup:
Remove these smart constructors for these reasons: * mkLocalClosureTableLabel : Does the same as the non-local variant. * mkLocalClosureLabel : Does the same as the non-local variant. * mkLocalInfoTableLabel : Decide if we make a local label based on the name and just use mkInfoTableLabel everywhere.
Diffstat (limited to 'compiler/GHC/Cmm')
-rw-r--r--compiler/GHC/Cmm/CLabel.hs16
-rw-r--r--compiler/GHC/Cmm/Info/Build.hs4
2 files changed, 6 insertions, 14 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index dd7e1f14f5..933151a679 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -33,9 +33,6 @@ module GHC.Cmm.CLabel (
mkBytesLabel,
mkLocalBlockLabel,
- mkLocalClosureLabel,
- mkLocalInfoTableLabel,
- mkLocalClosureTableLabel,
mkBlockInfoTableLabel,
@@ -587,14 +584,6 @@ mkRednCountsLabel name = IdLabel name NoCafRefs (IdTickyInfo TickyRednCounts)
mkTagHitLabel :: Name -> Unique -> CLabel
mkTagHitLabel name !uniq = IdLabel name NoCafRefs (IdTickyInfo (TickyInferedTag uniq))
--- These have local & (possibly) external variants:
-mkLocalClosureLabel :: Name -> CafInfo -> CLabel
-mkLocalInfoTableLabel :: Name -> CafInfo -> CLabel
-mkLocalClosureTableLabel :: Name -> CafInfo -> CLabel
-mkLocalClosureLabel !name !c = IdLabel name c Closure
-mkLocalInfoTableLabel name c = IdLabel name c LocalInfoTable
-mkLocalClosureTableLabel name c = IdLabel name c ClosureTable
-
mkClosureLabel :: Name -> CafInfo -> CLabel
mkInfoTableLabel :: Name -> CafInfo -> CLabel
mkEntryLabel :: Name -> CafInfo -> CLabel
@@ -602,7 +591,10 @@ mkClosureTableLabel :: Name -> CafInfo -> CLabel
mkConInfoTableLabel :: Name -> ConInfoTableLocation -> CLabel
mkBytesLabel :: Name -> CLabel
mkClosureLabel name c = IdLabel name c Closure
-mkInfoTableLabel name c = IdLabel name c InfoTable
+-- | Decicdes between external and local labels based on the names externality.
+mkInfoTableLabel name c
+ | isExternalName name = IdLabel name c InfoTable
+ | otherwise = IdLabel name c LocalInfoTable
mkEntryLabel name c = IdLabel name c Entry
mkClosureTableLabel name c = IdLabel name c ClosureTable
-- Special case for the normal 'DefinitionSite' case so that the 'ConInfoTable' application can be floated to a CAF.
diff --git a/compiler/GHC/Cmm/Info/Build.hs b/compiler/GHC/Cmm/Info/Build.hs
index 571a1faae7..4087225146 100644
--- a/compiler/GHC/Cmm/Info/Build.hs
+++ b/compiler/GHC/Cmm/Info/Build.hs
@@ -757,7 +757,7 @@ getStaticFuns decls =
, Just (id, _) <- [cit_clo info]
, let rep = cit_rep info
, isStaticRep rep && isFunRep rep
- , let !lbl = mkLocalClosureLabel (idName id) (idCafInfo id)
+ , let !lbl = mkClosureLabel (idName id) (idCafInfo id)
]
@@ -1219,7 +1219,7 @@ updInfoSRTs profile srt_env funSRTEnv caffy (CmmProc top_info top_l live g)
HeapRep sta ptrs nptrs ty ->
HeapRep sta (ptrs + length srtEntries) nptrs ty
_other -> panic "maybeStaticFun"
- lbl = mkLocalClosureLabel (idName id) caf_info
+ lbl = mkClosureLabel (idName id) caf_info
in
Just (newInfo, mkDataLits (Section Data lbl) lbl fields)
| otherwise = Nothing