[Git][ghc/ghc][wip/romes/ncg-perf] ncg perf: WIP SPECIALISE Line SDoc #25060

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Wed Jul 10 10:35:32 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/ncg-perf at Glasgow Haskell Compiler / GHC


Commits:
ad6e5be1 by Rodrigo Mesquita at 2024-07-10T11:34:52+01:00
ncg perf: WIP SPECIALISE Line SDoc #25060

- - - - -


21 changed files:

- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/DebugBlock.hs
- compiler/GHC/Cmm/Reg.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/Dwarf/Constants.hs
- compiler/GHC/CmmToAsm/Dwarf/Types.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/Ppr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToLlvm.hs
- compiler/GHC/CmmToLlvm/Ppr.hs
- compiler/GHC/Llvm/MetaData.hs
- compiler/GHC/Llvm/Ppr.hs
- compiler/GHC/Llvm/Types.hs
- compiler/GHC/Types/CostCentre.hs
- compiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Occurrence.hs
- compiler/GHC/Types/Unique.hs
- compiler/GHC/Unit/Types.hs
- compiler/GHC/Utils/Outputable.hs


Changes:

=====================================
compiler/GHC/Builtin/PrimOps.hs
=====================================
@@ -905,6 +905,7 @@ compare_fun_ty ty = mkVisFunTysMany [ty, ty] intPrimTy
 pprPrimOp  :: IsLine doc => PrimOp -> doc
 pprPrimOp other_op = pprOccName (primOpOcc other_op)
 {-# SPECIALIZE pprPrimOp :: PrimOp -> SDoc #-}
+{-# SPECIALIZE pprPrimOp :: PrimOp -> Line SDoc #-}
 {-# SPECIALIZE pprPrimOp :: PrimOp -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 {-


=====================================
compiler/GHC/Cmm/CLabel.hs
=====================================
@@ -307,6 +307,7 @@ pprModuleLabelKind MLK_FinalizerArray                      = text "fini_arr"
 pprModuleLabelKind (MLK_Finalizer (LexicalFastString s))   = text "fini__" <> ftext s
 pprModuleLabelKind MLK_IPEBuffer                           = text "ipe_buf"
 {-# SPECIALIZE pprModuleLabelKind :: ModuleLabelKind -> SDoc #-}
+{-# SPECIALIZE pprModuleLabelKind :: ModuleLabelKind -> Line SDoc #-}
 {-# SPECIALIZE pprModuleLabelKind :: ModuleLabelKind -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 isIdLabel :: CLabel -> Bool
@@ -1428,11 +1429,13 @@ data LabelStyle
 pprAsmLabel :: IsLine doc => Platform -> CLabel -> doc
 pprAsmLabel platform lbl = pprCLabelStyle platform AsmStyle lbl
 {-# SPECIALIZE pprAsmLabel :: Platform -> CLabel -> SDoc #-}
+{-# SPECIALIZE pprAsmLabel :: Platform -> CLabel -> Line SDoc #-}
 {-# SPECIALIZE pprAsmLabel :: Platform -> CLabel -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 pprCLabel :: IsLine doc => Platform -> CLabel -> doc
 pprCLabel platform lbl = pprCLabelStyle platform CStyle lbl
 {-# SPECIALIZE pprCLabel :: Platform -> CLabel -> SDoc #-}
+{-# SPECIALIZE pprCLabel :: Platform -> CLabel -> Line SDoc #-}
 {-# SPECIALIZE pprCLabel :: Platform -> CLabel -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 instance OutputableP Platform CLabel where
@@ -1583,8 +1586,8 @@ pprCLabelStyle !platform !sty lbl = -- see Note [Bangs in CLabel]
    CmmLabel _ _ fs CmmRetInfo  -> maybe_underscore $ ftext fs <> text "_info"
    CmmLabel _ _ fs CmmRet      -> maybe_underscore $ ftext fs <> text "_ret"
    CmmLabel _ _ fs CmmClosure  -> maybe_underscore $ ftext fs <> text "_closure"
-{-# INLINABLE pprCLabelStyle #-} -- Workaround a bug which prevented pprCLabelStyle from specialising (see #25060).
 {-# SPECIALIZE pprCLabelStyle :: Platform -> LabelStyle -> CLabel -> SDoc #-}
+{-# SPECIALIZE pprCLabelStyle :: Platform -> LabelStyle -> CLabel -> Line SDoc #-}
 {-# SPECIALIZE pprCLabelStyle :: Platform -> LabelStyle -> CLabel -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- Note [Internal proc labels]
@@ -1621,6 +1624,7 @@ ppInternalProcLabel this_mod (IdLabel nm _ flavour)
     <> ppIdFlavor flavour
 ppInternalProcLabel _ _ = Nothing
 {-# SPECIALIZE ppInternalProcLabel :: Module -> CLabel -> Maybe SDoc #-}
+{-# SPECIALIZE ppInternalProcLabel :: Module -> CLabel -> Maybe (Line SDoc) #-}
 {-# SPECIALIZE ppInternalProcLabel :: Module -> CLabel -> Maybe HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppIdFlavor :: IsLine doc => IdLabelInfo -> doc


=====================================
compiler/GHC/Cmm/DebugBlock.hs
=====================================
@@ -542,6 +542,7 @@ pprUnwindExpr p env = \case
    | p <= 1     -> pprUnwindExpr 2 env e0 <> char '*' <> pprUnwindExpr 2 env e1
   other         -> parens (pprUnwindExpr 0 env other)
 {-# SPECIALIZE pprUnwindExpr :: Rational -> Platform -> UnwindExpr -> SDoc #-}
+{-# SPECIALIZE pprUnwindExpr :: Rational -> Platform -> UnwindExpr -> Line SDoc #-}
 {-# SPECIALIZE pprUnwindExpr :: Rational -> Platform -> UnwindExpr -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Conversion of Cmm expressions to unwind expressions. We check for


=====================================
compiler/GHC/Cmm/Reg.hs
=====================================
@@ -284,6 +284,7 @@ pprGlobalReg gr
         BaseReg        -> text "BaseReg"
         PicBaseReg     -> text "PicBaseReg"
 {-# SPECIALIZE pprGlobalReg :: GlobalReg -> SDoc #-}
+{-# SPECIALIZE pprGlobalReg :: GlobalReg -> Line SDoc #-}
 {-# SPECIALIZE pprGlobalReg :: GlobalReg -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 


=====================================
compiler/GHC/CmmToAsm/AArch64/Ppr.hs
=====================================
@@ -68,6 +68,7 @@ pprNatCmmDecl config proc@(CmmProc top_info lbl _ (ListGraph blocks)) =
        else empty) $$
       pprSizeDecl platform info_lbl
 {-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl RawCmmStatics Instr -> SDoc #-}
+{-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl RawCmmStatics Instr -> Line SDoc #-}
 {-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl RawCmmStatics Instr -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 pprLabel :: IsDoc doc => Platform -> CLabel -> doc


=====================================
compiler/GHC/CmmToAsm/Dwarf/Constants.hs
=====================================
@@ -152,16 +152,22 @@ dwarfFrameSection   platform = dwarfSection platform "frame"
 dwarfGhcSection     platform = dwarfSection platform "ghc"
 dwarfARangesSection platform = dwarfSection platform "aranges"
 {-# SPECIALIZE dwarfInfoSection :: Platform -> SDoc #-}
+{-# SPECIALIZE dwarfInfoSection :: Platform -> Line SDoc #-}
 {-# SPECIALIZE dwarfInfoSection :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfAbbrevSection :: Platform -> SDoc #-}
+{-# SPECIALIZE dwarfAbbrevSection :: Platform -> Line SDoc #-}
 {-# SPECIALIZE dwarfAbbrevSection :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfLineSection :: Platform -> SDoc #-}
+{-# SPECIALIZE dwarfLineSection :: Platform -> Line SDoc #-}
 {-# SPECIALIZE dwarfLineSection :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfFrameSection :: Platform -> SDoc #-}
+{-# SPECIALIZE dwarfFrameSection :: Platform -> Line SDoc #-}
 {-# SPECIALIZE dwarfFrameSection :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfGhcSection :: Platform -> SDoc #-}
+{-# SPECIALIZE dwarfGhcSection :: Platform -> Line SDoc #-}
 {-# SPECIALIZE dwarfGhcSection :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfARangesSection :: Platform -> SDoc #-}
+{-# SPECIALIZE dwarfARangesSection :: Platform -> Line SDoc #-}
 {-# SPECIALIZE dwarfARangesSection :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 dwarfSection :: IsDoc doc => Platform -> String -> doc
@@ -175,6 +181,7 @@ dwarfSection platform name =
        | otherwise
        -> text "\t.section .debug_" <> text name <> text ",\"dr\""
 {-# SPECIALIZE dwarfSection :: Platform -> String -> SDoc #-}
+{-# SPECIALIZE dwarfSection :: Platform -> String -> Line SDoc #-}
 {-# SPECIALIZE dwarfSection :: Platform -> String -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -185,12 +192,16 @@ dwarfAbbrevLabel = text ".Lsection_abbrev"
 dwarfLineLabel   = text ".Lsection_line"
 dwarfFrameLabel  = text ".Lsection_frame"
 {-# SPECIALIZE dwarfInfoLabel :: SDoc #-}
+{-# SPECIALIZE dwarfInfoLabel :: Line SDoc #-}
 {-# SPECIALIZE dwarfInfoLabel :: HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfAbbrevLabel :: SDoc #-}
+{-# SPECIALIZE dwarfAbbrevLabel :: Line SDoc #-}
 {-# SPECIALIZE dwarfAbbrevLabel :: HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfLineLabel :: SDoc #-}
+{-# SPECIALIZE dwarfLineLabel :: Line SDoc #-}
 {-# SPECIALIZE dwarfLineLabel :: HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 {-# SPECIALIZE dwarfFrameLabel :: SDoc #-}
+{-# SPECIALIZE dwarfFrameLabel :: Line SDoc #-}
 {-# SPECIALIZE dwarfFrameLabel :: HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Mapping of registers to DWARF register numbers


=====================================
compiler/GHC/CmmToAsm/Dwarf/Types.hs
=====================================
@@ -144,6 +144,7 @@ pprAbbrevDecls platform haveDebugLine =
        ] $$
      pprByte 0
 {-# SPECIALIZE pprAbbrevDecls :: Platform -> Bool -> SDoc #-}
+{-# SPECIALIZE pprAbbrevDecls :: Platform -> Bool -> Line SDoc #-}
 {-# SPECIALIZE pprAbbrevDecls :: Platform -> Bool -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Generate assembly for DWARF data
@@ -161,6 +162,7 @@ pprDwarfInfo platform haveSrc d
         pprDwarfInfoClose
     noChildren = pprDwarfInfoOpen platform haveSrc d
 {-# SPECIALIZE pprDwarfInfo :: Platform -> Bool -> DwarfInfo -> SDoc #-}
+{-# SPECIALIZE pprDwarfInfo :: Platform -> Bool -> DwarfInfo -> Line SDoc #-}
 {-# SPECIALIZE pprDwarfInfo :: Platform -> Bool -> DwarfInfo -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print a CLabel name in a ".stringz \"LABEL\""
@@ -258,6 +260,7 @@ pprDwarfARanges platform arngs unitU =
      $$ pprWord platform (char '0')
      $$ pprWord platform (char '0')
 {-# SPECIALIZE pprDwarfARanges :: Platform -> [DwarfARange] -> Unique -> SDoc #-}
+{-# SPECIALIZE pprDwarfARanges :: Platform -> [DwarfARange] -> Unique -> Line SDoc #-}
 {-# SPECIALIZE pprDwarfARanges :: Platform -> [DwarfARange] -> Unique -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 pprDwarfARange :: IsDoc doc => Platform -> DwarfARange -> doc
@@ -355,6 +358,7 @@ pprDwarfFrame platform DwarfFrame{dwCieLabel=cieLabel,dwCieInit=cieInit,dwCiePro
        -- Procedure unwind tables
        vcat (map (pprFrameProc platform cieLabel cieInit) procs)
 {-# SPECIALIZE pprDwarfFrame :: Platform -> DwarfFrame -> SDoc #-}
+{-# SPECIALIZE pprDwarfFrame :: Platform -> DwarfFrame -> Line SDoc #-}
 {-# SPECIALIZE pprDwarfFrame :: Platform -> DwarfFrame -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Writes a "Frame Description Entry" for a procedure. This consists
@@ -548,18 +552,21 @@ wordAlign plat =
       PW4 -> char '2'
     _other   -> int (platformWordSizeInBytes plat)
 {-# SPECIALIZE wordAlign :: Platform -> SDoc #-}
+{-# SPECIALIZE wordAlign :: Platform -> Line SDoc #-}
 {-# SPECIALIZE wordAlign :: Platform -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Assembly for a single byte of constant DWARF data
 pprByte :: IsDoc doc => Word8 -> doc
 pprByte x = line $ text "\t.byte " <> integer (fromIntegral x)
 {-# SPECIALIZE pprByte :: Word8 -> SDoc #-}
+{-# SPECIALIZE pprByte :: Word8 -> Line SDoc #-}
 {-# SPECIALIZE pprByte :: Word8 -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Assembly for a two-byte constant integer
 pprHalf :: IsDoc doc => Word16 -> doc
 pprHalf x = line $ text "\t.short" <+> integer (fromIntegral x)
 {-# SPECIALIZE pprHalf :: Word16 -> SDoc #-}
+{-# SPECIALIZE pprHalf :: Word16 -> Line SDoc #-}
 {-# SPECIALIZE pprHalf :: Word16 -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Assembly for a constant DWARF flag
@@ -570,6 +577,7 @@ pprFlag f = pprByte (if f then 0xff else 0x00)
 pprData4' :: IsDoc doc => Line doc -> doc
 pprData4' x = line (text "\t.long " <> x)
 {-# SPECIALIZE pprData4' :: SDoc -> SDoc #-}
+{-# SPECIALIZE pprData4' :: SDoc -> Line SDoc #-}
 {-# SPECIALIZE pprData4' :: HLine -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Assembly for 4 bytes of constant DWARF data
@@ -581,6 +589,7 @@ pprData4 = pprData4' . integer . fromIntegral
 pprDwWord :: IsDoc doc => Line doc -> doc
 pprDwWord = pprData4'
 {-# SPECIALIZE pprDwWord :: SDoc -> SDoc #-}
+{-# SPECIALIZE pprDwWord :: SDoc -> Line SDoc #-}
 {-# SPECIALIZE pprDwWord :: HLine -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Assembly for a machine word of dynamic data. Depends on the
@@ -591,6 +600,7 @@ pprWord plat s =
     PW4 -> text "\t.long " <> s
     PW8 -> text "\t.quad " <> s
 {-# SPECIALIZE pprWord :: Platform -> SDoc -> SDoc #-}
+{-# SPECIALIZE pprWord :: Platform -> SDoc -> Line SDoc #-}
 {-# SPECIALIZE pprWord :: Platform -> HLine -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Prints a number in "little endian base 128" format. The idea is
@@ -602,6 +612,7 @@ pprLEBWord x | x < 128   = pprByte (fromIntegral x)
              | otherwise = pprByte (fromIntegral $ 128 .|. (x .&. 127)) $$
                            pprLEBWord (x `shiftR` 7)
 {-# SPECIALIZE pprLEBWord :: Word -> SDoc #-}
+{-# SPECIALIZE pprLEBWord :: Word -> Line SDoc #-}
 {-# SPECIALIZE pprLEBWord :: Word -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Same as @pprLEBWord@, but for a signed number
@@ -611,6 +622,7 @@ pprLEBInt x | x >= -64 && x < 64
             | otherwise = pprByte (fromIntegral $ 128 .|. (x .&. 127)) $$
                           pprLEBInt (x `shiftR` 7)
 {-# SPECIALIZE pprLEBInt :: Int -> SDoc #-}
+{-# SPECIALIZE pprLEBInt :: Int -> Line SDoc #-}
 {-# SPECIALIZE pprLEBInt :: Int -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Generates a dynamic null-terminated string. If required the
@@ -653,4 +665,5 @@ sectionOffset plat target section =
     OSMinGW32 -> line (text "\t.secrel32 " <> target)
     _other    -> pprDwWord target
 {-# SPECIALIZE sectionOffset :: Platform -> SDoc -> SDoc -> SDoc #-}
+{-# SPECIALIZE sectionOffset :: Platform -> SDoc -> SDoc -> Line SDoc #-}
 {-# SPECIALIZE sectionOffset :: Platform -> HLine -> HLine -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable


=====================================
compiler/GHC/CmmToAsm/PPC/Ppr.hs
=====================================
@@ -85,6 +85,7 @@ pprNatCmmDecl config proc@(CmmProc top_info lbl _ (ListGraph blocks)) =
        else empty) $$
       pprSizeDecl platform info_lbl
 {-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl RawCmmStatics Instr -> SDoc #-}
+{-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl RawCmmStatics Instr -> Line SDoc #-}
 {-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl RawCmmStatics Instr -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Output the ELF .size directive.


=====================================
compiler/GHC/CmmToAsm/Ppr.hs
=====================================
@@ -122,12 +122,14 @@ pprASCII str
        chr' :: Word8 -> Char
        chr' (W8# w#) = C# (chr# (word2Int# (word8ToWord# w#)))
 {-# SPECIALIZE pprASCII :: ByteString -> SDoc #-}
+{-# SPECIALIZE pprASCII :: ByteString -> Line SDoc #-}
 {-# SPECIALIZE pprASCII :: ByteString -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Emit a ".string" directive
 pprString :: IsLine doc => ByteString -> doc
 pprString bs = text "\t.string " <> doubleQuotes (pprASCII bs)
 {-# SPECIALIZE pprString :: ByteString -> SDoc #-}
+{-# SPECIALIZE pprString :: ByteString -> Line SDoc #-}
 {-# SPECIALIZE pprString :: ByteString -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Emit a ".incbin" directive
@@ -139,6 +141,7 @@ pprFileEmbed path
      <> pprFilePathString path -- proper escape (see #16389)
      <> text "\n\t.byte 0"
 {-# SPECIALIZE pprFileEmbed :: FilePath -> SDoc #-}
+{-# SPECIALIZE pprFileEmbed :: FilePath -> Line SDoc #-}
 {-# SPECIALIZE pprFileEmbed :: FilePath -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 {-
@@ -204,6 +207,7 @@ pprSectionHeader config (Section t suffix) =
    OSDarwin  -> pprDarwinSectionHeader t
    _         -> pprGNUSectionHeader config t suffix
 {-# SPECIALIZE pprSectionHeader :: NCGConfig -> Section -> SDoc #-}
+{-# SPECIALIZE pprSectionHeader :: NCGConfig -> Section -> Line SDoc #-}
 {-# SPECIALIZE pprSectionHeader :: NCGConfig -> Section -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 pprGNUSectionHeader :: IsLine doc => NCGConfig -> SectionType -> CLabel -> doc
@@ -256,6 +260,7 @@ pprGNUSectionHeader config t suffix =
         | otherwise -> text ",\"aMS\"," <> sectionType platform "progbits" <> text ",1"
       _ -> empty
 {-# SPECIALIZE pprGNUSectionHeader :: NCGConfig -> SectionType -> CLabel -> SDoc #-}
+{-# SPECIALIZE pprGNUSectionHeader :: NCGConfig -> SectionType -> CLabel -> Line SDoc #-}
 {-# SPECIALIZE pprGNUSectionHeader :: NCGConfig -> SectionType -> CLabel -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- XCOFF doesn't support relocating label-differences, so we place all
@@ -270,6 +275,7 @@ pprXcoffSectionHeader t = case t of
   UninitialisedData       -> text ".csect .data[BS]"
   _                       -> panic "pprXcoffSectionHeader: unknown section type"
 {-# SPECIALIZE pprXcoffSectionHeader :: SectionType -> SDoc #-}
+{-# SPECIALIZE pprXcoffSectionHeader :: SectionType -> Line SDoc #-}
 {-# SPECIALIZE pprXcoffSectionHeader :: SectionType -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 pprDarwinSectionHeader :: IsLine doc => SectionType -> doc
@@ -284,4 +290,5 @@ pprDarwinSectionHeader t = case t of
   CString                 -> text ".section\t__TEXT,__cstring,cstring_literals"
   OtherSection _          -> panic "pprDarwinSectionHeader: unknown section type"
 {-# SPECIALIZE pprDarwinSectionHeader :: SectionType -> SDoc #-}
+{-# SPECIALIZE pprDarwinSectionHeader :: SectionType -> Line SDoc #-}
 {-# SPECIALIZE pprDarwinSectionHeader :: SectionType -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable


=====================================
compiler/GHC/CmmToAsm/X86/Ppr.hs
=====================================
@@ -134,6 +134,7 @@ pprNatCmmDecl config proc@(CmmProc top_info entry_lbl _ (ListGraph blocks)) =
     , pprSizeDecl platform proc_lbl
     ]
 {-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl (Alignment, RawCmmStatics) Instr -> SDoc #-}
+{-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl (Alignment, RawCmmStatics) Instr -> Line SDoc #-}
 {-# SPECIALIZE pprNatCmmDecl :: NCGConfig -> NatCmmDecl (Alignment, RawCmmStatics) Instr -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Output an internal proc label. See Note [Internal proc labels] in CLabel.


=====================================
compiler/GHC/CmmToLlvm.hs
=====================================
@@ -126,6 +126,7 @@ llvmHeader cfg =
                    hang (text "Available targets:") 4
                         (vcat $ map (text . fst) $ llvmTargets config)
 {-# SPECIALIZE llvmHeader :: LlvmCgConfig -> SDoc #-}
+{-# SPECIALIZE llvmHeader :: LlvmCgConfig -> Line SDoc #-}
 {-# SPECIALIZE llvmHeader :: LlvmCgConfig -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 llvmGroupLlvmGens :: RawCmmGroup -> LlvmM ()


=====================================
compiler/GHC/CmmToLlvm/Ppr.hs
=====================================
@@ -36,6 +36,7 @@ pprLlvmData cfg (globals, types) =
         globals' = ppLlvmGlobals cfg globals
     in types' $$ globals'
 {-# SPECIALIZE pprLlvmData :: LlvmCgConfig -> LlvmData -> SDoc #-}
+{-# SPECIALIZE pprLlvmData :: LlvmCgConfig -> LlvmData -> Line SDoc #-}
 {-# SPECIALIZE pprLlvmData :: LlvmCgConfig -> LlvmData -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 


=====================================
compiler/GHC/Llvm/MetaData.hs
=====================================
@@ -79,6 +79,7 @@ instance Outputable MetaId where
 ppMetaId :: IsLine doc => MetaId -> doc
 ppMetaId (MetaId n) = char '!' <> int n
 {-# SPECIALIZE ppMetaId :: MetaId -> SDoc #-}
+{-# SPECIALIZE ppMetaId :: MetaId -> Line SDoc #-}
 {-# SPECIALIZE ppMetaId :: MetaId -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | LLVM metadata expressions


=====================================
compiler/GHC/Llvm/Ppr.hs
=====================================
@@ -58,6 +58,7 @@ ppLlvmModule opts (LlvmModule comments aliases meta globals decls funcs)
     $$ ppLlvmFunctionDecls decls $$ newLine
     $$ ppLlvmFunctions opts funcs
 {-# SPECIALIZE ppLlvmModule :: LlvmCgConfig -> LlvmModule -> SDoc #-}
+{-# SPECIALIZE ppLlvmModule :: LlvmCgConfig -> LlvmModule -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmModule :: LlvmCgConfig -> LlvmModule -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -65,12 +66,14 @@ ppLlvmModule opts (LlvmModule comments aliases meta globals decls funcs)
 ppLlvmComments :: IsDoc doc => [LMString] -> doc
 ppLlvmComments comments = lines_ $ map ppLlvmComment comments
 {-# SPECIALIZE ppLlvmComments :: [LMString] -> SDoc #-}
+{-# SPECIALIZE ppLlvmComments :: [LMString] -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmComments :: [LMString] -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out a comment, can be inside a function or on its own
 ppLlvmComment :: IsLine doc => LMString -> doc
 ppLlvmComment com = semi <+> ftext com
 {-# SPECIALIZE ppLlvmComment :: LMString -> SDoc #-}
+{-# SPECIALIZE ppLlvmComment :: LMString -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmComment :: LMString -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -78,6 +81,7 @@ ppLlvmComment com = semi <+> ftext com
 ppLlvmGlobals :: IsDoc doc => LlvmCgConfig -> [LMGlobal] -> doc
 ppLlvmGlobals opts ls = lines_ $ map (ppLlvmGlobal opts) ls
 {-# SPECIALIZE ppLlvmGlobals :: LlvmCgConfig -> [LMGlobal] -> SDoc #-}
+{-# SPECIALIZE ppLlvmGlobals :: LlvmCgConfig -> [LMGlobal] -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmGlobals :: LlvmCgConfig -> [LMGlobal] -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out a global mutable variable definition
@@ -106,6 +110,7 @@ ppLlvmGlobal opts (LMGlobal var@(LMGlobalVar _ _ link x a c) dat) =
 ppLlvmGlobal opts (LMGlobal var val) = pprPanic "ppLlvmGlobal" $
   text "Non Global var ppr as global! " <> ppVar opts var <> text "=" <> ppr (fmap (ppStatic @SDoc opts) val)
 {-# SPECIALIZE ppLlvmGlobal :: LlvmCgConfig -> LMGlobal -> SDoc #-}
+{-# SPECIALIZE ppLlvmGlobal :: LlvmCgConfig -> LMGlobal -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmGlobal :: LlvmCgConfig -> LMGlobal -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -113,6 +118,7 @@ ppLlvmGlobal opts (LMGlobal var val) = pprPanic "ppLlvmGlobal" $
 ppLlvmAliases :: IsDoc doc => [LlvmAlias] -> doc
 ppLlvmAliases tys = lines_ $ map ppLlvmAlias tys
 {-# SPECIALIZE ppLlvmAliases :: [LlvmAlias] -> SDoc #-}
+{-# SPECIALIZE ppLlvmAliases :: [LlvmAlias] -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmAliases :: [LlvmAlias] -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out an LLVM type alias.
@@ -120,6 +126,7 @@ ppLlvmAlias :: IsLine doc => LlvmAlias -> doc
 ppLlvmAlias (name, ty)
   = char '%' <> ftext name <+> equals <+> text "type" <+> ppLlvmType ty
 {-# SPECIALIZE ppLlvmAlias :: LlvmAlias -> SDoc #-}
+{-# SPECIALIZE ppLlvmAlias :: LlvmAlias -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmAlias :: LlvmAlias -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -127,6 +134,7 @@ ppLlvmAlias (name, ty)
 ppLlvmMetas :: IsDoc doc => LlvmCgConfig -> [MetaDecl] -> doc
 ppLlvmMetas opts metas = lines_ $ map (ppLlvmMeta opts) metas
 {-# SPECIALIZE ppLlvmMetas :: LlvmCgConfig -> [MetaDecl] -> SDoc #-}
+{-# SPECIALIZE ppLlvmMetas :: LlvmCgConfig -> [MetaDecl] -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmMetas :: LlvmCgConfig -> [MetaDecl] -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out an LLVM metadata definition.
@@ -139,6 +147,7 @@ ppLlvmMeta _opts (MetaNamed n m)
   where
     nodes = hcat $ intersperse comma $ map ppMetaId m
 {-# SPECIALIZE ppLlvmMeta :: LlvmCgConfig -> MetaDecl -> SDoc #-}
+{-# SPECIALIZE ppLlvmMeta :: LlvmCgConfig -> MetaDecl -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmMeta :: LlvmCgConfig -> MetaDecl -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -146,6 +155,7 @@ ppLlvmMeta _opts (MetaNamed n m)
 ppLlvmFunctions :: IsDoc doc => LlvmCgConfig -> LlvmFunctions -> doc
 ppLlvmFunctions opts funcs = vcat $ map (ppLlvmFunction opts) funcs
 {-# SPECIALIZE ppLlvmFunctions :: LlvmCgConfig -> LlvmFunctions -> SDoc #-}
+{-# SPECIALIZE ppLlvmFunctions :: LlvmCgConfig -> LlvmFunctions -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmFunctions :: LlvmCgConfig -> LlvmFunctions -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out a function definition.
@@ -167,6 +177,7 @@ ppLlvmFunction opts fun =
         , newLine
         , newLine]
 {-# SPECIALIZE ppLlvmFunction :: LlvmCgConfig -> LlvmFunction -> SDoc #-}
+{-# SPECIALIZE ppLlvmFunction :: LlvmCgConfig -> LlvmFunction -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmFunction :: LlvmCgConfig -> LlvmFunction -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out a function definition header.
@@ -186,12 +197,14 @@ ppLlvmFunctionHeader (LlvmFunctionDecl n l c r varg p a) args
     in ppLlvmLinkageType l <+> ppLlvmCallConvention c <+> ppLlvmType r <+> char '@' <> ftext n <> lparen <>
         hsep (punctuate comma args') <> varg' <> rparen <> align
 {-# SPECIALIZE ppLlvmFunctionHeader :: LlvmFunctionDecl -> [LMString] -> SDoc #-}
+{-# SPECIALIZE ppLlvmFunctionHeader :: LlvmFunctionDecl -> [LMString] -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmFunctionHeader :: LlvmFunctionDecl -> [LMString] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out a list of function declaration.
 ppLlvmFunctionDecls :: IsDoc doc => LlvmFunctionDecls -> doc
 ppLlvmFunctionDecls decs = vcat $ map ppLlvmFunctionDecl decs
 {-# SPECIALIZE ppLlvmFunctionDecls :: LlvmFunctionDecls -> SDoc #-}
+{-# SPECIALIZE ppLlvmFunctionDecls :: LlvmFunctionDecls -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmFunctionDecls :: LlvmFunctionDecls -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out a function declaration.
@@ -213,6 +226,7 @@ ppLlvmFunctionDecl (LlvmFunctionDecl n l c r varg p a)
           <+> ppLlvmType r <+> char '@' <> ftext n <> lparen <> args <> varg' <> rparen <> align
         , empty]
 {-# SPECIALIZE ppLlvmFunctionDecl :: LlvmFunctionDecl -> SDoc #-}
+{-# SPECIALIZE ppLlvmFunctionDecl :: LlvmFunctionDecl -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmFunctionDecl :: LlvmFunctionDecl -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -220,6 +234,7 @@ ppLlvmFunctionDecl (LlvmFunctionDecl n l c r varg p a)
 ppLlvmBlocks :: IsDoc doc => LlvmCgConfig -> LlvmBlocks -> doc
 ppLlvmBlocks opts blocks = vcat $ map (ppLlvmBlock opts) blocks
 {-# SPECIALIZE ppLlvmBlocks :: LlvmCgConfig -> LlvmBlocks -> SDoc #-}
+{-# SPECIALIZE ppLlvmBlocks :: LlvmCgConfig -> LlvmBlocks -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmBlocks :: LlvmCgConfig -> LlvmBlocks -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out an LLVM block.
@@ -237,12 +252,14 @@ ppLlvmBlock opts (LlvmBlock blockId stmts) =
       : map (ppLlvmStatement opts) block
       ++ [ empty , ppRest ]
 {-# SPECIALIZE ppLlvmBlock :: LlvmCgConfig -> LlvmBlock -> SDoc #-}
+{-# SPECIALIZE ppLlvmBlock :: LlvmCgConfig -> LlvmBlock -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmBlock :: LlvmCgConfig -> LlvmBlock -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out an LLVM block label.
 ppLlvmBlockLabel :: IsLine doc => LlvmBlockId -> doc
 ppLlvmBlockLabel id = pprUniqueAlways id <> colon
 {-# SPECIALIZE ppLlvmBlockLabel :: LlvmBlockId -> SDoc #-}
+{-# SPECIALIZE ppLlvmBlockLabel :: LlvmBlockId -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmBlockLabel :: LlvmBlockId -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -266,6 +283,7 @@ ppLlvmStatement opts stmt =
         Nop                       -> line empty
 
 {-# SPECIALIZE ppLlvmStatement :: LlvmCgConfig -> LlvmStatement -> SDoc #-}
+{-# SPECIALIZE ppLlvmStatement :: LlvmCgConfig -> LlvmStatement -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmStatement :: LlvmCgConfig -> LlvmStatement -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print out an LLVM expression.
@@ -291,6 +309,7 @@ ppLlvmExpression opts expr
         Asm        asm c ty v se sk -> ppAsm opts asm c ty v se sk
         MExpr      meta expr        -> ppMetaAnnotExpr opts meta expr
 {-# SPECIALIZE ppLlvmExpression :: LlvmCgConfig -> LlvmExpression -> SDoc #-}
+{-# SPECIALIZE ppLlvmExpression :: LlvmCgConfig -> LlvmExpression -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmExpression :: LlvmCgConfig -> LlvmExpression -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppMetaExpr :: IsLine doc => LlvmCgConfig -> MetaExpr -> doc
@@ -302,6 +321,7 @@ ppMetaExpr opts = \case
   MetaVar    v                     -> ppVar opts v
   MetaStruct es                    -> char '!' <> braces (ppCommaJoin (ppMetaExpr opts) es)
 {-# SPECIALIZE ppMetaExpr :: LlvmCgConfig -> MetaExpr -> SDoc #-}
+{-# SPECIALIZE ppMetaExpr :: LlvmCgConfig -> MetaExpr -> Line SDoc #-}
 {-# SPECIALIZE ppMetaExpr :: LlvmCgConfig -> MetaExpr -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -348,6 +368,7 @@ ppCall opts ct fptr args attrs = case fptr of
           ppCallMetaExpr attrs (MetaVar v) = ppVar' attrs opts v
           ppCallMetaExpr _ v             = text "metadata" <+> ppMetaExpr opts v
 {-# SPECIALIZE ppCall :: LlvmCgConfig -> LlvmCallType -> LlvmVar -> [MetaExpr] -> [LlvmFuncAttr] -> SDoc #-}
+{-# SPECIALIZE ppCall :: LlvmCgConfig -> LlvmCallType -> LlvmVar -> [MetaExpr] -> [LlvmFuncAttr] -> Line SDoc #-}
 {-# SPECIALIZE ppCall :: LlvmCgConfig -> LlvmCallType -> LlvmVar -> [MetaExpr] -> [LlvmFuncAttr] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -356,6 +377,7 @@ ppMachOp opts op left right =
   ppLlvmMachOp op <+> ppLlvmType (getVarType left) <+> ppName opts left
         <> comma <+> ppName opts right
 {-# SPECIALIZE ppMachOp :: LlvmCgConfig -> LlvmMachOp -> LlvmVar -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppMachOp :: LlvmCgConfig -> LlvmMachOp -> LlvmVar -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppMachOp :: LlvmCgConfig -> LlvmMachOp -> LlvmVar -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -373,11 +395,13 @@ ppCmpOp opts op left right =
   in cmpOp <+> ppLlvmCmpOp op <+> ppLlvmType (getVarType left)
         <+> ppName opts left <> comma <+> ppName opts right
 {-# SPECIALIZE ppCmpOp :: LlvmCgConfig -> LlvmCmpOp -> LlvmVar -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppCmpOp :: LlvmCgConfig -> LlvmCmpOp -> LlvmVar -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppCmpOp :: LlvmCgConfig -> LlvmCmpOp -> LlvmVar -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppAssignment :: IsLine doc => LlvmCgConfig -> LlvmVar -> doc -> doc
 ppAssignment opts var expr = ppName opts var <+> equals <+> expr
 {-# SPECIALIZE ppAssignment :: LlvmCgConfig -> LlvmVar -> SDoc -> SDoc #-}
+{-# SPECIALIZE ppAssignment :: LlvmCgConfig -> LlvmVar -> SDoc -> Line SDoc #-}
 {-# SPECIALIZE ppAssignment :: LlvmCgConfig -> LlvmVar -> HLine -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppFence :: IsLine doc => Bool -> LlvmSyncOrdering -> doc
@@ -386,6 +410,7 @@ ppFence st ord =
                                 False -> empty
   in text "fence" <+> singleThread <+> ppSyncOrdering ord
 {-# SPECIALIZE ppFence :: Bool -> LlvmSyncOrdering -> SDoc #-}
+{-# SPECIALIZE ppFence :: Bool -> LlvmSyncOrdering -> Line SDoc #-}
 {-# SPECIALIZE ppFence :: Bool -> LlvmSyncOrdering -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppSyncOrdering :: IsLine doc => LlvmSyncOrdering -> doc
@@ -396,6 +421,7 @@ ppSyncOrdering SyncRelease   = text "release"
 ppSyncOrdering SyncAcqRel    = text "acq_rel"
 ppSyncOrdering SyncSeqCst    = text "seq_cst"
 {-# SPECIALIZE ppSyncOrdering :: LlvmSyncOrdering -> SDoc #-}
+{-# SPECIALIZE ppSyncOrdering :: LlvmSyncOrdering -> Line SDoc #-}
 {-# SPECIALIZE ppSyncOrdering :: LlvmSyncOrdering -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppAtomicOp :: IsLine doc => LlvmAtomicOp -> doc
@@ -411,6 +437,7 @@ ppAtomicOp LAO_Min  = text "min"
 ppAtomicOp LAO_Umax = text "umax"
 ppAtomicOp LAO_Umin = text "umin"
 {-# SPECIALIZE ppAtomicOp :: LlvmAtomicOp -> SDoc #-}
+{-# SPECIALIZE ppAtomicOp :: LlvmAtomicOp -> Line SDoc #-}
 {-# SPECIALIZE ppAtomicOp :: LlvmAtomicOp -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppAtomicRMW :: IsLine doc => LlvmCgConfig -> LlvmAtomicOp -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> doc
@@ -418,6 +445,7 @@ ppAtomicRMW opts aop tgt src ordering =
   text "atomicrmw" <+> ppAtomicOp aop <+> ppVar opts tgt <> comma
   <+> ppVar opts src <+> ppSyncOrdering ordering
 {-# SPECIALIZE ppAtomicRMW :: LlvmCgConfig -> LlvmAtomicOp -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> SDoc #-}
+{-# SPECIALIZE ppAtomicRMW :: LlvmCgConfig -> LlvmAtomicOp -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> Line SDoc #-}
 {-# SPECIALIZE ppAtomicRMW :: LlvmCgConfig -> LlvmAtomicOp -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppCmpXChg :: IsLine doc => LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar
@@ -426,6 +454,7 @@ ppCmpXChg opts addr old new s_ord f_ord =
   text "cmpxchg" <+> ppVar opts addr <> comma <+> ppVar opts old <> comma <+> ppVar opts new
   <+> ppSyncOrdering s_ord <+> ppSyncOrdering f_ord
 {-# SPECIALIZE ppCmpXChg :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmSyncOrdering -> SDoc #-}
+{-# SPECIALIZE ppCmpXChg :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmSyncOrdering -> Line SDoc #-}
 {-# SPECIALIZE ppCmpXChg :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmSyncOrdering -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -439,6 +468,7 @@ ppLoad opts var alignment =
         Just n  -> text ", align" <+> int n
         Nothing -> empty
 {-# SPECIALIZE ppLoad :: LlvmCgConfig -> LlvmVar -> LMAlign -> SDoc #-}
+{-# SPECIALIZE ppLoad :: LlvmCgConfig -> LlvmVar -> LMAlign -> Line SDoc #-}
 {-# SPECIALIZE ppLoad :: LlvmCgConfig -> LlvmVar -> LMAlign -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppALoad :: IsLine doc => LlvmCgConfig -> LlvmSyncOrdering -> SingleThreaded -> LlvmVar -> doc
@@ -451,6 +481,7 @@ ppALoad opts ord st var =
   in text "load atomic" <+> ppLlvmType derefType <> comma <+> ppVar opts var <> sThreaded
             <+> ppSyncOrdering ord <> align
 {-# SPECIALIZE ppALoad :: LlvmCgConfig -> LlvmSyncOrdering -> SingleThreaded -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppALoad :: LlvmCgConfig -> LlvmSyncOrdering -> SingleThreaded -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppALoad :: LlvmCgConfig -> LlvmSyncOrdering -> SingleThreaded -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppStore :: IsLine doc => LlvmCgConfig -> LlvmVar -> LlvmVar -> LMAlign -> [MetaAnnot] -> doc
@@ -462,6 +493,7 @@ ppStore opts val dst alignment metas =
         Just n  -> text ", align" <+> int n
         Nothing -> empty
 {-# SPECIALIZE ppStore :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LMAlign -> [MetaAnnot] -> SDoc #-}
+{-# SPECIALIZE ppStore :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LMAlign -> [MetaAnnot] -> Line SDoc #-}
 {-# SPECIALIZE ppStore :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LMAlign -> [MetaAnnot] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -472,6 +504,7 @@ ppCast opts op from to
     <+> text "to"
     <+> ppLlvmType to
 {-# SPECIALIZE ppCast :: LlvmCgConfig -> LlvmCastOp -> LlvmVar -> LlvmType -> SDoc #-}
+{-# SPECIALIZE ppCast :: LlvmCgConfig -> LlvmCastOp -> LlvmVar -> LlvmType -> Line SDoc #-}
 {-# SPECIALIZE ppCast :: LlvmCgConfig -> LlvmCastOp -> LlvmVar -> LlvmType -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -480,6 +513,7 @@ ppMalloc opts tp amount =
   let amount' = LMLitVar $ LMIntLit (toInteger amount) i32
   in text "malloc" <+> ppLlvmType tp <> comma <+> ppVar opts amount'
 {-# SPECIALIZE ppMalloc :: LlvmCgConfig -> LlvmType -> Int -> SDoc #-}
+{-# SPECIALIZE ppMalloc :: LlvmCgConfig -> LlvmType -> Int -> Line SDoc #-}
 {-# SPECIALIZE ppMalloc :: LlvmCgConfig -> LlvmType -> Int -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppAlloca :: IsLine doc => LlvmCgConfig -> LlvmType -> Int -> doc
@@ -487,6 +521,7 @@ ppAlloca opts tp amount =
   let amount' = LMLitVar $ LMIntLit (toInteger amount) i32
   in text "alloca" <+> ppLlvmType tp <> comma <+> ppVar opts amount'
 {-# SPECIALIZE ppAlloca :: LlvmCgConfig -> LlvmType -> Int -> SDoc #-}
+{-# SPECIALIZE ppAlloca :: LlvmCgConfig -> LlvmType -> Int -> Line SDoc #-}
 {-# SPECIALIZE ppAlloca :: LlvmCgConfig -> LlvmType -> Int -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppGetElementPtr :: IsLine doc => LlvmCgConfig -> Bool -> LlvmVar -> [LlvmVar] -> doc
@@ -497,6 +532,7 @@ ppGetElementPtr opts inb ptr idx =
   in text "getelementptr" <+> inbound <+> ppLlvmType derefType <> comma <+> ppVar opts ptr
                             <> indexes
 {-# SPECIALIZE ppGetElementPtr :: LlvmCgConfig -> Bool -> LlvmVar -> [LlvmVar] -> SDoc #-}
+{-# SPECIALIZE ppGetElementPtr :: LlvmCgConfig -> Bool -> LlvmVar -> [LlvmVar] -> Line SDoc #-}
 {-# SPECIALIZE ppGetElementPtr :: LlvmCgConfig -> Bool -> LlvmVar -> [LlvmVar] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -504,11 +540,13 @@ ppReturn :: IsLine doc => LlvmCgConfig -> Maybe LlvmVar -> doc
 ppReturn opts (Just var) = text "ret" <+> ppVar opts var
 ppReturn _    Nothing    = text "ret" <+> ppLlvmType LMVoid
 {-# SPECIALIZE ppReturn :: LlvmCgConfig -> Maybe LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppReturn :: LlvmCgConfig -> Maybe LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppReturn :: LlvmCgConfig -> Maybe LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppBranch :: IsLine doc => LlvmCgConfig -> LlvmVar -> doc
 ppBranch opts var = text "br" <+> ppVar opts var
 {-# SPECIALIZE ppBranch :: LlvmCgConfig -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppBranch :: LlvmCgConfig -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppBranch :: LlvmCgConfig -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -516,6 +554,7 @@ ppBranchIf :: IsLine doc => LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> doc
 ppBranchIf opts cond trueT falseT
   = text "br" <+> ppVar opts cond <> comma <+> ppVar opts trueT <> comma <+> ppVar opts falseT
 {-# SPECIALIZE ppBranchIf :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppBranchIf :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppBranchIf :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -524,6 +563,7 @@ ppPhi opts tp preds =
   let ppPreds (val, label) = brackets $ ppName opts val <> comma <+> ppName opts label
   in text "phi" <+> ppLlvmType tp <+> hsep (punctuate comma $ map ppPreds preds)
 {-# SPECIALIZE ppPhi :: LlvmCgConfig -> LlvmType -> [(LlvmVar,LlvmVar)] -> SDoc #-}
+{-# SPECIALIZE ppPhi :: LlvmCgConfig -> LlvmType -> [(LlvmVar,LlvmVar)] -> Line SDoc #-}
 {-# SPECIALIZE ppPhi :: LlvmCgConfig -> LlvmType -> [(LlvmVar,LlvmVar)] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -536,6 +576,7 @@ ppSwitch opts scrut dflt targets =
       , [char ']']
       ]
 {-# SPECIALIZE ppSwitch :: LlvmCgConfig -> LlvmVar -> LlvmVar -> [(LlvmVar,LlvmVar)] -> SDoc #-}
+{-# SPECIALIZE ppSwitch :: LlvmCgConfig -> LlvmVar -> LlvmVar -> [(LlvmVar,LlvmVar)] -> Line SDoc #-}
 {-# SPECIALIZE ppSwitch :: LlvmCgConfig -> LlvmVar -> LlvmVar -> [(LlvmVar,LlvmVar)] -> HDoc #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -550,6 +591,7 @@ ppAsm opts asm constraints rty vars sideeffect alignstack =
   in text "call" <+> rty' <+> text "asm" <+> side <+> align <+> asm' <> comma
         <+> cons <> vars'
 {-# SPECIALIZE ppAsm :: LlvmCgConfig -> LMString -> LMString -> LlvmType -> [LlvmVar] -> Bool -> Bool -> SDoc #-}
+{-# SPECIALIZE ppAsm :: LlvmCgConfig -> LMString -> LMString -> LlvmType -> [LlvmVar] -> Bool -> Bool -> Line SDoc #-}
 {-# SPECIALIZE ppAsm :: LlvmCgConfig -> LMString -> LMString -> LlvmType -> [LlvmVar] -> Bool -> Bool -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppExtract :: IsLine doc => LlvmCgConfig -> LlvmVar -> LlvmVar -> doc
@@ -558,6 +600,7 @@ ppExtract opts vec idx =
     <+> ppLlvmType (getVarType vec) <+> ppName opts vec <> comma
     <+> ppVar opts idx
 {-# SPECIALIZE ppExtract :: LlvmCgConfig -> LlvmVar -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppExtract :: LlvmCgConfig -> LlvmVar -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppExtract :: LlvmCgConfig -> LlvmVar -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppExtractV :: IsLine doc => LlvmCgConfig -> LlvmVar -> Int -> doc
@@ -566,6 +609,7 @@ ppExtractV opts struct idx =
     <+> ppLlvmType (getVarType struct) <+> ppName opts struct <> comma
     <+> int idx
 {-# SPECIALIZE ppExtractV :: LlvmCgConfig -> LlvmVar -> Int -> SDoc #-}
+{-# SPECIALIZE ppExtractV :: LlvmCgConfig -> LlvmVar -> Int -> Line SDoc #-}
 {-# SPECIALIZE ppExtractV :: LlvmCgConfig -> LlvmVar -> Int -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppInsert :: IsLine doc => LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> doc
@@ -575,12 +619,14 @@ ppInsert opts vec elt idx =
     <+> ppLlvmType (getVarType elt) <+> ppName opts elt <> comma
     <+> ppVar opts idx
 {-# SPECIALIZE ppInsert :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppInsert :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppInsert :: LlvmCgConfig -> LlvmVar -> LlvmVar -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppMetaAnnotExpr :: IsLine doc => LlvmCgConfig -> [MetaAnnot] -> LlvmExpression -> doc
 ppMetaAnnotExpr opts meta expr =
    ppLlvmExpression opts expr <> ppMetaAnnots opts meta
 {-# SPECIALIZE ppMetaAnnotExpr :: LlvmCgConfig -> [MetaAnnot] -> LlvmExpression -> SDoc #-}
+{-# SPECIALIZE ppMetaAnnotExpr :: LlvmCgConfig -> [MetaAnnot] -> LlvmExpression -> Line SDoc #-}
 {-# SPECIALIZE ppMetaAnnotExpr :: LlvmCgConfig -> [MetaAnnot] -> LlvmExpression -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppMetaAnnots :: IsLine doc => LlvmCgConfig -> [MetaAnnot] -> doc
@@ -593,6 +639,7 @@ ppMetaAnnots opts meta = hcat $ map ppMeta meta
             MetaStruct ms -> exclamation <> braces (ppCommaJoin (ppMetaExpr opts) ms)
             other         -> exclamation <> braces (ppMetaExpr opts other) -- possible?
 {-# SPECIALIZE ppMetaAnnots :: LlvmCgConfig -> [MetaAnnot] -> SDoc #-}
+{-# SPECIALIZE ppMetaAnnots :: LlvmCgConfig -> [MetaAnnot] -> Line SDoc #-}
 {-# SPECIALIZE ppMetaAnnots :: LlvmCgConfig -> [MetaAnnot] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Return the variable name or value of the 'LlvmVar'
@@ -604,6 +651,7 @@ ppName opts v = case v of
    LMNLocalVar {} -> char '%' <> ppPlainName opts v
    LMLitVar    {} ->             ppPlainName opts v
 {-# SPECIALIZE ppName :: LlvmCgConfig -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppName :: LlvmCgConfig -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppName :: LlvmCgConfig -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Return the variable name or value of the 'LlvmVar'
@@ -616,6 +664,7 @@ ppPlainName opts v = case v of
    (LMNLocalVar x _        ) -> ftext x
    (LMLitVar    x          ) -> ppLit opts x
 {-# SPECIALIZE ppPlainName :: LlvmCgConfig -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppPlainName :: LlvmCgConfig -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppPlainName :: LlvmCgConfig -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print a literal value. No type.
@@ -639,11 +688,13 @@ ppLit opts l = case l of
       , Just lit <- garbageLit t   -> ppLit opts lit
       | otherwise                  -> text "undef"
 {-# SPECIALIZE ppLit :: LlvmCgConfig -> LlvmLit -> SDoc #-}
+{-# SPECIALIZE ppLit :: LlvmCgConfig -> LlvmLit -> Line SDoc #-}
 {-# SPECIALIZE ppLit :: LlvmCgConfig -> LlvmLit -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppVar :: IsLine doc => LlvmCgConfig -> LlvmVar -> doc
 ppVar = ppVar' []
 {-# SPECIALIZE ppVar :: LlvmCgConfig -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppVar :: LlvmCgConfig -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppVar :: LlvmCgConfig -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppVar' :: IsLine doc => [LlvmParamAttr] -> LlvmCgConfig -> LlvmVar -> doc
@@ -651,11 +702,13 @@ ppVar' attrs opts v = case v of
   LMLitVar x -> ppTypeLit' attrs opts x
   x          -> ppLlvmType (getVarType x) <+> ppSpaceJoin ppLlvmParamAttr attrs <+> ppName opts x
 {-# SPECIALIZE ppVar' :: [LlvmParamAttr] -> LlvmCgConfig -> LlvmVar -> SDoc #-}
+{-# SPECIALIZE ppVar' :: [LlvmParamAttr] -> LlvmCgConfig -> LlvmVar -> Line SDoc #-}
 {-# SPECIALIZE ppVar' :: [LlvmParamAttr] -> LlvmCgConfig -> LlvmVar -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppTypeLit :: IsLine doc => LlvmCgConfig -> LlvmLit -> doc
 ppTypeLit = ppTypeLit' []
 {-# SPECIALIZE ppTypeLit :: LlvmCgConfig -> LlvmLit -> SDoc #-}
+{-# SPECIALIZE ppTypeLit :: LlvmCgConfig -> LlvmLit -> Line SDoc #-}
 {-# SPECIALIZE ppTypeLit :: LlvmCgConfig -> LlvmLit -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppTypeLit' :: IsLine doc => [LlvmParamAttr] -> LlvmCgConfig -> LlvmLit -> doc
@@ -663,6 +716,7 @@ ppTypeLit' attrs opts l = case l of
   LMVectorLit {} -> ppLit opts l
   _              -> ppLlvmType (getLitType l) <+> ppSpaceJoin ppLlvmParamAttr attrs <+> ppLit opts l
 {-# SPECIALIZE ppTypeLit' :: [LlvmParamAttr] -> LlvmCgConfig -> LlvmLit -> SDoc #-}
+{-# SPECIALIZE ppTypeLit' :: [LlvmParamAttr] -> LlvmCgConfig -> LlvmLit -> Line SDoc #-}
 {-# SPECIALIZE ppTypeLit' :: [LlvmParamAttr] -> LlvmCgConfig -> LlvmLit -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppStatic :: IsLine doc => LlvmCgConfig -> LlvmStatic -> doc
@@ -681,6 +735,7 @@ ppStatic opts st = case st of
   LMAdd s1 s2       -> pprStaticArith opts s1 s2 (text "add") (text "fadd") (text "LMAdd")
   LMSub s1 s2       -> pprStaticArith opts s1 s2 (text "sub") (text "fsub") (text "LMSub")
 {-# SPECIALIZE ppStatic :: LlvmCgConfig -> LlvmStatic -> SDoc #-}
+{-# SPECIALIZE ppStatic :: LlvmCgConfig -> LlvmStatic -> Line SDoc #-}
 {-# SPECIALIZE ppStatic :: LlvmCgConfig -> LlvmStatic -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -694,6 +749,7 @@ pprSpecialStatic opts stat = case stat of
                         <> comma <+> ppStatic opts stat
    _                 -> ppStatic opts stat
 {-# SPECIALIZE pprSpecialStatic :: LlvmCgConfig -> LlvmStatic -> SDoc #-}
+{-# SPECIALIZE pprSpecialStatic :: LlvmCgConfig -> LlvmStatic -> Line SDoc #-}
 {-# SPECIALIZE pprSpecialStatic :: LlvmCgConfig -> LlvmStatic -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -707,6 +763,7 @@ pprStaticArith opts s1 s2 int_op float_op op_name =
                  op_name <> text " with different types! s1: " <> ppStatic opts s1
                          <> text", s2: " <> ppStatic opts s2
 {-# SPECIALIZE pprStaticArith :: LlvmCgConfig -> LlvmStatic -> LlvmStatic -> SDoc -> SDoc -> SDoc -> SDoc #-}
+{-# SPECIALIZE pprStaticArith :: LlvmCgConfig -> LlvmStatic -> LlvmStatic -> SDoc -> SDoc -> SDoc -> Line SDoc #-}
 {-# SPECIALIZE pprStaticArith :: LlvmCgConfig -> LlvmStatic -> LlvmStatic -> HLine -> HLine -> SDoc -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -718,10 +775,12 @@ pprStaticArith opts s1 s2 int_op float_op op_name =
 newLine :: IsDoc doc => doc
 newLine = empty
 {-# SPECIALIZE newLine :: SDoc #-}
+{-# SPECIALIZE newLine :: Line SDoc #-}
 {-# SPECIALIZE newLine :: HDoc #-}
 
 -- | Exclamation point.
 exclamation :: IsLine doc => doc
 exclamation = char '!'
 {-# SPECIALIZE exclamation :: SDoc #-}
+{-# SPECIALIZE exclamation :: Line SDoc #-}
 {-# SPECIALIZE exclamation :: HLine #-}


=====================================
compiler/GHC/Llvm/Types.hs
=====================================
@@ -89,6 +89,7 @@ ppLlvmType t = case t of
   LMFunction (LlvmFunctionDecl _ _ _ r varg p _)
     -> ppLlvmType r <+> lparen <> ppParams varg p <> rparen
 {-# SPECIALIZE ppLlvmType :: LlvmType -> SDoc #-}
+{-# SPECIALIZE ppLlvmType :: LlvmType -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmType :: LlvmType -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppParams :: IsLine doc => LlvmParameterListType -> [LlvmParameter] -> doc
@@ -101,6 +102,7 @@ ppParams varg p
         args = map fst p
     in ppCommaJoin ppLlvmType args <> varg'
 {-# SPECIALIZE ppParams :: LlvmParameterListType -> [LlvmParameter] -> SDoc #-}
+{-# SPECIALIZE ppParams :: LlvmParameterListType -> [LlvmParameter] -> Line SDoc #-}
 {-# SPECIALIZE ppParams :: LlvmParameterListType -> [LlvmParameter] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | An LLVM section definition. If Nothing then let LLVM decide the section
@@ -400,6 +402,7 @@ ppLlvmParamAttr NoAlias   = text "noalias"
 ppLlvmParamAttr NoCapture = text "nocapture"
 ppLlvmParamAttr Nest      = text "nest"
 {-# SPECIALIZE ppLlvmParamAttr :: LlvmParamAttr -> SDoc #-}
+{-# SPECIALIZE ppLlvmParamAttr :: LlvmParamAttr -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmParamAttr :: LlvmParamAttr -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Llvm Function Attributes.
@@ -498,6 +501,7 @@ ppLlvmFuncAttr NoRedZone          = text "noredzone"
 ppLlvmFuncAttr NoImplicitFloat    = text "noimplicitfloat"
 ppLlvmFuncAttr Naked              = text "naked"
 {-# SPECIALIZE ppLlvmFuncAttr :: LlvmFuncAttr -> SDoc #-}
+{-# SPECIALIZE ppLlvmFuncAttr :: LlvmFuncAttr -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmFuncAttr :: LlvmFuncAttr -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -556,6 +560,7 @@ ppLlvmCallConvention CC_Ghc       = text "ghccc"
 ppLlvmCallConvention (CC_Ncc i)   = text "cc " <> int i
 ppLlvmCallConvention CC_X86_Stdcc = text "x86_stdcallcc"
 {-# SPECIALIZE ppLlvmCallConvention :: LlvmCallConvention -> SDoc #-}
+{-# SPECIALIZE ppLlvmCallConvention :: LlvmCallConvention -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmCallConvention :: LlvmCallConvention -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -630,6 +635,7 @@ ppLlvmLinkageType ExternallyVisible = empty
 ppLlvmLinkageType External          = text "external"
 ppLlvmLinkageType Private           = text "private"
 {-# SPECIALIZE ppLlvmLinkageType :: LlvmLinkageType -> SDoc #-}
+{-# SPECIALIZE ppLlvmLinkageType :: LlvmLinkageType -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmLinkageType :: LlvmLinkageType -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- -----------------------------------------------------------------------------
@@ -690,6 +696,7 @@ ppLlvmMachOp LM_MO_And  = text "and"
 ppLlvmMachOp LM_MO_Or   = text "or"
 ppLlvmMachOp LM_MO_Xor  = text "xor"
 {-# SPECIALIZE ppLlvmMachOp :: LlvmMachOp -> SDoc #-}
+{-# SPECIALIZE ppLlvmMachOp :: LlvmMachOp -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmMachOp :: LlvmMachOp -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -737,6 +744,7 @@ ppLlvmCmpOp LM_CMP_Fge = text "oge"
 ppLlvmCmpOp LM_CMP_Flt = text "olt"
 ppLlvmCmpOp LM_CMP_Fle = text "ole"
 {-# SPECIALIZE ppLlvmCmpOp :: LlvmCmpOp -> SDoc #-}
+{-# SPECIALIZE ppLlvmCmpOp :: LlvmCmpOp -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmCmpOp :: LlvmCmpOp -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -773,6 +781,7 @@ ppLlvmCastOp LM_Ptrtoint = text "ptrtoint"
 ppLlvmCastOp LM_Inttoptr = text "inttoptr"
 ppLlvmCastOp LM_Bitcast  = text "bitcast"
 {-# SPECIALIZE ppLlvmCastOp :: LlvmCastOp -> SDoc #-}
+{-# SPECIALIZE ppLlvmCastOp :: LlvmCastOp -> Line SDoc #-}
 {-# SPECIALIZE ppLlvmCastOp :: LlvmCastOp -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- -----------------------------------------------------------------------------
@@ -799,6 +808,7 @@ ppDouble platform d
         str       = map toUpper $ concat $ fixEndian $ map hex bs
     in text "0x" <> text str
 {-# SPECIALIZE ppDouble :: Platform -> Double -> SDoc #-}
+{-# SPECIALIZE ppDouble :: Platform -> Double -> Line SDoc #-}
 {-# SPECIALIZE ppDouble :: Platform -> Double -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- Note [LLVM Float Types]
@@ -829,6 +839,7 @@ widenFp = float2Double
 ppFloat :: IsLine doc => Platform -> Float -> doc
 ppFloat platform = ppDouble platform . widenFp
 {-# SPECIALIZE ppFloat :: Platform -> Float -> SDoc #-}
+{-# SPECIALIZE ppFloat :: Platform -> Float -> Line SDoc #-}
 {-# SPECIALIZE ppFloat :: Platform -> Float -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 
@@ -839,9 +850,11 @@ ppFloat platform = ppDouble platform . widenFp
 ppCommaJoin :: IsLine doc => (a -> doc) -> [a] -> doc
 ppCommaJoin ppr strs = hsep $ punctuate comma (map ppr strs)
 {-# SPECIALIZE ppCommaJoin :: (a -> SDoc) -> [a] -> SDoc #-}
+{-# SPECIALIZE ppCommaJoin :: (a -> SDoc) -> [a] -> Line SDoc #-}
 {-# SPECIALIZE ppCommaJoin :: (a -> HLine) -> [a] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 ppSpaceJoin :: IsLine doc => (a -> doc) -> [a] -> doc
 ppSpaceJoin ppr strs = hsep (map ppr strs)
 {-# SPECIALIZE ppSpaceJoin :: (a -> SDoc) -> [a] -> SDoc #-}
+{-# SPECIALIZE ppSpaceJoin :: (a -> SDoc) -> [a] -> Line SDoc #-}
 {-# SPECIALIZE ppSpaceJoin :: (a -> HLine) -> [a] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable


=====================================
compiler/GHC/Types/CostCentre.hs
=====================================
@@ -261,6 +261,7 @@ pprCostCentreStack CurrentCCS        = text "CCCS"
 pprCostCentreStack DontCareCCS       = text "CCS_DONT_CARE"
 pprCostCentreStack (SingletonCCS cc) = pprCostCentre cc <> text "_ccs"
 {-# SPECIALISE pprCostCentreStack :: CostCentreStack -> SDoc #-}
+{-# SPECIALISE pprCostCentreStack :: CostCentreStack -> Line SDoc #-}
 {-# SPECIALISE pprCostCentreStack :: CostCentreStack -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -----------------------------------------------------------------------------
@@ -284,6 +285,7 @@ pprCostCentre :: IsLine doc => CostCentre -> doc
 pprCostCentre cc = docWithStyle (ppCostCentreLbl cc)
                                 (\_ -> ftext (costCentreUserNameFS cc))
 {-# SPECIALISE pprCostCentre :: CostCentre -> SDoc #-}
+{-# SPECIALISE pprCostCentre :: CostCentre -> Line SDoc #-}
 {-# SPECIALISE pprCostCentre :: CostCentre -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- Printing in Core
@@ -315,6 +317,7 @@ ppCostCentreLbl (NormalCC {cc_flavour = f, cc_name = n, cc_mod = m})
   = pprModule m <> char '_' <> ztext (zEncodeFS n) <> char '_' <>
         ppFlavourLblComponent f <> text "_cc"
 {-# SPECIALISE ppCostCentreLbl :: CostCentre -> SDoc #-}
+{-# SPECIALISE ppCostCentreLbl :: CostCentre -> Line SDoc #-}
 {-# SPECIALISE ppCostCentreLbl :: CostCentre -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- ^ Print the flavour component of a C label
@@ -328,6 +331,7 @@ ppFlavourLblComponent (IndexedCC flav i) =
     LateCC -> text "LATECC" <> ppIdxLblComponent i
     CallerCC -> text "CALLERCC" <> ppIdxLblComponent i
 {-# SPECIALISE ppFlavourLblComponent :: CCFlavour -> SDoc #-}
+{-# SPECIALISE ppFlavourLblComponent :: CCFlavour -> Line SDoc #-}
 {-# SPECIALISE ppFlavourLblComponent :: CCFlavour -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- ^ Print the flavour index component of a C label
@@ -337,6 +341,7 @@ ppIdxLblComponent n =
     0 -> empty
     n -> int n
 {-# SPECIALISE ppIdxLblComponent :: CostCentreIndex -> SDoc #-}
+{-# SPECIALISE ppIdxLblComponent :: CostCentreIndex -> Line SDoc #-}
 {-# SPECIALISE ppIdxLblComponent :: CostCentreIndex -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- This is the name to go in the user-displayed string,


=====================================
compiler/GHC/Types/Name.hs
=====================================
@@ -713,8 +713,8 @@ pprName name@(Name {n_sort = sort, n_uniq = uniq, n_occ = occ})
    handlePuns :: Bool -> Maybe FastString -> SDoc -> SDoc
    handlePuns True (Just pun) _ = ftext pun
    handlePuns _    _          r = r
-{-# INLINABLE pprName #-} -- Workaround a bug which prevented pprName from specialising (see #25060).
 {-# SPECIALISE pprName :: Name -> SDoc #-}
+{-# SPECIALISE pprName :: Name -> Line SDoc #-}
 {-# SPECIALISE pprName :: Name -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Print fully qualified name (with unit-id, module and unique)


=====================================
compiler/GHC/Types/Name/Occurrence.hs
=====================================
@@ -403,6 +403,7 @@ pprOccName (OccName sp occ)
   = docWithStyle (ztext (zEncodeFS occ))
     (\_ -> ftext occ <> whenPprDebug (braces (pprNameSpaceBrief sp)))
 {-# SPECIALIZE pprOccName :: OccName -> SDoc #-}
+{-# SPECIALIZE pprOccName :: OccName -> Line SDoc #-}
 {-# SPECIALIZE pprOccName :: OccName -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 -- | Mangle field names to avoid duplicate symbols.


=====================================
compiler/GHC/Types/Unique.hs
=====================================
@@ -305,6 +305,7 @@ pprUniqueAlways :: IsLine doc => Unique -> doc
 pprUniqueAlways u
   = text (showUnique u)
 {-# SPECIALIZE pprUniqueAlways :: Unique -> SDoc #-}
+{-# SPECIALIZE pprUniqueAlways :: Unique -> Line SDoc #-}
 {-# SPECIALIZE pprUniqueAlways :: Unique -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 instance Outputable Unique where


=====================================
compiler/GHC/Unit/Types.hs
=====================================
@@ -223,6 +223,7 @@ pprModule mod@(Module p n) = docWithStyle code doc
     | otherwise =
         pprModuleName n
 {-# SPECIALIZE pprModule :: Module -> SDoc #-}
+{-# SPECIALIZE pprModule :: Module -> Line SDoc #-}
 {-# SPECIALIZE pprModule :: Module -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
 
 pprInstantiatedModule :: InstantiatedModule -> SDoc


=====================================
compiler/GHC/Utils/Outputable.hs
=====================================
@@ -1080,6 +1080,7 @@ pprModuleName :: IsLine doc => ModuleName -> doc
 pprModuleName (ModuleName nm) =
     docWithStyle (ztext (zEncodeFS nm)) (\_ -> ftext nm)
 {-# SPECIALIZE pprModuleName :: ModuleName -> SDoc #-}
+{-# SPECIALIZE pprModuleName :: ModuleName -> Line SDoc #-}
 {-# SPECIALIZE pprModuleName :: ModuleName -> HLine #-} -- see Note [SPECIALIZE to HDoc]
 
 -----------------------------------------------------------------------
@@ -1374,6 +1375,7 @@ pprFilePathString path = doubleQuotes $ text (escape (normalise path))
       escape ('\\':xs) = '\\':'\\':escape xs
       escape (x:xs)    = x:escape xs
 {-# SPECIALIZE pprFilePathString :: FilePath -> SDoc #-}
+{-# SPECIALIZE pprFilePathString :: FilePath -> Line SDoc #-}
 {-# SPECIALIZE pprFilePathString :: FilePath -> HLine #-} -- see Note [SPECIALIZE to HDoc]
 
 {-
@@ -1737,6 +1739,11 @@ pragma just to the entry point pprNatCmmDecl, to avoid cluttering
 the entire module. Because specialization is transitive, this makes sure
 that other functions in that module are specialized too.
 
+NB: Specialising to SDoc also requires specialising to (Line SDoc) (which is a
+type family that reduces to SDoc). This serves to workaround the fact that a
+rule on @SDoc will not fire for @(Line SDoc) since the rule matching is blind
+to type-family equations. See #25060 for a discussion.
+
 Note [dualLine and dualDoc]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 The IsLine and IsDoc classes provide the dualLine and dualDoc methods,



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ad6e5be1ed852574f716052dcaf1e2ed03b7cfa4

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ad6e5be1ed852574f716052dcaf1e2ed03b7cfa4
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240710/5cfe0a02/attachment-0001.html>


More information about the ghc-commits mailing list