diff options
Diffstat (limited to 'compiler/GHC/CmmToAsm')
-rw-r--r-- | compiler/GHC/CmmToAsm/AArch64/Ppr.hs | 17 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/AArch64/Regs.hs | 10 | ||||
-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 | 4 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Regs.hs | 5 |
7 files changed, 16 insertions, 26 deletions
diff --git a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs index 5190633448..9c50f7676c 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs @@ -50,14 +50,14 @@ pprNatCmmDecl config proc@(CmmProc top_info lbl _ (ListGraph blocks)) = pprLabel platform lbl $$ -- blocks guaranteed not null, so label needed vcat (map (pprBasicBlock config top_info) blocks) $$ (if ncgDwarfEnabled config - then ppr (mkAsmTempEndLabel lbl) <> char ':' else empty) $$ + then pdoc platform (mkAsmTempEndLabel lbl) <> char ':' else empty) $$ pprSizeDecl platform lbl Just (CmmStaticsRaw info_lbl _) -> pprSectionAlign config (Section Text info_lbl) $$ -- pprProcAlignment config $$ (if platformHasSubsectionsViaSymbols platform - then ppr (mkDeadStripPreventer info_lbl) <> char ':' + then pdoc platform (mkDeadStripPreventer info_lbl) <> char ':' else empty) $$ vcat (map (pprBasicBlock config top_info) blocks) $$ -- above: Even the first block gets a label, because with branch-chain @@ -65,9 +65,9 @@ pprNatCmmDecl config proc@(CmmProc top_info lbl _ (ListGraph blocks)) = (if platformHasSubsectionsViaSymbols platform then -- See Note [Subsections Via Symbols] text "\t.long " - <+> ppr info_lbl + <+> pdoc platform info_lbl <+> char '-' - <+> ppr (mkDeadStripPreventer info_lbl) + <+> pdoc platform (mkDeadStripPreventer info_lbl) else empty) $$ pprSizeDecl platform info_lbl @@ -87,9 +87,6 @@ pprAlignForSection _platform _seg -- .balign is stable, whereas .align is platform dependent. = text "\t.balign 8" -- always 8 -instance Outputable Instr where - ppr = pprInstr genericPlatform - -- | Print section header and appropriate alignment for that section. -- -- This one will emit the header: @@ -118,7 +115,7 @@ pprBasicBlock config info_env (BasicBlock blockid instrs) pprLabel platform asmLbl $$ vcat (map (pprInstr platform) (id {-detectTrivialDeadlock-} optInstrs)) $$ (if ncgDwarfEnabled config - then ppr (mkAsmTempEndLabel asmLbl) <> char ':' + then pdoc platform (mkAsmTempEndLabel asmLbl) <> char ':' else empty ) where @@ -138,7 +135,7 @@ pprBasicBlock config info_env (BasicBlock blockid instrs) pprLabel platform info_lbl $$ c $$ (if ncgDwarfEnabled config - then ppr (mkAsmTempEndLabel info_lbl) <> char ':' + then pdoc platform (mkAsmTempEndLabel info_lbl) <> char ':' else empty) -- Make sure the info table has the right .loc for the block -- coming right after it. See Note [Info Offset] @@ -235,7 +232,7 @@ pprImm _ (ImmInt i) = int i pprImm _ (ImmInteger i) = integer i pprImm p (ImmCLbl l) = pdoc p l pprImm p (ImmIndex l i) = pdoc p l <> char '+' <> int i -pprImm _ (ImmLit s) = s +pprImm _ (ImmLit s) = text 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 4fd50b0d3f..d3650c96f0 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Regs.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Regs.hs @@ -59,7 +59,7 @@ data Imm = ImmInt Int | ImmInteger Integer -- Sigh. | ImmCLbl CLabel -- AbstractC Label (with baggage) - | ImmLit SDoc -- Simple string + | ImmLit String | ImmIndex CLabel Int | ImmFloat Rational | ImmDouble Rational @@ -67,14 +67,8 @@ data Imm | ImmConstantDiff Imm Imm deriving (Eq, Show) -instance Show SDoc where - show = showPprUnsafe . ppr - -instance Eq SDoc where - lhs == rhs = show lhs == show rhs - strImmLit :: String -> Imm -strImmLit s = ImmLit (text s) +strImmLit s = ImmLit s litToImm :: CmmLit -> Imm diff --git a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs index 099d10920e..c58aafbf95 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 (text "ghc_toc_table[TC]")) + tocAddr = AddrRegImm toc (ImmLit "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 b1d141fb3f..c09d02bafc 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 -> pdoc platform l ImmIndex l i -> pdoc platform l <> char '+' <> int i - ImmLit s -> s + ImmLit s -> text 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 5c9fab32d4..901913f7d9 100644 --- a/compiler/GHC/CmmToAsm/PPC/Regs.hs +++ b/compiler/GHC/CmmToAsm/PPC/Regs.hs @@ -133,7 +133,7 @@ data Imm = ImmInt Int | ImmInteger Integer -- Sigh. | ImmCLbl CLabel -- AbstractC Label (with baggage) - | ImmLit SDoc -- Simple string + | ImmLit String | ImmIndex CLabel Int | ImmFloat Rational | ImmDouble Rational @@ -147,7 +147,7 @@ data Imm strImmLit :: String -> Imm -strImmLit s = ImmLit (text s) +strImmLit s = ImmLit s litToImm :: CmmLit -> Imm diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs index 4cbfb62f0a..8eb69f5179 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 -> pdoc platform l ImmIndex l i -> pdoc platform l <> char '+' <> int i - ImmLit s -> s + ImmLit s -> text 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 38d4fdc422..ab5558d8e1 100644 --- a/compiler/GHC/CmmToAsm/X86/Regs.hs +++ b/compiler/GHC/CmmToAsm/X86/Regs.hs @@ -55,7 +55,6 @@ import GHC.Platform.Reg.Class import GHC.Cmm import GHC.Cmm.CLabel ( CLabel ) -import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Platform @@ -111,7 +110,7 @@ data Imm = ImmInt Int | ImmInteger Integer -- Sigh. | ImmCLbl CLabel -- AbstractC Label (with baggage) - | ImmLit SDoc -- Simple string + | ImmLit String | ImmIndex CLabel Int | ImmFloat Rational | ImmDouble Rational @@ -119,7 +118,7 @@ data Imm | ImmConstantDiff Imm Imm strImmLit :: String -> Imm -strImmLit s = ImmLit (text s) +strImmLit s = ImmLit s litToImm :: CmmLit -> Imm |