summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToAsm/Ppr.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-03-11 17:41:51 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-29 17:29:44 -0400
commit1d03d8bef962e6789db44e8b6f2cfd9e34f3f5ad (patch)
treed77ec6ba70bc70e87e954ecb2f56cfa39d12159e /compiler/GHC/CmmToAsm/Ppr.hs
parentc2541c49f162f1d03b0ae55f47b9c76cc96df76f (diff)
downloadhaskell-1d03d8bef962e6789db44e8b6f2cfd9e34f3f5ad.tar.gz
Replace (ptext .. sLit) with `text`
1. `text` is as efficient as `ptext . sLit` thanks to the rewrite rules 2. `text` is visually nicer than `ptext . sLit` 3. `ptext . sLit` encourages using one `ptext` for several `sLit` as in: ptext $ case xy of ... -> sLit ... ... -> sLit ... which may allocate SDoc's TextBeside constructors at runtime instead of sharing them into CAFs.
Diffstat (limited to 'compiler/GHC/CmmToAsm/Ppr.hs')
-rw-r--r--compiler/GHC/CmmToAsm/Ppr.hs40
1 files changed, 18 insertions, 22 deletions
diff --git a/compiler/GHC/CmmToAsm/Ppr.hs b/compiler/GHC/CmmToAsm/Ppr.hs
index a2382705ae..e4e9d7708e 100644
--- a/compiler/GHC/CmmToAsm/Ppr.hs
+++ b/compiler/GHC/CmmToAsm/Ppr.hs
@@ -24,7 +24,6 @@ import GHC.Utils.Asm
import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.CmmToAsm.Config
-import GHC.Data.FastString
import GHC.Utils.Outputable as SDoc
import qualified GHC.Utils.Ppr as Pretty
import GHC.Utils.Panic
@@ -243,26 +242,23 @@ pprGNUSectionHeader config t suffix =
-- XCOFF doesn't support relocating label-differences, so we place all
-- RO sections into .text[PR] sections
pprXcoffSectionHeader :: SectionType -> SDoc
-pprXcoffSectionHeader t = text $ case t of
- Text -> ".csect .text[PR]"
- Data -> ".csect .data[RW]"
- ReadOnlyData -> ".csect .text[PR] # ReadOnlyData"
- RelocatableReadOnlyData -> ".csect .text[PR] # RelocatableReadOnlyData"
- ReadOnlyData16 -> ".csect .text[PR] # ReadOnlyData16"
- CString -> ".csect .text[PR] # CString"
- UninitialisedData -> ".csect .data[BS]"
- OtherSection _ ->
- panic "PprBase.pprXcoffSectionHeader: unknown section type"
+pprXcoffSectionHeader t = case t of
+ Text -> text ".csect .text[PR]"
+ Data -> text ".csect .data[RW]"
+ ReadOnlyData -> text ".csect .text[PR] # ReadOnlyData"
+ RelocatableReadOnlyData -> text ".csect .text[PR] # RelocatableReadOnlyData"
+ ReadOnlyData16 -> text ".csect .text[PR] # ReadOnlyData16"
+ CString -> text ".csect .text[PR] # CString"
+ UninitialisedData -> text ".csect .data[BS]"
+ OtherSection _ -> panic "pprXcoffSectionHeader: unknown section type"
pprDarwinSectionHeader :: SectionType -> SDoc
-pprDarwinSectionHeader t =
- ptext $ case t of
- Text -> sLit ".text"
- Data -> sLit ".data"
- ReadOnlyData -> sLit ".const"
- RelocatableReadOnlyData -> sLit ".const_data"
- UninitialisedData -> sLit ".data"
- ReadOnlyData16 -> sLit ".const"
- CString -> sLit ".section\t__TEXT,__cstring,cstring_literals"
- OtherSection _ ->
- panic "PprBase.pprDarwinSectionHeader: unknown section type"
+pprDarwinSectionHeader t = case t of
+ Text -> text ".text"
+ Data -> text ".data"
+ ReadOnlyData -> text ".const"
+ RelocatableReadOnlyData -> text ".const_data"
+ UninitialisedData -> text ".data"
+ ReadOnlyData16 -> text ".const"
+ CString -> text ".section\t__TEXT,__cstring,cstring_literals"
+ OtherSection _ -> panic "pprDarwinSectionHeader: unknown section type"