diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-09-18 11:44:44 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-23 20:43:48 -0400 |
commit | 667d63558a694e12974ace723b553950f6080365 (patch) | |
tree | 50167bdcff894b1ca9ca96a8ad73fe20a883d245 /compiler/GHC/CmmToAsm | |
parent | d7385f7077c6258c2a76ae51b4ea80f6fa9c7015 (diff) | |
download | haskell-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/CmmToAsm')
-rw-r--r-- | compiler/GHC/CmmToAsm/Dwarf/Types.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/PIC.hs | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/compiler/GHC/CmmToAsm/Dwarf/Types.hs b/compiler/GHC/CmmToAsm/Dwarf/Types.hs index c4748b00cd..449ba4a737 100644 --- a/compiler/GHC/CmmToAsm/Dwarf/Types.hs +++ b/compiler/GHC/CmmToAsm/Dwarf/Types.hs @@ -164,9 +164,8 @@ pprDwarfInfo 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 + pprString' -- we don't need to escape the string as labels don't contain exotic characters + $ pprCLabel platform CStyle label -- pretty-print as C label (foreign labels may be printed differently in Asm) -- | Prints assembler data corresponding to DWARF info records. Note -- that the binary format of this is parameterized in @abbrevDecls@ and diff --git a/compiler/GHC/CmmToAsm/PIC.hs b/compiler/GHC/CmmToAsm/PIC.hs index d776b1addb..450a01b7fd 100644 --- a/compiler/GHC/CmmToAsm/PIC.hs +++ b/compiler/GHC/CmmToAsm/PIC.hs @@ -699,7 +699,7 @@ pprImportedSymbol config importedLbl = case (arch,os) of _ -> panic "PIC.pprImportedSymbol: no match" where platform = ncgPlatform config - ppr_lbl = pprCLabel_NCG platform + ppr_lbl = pprCLabel platform AsmStyle arch = platformArch platform os = platformOS platform pic = ncgPIC config |