summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToLlvm/Base.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-09-18 11:44:44 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-23 20:43:48 -0400
commit667d63558a694e12974ace723b553950f6080365 (patch)
tree50167bdcff894b1ca9ca96a8ad73fe20a883d245 /compiler/GHC/CmmToLlvm/Base.hs
parentd7385f7077c6258c2a76ae51b4ea80f6fa9c7015 (diff)
downloadhaskell-667d63558a694e12974ace723b553950f6080365.tar.gz
Refactor CLabel pretty-printing
* Don't depend on the selected backend to know if we print Asm or C labels: we already have PprStyle to determine this. Moreover even when a native backend is used (NCG, LLVM) we may want to C headers containing pretty-printed labels, so it wasn't a good predicate anyway. * Make pretty-printing code clearer and avoid partiality
Diffstat (limited to 'compiler/GHC/CmmToLlvm/Base.hs')
-rw-r--r--compiler/GHC/CmmToLlvm/Base.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/CmmToLlvm/Base.hs b/compiler/GHC/CmmToLlvm/Base.hs
index d7667bb073..43eaab424e 100644
--- a/compiler/GHC/CmmToLlvm/Base.hs
+++ b/compiler/GHC/CmmToLlvm/Base.hs
@@ -435,7 +435,7 @@ renderLlvm sdoc = do
-- Write to output
dflags <- getDynFlags
out <- getEnv envOutput
- let ctx = initSDocContext dflags (Outp.mkCodeStyle Outp.CStyle)
+ let ctx = initSDocContext dflags (Outp.PprCode Outp.CStyle)
liftIO $ Outp.bufLeftRenderSDoc ctx out sdoc
-- Dump, if requested
@@ -497,9 +497,9 @@ strCLabel_llvm :: CLabel -> LlvmM LMString
strCLabel_llvm lbl = do
dflags <- getDynFlags
platform <- getPlatform
- let sdoc = pprCLabel_LLVM platform lbl
+ let sdoc = pprCLabel platform CStyle lbl
str = Outp.renderWithContext
- (initSDocContext dflags (Outp.mkCodeStyle Outp.CStyle))
+ (initSDocContext dflags (Outp.PprCode Outp.CStyle))
sdoc
return (fsLit str)