summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-07-26 20:23:47 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-07-26 20:25:52 +0200
commit2284b2a54df8bc84368ea5b67f137354f2a8bedc (patch)
tree92a2c4cec55434f01981a36f966ee5bde6d84eb8
parentdbe2a97bd681261afff79c95456e28b30832d8dc (diff)
downloadhaskell-2284b2a54df8bc84368ea5b67f137354f2a8bedc.tar.gz
Cleanup pretty printing code
- Use pprCLabel recursively - Remove unused pprCmms
-rw-r--r--compiler/GHC/Cmm/CLabel.hs2
-rw-r--r--compiler/GHC/Cmm/Ppr/Decl.hs9
-rw-r--r--compiler/GHC/Driver/CodeOutput.hs10
3 files changed, 6 insertions, 15 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index 6d0870e281..3cac85c5f0 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -1522,7 +1522,7 @@ pprCLabel !platform !sty lbl = -- see Note [Bangs in CLabel]
CC_Label cc -> maybe_underscore $ ppr cc
CCS_Label ccs -> maybe_underscore $ ppr ccs
- IPE_Label (InfoProvEnt l _ _ m _) -> maybe_underscore $ (pprCode CStyle (pdoc platform l) <> text "_" <> ppr m <> text "_ipe")
+ IPE_Label (InfoProvEnt l _ _ m _) -> maybe_underscore $ (pprCLabel platform CStyle l <> text "_" <> ppr m <> text "_ipe")
ModuleLabel mod kind -> maybe_underscore $ ppr mod <> text "_" <> ppr kind
CmmLabel _ _ fs CmmCode -> maybe_underscore $ ftext fs
diff --git a/compiler/GHC/Cmm/Ppr/Decl.hs b/compiler/GHC/Cmm/Ppr/Decl.hs
index 3b1eff78ff..2eba51e9da 100644
--- a/compiler/GHC/Cmm/Ppr/Decl.hs
+++ b/compiler/GHC/Cmm/Ppr/Decl.hs
@@ -40,7 +40,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module GHC.Cmm.Ppr.Decl
- ( pprCmms, pprCmmGroup, pprSection, pprStatic
+ ( pprCmmGroup, pprSection, pprStatic
)
where
@@ -56,13 +56,6 @@ import Data.List (intersperse)
import qualified Data.ByteString as BS
-
-pprCmms :: (OutputableP Platform info, OutputableP Platform g)
- => Platform -> [GenCmmGroup RawCmmStatics info g] -> SDoc
-pprCmms platform cmms = pprCode CStyle (vcat (intersperse separator $ map (pdoc platform) cmms))
- where
- separator = space $$ text "-------------------" $$ space
-
-----------------------------------------------------------------------------
instance (OutputableP Platform d, OutputableP Platform info, OutputableP Platform i)
diff --git a/compiler/GHC/Driver/CodeOutput.hs b/compiler/GHC/Driver/CodeOutput.hs
index 5b3f614d8e..df8637b8a7 100644
--- a/compiler/GHC/Driver/CodeOutput.hs
+++ b/compiler/GHC/Driver/CodeOutput.hs
@@ -253,19 +253,17 @@ outputForeignStubs logger tmpfs dflags unit_state mod location stubs
ForeignStubs (CHeader h_code) (CStub c_code _ _) -> do
let
- stub_c_output_d = pprCode CStyle c_code
- stub_c_output_w = showSDoc dflags stub_c_output_d
+ stub_c_output_w = showSDoc dflags $ pprCode CStyle c_code
-- Header file protos for "foreign export"ed functions.
- stub_h_output_d = pprCode CStyle h_code
- stub_h_output_w = showSDoc dflags stub_h_output_d
+ stub_h_output_w = showSDoc dflags $ pprCode CStyle h_code
createDirectoryIfMissing True (takeDirectory stub_h)
putDumpFileMaybe logger Opt_D_dump_foreign
"Foreign export header file"
FormatC
- stub_h_output_d
+ h_code
-- we need the #includes from the rts package for the stub files
let rts_includes =
@@ -288,7 +286,7 @@ outputForeignStubs logger tmpfs dflags unit_state mod location stubs
("#include <HsFFI.h>\n" ++ cplusplus_hdr) cplusplus_ftr
putDumpFileMaybe logger Opt_D_dump_foreign
- "Foreign export stubs" FormatC stub_c_output_d
+ "Foreign export stubs" FormatC c_code
stub_c_file_exists
<- outputForeignStubs_help stub_c stub_c_output_w