diff options
| author | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2016-01-15 18:24:14 +0100 |
|---|---|---|
| committer | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2016-01-18 18:54:10 +0100 |
| commit | b8abd852d3674cb485490d2b2e94906c06ee6e8f (patch) | |
| tree | eddf226b9c10be8b9b982ed29c1ef61841755c6f /compiler/cmm | |
| parent | 817dd925569d981523bbf4fb471014d46c51c7db (diff) | |
| download | haskell-b8abd852d3674cb485490d2b2e94906c06ee6e8f.tar.gz | |
Replace calls to `ptext . sLit` with `text`
Summary:
In the past the canonical way for constructing an SDoc string literal was the
composition `ptext . sLit`. But for some time now we have function `text` that
does the same. Plus it has some rules that optimize its runtime behaviour.
This patch takes all uses of `ptext . sLit` in the compiler and replaces them
with calls to `text`. The main benefits of this patch are clener (shorter) code
and less dependencies between module, because many modules now do not need to
import `FastString`. I don't expect any performance benefits - we mostly use
SDocs to report errors and it seems there is little to be gained here.
Test Plan: ./validate
Reviewers: bgamari, austin, goldfire, hvr, alanz
Subscribers: goldfire, thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1784
Diffstat (limited to 'compiler/cmm')
| -rw-r--r-- | compiler/cmm/CLabel.hs | 74 | ||||
| -rw-r--r-- | compiler/cmm/CmmLayoutStack.hs | 4 | ||||
| -rw-r--r-- | compiler/cmm/CmmLint.hs | 5 | ||||
| -rw-r--r-- | compiler/cmm/CmmType.hs | 6 | ||||
| -rw-r--r-- | compiler/cmm/PprC.hs | 288 | ||||
| -rw-r--r-- | compiler/cmm/PprCmm.hs | 64 | ||||
| -rw-r--r-- | compiler/cmm/PprCmmDecl.hs | 18 | ||||
| -rw-r--r-- | compiler/cmm/PprCmmExpr.hs | 49 | ||||
| -rw-r--r-- | compiler/cmm/SMRep.hs | 36 |
9 files changed, 271 insertions, 273 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index a7eb797eeb..9304d66323 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -1000,11 +1000,11 @@ pprCLabel platform (DynamicLinkerLabel info lbl) pprCLabel _ PicBaseLabel | cGhcWithNativeCodeGen == "YES" - = ptext (sLit "1b") + = text "1b" pprCLabel platform (DeadStripPreventer lbl) | cGhcWithNativeCodeGen == "YES" - = pprCLabel platform lbl <> ptext (sLit "_dsp") + = pprCLabel platform lbl <> text "_dsp" pprCLabel platform lbl = getPprStyle $ \ sty -> @@ -1028,22 +1028,22 @@ pprAsmCLbl _ lbl pprCLbl :: CLabel -> SDoc pprCLbl (StringLitLabel u) - = pprUnique u <> ptext (sLit "_str") + = pprUnique u <> text "_str" pprCLbl (CaseLabel u CaseReturnPt) - = hcat [pprUnique u, ptext (sLit "_ret")] + = hcat [pprUnique u, text "_ret"] pprCLbl (CaseLabel u CaseReturnInfo) - = hcat [pprUnique u, ptext (sLit "_info")] + = hcat [pprUnique u, text "_info"] pprCLbl (CaseLabel u (CaseAlt tag)) - = hcat [pprUnique u, pp_cSEP, int tag, ptext (sLit "_alt")] + = hcat [pprUnique u, pp_cSEP, int tag, text "_alt"] pprCLbl (CaseLabel u CaseDefault) - = hcat [pprUnique u, ptext (sLit "_dflt")] + = hcat [pprUnique u, text "_dflt"] pprCLbl (SRTLabel u) - = pprUnique u <> pp_cSEP <> ptext (sLit "srt") + = pprUnique u <> pp_cSEP <> text "srt" -pprCLbl (LargeSRTLabel u) = pprUnique u <> pp_cSEP <> ptext (sLit "srtd") -pprCLbl (LargeBitmapLabel u) = text "b" <> pprUnique u <> pp_cSEP <> ptext (sLit "btm") +pprCLbl (LargeSRTLabel u) = pprUnique u <> pp_cSEP <> text "srtd" +pprCLbl (LargeBitmapLabel u) = text "b" <> pprUnique u <> pp_cSEP <> text "btm" -- Some bitsmaps for tuple constructors have a numeric tag (e.g. '7') -- until that gets resolved we'll just force them to start -- with a letter so the label will be legal assmbly code. @@ -1053,56 +1053,56 @@ pprCLbl (CmmLabel _ str CmmCode) = ftext str pprCLbl (CmmLabel _ str CmmData) = ftext str pprCLbl (CmmLabel _ str CmmPrimCall) = ftext str -pprCLbl (RtsLabel (RtsApFast str)) = ftext str <> ptext (sLit "_fast") +pprCLbl (RtsLabel (RtsApFast str)) = ftext str <> text "_fast" pprCLbl (RtsLabel (RtsSelectorInfoTable upd_reqd offset)) - = hcat [ptext (sLit "stg_sel_"), text (show offset), + = hcat [text "stg_sel_", text (show offset), ptext (if upd_reqd then (sLit "_upd_info") else (sLit "_noupd_info")) ] pprCLbl (RtsLabel (RtsSelectorEntry upd_reqd offset)) - = hcat [ptext (sLit "stg_sel_"), text (show offset), + = hcat [text "stg_sel_", text (show offset), ptext (if upd_reqd then (sLit "_upd_entry") else (sLit "_noupd_entry")) ] pprCLbl (RtsLabel (RtsApInfoTable upd_reqd arity)) - = hcat [ptext (sLit "stg_ap_"), text (show arity), + = hcat [text "stg_ap_", text (show arity), ptext (if upd_reqd then (sLit "_upd_info") else (sLit "_noupd_info")) ] pprCLbl (RtsLabel (RtsApEntry upd_reqd arity)) - = hcat [ptext (sLit "stg_ap_"), text (show arity), + = hcat [text "stg_ap_", text (show arity), ptext (if upd_reqd then (sLit "_upd_entry") else (sLit "_noupd_entry")) ] pprCLbl (CmmLabel _ fs CmmInfo) - = ftext fs <> ptext (sLit "_info") + = ftext fs <> text "_info" pprCLbl (CmmLabel _ fs CmmEntry) - = ftext fs <> ptext (sLit "_entry") + = ftext fs <> text "_entry" pprCLbl (CmmLabel _ fs CmmRetInfo) - = ftext fs <> ptext (sLit "_info") + = ftext fs <> text "_info" pprCLbl (CmmLabel _ fs CmmRet) - = ftext fs <> ptext (sLit "_ret") + = ftext fs <> text "_ret" pprCLbl (CmmLabel _ fs CmmClosure) - = ftext fs <> ptext (sLit "_closure") + = ftext fs <> text "_closure" pprCLbl (RtsLabel (RtsPrimOp primop)) - = ptext (sLit "stg_") <> ppr primop + = text "stg_" <> ppr primop pprCLbl (RtsLabel (RtsSlowFastTickyCtr pat)) - = ptext (sLit "SLOW_CALL_fast_") <> text pat <> ptext (sLit "_ctr") + = text "SLOW_CALL_fast_" <> text pat <> ptext (sLit "_ctr") pprCLbl (ForeignLabel str _ _ _) = ftext str @@ -1113,10 +1113,10 @@ pprCLbl (CC_Label cc) = ppr cc pprCLbl (CCS_Label ccs) = ppr ccs pprCLbl (PlainModuleInitLabel mod) - = ptext (sLit "__stginit_") <> ppr mod + = text "__stginit_" <> ppr mod pprCLbl (HpcTicksLabel mod) - = ptext (sLit "_hpc_tickboxes_") <> ppr mod <> ptext (sLit "_hpc") + = text "_hpc_tickboxes_" <> ppr mod <> ptext (sLit "_hpc") pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel" pprCLbl (AsmTempDerivedLabel {})= panic "pprCLbl AsmTempDerivedLabel" @@ -1127,19 +1127,19 @@ pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer" ppIdFlavor :: IdLabelInfo -> SDoc ppIdFlavor x = pp_cSEP <> (case x of - Closure -> ptext (sLit "closure") - SRT -> ptext (sLit "srt") - InfoTable -> ptext (sLit "info") - LocalInfoTable -> ptext (sLit "info") - Entry -> ptext (sLit "entry") - LocalEntry -> ptext (sLit "entry") - Slow -> ptext (sLit "slow") - RednCounts -> ptext (sLit "ct") - ConEntry -> ptext (sLit "con_entry") - ConInfoTable -> ptext (sLit "con_info") - StaticConEntry -> ptext (sLit "static_entry") - StaticInfoTable -> ptext (sLit "static_info") - ClosureTable -> ptext (sLit "closure_tbl") + Closure -> text "closure" + SRT -> text "srt" + InfoTable -> text "info" + LocalInfoTable -> text "info" + Entry -> text "entry" + LocalEntry -> text "entry" + Slow -> text "slow" + RednCounts -> text "ct" + ConEntry -> text "con_entry" + ConInfoTable -> text "con_info" + StaticConEntry -> text "static_entry" + StaticInfoTable -> text "static_info" + ClosureTable -> text "closure_tbl" ) diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs index 1a10e683e1..5fea0e71ac 100644 --- a/compiler/cmm/CmmLayoutStack.hs +++ b/compiler/cmm/CmmLayoutStack.hs @@ -1071,8 +1071,8 @@ data StackSlot = Occupied | Empty -- Occupied: a return address or part of an update frame instance Outputable StackSlot where - ppr Occupied = ptext (sLit "XXX") - ppr Empty = ptext (sLit "---") + ppr Occupied = text "XXX" + ppr Empty = text "---" dropEmpty :: WordOff -> [StackSlot] -> Maybe [StackSlot] dropEmpty 0 ss = Just ss diff --git a/compiler/cmm/CmmLint.hs b/compiler/cmm/CmmLint.hs index 015337bdad..c009112d4b 100644 --- a/compiler/cmm/CmmLint.hs +++ b/compiler/cmm/CmmLint.hs @@ -17,7 +17,6 @@ import CmmLive import CmmSwitch (switchTargetsToList) import PprCmm () import BlockId -import FastString import Outputable import DynFlags @@ -41,9 +40,9 @@ cmmLintGraph dflags g = runCmmLint dflags (lintCmmGraph dflags) g runCmmLint :: Outputable a => DynFlags -> (a -> CmmLint b) -> a -> Maybe SDoc runCmmLint dflags l p = case unCL (l p) dflags of - Left err -> Just (vcat [ptext $ sLit ("Cmm lint error:"), + Left err -> Just (vcat [text "Cmm lint error:", nest 2 err, - ptext $ sLit ("Program was:"), + text "Program was:", nest 2 (ppr p)]) Right _ -> Nothing diff --git a/compiler/cmm/CmmType.hs b/compiler/cmm/CmmType.hs index f852d54b34..ae46330f7c 100644 --- a/compiler/cmm/CmmType.hs +++ b/compiler/cmm/CmmType.hs @@ -63,9 +63,9 @@ instance Outputable CmmType where ppr (CmmType cat wid) = ppr cat <> ppr (widthInBits wid) instance Outputable CmmCat where - ppr FloatCat = ptext $ sLit("F") - ppr GcPtrCat = ptext $ sLit("P") - ppr BitsCat = ptext $ sLit("I") + ppr FloatCat = text "F" + ppr GcPtrCat = text "P" + ppr BitsCat = text "I" ppr (VecCat n cat) = ppr cat <> text "x" <> ppr n <> text "V" -- Why is CmmType stratified? For native code generation, diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 3d3acec47d..e679d5516b 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -66,7 +66,7 @@ pprCs dflags cmms = pprCode CStyle (vcat $ map (\c -> split_marker $$ pprC c) cmms) where split_marker - | gopt Opt_SplitObjs dflags = ptext (sLit "__STG_SPLIT_MARKER") + | gopt Opt_SplitObjs dflags = text "__STG_SPLIT_MARKER" | otherwise = empty writeCs :: DynFlags -> Handle -> [RawCmmGroup] -> IO () @@ -112,13 +112,13 @@ pprTop (CmmProc infos clbl _ graph) = pprTop (CmmData _section (Statics lbl [CmmString str])) = hcat [ - pprLocalness lbl, ptext (sLit "char "), ppr lbl, - ptext (sLit "[] = "), pprStringInCStyle str, semi + pprLocalness lbl, text "char ", ppr lbl, + text "[] = ", pprStringInCStyle str, semi ] pprTop (CmmData _section (Statics lbl [CmmUninitialised size])) = hcat [ - pprLocalness lbl, ptext (sLit "char "), ppr lbl, + pprLocalness lbl, text "char ", ppr lbl, brackets (int size), semi ] @@ -147,16 +147,16 @@ pprBBlock block = pprWordArray :: CLabel -> [CmmStatic] -> SDoc pprWordArray lbl ds = sdocWithDynFlags $ \dflags -> - hcat [ pprLocalness lbl, ptext (sLit "StgWord") - , space, ppr lbl, ptext (sLit "[] = {") ] + hcat [ pprLocalness lbl, text "StgWord" + , space, ppr lbl, text "[] = {" ] $$ nest 8 (commafy (pprStatics dflags ds)) - $$ ptext (sLit "};") + $$ text "};" -- -- has to be static, if it isn't globally visible -- pprLocalness :: CLabel -> SDoc -pprLocalness lbl | not $ externallyVisibleCLabel lbl = ptext (sLit "static ") +pprLocalness lbl | not $ externallyVisibleCLabel lbl = text "static " | otherwise = empty -- -------------------------------------------------------------------------- @@ -169,7 +169,7 @@ pprStmt stmt = sdocWithDynFlags $ \dflags -> case stmt of CmmEntry{} -> empty - CmmComment _ -> empty -- (hang (ptext (sLit "/*")) 3 (ftext s)) $$ ptext (sLit "*/") + CmmComment _ -> empty -- (hang (text "/*") 3 (ftext s)) $$ ptext (sLit "*/") -- XXX if the string contains "*/", we need to fix it -- XXX we probably want to emit these comments when -- some debugging option is on. They can get quite @@ -182,7 +182,7 @@ pprStmt stmt = CmmStore dest src | typeWidth rep == W64 && wordWidth dflags /= W64 - -> (if isFloatType rep then ptext (sLit "ASSIGN_DBL") + -> (if isFloatType rep then text "ASSIGN_DBL" else ptext (sLit ("ASSIGN_Word64"))) <> parens (mkP_ <> pprExpr1 dest <> comma <> pprExpr src) <> semi @@ -240,7 +240,7 @@ pprStmt stmt = -- We also need to cast mem primops to prevent conflicts with GCC -- builtins (see bug #5967). | Just _align <- machOpMemcpyishAlign op - = (ptext (sLit ";EF_(") <> fn <> char ')' <> semi) $$ + = (text ";EF_(" <> fn <> char ')' <> semi) $$ pprForeignCall fn cconv hresults hargs | otherwise = pprCall fn cconv hresults hargs @@ -269,7 +269,7 @@ pprForeignCall fn cconv results args = fn_call pprCFunType :: SDoc -> CCallConv -> [Hinted CmmFormal] -> [Hinted CmmActual] -> SDoc pprCFunType ppr_fn cconv ress args = sdocWithDynFlags $ \dflags -> - let res_type [] = ptext (sLit "void") + let res_type [] = text "void" res_type [(one, hint)] = machRepHintCType (localRegType one) hint res_type _ = panic "pprCFunType: only void or 1 return value supported" @@ -281,16 +281,16 @@ pprCFunType ppr_fn cconv ress args -- --------------------------------------------------------------------- -- unconditional branches pprBranch :: BlockId -> SDoc -pprBranch ident = ptext (sLit "goto") <+> pprBlockId ident <> semi +pprBranch ident = text "goto" <+> pprBlockId ident <> semi -- --------------------------------------------------------------------- -- conditional branches to local labels pprCondBranch :: CmmExpr -> BlockId -> BlockId -> SDoc pprCondBranch expr yes no - = hsep [ ptext (sLit "if") , parens(pprExpr expr) , - ptext (sLit "goto"), pprBlockId yes <> semi, - ptext (sLit "else goto"), pprBlockId no <> semi ] + = hsep [ text "if" , parens(pprExpr expr) , + text "goto", pprBlockId yes <> semi, + text "else goto", pprBlockId no <> semi ] -- --------------------------------------------------------------------- -- a local table branch @@ -299,7 +299,7 @@ pprCondBranch expr yes no -- pprSwitch :: DynFlags -> CmmExpr -> SwitchTargets -> SDoc pprSwitch dflags e ids - = (hang (ptext (sLit "switch") <+> parens ( pprExpr e ) <+> lbrace) + = (hang (text "switch" <+> parens ( pprExpr e ) <+> lbrace) 4 (vcat ( map caseify pairs ) $$ def)) $$ rbrace where (pairs, mbdef) = switchTargetsFallThrough ids @@ -308,16 +308,16 @@ pprSwitch dflags e ids caseify (ix:ixs, ident) = vcat (map do_fallthrough ixs) $$ final_branch ix where do_fallthrough ix = - hsep [ ptext (sLit "case") , pprHexVal ix (wordWidth dflags) <> colon , - ptext (sLit "/* fall through */") ] + hsep [ text "case" , pprHexVal ix (wordWidth dflags) <> colon , + text "/* fall through */" ] final_branch ix = - hsep [ ptext (sLit "case") , pprHexVal ix (wordWidth dflags) <> colon , - ptext (sLit "goto") , (pprBlockId ident) <> semi ] + hsep [ text "case" , pprHexVal ix (wordWidth dflags) <> colon , + text "goto" , (pprBlockId ident) <> semi ] caseify (_ , _ ) = panic "pprSwitch: switch with no cases!" - def | Just l <- mbdef = ptext (sLit "default: goto") <+> pprBlockId l <> semi + def | Just l <- mbdef = text "default: goto" <+> pprBlockId l <> semi | otherwise = empty -- --------------------------------------------------------------------- @@ -360,8 +360,8 @@ pprExpr e = case e of pprLoad :: DynFlags -> CmmExpr -> CmmType -> SDoc pprLoad dflags e ty | width == W64, wordWidth dflags /= W64 - = (if isFloatType ty then ptext (sLit "PK_DBL") - else ptext (sLit "PK_Word64")) + = (if isFloatType ty then text "PK_DBL" + else text "PK_Word64") <> parens (mkP_ <> pprExpr1 e) | otherwise @@ -394,7 +394,7 @@ pprMachOpApp :: MachOp -> [CmmExpr] -> SDoc pprMachOpApp op args | isMulMayOfloOp op - = ptext (sLit "mulIntMayOflo") <> parens (commafy (map pprExpr args)) + = text "mulIntMayOflo" <> parens (commafy (map pprExpr args)) where isMulMayOfloOp (MO_U_MulMayOflo _) = True isMulMayOfloOp (MO_S_MulMayOflo _) = True isMulMayOfloOp _ = False @@ -446,9 +446,9 @@ pprLit lit = case lit of CmmFloat f w -> parens (machRep_F_CType w) <> str where d = fromRational f :: Double - str | isInfinite d && d < 0 = ptext (sLit "-INFINITY") - | isInfinite d = ptext (sLit "INFINITY") - | isNaN d = ptext (sLit "NAN") + str | isInfinite d && d < 0 = text "-INFINITY" + | isInfinite d = text "INFINITY" + | isNaN d = text "NAN" | otherwise = text (show d) -- these constants come from <math.h> -- see #1861 @@ -489,7 +489,7 @@ pprStatics dflags (CmmStaticLit (CmmFloat f W32) : rest) = pprPanic "pprStatics: float" (vcat (map ppr' rest)) where ppr' (CmmStaticLit l) = sdocWithDynFlags $ \dflags -> ppr (cmmLitType dflags l) - ppr' _other = ptext (sLit "bad static!") + ppr' _other = text "bad static!" pprStatics dflags (CmmStaticLit (CmmFloat f W64) : rest) = map pprLit1 (doubleToWords dflags f) ++ pprStatics dflags rest pprStatics dflags (CmmStaticLit (CmmInt i W64) : rest) @@ -536,8 +536,8 @@ pprMachOp_for_C mop = case mop of -- Integer operations MO_Add _ -> char '+' MO_Sub _ -> char '-' - MO_Eq _ -> ptext (sLit "==") - MO_Ne _ -> ptext (sLit "!=") + MO_Eq _ -> text "==" + MO_Ne _ -> text "!=" MO_Mul _ -> char '*' MO_S_Quot _ -> char '/' @@ -555,22 +555,22 @@ pprMachOp_for_C mop = case mop of MO_F_Quot _ -> char '/' -- Signed comparisons - MO_S_Ge _ -> ptext (sLit ">=") - MO_S_Le _ -> ptext (sLit "<=") + MO_S_Ge _ -> text ">=" + MO_S_Le _ -> text "<=" MO_S_Gt _ -> char '>' MO_S_Lt _ -> char '<' -- & Unsigned comparisons - MO_U_Ge _ -> ptext (sLit ">=") - MO_U_Le _ -> ptext (sLit "<=") + MO_U_Ge _ -> text ">=" + MO_U_Le _ -> text "<=" MO_U_Gt _ -> char '>' MO_U_Lt _ -> char '<' -- & Floating-point comparisons - MO_F_Eq _ -> ptext (sLit "==") - MO_F_Ne _ -> ptext (sLit "!=") - MO_F_Ge _ -> ptext (sLit ">=") - MO_F_Le _ -> ptext (sLit "<=") + MO_F_Eq _ -> text "==" + MO_F_Ne _ -> text "!=" + MO_F_Ge _ -> text ">=" + MO_F_Le _ -> text "<=" MO_F_Gt _ -> char '>' MO_F_Lt _ -> char '<' @@ -580,9 +580,9 @@ pprMachOp_for_C mop = case mop of MO_Or _ -> char '|' MO_Xor _ -> char '^' MO_Not _ -> char '~' - MO_Shl _ -> ptext (sLit "<<") - MO_U_Shr _ -> ptext (sLit ">>") -- unsigned shift right - MO_S_Shr _ -> ptext (sLit ">>") -- signed shift right + MO_Shl _ -> text "<<" + MO_U_Shr _ -> text ">>" -- unsigned shift right + MO_S_Shr _ -> text ">>" -- signed shift right -- Conversions. Some of these will be NOPs, but never those that convert -- between ints and floats. @@ -604,85 +604,85 @@ pprMachOp_for_C mop = case mop of MO_FS_Conv _from to -> parens (machRep_S_CType to) MO_S_MulMayOflo _ -> pprTrace "offending mop:" - (ptext $ sLit "MO_S_MulMayOflo") + (text "MO_S_MulMayOflo") (panic $ "PprC.pprMachOp_for_C: MO_S_MulMayOflo" ++ " should have been handled earlier!") MO_U_MulMayOflo _ -> pprTrace "offending mop:" - (ptext $ sLit "MO_U_MulMayOflo") + (text "MO_U_MulMayOflo") (panic $ "PprC.pprMachOp_for_C: MO_U_MulMayOflo" ++ " should have been handled earlier!") MO_V_Insert {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_V_Insert") + (text "MO_V_Insert") (panic $ "PprC.pprMachOp_for_C: MO_V_Insert" ++ " should have been handled earlier!") MO_V_Extract {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_V_Extract") + (text "MO_V_Extract") (panic $ "PprC.pprMachOp_for_C: MO_V_Extract" ++ " should have been handled earlier!") MO_V_Add {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_V_Add") + (text "MO_V_Add") (panic $ "PprC.pprMachOp_for_C: MO_V_Add" ++ " should have been handled earlier!") MO_V_Sub {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_V_Sub") + (text "MO_V_Sub") (panic $ "PprC.pprMachOp_for_C: MO_V_Sub" ++ " should have been handled earlier!") MO_V_Mul {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_V_Mul") + (text "MO_V_Mul") (panic $ "PprC.pprMachOp_for_C: MO_V_Mul" ++ " should have been handled earlier!") MO_VS_Quot {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VS_Quot") + (text "MO_VS_Quot") (panic $ "PprC.pprMachOp_for_C: MO_VS_Quot" ++ " should have been handled earlier!") MO_VS_Rem {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VS_Rem") + (text "MO_VS_Rem") (panic $ "PprC.pprMachOp_for_C: MO_VS_Rem" ++ " should have been handled earlier!") MO_VS_Neg {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VS_Neg") + (text "MO_VS_Neg") (panic $ "PprC.pprMachOp_for_C: MO_VS_Neg" ++ " should have been handled earlier!") MO_VU_Quot {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VU_Quot") + (text "MO_VU_Quot") (panic $ "PprC.pprMachOp_for_C: MO_VU_Quot" ++ " should have been handled earlier!") MO_VU_Rem {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VU_Rem") + (text "MO_VU_Rem") (panic $ "PprC.pprMachOp_for_C: MO_VU_Rem" ++ " should have been handled earlier!") MO_VF_Insert {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Insert") + (text "MO_VF_Insert") (panic $ "PprC.pprMachOp_for_C: MO_VF_Insert" ++ " should have been handled earlier!") MO_VF_Extract {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Extract") + (text "MO_VF_Extract") (panic $ "PprC.pprMachOp_for_C: MO_VF_Extract" ++ " should have been handled earlier!") MO_VF_Add {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Add") + (text "MO_VF_Add") (panic $ "PprC.pprMachOp_for_C: MO_VF_Add" ++ " should have been handled earlier!") MO_VF_Sub {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Sub") + (text "MO_VF_Sub") (panic $ "PprC.pprMachOp_for_C: MO_VF_Sub" ++ " should have been handled earlier!") MO_VF_Neg {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Neg") + (text "MO_VF_Neg") (panic $ "PprC.pprMachOp_for_C: MO_VF_Neg" ++ " should have been handled earlier!") MO_VF_Mul {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Mul") + (text "MO_VF_Mul") (panic $ "PprC.pprMachOp_for_C: MO_VF_Mul" ++ " should have been handled earlier!") MO_VF_Quot {} -> pprTrace "offending mop:" - (ptext $ sLit "MO_VF_Quot") + (text "MO_VF_Quot") (panic $ "PprC.pprMachOp_for_C: MO_VF_Quot" ++ " should have been handled earlier!") @@ -715,36 +715,36 @@ pprCallishMachOp_for_C :: CallishMachOp -> SDoc pprCallishMachOp_for_C mop = case mop of - MO_F64_Pwr -> ptext (sLit "pow") - MO_F64_Sin -> ptext (sLit "sin") - MO_F64_Cos -> ptext (sLit "cos") - MO_F64_Tan -> ptext (sLit "tan") - MO_F64_Sinh -> ptext (sLit "sinh") - MO_F64_Cosh -> ptext (sLit "cosh") - MO_F64_Tanh -> ptext (sLit "tanh") - MO_F64_Asin -> ptext (sLit "asin") - MO_F64_Acos -> ptext (sLit "acos") - MO_F64_Atan -> ptext (sLit "atan") - MO_F64_Log -> ptext (sLit "log") - MO_F64_Exp -> ptext (sLit "exp") - MO_F64_Sqrt -> ptext (sLit "sqrt") - MO_F32_Pwr -> ptext (sLit "powf") - MO_F32_Sin -> ptext (sLit "sinf") - MO_F32_Cos -> ptext (sLit "cosf") - MO_F32_Tan -> ptext (sLit "tanf") - MO_F32_Sinh -> ptext (sLit "sinhf") - MO_F32_Cosh -> ptext (sLit "coshf") - MO_F32_Tanh -> ptext (sLit "tanhf") - MO_F32_Asin -> ptext (sLit "asinf") - MO_F32_Acos -> ptext (sLit "acosf") - MO_F32_Atan -> ptext (sLit "atanf") - MO_F32_Log -> ptext (sLit "logf") - MO_F32_Exp -> ptext (sLit "expf") - MO_F32_Sqrt -> ptext (sLit "sqrtf") - MO_WriteBarrier -> ptext (sLit "write_barrier") - MO_Memcpy _ -> ptext (sLit "memcpy") - MO_Memset _ -> ptext (sLit "memset") - MO_Memmove _ -> ptext (sLit "memmove") + MO_F64_Pwr -> text "pow" + MO_F64_Sin -> text "sin" + MO_F64_Cos -> text "cos" + MO_F64_Tan -> text "tan" + MO_F64_Sinh -> text "sinh" + MO_F64_Cosh -> text "cosh" + MO_F64_Tanh -> text "tanh" + MO_F64_Asin -> text "asin" + MO_F64_Acos -> text "acos" + MO_F64_Atan -> text "atan" + MO_F64_Log -> text "log" + MO_F64_Exp -> text "exp" + MO_F64_Sqrt -> text "sqrt" + MO_F32_Pwr -> text "powf" + MO_F32_Sin -> text "sinf" + MO_F32_Cos -> text "cosf" + MO_F32_Tan -> text "tanf" + MO_F32_Sinh -> text "sinhf" + MO_F32_Cosh -> text "coshf" + MO_F32_Tanh -> text "tanhf" + MO_F32_Asin -> text "asinf" + MO_F32_Acos -> text "acosf" + MO_F32_Atan -> text "atanf" + MO_F32_Log -> text "logf" + MO_F32_Exp -> text "expf" + MO_F32_Sqrt -> text "sqrtf" + MO_WriteBarrier -> text "write_barrier" + MO_Memcpy _ -> text "memcpy" + MO_Memset _ -> text "memset" + MO_Memmove _ -> text "memmove" (MO_BSwap w) -> ptext (sLit $ bSwapLabel w) (MO_PopCnt w) -> ptext (sLit $ popCntLabel w) (MO_Clz w) -> ptext (sLit $ clzLabel w) @@ -776,17 +776,17 @@ pprCallishMachOp_for_C mop mkJMP_, mkFN_, mkIF_ :: SDoc -> SDoc -mkJMP_ i = ptext (sLit "JMP_") <> parens i -mkFN_ i = ptext (sLit "FN_") <> parens i -- externally visible function -mkIF_ i = ptext (sLit "IF_") <> parens i -- locally visible +mkJMP_ i = text "JMP_" <> parens i +mkFN_ i = text "FN_" <> parens i -- externally visible function +mkIF_ i = text "IF_" <> parens i -- locally visible -- from includes/Stg.h -- mkC_,mkW_,mkP_ :: SDoc -mkC_ = ptext (sLit "(C_)") -- StgChar -mkW_ = ptext (sLit "(W_)") -- StgWord -mkP_ = ptext (sLit "(P_)") -- StgWord* +mkC_ = text "(C_)" -- StgChar +mkW_ = text "(W_)" -- StgWord +mkP_ = text "(P_)" -- StgWord* -- --------------------------------------------------------------------- -- @@ -819,8 +819,8 @@ pprAssign _ r1 r2 | Just ty <- strangeRegType r1 = mkAssign (parens ty <> pprExpr1 r2) | otherwise = mkAssign (pprExpr r2) where mkAssign x = if r1 == CmmGlobal BaseReg - then ptext (sLit "ASSIGN_BaseReg") <> parens x <> semi - else pprReg r1 <> ptext (sLit " = ") <> x <> semi + then text "ASSIGN_BaseReg" <> parens x <> semi + else pprReg r1 <> text " = " <> x <> semi -- --------------------------------------------------------------------- -- Registers @@ -869,10 +869,10 @@ isStrangeTypeGlobal BaseReg = True isStrangeTypeGlobal r = isFixedPtrGlobalReg r strangeRegType :: CmmReg -> Maybe SDoc -strangeRegType (CmmGlobal CCCS) = Just (ptext (sLit "struct CostCentreStack_ *")) -strangeRegType (CmmGlobal CurrentTSO) = Just (ptext (sLit "struct StgTSO_ *")) -strangeRegType (CmmGlobal CurrentNursery) = Just (ptext (sLit "struct bdescr_ *")) -strangeRegType (CmmGlobal BaseReg) = Just (ptext (sLit "struct StgRegTable_ *")) +strangeRegType (CmmGlobal CCCS) = Just (text "struct CostCentreStack_ *") +strangeRegType (CmmGlobal CurrentTSO) = Just (text "struct StgTSO_ *") +strangeRegType (CmmGlobal CurrentNursery) = Just (text "struct bdescr_ *") +strangeRegType (CmmGlobal BaseReg) = Just (text "struct StgRegTable_ *") strangeRegType _ = Nothing -- pprReg just prints the register name. @@ -884,30 +884,30 @@ pprReg r = case r of pprAsPtrReg :: CmmReg -> SDoc pprAsPtrReg (CmmGlobal (VanillaReg n gcp)) - = WARN( gcp /= VGcPtr, ppr n ) char 'R' <> int n <> ptext (sLit ".p") + = WARN( gcp /= VGcPtr, ppr n ) char 'R' <> int n <> text ".p" pprAsPtrReg other_reg = pprReg other_reg pprGlobalReg :: GlobalReg -> SDoc pprGlobalReg gr = case gr of - VanillaReg n _ -> char 'R' <> int n <> ptext (sLit ".w") + VanillaReg n _ -> char 'R' <> int n <> text ".w" -- pprGlobalReg prints a VanillaReg as a .w regardless -- Example: R1.w = R1.w & (-0x8UL); -- JMP_(*R1.p); FloatReg n -> char 'F' <> int n DoubleReg n -> char 'D' <> int n LongReg n -> char 'L' <> int n - Sp -> ptext (sLit "Sp") - SpLim -> ptext (sLit "SpLim") - Hp -> ptext (sLit "Hp") - HpLim -> ptext (sLit "HpLim") - CCCS -> ptext (sLit "CCCS") - CurrentTSO -> ptext (sLit "CurrentTSO") - CurrentNursery -> ptext (sLit "CurrentNursery") - HpAlloc -> ptext (sLit "HpAlloc") - BaseReg -> ptext (sLit "BaseReg") - EagerBlackholeInfo -> ptext (sLit "stg_EAGER_BLACKHOLE_info") - GCEnter1 -> ptext (sLit "stg_gc_enter_1") - GCFun -> ptext (sLit "stg_gc_fun") + Sp -> text "Sp" + SpLim -> text "SpLim" + Hp -> text "Hp" + HpLim -> text "HpLim" + CCCS -> text "CCCS" + CurrentTSO -> text "CurrentTSO" + CurrentNursery -> text "CurrentNursery" + HpAlloc -> text "HpAlloc" + BaseReg -> text "BaseReg" + EagerBlackholeInfo -> text "stg_EAGER_BLACKHOLE_info" + GCEnter1 -> text "stg_gc_enter_1" + GCFun -> text "stg_gc_fun" other -> panic $ "pprGlobalReg: Unsupported register: " ++ show other pprLocalReg :: LocalReg -> SDoc @@ -927,12 +927,12 @@ pprCall ppr_fn cconv results args where ppr_assign [] rhs = rhs ppr_assign [(one,hint)] rhs - = pprLocalReg one <> ptext (sLit " = ") + = pprLocalReg one <> text " = " <> pprUnHint hint (localRegType one) <> rhs ppr_assign _other _rhs = panic "pprCall: multiple results" pprArg (expr, AddrHint) - = cCast (ptext (sLit "void *")) expr + = cCast (text "void *") expr -- see comment by machRepHintCType below pprArg (expr, SignedHint) = sdocWithDynFlags $ \dflags -> @@ -981,8 +981,8 @@ pprExternDecl _in_srt lbl hcat [ visibility, label_type lbl, lparen, ppr lbl, text ");" ] where - label_type lbl | isCFunctionLabel lbl = ptext (sLit "F_") - | otherwise = ptext (sLit "I_") + label_type lbl | isCFunctionLabel lbl = text "F_" + | otherwise = text "I_" visibility | externallyVisibleCLabel lbl = char 'E' @@ -992,7 +992,7 @@ pprExternDecl _in_srt lbl -- we must generate an appropriate prototype for it, so that the C compiler will -- add the @n suffix to the label (#2276) stdcall_decl sz = sdocWithDynFlags $ \dflags -> - ptext (sLit "extern __attribute__((stdcall)) void ") <> ppr lbl + text "extern __attribute__((stdcall)) void " <> ppr lbl <> parens (commafy (replicate (sz `quot` wORD_SIZE dflags) (machRep_U_CType (wordWidth dflags)))) <> semi @@ -1071,11 +1071,11 @@ cLoad :: CmmExpr -> CmmType -> SDoc cLoad expr rep = sdocWithPlatform $ \platform -> if bewareLoadStoreAlignment (platformArch platform) - then let decl = machRepCType rep <+> ptext (sLit "x") <> semi - struct = ptext (sLit "struct") <+> braces (decl) - packed_attr = ptext (sLit "__attribute__((packed))") + then let decl = machRepCType rep <+> text "x" <> semi + struct = text "struct" <+> braces (decl) + packed_attr = text "__attribute__((packed))" cast = parens (struct <+> packed_attr <> char '*') - in parens (cast <+> pprExpr1 expr) <> ptext (sLit "->x") + in parens (cast <+> pprExpr1 expr) <> text "->x" else char '*' <> parens (cCast (machRepPtrCType rep) expr) where -- On these platforms, unaligned loads are known to cause problems bewareLoadStoreAlignment ArchAlpha = True @@ -1097,14 +1097,14 @@ isCmmWordType dflags ty = not (isFloatType ty) -- argument, we always cast the argument to (void *), to avoid warnings from -- the C compiler. machRepHintCType :: CmmType -> ForeignHint -> SDoc -machRepHintCType _ AddrHint = ptext (sLit "void *") +machRepHintCType _ AddrHint = text "void *" machRepHintCType rep SignedHint = machRep_S_CType (typeWidth rep) machRepHintCType rep _other = machRepCType rep machRepPtrCType :: CmmType -> SDoc machRepPtrCType r = sdocWithDynFlags $ \dflags -> - if isCmmWordType dflags r then ptext (sLit "P_") + if isCmmWordType dflags r then text "P_" else machRepCType r <> char '*' machRepCType :: CmmType -> SDoc @@ -1114,30 +1114,30 @@ machRepCType ty | isFloatType ty = machRep_F_CType w w = typeWidth ty machRep_F_CType :: Width -> SDoc -machRep_F_CType W32 = ptext (sLit "StgFloat") -- ToDo: correct? -machRep_F_CType W64 = ptext (sLit "StgDouble") +machRep_F_CType W32 = text "StgFloat" -- ToDo: correct? +machRep_F_CType W64 = text "StgDouble" machRep_F_CType _ = panic "machRep_F_CType" machRep_U_CType :: Width -> SDoc machRep_U_CType w = sdocWithDynFlags $ \dflags -> case w of - _ | w == wordWidth dflags -> ptext (sLit "W_") - W8 -> ptext (sLit "StgWord8") - W16 -> ptext (sLit "StgWord16") - W32 -> ptext (sLit "StgWord32") - W64 -> ptext (sLit "StgWord64") + _ | w == wordWidth dflags -> text "W_" + W8 -> text "StgWord8" + W16 -> text "StgWord16" + W32 -> text "StgWord32" + W64 -> text "StgWord64" _ -> panic "machRep_U_CType" machRep_S_CType :: Width -> SDoc machRep_S_CType w = sdocWithDynFlags $ \dflags -> case w of - _ | w == wordWidth dflags -> ptext (sLit "I_") - W8 -> ptext (sLit "StgInt8") - W16 -> ptext (sLit "StgInt16") - W32 -> ptext (sLit "StgInt32") - W64 -> ptext (sLit "StgInt64") + _ | w == wordWidth dflags -> text "I_" + W8 -> text "StgInt8" + W16 -> text "StgInt16" + W32 -> text "StgInt32" + W64 -> text "StgInt64" _ -> panic "machRep_S_CType" @@ -1213,8 +1213,8 @@ commafy xs = hsep $ punctuate comma xs pprHexVal :: Integer -> Width -> SDoc pprHexVal w rep | w < 0 = parens (char '-' <> - ptext (sLit "0x") <> intToDoc (-w) <> repsuffix rep) - | otherwise = ptext (sLit "0x") <> intToDoc w <> repsuffix rep + text "0x" <> intToDoc (-w) <> repsuffix rep) + | otherwise = text "0x" <> intToDoc w <> repsuffix rep where -- type suffix for literals: -- Integer literals are unsigned in Cmm/C. We explicitly cast to @@ -1224,8 +1224,8 @@ pprHexVal w rep repsuffix W64 = sdocWithDynFlags $ \dflags -> if cINT_SIZE dflags == 8 then char 'U' - else if cLONG_SIZE dflags == 8 then ptext (sLit "UL") - else if cLONG_LONG_SIZE dflags == 8 then ptext (sLit "ULL") + else if cLONG_SIZE dflags == 8 then text "UL" + else if cLONG_LONG_SIZE dflags == 8 then text "ULL" else panic "pprHexVal: Can't find a 64-bit type" repsuffix _ = char 'U' diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 5caea90db4..9517ea3c09 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -102,13 +102,13 @@ instance Outputable CmmGraph where pprStackInfo :: CmmStackInfo -> SDoc pprStackInfo (StackInfo {arg_space=arg_space, updfr_space=updfr_space}) = - ptext (sLit "arg_space: ") <> ppr arg_space <+> - ptext (sLit "updfr_space: ") <> ppr updfr_space + text "arg_space: " <> ppr arg_space <+> + text "updfr_space: " <> ppr updfr_space pprTopInfo :: CmmTopInfo -> SDoc pprTopInfo (TopInfo {info_tbls=info_tbl, stack_info=stack_info}) = - vcat [ptext (sLit "info_tbl: ") <> ppr info_tbl, - ptext (sLit "stack_info: ") <> ppr stack_info] + vcat [text "info_tbl: " <> ppr info_tbl, + text "stack_info: " <> ppr stack_info] ---------------------------------------------------------- -- Outputting blocks and graphs @@ -161,7 +161,7 @@ pprForeignConvention (ForeignConvention c args res ret) = pprReturnInfo :: CmmReturnInfo -> SDoc pprReturnInfo CmmMayReturn = empty -pprReturnInfo CmmNeverReturns = ptext (sLit "never returns") +pprReturnInfo CmmNeverReturns = text "never returns" pprForeignTarget :: ForeignTarget -> SDoc pprForeignTarget (ForeignTarget fn c) = ppr c <+> ppr_target fn @@ -193,11 +193,11 @@ pprNode node = pp_node <+> pp_debug -- //tick bla<...> CmmTick t -> if gopt Opt_PprShowTicks dflags - then ptext (sLit "//tick") <+> ppr t + then text "//tick" <+> ppr t else empty -- unwind reg = expr; - CmmUnwind r e -> ptext (sLit "unwind ") <> ppr r <+> char '=' <+> ppr e + CmmUnwind r e -> text "unwind " <> ppr r <+> char '=' <+> ppr e -- reg = expr; CmmAssign reg expr -> ppr reg <+> equals <+> ppr expr <> semi @@ -213,75 +213,75 @@ pprNode node = pp_node <+> pp_debug CmmUnsafeForeignCall target results args -> hsep [ ppUnless (null results) $ parens (commafy $ map ppr results) <+> equals, - ptext $ sLit "call", + text "call", ppr target <> parens (commafy $ map ppr args) <> semi] -- goto label; - CmmBranch ident -> ptext (sLit "goto") <+> ppr ident <> semi + CmmBranch ident -> text "goto" <+> ppr ident <> semi -- if (expr) goto t; else goto f; CmmCondBranch expr t f l -> - hsep [ ptext (sLit "if") + hsep [ text "if" , parens(ppr expr) , case l of Nothing -> empty - Just b -> parens (ptext (sLit "likely:") <+> ppr b) - , ptext (sLit "goto") + Just b -> parens (text "likely:" <+> ppr b) + , text "goto" , ppr t <> semi - , ptext (sLit "else goto") + , text "else goto" , ppr f <> semi ] CmmSwitch expr ids -> - hang (hsep [ ptext (sLit "switch") + hang (hsep [ text "switch" , range , if isTrivialCmmExpr expr then ppr expr else parens (ppr expr) - , ptext (sLit "{") + , text "{" ]) 4 (vcat (map ppCase cases) $$ def) $$ rbrace where (cases, mbdef) = switchTargetsFallThrough ids ppCase (is,l) = hsep - [ ptext (sLit "case") + [ text "case" , commafy $ map integer is - , ptext (sLit ": goto") + , text ": goto" , ppr l <> semi ] def | Just l <- mbdef = hsep - [ ptext (sLit "default: goto") + [ text "default: goto" , ppr l <> semi ] | otherwise = empty - range = brackets $ hsep [integer lo, ptext (sLit ".."), integer hi] + range = brackets $ hsep [integer lo, text "..", integer hi] where (lo,hi) = switchTargetsRange ids CmmCall tgt k regs out res updfr_off -> - hcat [ ptext (sLit "call"), space + hcat [ text "call", space , pprFun tgt, parens (interpp'SP regs), space , returns <+> - ptext (sLit "args: ") <> ppr out <> comma <+> - ptext (sLit "res: ") <> ppr res <> comma <+> - ptext (sLit "upd: ") <> ppr updfr_off + text "args: " <> ppr out <> comma <+> + text "res: " <> ppr res <> comma <+> + text "upd: " <> ppr updfr_off , semi ] where pprFun f@(CmmLit _) = ppr f pprFun f = parens (ppr f) returns - | Just r <- k = ptext (sLit "returns to") <+> ppr r <> comma + | Just r <- k = text "returns to" <+> ppr r <> comma | otherwise = empty CmmForeignCall {tgt=t, res=rs, args=as, succ=s, ret_args=a, ret_off=u, intrbl=i} -> - hcat $ if i then [ptext (sLit "interruptible"), space] else [] ++ - [ ptext (sLit "foreign call"), space - , ppr t, ptext (sLit "(...)"), space - , ptext (sLit "returns to") <+> ppr s - <+> ptext (sLit "args:") <+> parens (ppr as) - <+> ptext (sLit "ress:") <+> parens (ppr rs) - , ptext (sLit "ret_args:") <+> ppr a - , ptext (sLit "ret_off:") <+> ppr u + hcat $ if i then [text "interruptible", space] else [] ++ + [ text "foreign call", space + , ppr t, text "(...)", space + , text "returns to" <+> ppr s + <+> text "args:" <+> parens (ppr as) + <+> text "ress:" <+> parens (ppr rs) + , text "ret_args:" <+> ppr a + , text "ret_off:" <+> ppr u , semi ] pp_debug :: SDoc diff --git a/compiler/cmm/PprCmmDecl.hs b/compiler/cmm/PprCmmDecl.hs index 830f536891..9364d2bcf4 100644 --- a/compiler/cmm/PprCmmDecl.hs +++ b/compiler/cmm/PprCmmDecl.hs @@ -59,7 +59,7 @@ pprCmms :: (Outputable info, Outputable g) => [GenCmmGroup CmmStatics info g] -> SDoc pprCmms cmms = pprCode CStyle (vcat (intersperse separator $ map ppr cmms)) where - separator = space $$ ptext (sLit "-------------------") $$ space + separator = space $$ text "-------------------" $$ space writeCmms :: (Outputable info, Outputable g) => DynFlags -> Handle -> [GenCmmGroup CmmStatics info g] -> IO () @@ -96,7 +96,7 @@ pprTop :: (Outputable d, Outputable info, Outputable i) pprTop (CmmProc info lbl live graph) - = vcat [ ppr lbl <> lparen <> rparen <+> ptext (sLit "// ") <+> ppr live + = vcat [ ppr lbl <> lparen <> rparen <+> text "// " <+> ppr live , nest 8 $ lbrace <+> ppr info $$ rbrace , nest 4 $ ppr graph , rbrace ] @@ -117,15 +117,15 @@ pprInfoTable :: CmmInfoTable -> SDoc pprInfoTable (CmmInfoTable { cit_lbl = lbl, cit_rep = rep , cit_prof = prof_info , cit_srt = _srt }) - = vcat [ ptext (sLit "label:") <+> ppr lbl - , ptext (sLit "rep:") <> ppr rep + = vcat [ text "label:" <+> ppr lbl + , text "rep:" <> ppr rep , case prof_info of NoProfilingInfo -> empty - ProfilingInfo ct cd -> vcat [ ptext (sLit "type:") <+> pprWord8String ct - , ptext (sLit "desc: ") <> pprWord8String cd ] ] + ProfilingInfo ct cd -> vcat [ text "type:" <+> pprWord8String ct + , text "desc: " <> pprWord8String cd ] ] instance Outputable C_SRT where - ppr NoC_SRT = ptext (sLit "_no_srt_") + ppr NoC_SRT = text "_no_srt_" ppr (C_SRT label off bitmap) = parens (ppr label <> comma <> ppr off <> comma <> ppr bitmap) @@ -146,7 +146,7 @@ pprStatics (Statics lbl ds) = vcat ((ppr lbl <> colon) : map ppr ds) pprStatic :: CmmStatic -> SDoc pprStatic s = case s of - CmmStaticLit lit -> nest 4 $ ptext (sLit "const") <+> pprLit lit <> semi + CmmStaticLit lit -> nest 4 $ text "const" <+> pprLit lit <> semi CmmUninitialised i -> nest 4 $ text "I8" <> brackets (int i) CmmString s' -> nest 4 $ text "I8[]" <+> text (show s') @@ -157,7 +157,7 @@ pprSection :: Section -> SDoc pprSection (Section t suffix) = section <+> doubleQuotes (pprSectionType t <+> char '.' <+> ppr suffix) where - section = ptext (sLit "section") + section = text "section" pprSectionType :: SectionType -> SDoc pprSectionType s = doubleQuotes (ptext t) diff --git a/compiler/cmm/PprCmmExpr.hs b/compiler/cmm/PprCmmExpr.hs index 1f1c7f8e49..77c92407bc 100644 --- a/compiler/cmm/PprCmmExpr.hs +++ b/compiler/cmm/PprCmmExpr.hs @@ -41,7 +41,6 @@ where import CmmExpr import Outputable -import FastString import Data.Maybe import Numeric ( fromRat ) @@ -102,12 +101,12 @@ pprExpr1 e = pprExpr7 e infixMachOp1, infixMachOp7, infixMachOp8 :: MachOp -> Maybe SDoc -infixMachOp1 (MO_Eq _) = Just (ptext (sLit "==")) -infixMachOp1 (MO_Ne _) = Just (ptext (sLit "!=")) -infixMachOp1 (MO_Shl _) = Just (ptext (sLit "<<")) -infixMachOp1 (MO_U_Shr _) = Just (ptext (sLit ">>")) -infixMachOp1 (MO_U_Ge _) = Just (ptext (sLit ">=")) -infixMachOp1 (MO_U_Le _) = Just (ptext (sLit "<=")) +infixMachOp1 (MO_Eq _) = Just (text "==") +infixMachOp1 (MO_Ne _) = Just (text "!=") +infixMachOp1 (MO_Shl _) = Just (text "<<") +infixMachOp1 (MO_U_Shr _) = Just (text ">>") +infixMachOp1 (MO_U_Ge _) = Just (text ">=") +infixMachOp1 (MO_U_Le _) = Just (text "<=") infixMachOp1 (MO_U_Gt _) = Just (char '>') infixMachOp1 (MO_U_Lt _) = Just (char '<') infixMachOp1 _ = Nothing @@ -255,24 +254,24 @@ pprGlobalReg gr FloatReg n -> char 'F' <> int n DoubleReg n -> char 'D' <> int n LongReg n -> char 'L' <> int n - XmmReg n -> ptext (sLit "XMM") <> int n - YmmReg n -> ptext (sLit "YMM") <> int n - ZmmReg n -> ptext (sLit "ZMM") <> int n - Sp -> ptext (sLit "Sp") - SpLim -> ptext (sLit "SpLim") - Hp -> ptext (sLit "Hp") - HpLim -> ptext (sLit "HpLim") - MachSp -> ptext (sLit "MachSp") - UnwindReturnReg-> ptext (sLit "UnwindReturnReg") - CCCS -> ptext (sLit "CCCS") - CurrentTSO -> ptext (sLit "CurrentTSO") - CurrentNursery -> ptext (sLit "CurrentNursery") - HpAlloc -> ptext (sLit "HpAlloc") - EagerBlackholeInfo -> ptext (sLit "stg_EAGER_BLACKHOLE_info") - GCEnter1 -> ptext (sLit "stg_gc_enter_1") - GCFun -> ptext (sLit "stg_gc_fun") - BaseReg -> ptext (sLit "BaseReg") - PicBaseReg -> ptext (sLit "PicBaseReg") + XmmReg n -> text "XMM" <> int n + YmmReg n -> text "YMM" <> int n + ZmmReg n -> text "ZMM" <> int n + Sp -> text "Sp" + SpLim -> text "SpLim" + Hp -> text "Hp" + HpLim -> text "HpLim" + MachSp -> text "MachSp" + UnwindReturnReg-> text "UnwindReturnReg" + CCCS -> text "CCCS" + CurrentTSO -> text "CurrentTSO" + CurrentNursery -> text "CurrentNursery" + HpAlloc -> text "HpAlloc" + EagerBlackholeInfo -> text "stg_EAGER_BLACKHOLE_info" + GCEnter1 -> text "stg_gc_enter_1" + GCFun -> text "stg_gc_fun" + BaseReg -> text "BaseReg" + PicBaseReg -> text "PicBaseReg" ----------------------------------------------------------------------------- diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs index 6c0076122e..ecd8905cbb 100644 --- a/compiler/cmm/SMRep.hs +++ b/compiler/cmm/SMRep.hs @@ -498,44 +498,44 @@ instance Outputable SMRep where ppr (HeapRep static ps nps tyinfo) = hang (header <+> lbrace) 2 (ppr tyinfo <+> rbrace) where - header = ptext (sLit "HeapRep") - <+> if static then ptext (sLit "static") else empty + header = text "HeapRep" + <+> if static then text "static" else empty <+> pp_n "ptrs" ps <+> pp_n "nonptrs" nps pp_n :: String -> Int -> SDoc pp_n _ 0 = empty pp_n s n = int n <+> text s - ppr (ArrayPtrsRep size _) = ptext (sLit "ArrayPtrsRep") <+> ppr size + ppr (ArrayPtrsRep size _) = text "ArrayPtrsRep" <+> ppr size - ppr (SmallArrayPtrsRep size) = ptext (sLit "SmallArrayPtrsRep") <+> ppr size + ppr (SmallArrayPtrsRep size) = text "SmallArrayPtrsRep" <+> ppr size - ppr (ArrayWordsRep words) = ptext (sLit "ArrayWordsRep") <+> ppr words + ppr (ArrayWordsRep words) = text "ArrayWordsRep" <+> ppr words - ppr (StackRep bs) = ptext (sLit "StackRep") <+> ppr bs + ppr (StackRep bs) = text "StackRep" <+> ppr bs - ppr (RTSRep ty rep) = ptext (sLit "tag:") <> ppr ty <+> ppr rep + ppr (RTSRep ty rep) = text "tag:" <> ppr ty <+> ppr rep instance Outputable ArgDescr where - ppr (ArgSpec n) = ptext (sLit "ArgSpec") <+> ppr n - ppr (ArgGen ls) = ptext (sLit "ArgGen") <+> ppr ls + ppr (ArgSpec n) = text "ArgSpec" <+> ppr n + ppr (ArgGen ls) = text "ArgGen" <+> ppr ls pprTypeInfo :: ClosureTypeInfo -> SDoc pprTypeInfo (Constr tag descr) - = ptext (sLit "Con") <+> - braces (sep [ ptext (sLit "tag:") <+> ppr tag - , ptext (sLit "descr:") <> text (show descr) ]) + = text "Con" <+> + braces (sep [ text "tag:" <+> ppr tag + , text "descr:" <> text (show descr) ]) pprTypeInfo (Fun arity args) - = ptext (sLit "Fun") <+> - braces (sep [ ptext (sLit "arity:") <+> ppr arity + = text "Fun" <+> + braces (sep [ text "arity:" <+> ppr arity , ptext (sLit ("fun_type:")) <+> ppr args ]) pprTypeInfo (ThunkSelector offset) - = ptext (sLit "ThunkSel") <+> ppr offset + = text "ThunkSel" <+> ppr offset -pprTypeInfo Thunk = ptext (sLit "Thunk") -pprTypeInfo BlackHole = ptext (sLit "BlackHole") -pprTypeInfo IndStatic = ptext (sLit "IndStatic") +pprTypeInfo Thunk = text "Thunk" +pprTypeInfo BlackHole = text "BlackHole" +pprTypeInfo IndStatic = text "IndStatic" -- XXX Does not belong here!! stringToWord8s :: String -> [Word8] |
