diff options
author | Benjamin Maurer <maurer.benjamin@gmail.com> | 2021-09-21 20:25:34 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-29 09:42:41 -0400 |
commit | 5cc4bd574720fd97d877d702cbafa453434f035e (patch) | |
tree | 737560ef4b45170a7e48ad03867f5588ad2b8525 /compiler/GHC/CmmToAsm/SPARC | |
parent | 361da88a29af9005135d33e00fc61ba92c592970 (diff) | |
download | haskell-5cc4bd574720fd97d877d702cbafa453434f035e.tar.gz |
Rectifying COMMENT and `mkComment` across platforms to work with SDoc
and exhibit similar behaviors. Issue 20400
Diffstat (limited to 'compiler/GHC/CmmToAsm/SPARC')
-rw-r--r-- | compiler/GHC/CmmToAsm/SPARC/CodeGen.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/SPARC/Instr.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/SPARC/Ppr.hs | 9 |
3 files changed, 10 insertions, 6 deletions
diff --git a/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs b/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs index aeaaf1c9d3..ae8ee37cf9 100644 --- a/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/SPARC/CodeGen.hs @@ -53,6 +53,7 @@ import GHC.CmmToAsm.CPrim import GHC.Types.Basic import GHC.Data.FastString import GHC.Data.OrdList +import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Platform @@ -125,7 +126,7 @@ stmtToInstrs stmt = do platform <- getPlatform config <- getConfig case stmt of - CmmComment s -> return (unitOL (COMMENT s)) + CmmComment s -> return (unitOL (COMMENT $ ftext s)) CmmTick {} -> return nilOL CmmUnwind {} -> return nilOL diff --git a/compiler/GHC/CmmToAsm/SPARC/Instr.hs b/compiler/GHC/CmmToAsm/SPARC/Instr.hs index a5c9e46936..6881b06de0 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Instr.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Instr.hs @@ -51,7 +51,7 @@ import GHC.Platform.Regs import GHC.Cmm.CLabel import GHC.Cmm.BlockId import GHC.Cmm -import GHC.Data.FastString +import GHC.Utils.Outputable import GHC.Utils.Panic @@ -102,7 +102,7 @@ data Instr -- meta ops -------------------------------------------------- -- comment pseudo-op - = COMMENT FastString + = COMMENT SDoc -- some static data spat out during code generation. -- Will be extracted before pretty-printing. diff --git a/compiler/GHC/CmmToAsm/SPARC/Ppr.hs b/compiler/GHC/CmmToAsm/SPARC/Ppr.hs index b4028fe3b4..2b0d9675fd 100644 --- a/compiler/GHC/CmmToAsm/SPARC/Ppr.hs +++ b/compiler/GHC/CmmToAsm/SPARC/Ppr.hs @@ -56,7 +56,6 @@ import GHC.Types.Unique ( pprUniqueAlways ) import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Platform -import GHC.Data.FastString -- ----------------------------------------------------------------------------- -- Printing this stuff out @@ -388,11 +387,15 @@ castFloatToWord8Array :: STUArray s Int Float -> ST s (STUArray s Int Word8) castFloatToWord8Array = U.castSTUArray +asmComment :: SDoc -> SDoc +asmComment c = whenPprDebug $ text "#" <+> c + + -- | Pretty print an instruction. pprInstr :: Platform -> Instr -> SDoc pprInstr platform = \case - COMMENT _ -> empty -- nuke comments. - DELTA d -> pprInstr platform (COMMENT (mkFastString ("\tdelta = " ++ show d))) + COMMENT s -> asmComment s + DELTA d -> asmComment $ text ("\tdelta = " ++ show d) -- Newblocks and LData should have been slurped out before producing the .s file. NEWBLOCK _ -> panic "X86.Ppr.pprInstr: NEWBLOCK" |