diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-10-28 21:05:34 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-11-04 15:54:25 +0100 |
commit | 4dd9e74bb216244c77e973eca8047447dddd1509 (patch) | |
tree | e11a998f4ca8a25badfb289e2ff540347e78acea /compiler/GHC/CmmToAsm | |
parent | 311251543f2e37af4a121e58028bfc46267a7fc9 (diff) | |
download | haskell-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/CmmToAsm')
-rw-r--r-- | compiler/GHC/CmmToAsm/AArch64/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/AArch64/Regs.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/PPC/CodeGen.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/PPC/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/PPC/Regs.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Instr.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Regs.hs | 5 |
8 files changed, 16 insertions, 12 deletions
diff --git a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs index 5ca443f08e..54cf73d55e 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs @@ -232,7 +232,7 @@ pprImm _ (ImmInt i) = int i pprImm _ (ImmInteger i) = integer i pprImm p (ImmCLbl l) = pprAsmLabel p l pprImm p (ImmIndex l i) = pprAsmLabel p l <> char '+' <> int i -pprImm _ (ImmLit s) = text s +pprImm _ (ImmLit s) = ftext s -- TODO: See pprIm below for why this is a bad idea! pprImm _ (ImmFloat f) diff --git a/compiler/GHC/CmmToAsm/AArch64/Regs.hs b/compiler/GHC/CmmToAsm/AArch64/Regs.hs index d3650c96f0..4895d2b092 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Regs.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Regs.hs @@ -2,6 +2,7 @@ module GHC.CmmToAsm.AArch64.Regs where import GHC.Prelude +import GHC.Data.FastString import GHC.Platform.Reg import GHC.Platform.Reg.Class @@ -59,7 +60,7 @@ data Imm = ImmInt Int | ImmInteger Integer -- Sigh. | ImmCLbl CLabel -- AbstractC Label (with baggage) - | ImmLit String + | ImmLit FastString | ImmIndex CLabel Int | ImmFloat Rational | ImmDouble Rational @@ -67,7 +68,7 @@ data Imm | ImmConstantDiff Imm Imm deriving (Eq, Show) -strImmLit :: String -> Imm +strImmLit :: FastString -> Imm strImmLit s = ImmLit s diff --git a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs index f8563004b5..abad5d0427 100644 --- a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs @@ -407,7 +407,7 @@ getRegister' :: NCGConfig -> Platform -> CmmExpr -> NatM Register getRegister' _ platform (CmmReg (CmmGlobal PicBaseReg)) | OSAIX <- platformOS platform = do let code dst = toOL [ LD II32 dst tocAddr ] - tocAddr = AddrRegImm toc (ImmLit "ghc_toc_table[TC]") + tocAddr = AddrRegImm toc (ImmLit (fsLit "ghc_toc_table[TC]")) return (Any II32 code) | target32Bit platform = do reg <- getPicBaseNat $ archWordFormat (target32Bit platform) diff --git a/compiler/GHC/CmmToAsm/PPC/Ppr.hs b/compiler/GHC/CmmToAsm/PPC/Ppr.hs index 19de3cd1e2..78abfcb0a3 100644 --- a/compiler/GHC/CmmToAsm/PPC/Ppr.hs +++ b/compiler/GHC/CmmToAsm/PPC/Ppr.hs @@ -240,7 +240,7 @@ pprImm platform = \case ImmInteger i -> integer i ImmCLbl l -> pprAsmLabel platform l ImmIndex l i -> pprAsmLabel platform l <> char '+' <> int i - ImmLit s -> text s + ImmLit s -> ftext s ImmFloat f -> float $ fromRational f ImmDouble d -> double $ fromRational d ImmConstantSum a b -> pprImm platform a <> char '+' <> pprImm platform b diff --git a/compiler/GHC/CmmToAsm/PPC/Regs.hs b/compiler/GHC/CmmToAsm/PPC/Regs.hs index 901913f7d9..5b4e179f1a 100644 --- a/compiler/GHC/CmmToAsm/PPC/Regs.hs +++ b/compiler/GHC/CmmToAsm/PPC/Regs.hs @@ -47,6 +47,7 @@ module GHC.CmmToAsm.PPC.Regs ( where import GHC.Prelude +import GHC.Data.FastString import GHC.Platform.Reg import GHC.Platform.Reg.Class @@ -133,7 +134,7 @@ data Imm = ImmInt Int | ImmInteger Integer -- Sigh. | ImmCLbl CLabel -- AbstractC Label (with baggage) - | ImmLit String + | ImmLit FastString | ImmIndex CLabel Int | ImmFloat Rational | ImmDouble Rational @@ -146,7 +147,7 @@ data Imm | HIGHESTA Imm -strImmLit :: String -> Imm +strImmLit :: FastString -> Imm strImmLit s = ImmLit s diff --git a/compiler/GHC/CmmToAsm/X86/Instr.hs b/compiler/GHC/CmmToAsm/X86/Instr.hs index 42b9543204..06fc3f6c7e 100644 --- a/compiler/GHC/CmmToAsm/X86/Instr.hs +++ b/compiler/GHC/CmmToAsm/X86/Instr.hs @@ -38,6 +38,7 @@ module GHC.CmmToAsm.X86.Instr where import GHC.Prelude +import GHC.Data.FastString import GHC.CmmToAsm.X86.Cond import GHC.CmmToAsm.X86.Regs @@ -868,7 +869,7 @@ mkStackAllocInstr platform amount case platformArch platform of ArchX86 | needs_probe_call platform amount -> [ MOV II32 (OpImm (ImmInt amount)) (OpReg eax) - , CALL (Left $ strImmLit "___chkstk_ms") [eax] + , CALL (Left $ strImmLit (fsLit "___chkstk_ms")) [eax] , SUB II32 (OpReg eax) (OpReg esp) ] | otherwise -> @@ -877,7 +878,7 @@ mkStackAllocInstr platform amount ] ArchX86_64 | needs_probe_call platform amount -> [ MOV II64 (OpImm (ImmInt amount)) (OpReg rax) - , CALL (Left $ strImmLit "___chkstk_ms") [rax] + , CALL (Left $ strImmLit (fsLit "___chkstk_ms")) [rax] , SUB II64 (OpReg rax) (OpReg rsp) ] | otherwise -> diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs index 6c16160ce8..32b163357d 100644 --- a/compiler/GHC/CmmToAsm/X86/Ppr.hs +++ b/compiler/GHC/CmmToAsm/X86/Ppr.hs @@ -432,7 +432,7 @@ pprImm platform = \case ImmInteger i -> integer i ImmCLbl l -> pprAsmLabel platform l ImmIndex l i -> pprAsmLabel platform l <> char '+' <> int i - ImmLit s -> text s + ImmLit s -> ftext s ImmFloat f -> float $ fromRational f ImmDouble d -> double $ fromRational d ImmConstantSum a b -> pprImm platform a <> char '+' <> pprImm platform b diff --git a/compiler/GHC/CmmToAsm/X86/Regs.hs b/compiler/GHC/CmmToAsm/X86/Regs.hs index ab5558d8e1..25746f9deb 100644 --- a/compiler/GHC/CmmToAsm/X86/Regs.hs +++ b/compiler/GHC/CmmToAsm/X86/Regs.hs @@ -48,6 +48,7 @@ module GHC.CmmToAsm.X86.Regs ( where import GHC.Prelude +import GHC.Data.FastString import GHC.Platform.Regs import GHC.Platform.Reg @@ -110,14 +111,14 @@ data Imm = ImmInt Int | ImmInteger Integer -- Sigh. | ImmCLbl CLabel -- AbstractC Label (with baggage) - | ImmLit String + | ImmLit FastString | ImmIndex CLabel Int | ImmFloat Rational | ImmDouble Rational | ImmConstantSum Imm Imm | ImmConstantDiff Imm Imm -strImmLit :: String -> Imm +strImmLit :: FastString -> Imm strImmLit s = ImmLit s |