summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-10-28 21:05:34 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-05 00:29:57 -0400
commit3c0e379322965aa87b14923f6d8e1ef5cd677925 (patch)
treec7db820ab9cd898e3539b4704d041bbaf0d6954f /compiler/GHC/Cmm
parentbdc8cbb3a0808632fc6b33a7e3c10212f5d8a5e9 (diff)
downloadhaskell-3c0e379322965aa87b14923f6d8e1ef5cd677925.tar.gz
Minor refactor around FastStrings
Pass FastStrings to functions directly, to make sure the rule for fsLit "literal" fires. Remove SDoc indirection in GHCi.UI.Tags and GHC.Unit.Module.Graph.
Diffstat (limited to 'compiler/GHC/Cmm')
-rw-r--r--compiler/GHC/Cmm/BlockId.hs3
-rw-r--r--compiler/GHC/Cmm/CLabel.hs22
2 files changed, 13 insertions, 12 deletions
diff --git a/compiler/GHC/Cmm/BlockId.hs b/compiler/GHC/Cmm/BlockId.hs
index e6396c8e83..ec52a3842a 100644
--- a/compiler/GHC/Cmm/BlockId.hs
+++ b/compiler/GHC/Cmm/BlockId.hs
@@ -11,6 +11,7 @@ module GHC.Cmm.BlockId
import GHC.Prelude
import GHC.Cmm.CLabel
+import GHC.Data.FastString
import GHC.Types.Id.Info
import GHC.Types.Name
import GHC.Types.Unique
@@ -43,4 +44,4 @@ blockLbl label = mkLocalBlockLabel (getUnique label)
infoTblLbl :: BlockId -> CLabel
infoTblLbl label
- = mkBlockInfoTableLabel (mkFCallName (getUnique label) "block") NoCafRefs
+ = mkBlockInfoTableLabel (mkFCallName (getUnique label) (fsLit "block")) NoCafRefs
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index bf4214fed2..22c1c9ef05 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -300,19 +300,19 @@ instance Show CLabel where
show = showPprUnsafe . pprDebugCLabel genericPlatform
data ModuleLabelKind
- = MLK_Initializer String
+ = MLK_Initializer LexicalFastString
| MLK_InitializerArray
- | MLK_Finalizer String
+ | MLK_Finalizer LexicalFastString
| MLK_FinalizerArray
| MLK_IPEBuffer
deriving (Eq, Ord)
instance Outputable ModuleLabelKind where
- ppr MLK_InitializerArray = text "init_arr"
- ppr (MLK_Initializer s) = text ("init__" ++ s)
- ppr MLK_FinalizerArray = text "fini_arr"
- ppr (MLK_Finalizer s) = text ("fini__" ++ s)
- ppr MLK_IPEBuffer = text "ipe_buf"
+ ppr MLK_InitializerArray = text "init_arr"
+ ppr (MLK_Initializer (LexicalFastString s)) = text "init__" <> ftext s
+ ppr MLK_FinalizerArray = text "fini_arr"
+ ppr (MLK_Finalizer (LexicalFastString s)) = text "fini__" <> ftext s
+ ppr MLK_IPEBuffer = text "ipe_buf"
isIdLabel :: CLabel -> Bool
isIdLabel IdLabel{} = True
@@ -885,15 +885,15 @@ mkDeadStripPreventer lbl = DeadStripPreventer lbl
mkStringLitLabel :: Unique -> CLabel
mkStringLitLabel = StringLitLabel
-mkInitializerStubLabel :: Module -> String -> CLabel
-mkInitializerStubLabel mod s = ModuleLabel mod (MLK_Initializer s)
+mkInitializerStubLabel :: Module -> FastString -> CLabel
+mkInitializerStubLabel mod s = ModuleLabel mod (MLK_Initializer (LexicalFastString s))
mkInitializerArrayLabel :: Module -> CLabel
mkInitializerArrayLabel mod = ModuleLabel mod MLK_InitializerArray
-mkFinalizerStubLabel :: Module -> String -> CLabel
-mkFinalizerStubLabel mod s = ModuleLabel mod (MLK_Finalizer s)
+mkFinalizerStubLabel :: Module -> FastString -> CLabel
+mkFinalizerStubLabel mod s = ModuleLabel mod (MLK_Finalizer (LexicalFastString s))
mkFinalizerArrayLabel :: Module -> CLabel
mkFinalizerArrayLabel mod = ModuleLabel mod MLK_FinalizerArray