--
module PprCmm
- ( writeCmms, pprCmms, pprCmm, pprStmt, pprExpr, pprSection, pprStatic
+ ( writeCmms, pprCmms, pprCmm, pprStmt, pprExpr, pprSection, pprStatic, pprLit
)
where
-----------------------------------------------------------------------------
-instance (Outputable info, Outputable g)
- => Outputable (GenCmm CmmStatic info g) where
+instance (Outputable d, Outputable info, Outputable g)
+ => Outputable (GenCmm d info g) where
ppr c = pprCmm c
instance (Outputable d, Outputable info, Outputable i)
-----------------------------------------------------------------------------
-pprCmm :: (Outputable info, Outputable g) => GenCmm CmmStatic info g -> SDoc
+pprCmm :: (Outputable d, Outputable info, Outputable g) => GenCmm d info g -> SDoc
pprCmm (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops
-- --------------------------------------------------------------------------
--
-- jump foo(a, b, c);
--
-genJump :: CmmExpr -> [(CmmExpr, MachHint)] -> SDoc
+genJump :: CmmExpr -> [CmmHinted CmmExpr] -> SDoc
genJump expr args =
hcat [ ptext SLIT("jump")
CmmLoad (CmmReg _) _ -> pprExpr expr
_ -> parens (pprExpr expr)
, space
- , parens ( commafy $ map ppr args )
+ , parens ( commafy $ map pprHinted args )
, semi ]
+pprHinted :: Outputable a => (CmmHinted a) -> SDoc
+pprHinted (CmmHinted a NoHint) = ppr a
+pprHinted (CmmHinted a PtrHint) = quotes(text "address") <+> ppr a
+pprHinted (CmmHinted a SignedHint) = quotes(text "signed") <+> ppr a
+pprHinted (CmmHinted a FloatHint) = quotes(text "float") <+> ppr a
+
-- --------------------------------------------------------------------------
-- Return from a function. [1], Section 6.8.2 of version 1.128
--
-- return (a, b, c);
--
-genReturn :: [(CmmExpr, MachHint)] -> SDoc
+genReturn :: [CmmHinted CmmExpr] -> SDoc
genReturn args =
hcat [ ptext SLIT("return")
commafy :: [SDoc] -> SDoc
commafy xs = hsep $ punctuate comma xs
-