summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/CLabel.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/Cmm/CLabel.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/Cmm/CLabel.hs')
-rw-r--r--compiler/GHC/Cmm/CLabel.hs23
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index 2782da2ea4..c8f39b80ef 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -108,7 +108,7 @@ module GHC.Cmm.CLabel (
-- * Conversions
toClosureLbl, toSlowEntryLbl, toEntryLbl, toInfoLbl, hasHaskellName,
- pprCLabel, pprCLabel_LLVM, pprCLabel_NCG,
+ pprCLabel, pprCLabel_LLVM, pprCLabel_NCG, pprCLabel_ViaC,
isInfoTableLabel,
isConInfoTableLabel,
isIdLabel, isTickyLabel
@@ -1218,11 +1218,15 @@ pprCLabel bcknd platform lbl =
case bcknd of
NCG -> pprCLabel_NCG platform lbl
LLVM -> pprCLabel_LLVM platform lbl
+ ViaC -> pprCLabel_ViaC platform lbl
_ -> pprCLabel_other platform lbl
pprCLabel_LLVM :: Platform -> CLabel -> SDoc
pprCLabel_LLVM = pprCLabel_NCG
+pprCLabel_ViaC :: Platform -> CLabel -> SDoc
+pprCLabel_ViaC = pprCLabel_other
+
pprCLabel_NCG :: Platform -> CLabel -> SDoc
pprCLabel_NCG platform lbl = getPprStyle $ \sty ->
let
@@ -1348,7 +1352,13 @@ pprCLabel_common platform = \case
(ForeignLabel str _ _ _) -> ftext str
- (IdLabel name _cafs flavor) -> internalNamePrefix platform name <> ppr name <> ppIdFlavor flavor
+ (IdLabel name _cafs flavor) -> internalNamePrefix <> ppr name <> ppIdFlavor flavor
+ where
+ isRandomGenerated = not (isExternalName name)
+ internalNamePrefix = getPprStyle $ \ sty ->
+ if asmStyle sty && isRandomGenerated
+ then ptext (asmTempLabelPrefix platform)
+ else empty
(CC_Label cc) -> ppr cc
(CCS_Label ccs) -> ppr ccs
@@ -1389,15 +1399,6 @@ instance Outputable ForeignLabelSource where
ForeignLabelInThisPackage -> parens $ text "this package"
ForeignLabelInExternalPackage -> parens $ text "external package"
-internalNamePrefix :: Platform -> Name -> SDoc
-internalNamePrefix platform name = getPprStyle $ \ sty ->
- if asmStyle sty && isRandomGenerated then
- ptext (asmTempLabelPrefix platform)
- else
- empty
- where
- isRandomGenerated = not $ isExternalName name
-
tempLabelPrefixOrUnderscore :: Platform -> SDoc
tempLabelPrefixOrUnderscore platform =
getPprStyle $ \ sty ->