summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-10-28 21:05:34 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-11-04 15:54:25 +0100
commit4dd9e74bb216244c77e973eca8047447dddd1509 (patch)
treee11a998f4ca8a25badfb289e2ff540347e78acea /compiler/GHC/Cmm
parent311251543f2e37af4a121e58028bfc46267a7fc9 (diff)
downloadhaskell-wip/strings-refactor3.tar.gz
Minor refactor around FastStringswip/strings-refactor3
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