X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FPprCmm.hs;h=c31c4de6e255a3358f27427170f5e63a19970fc4;hb=16a2f6a8a381af31c23b6a41a851951da9bc1803;hp=7a1ffbbf299346fa6ec1f9776ffa9d90dca6d360;hpb=ad94d40948668032189ad22a0ad741ac1f645f50;p=ghc-hetmet.git diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 7a1ffbb..c31c4de 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -2,7 +2,7 @@ -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and fix -- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings -- for details ---------------------------------------------------------------------------- @@ -39,13 +39,15 @@ -- A useful example pass over Cmm is in nativeGen/MachCodeGen.hs -- -module PprCmm ( - writeCmms, pprCmms, pprCmm, pprStmt, pprExpr, pprSection, pprStatic - ) where +module PprCmm + ( writeCmms, pprCmms, pprCmm, pprStmt, pprExpr, pprSection, pprStatic + ) +where #include "HsVersions.h" import Cmm +import CmmExpr import CmmUtils import MachOp import CLabel @@ -59,7 +61,7 @@ import Data.List import System.IO import Data.Maybe -pprCmms :: (Outputable info) => [GenCmm CmmStatic info CmmStmt] -> SDoc +pprCmms :: (Outputable info, Outputable g) => [GenCmm CmmStatic info g] -> SDoc pprCmms cmms = pprCode CStyle (vcat (intersperse separator $ map ppr cmms)) where separator = space $$ ptext SLIT("-------------------") $$ space @@ -69,19 +71,20 @@ writeCmms handle cmms = printForC handle (pprCmms cmms) ----------------------------------------------------------------------------- -instance (Outputable info) => Outputable (GenCmm CmmStatic info CmmStmt) where +instance (Outputable info, Outputable g) + => Outputable (GenCmm CmmStatic info g) where ppr c = pprCmm c instance (Outputable d, Outputable info, Outputable i) => Outputable (GenCmmTop d info i) where ppr t = pprTop t +instance (Outputable instr) => Outputable (ListGraph instr) where + ppr (ListGraph blocks) = vcat (map ppr blocks) + instance (Outputable instr) => Outputable (GenBasicBlock instr) where ppr b = pprBBlock b -instance Outputable BlockId where - ppr id = pprBlockId id - instance Outputable CmmStmt where ppr s = pprStmt s @@ -107,7 +110,7 @@ instance Outputable CmmInfo where ----------------------------------------------------------------------------- -pprCmm :: (Outputable info) => GenCmm CmmStatic info CmmStmt -> SDoc +pprCmm :: (Outputable info, Outputable g) => GenCmm CmmStatic info g -> SDoc pprCmm (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops -- -------------------------------------------------------------------------- @@ -116,11 +119,11 @@ pprCmm (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops pprTop :: (Outputable d, Outputable info, Outputable i) => GenCmmTop d info i -> SDoc -pprTop (CmmProc info lbl params blocks ) +pprTop (CmmProc info lbl params graph ) = vcat [ pprCLabel lbl <> parens (commafy $ map ppr params) <+> lbrace , nest 8 $ lbrace <+> ppr info $$ rbrace - , nest 4 $ vcat (map ppr blocks) + , nest 4 $ ppr graph , rbrace ] -- -------------------------------------------------------------------------- @@ -232,7 +235,7 @@ pprStmt stmt = case stmt of then empty else parens (commafy $ map ppr results) <> ptext SLIT(" = "), - ptext SLIT("call"), space, + ptext SLIT("foreign"), space, doubleQuotes(ppr cconv), space, target fn, parens ( commafy $ map ppr args ), brackets (ppr safety), @@ -545,6 +548,7 @@ pprSection s = case s of Text -> section <+> doubleQuotes (ptext SLIT("text")) Data -> section <+> doubleQuotes (ptext SLIT("data")) ReadOnlyData -> section <+> doubleQuotes (ptext SLIT("readonly")) + ReadOnlyData16 -> section <+> doubleQuotes (ptext SLIT("readonly16")) RelocatableReadOnlyData -> section <+> doubleQuotes (ptext SLIT("relreadonly")) UninitialisedData -> section <+> doubleQuotes (ptext SLIT("uninitialised"))