summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-06-03 18:29:44 +0200
committerSylvain Henry <sylvain@haskus.fr>2020-07-31 19:32:09 +0200
commit3b15dc3cfb1a33e3d4d952af62d4d0b841a731f5 (patch)
tree9238c6013ff47ee46d27cf6f522918b9fd898af0
parent56a7c19337c5b2aa21d521a6d7c965174ec8379b (diff)
downloadhaskell-3b15dc3cfb1a33e3d4d952af62d4d0b841a731f5.tar.gz
DynFlags: don't use sdocWithDynFlags in GHC.CmmToAsm.Dwarf.Types
-rw-r--r--compiler/GHC/CmmToAsm/Dwarf/Types.hs20
1 files changed, 13 insertions, 7 deletions
diff --git a/compiler/GHC/CmmToAsm/Dwarf/Types.hs b/compiler/GHC/CmmToAsm/Dwarf/Types.hs
index 41c0dd518d..8efdbab7fb 100644
--- a/compiler/GHC/CmmToAsm/Dwarf/Types.hs
+++ b/compiler/GHC/CmmToAsm/Dwarf/Types.hs
@@ -156,6 +156,13 @@ pprDwarfInfo platform haveSrc d
pprDwarfInfoClose
noChildren = pprDwarfInfoOpen platform haveSrc d
+-- | Print a CLabel name in a ".stringz \"LABEL\""
+pprLabelString :: Platform -> CLabel -> SDoc
+pprLabelString platform label =
+ pprString' -- we don't need to escape the string as labels don't contain exotic characters
+ $ withPprStyle (mkCodeStyle CStyle) -- force CStyle (foreign labels may be printed differently in AsmStyle)
+ $ pprCLabel_NCG platform label
+
-- | Prints assembler data corresponding to DWARF info records. Note
-- that the binary format of this is parameterized in @abbrevDecls@ and
-- has to be kept in synch.
@@ -172,12 +179,11 @@ pprDwarfInfoOpen platform haveSrc (DwarfCompileUnit _ name producer compDir lowL
$$ if haveSrc
then sectionOffset platform (ptext lineLbl) (ptext dwarfLineLabel)
else empty
-pprDwarfInfoOpen platform _ (DwarfSubprogram _ name label
- parent) = sdocWithDynFlags $ \df ->
+pprDwarfInfoOpen platform _ (DwarfSubprogram _ name label parent) =
ppr (mkAsmTempDieLabel label) <> colon
$$ pprAbbrev abbrev
$$ pprString name
- $$ pprString (renderWithStyle (initSDocContext df (mkCodeStyle CStyle)) (ppr label))
+ $$ pprLabelString platform label
$$ pprFlag (externallyVisibleCLabel label)
$$ pprWord platform (ppr label)
$$ pprWord platform (ppr $ mkAsmTempEndLabel label)
@@ -189,14 +195,14 @@ pprDwarfInfoOpen platform _ (DwarfSubprogram _ name label
Just _ -> DwAbbrSubprogramWithParent
parentValue = maybe empty pprParentDie parent
pprParentDie sym = sectionOffset platform (ppr sym) (ptext dwarfInfoLabel)
-pprDwarfInfoOpen _ _ (DwarfBlock _ label Nothing) = sdocWithDynFlags $ \df ->
+pprDwarfInfoOpen platform _ (DwarfBlock _ label Nothing) =
ppr (mkAsmTempDieLabel label) <> colon
$$ pprAbbrev DwAbbrBlockWithoutCode
- $$ pprString (renderWithStyle (initSDocContext df (mkCodeStyle CStyle)) (ppr label))
-pprDwarfInfoOpen platform _ (DwarfBlock _ label (Just marker)) = sdocWithDynFlags $ \df ->
+ $$ pprLabelString platform label
+pprDwarfInfoOpen platform _ (DwarfBlock _ label (Just marker)) =
ppr (mkAsmTempDieLabel label) <> colon
$$ pprAbbrev DwAbbrBlock
- $$ pprString (renderWithStyle (initSDocContext df (mkCodeStyle CStyle)) (ppr label))
+ $$ pprLabelString platform label
$$ pprWord platform (ppr marker)
$$ pprWord platform (ppr $ mkAsmTempEndLabel marker)
pprDwarfInfoOpen _ _ (DwarfSrcNote ss) =