summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToC.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-09-01 15:06:18 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-04 16:24:20 -0400
commit1d6d648866da9e7754859c48235f8009b8c130fd (patch)
treee73b1d5d2321d71ba13001e3f0aeea82e0a76735 /compiler/GHC/CmmToC.hs
parent4891c18a49876958b44e50dc6e2f24326d92052f (diff)
downloadhaskell-1d6d648866da9e7754859c48235f8009b8c130fd.tar.gz
Don't rely on CLabel's Outputable instance in CmmToC
This is in preparation of the removal of sdocWithDynFlags (#10143), hence of the refactoring of CLabel's Outputable instance.
Diffstat (limited to 'compiler/GHC/CmmToC.hs')
-rw-r--r--compiler/GHC/CmmToC.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/GHC/CmmToC.hs b/compiler/GHC/CmmToC.hs
index daf98f71a5..dc7a383d2f 100644
--- a/compiler/GHC/CmmToC.hs
+++ b/compiler/GHC/CmmToC.hs
@@ -91,7 +91,7 @@ pprTop platform = \case
blankLine,
extern_decls,
(if (externallyVisibleCLabel clbl)
- then mkFN_ else mkIF_) (ppr clbl) <+> lbrace,
+ then mkFN_ else mkIF_) (pprCLabel_ViaC platform clbl) <+> lbrace,
nest 8 temp_decls,
vcat (map (pprBBlock platform) blocks),
rbrace ]
@@ -110,14 +110,14 @@ pprTop platform = \case
(CmmData section (CmmStaticsRaw lbl [CmmString str])) ->
pprExternDecl platform lbl $$
hcat [
- pprLocalness lbl, pprConstness (isSecConstant section), text "char ", ppr lbl,
+ pprLocalness lbl, pprConstness (isSecConstant section), text "char ", pprCLabel_ViaC platform lbl,
text "[] = ", pprStringInCStyle str, semi
]
(CmmData section (CmmStaticsRaw lbl [CmmUninitialised size])) ->
pprExternDecl platform lbl $$
hcat [
- pprLocalness lbl, pprConstness (isSecConstant section), text "char ", ppr lbl,
+ pprLocalness lbl, pprConstness (isSecConstant section), text "char ", pprCLabel_ViaC platform lbl,
brackets (int size), semi
]
@@ -153,7 +153,7 @@ pprWordArray platform is_ro lbl ds
= -- TODO: align closures only
pprExternDecl platform lbl $$
hcat [ pprLocalness lbl, pprConstness is_ro, text "StgWord"
- , space, ppr lbl, text "[]"
+ , space, pprCLabel_ViaC platform lbl, text "[]"
-- See Note [StgWord alignment]
, pprAlignment (wordWidth platform)
, text "= {" ]
@@ -238,7 +238,7 @@ pprStmt platform stmt =
case fn of
CmmLit (CmmLabel lbl)
| StdCallConv <- cconv ->
- pprCall platform (ppr lbl) cconv hresults hargs
+ pprCall platform (pprCLabel_ViaC platform lbl) cconv hresults hargs
-- stdcall functions must be declared with
-- a function type, otherwise the C compiler
-- doesn't add the @n suffix to the label. We
@@ -247,7 +247,7 @@ pprStmt platform stmt =
| CmmNeverReturns <- ret ->
pprCall platform cast_fn cconv hresults hargs <> semi
| not (isMathFun lbl) ->
- pprForeignCall platform (ppr lbl) cconv hresults hargs
+ pprForeignCall platform (pprCLabel_ViaC platform lbl) cconv hresults hargs
_ ->
pprCall platform cast_fn cconv hresults hargs <> semi
-- for a dynamic call, no declaration is necessary.
@@ -487,7 +487,7 @@ pprLit platform lit = case lit of
-> mkW_ <> pprCLabelAddr clbl1 <> char '+' <> int i
where
- pprCLabelAddr lbl = char '&' <> ppr lbl
+ pprCLabelAddr lbl = char '&' <> pprCLabel_ViaC platform lbl
pprLit1 :: Platform -> CmmLit -> SDoc
pprLit1 platform lit = case lit of
@@ -1047,7 +1047,7 @@ pprExternDecl platform lbl
| not (needsCDecl lbl) = empty
| Just sz <- foreignLabelStdcallInfo lbl = stdcall_decl sz
| otherwise =
- hcat [ visibility, label_type lbl , lparen, ppr lbl, text ");"
+ hcat [ visibility, label_type lbl , lparen, pprCLabel_ViaC platform lbl, text ");"
-- occasionally useful to see label type
-- , text "/* ", pprDebugCLabel lbl, text " */"
]
@@ -1070,7 +1070,7 @@ pprExternDecl platform lbl
-- we must generate an appropriate prototype for it, so that the C compiler will
-- add the @n suffix to the label (#2276)
stdcall_decl sz =
- text "extern __attribute__((stdcall)) void " <> ppr lbl
+ text "extern __attribute__((stdcall)) void " <> pprCLabel_ViaC platform lbl
<> parens (commafy (replicate (sz `quot` platformWordSizeInBytes platform) (machRep_U_CType platform (wordWidth platform))))
<> semi