summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-06-13 12:13:00 +0100
committerIan Lynagh <igloo@earth.li>2012-06-13 12:13:00 +0100
commitd06edb8e93d6d19bbd898e2b2e26755598bb11f3 (patch)
tree88a6adbbd663f1a575c8b6a4d67f55ffd806ea2d /compiler/codeGen
parent2901e3ff1acaea9689d38e65b58080d515215414 (diff)
downloadhaskell-d06edb8e93d6d19bbd898e2b2e26755598bb11f3.tar.gz
Remove PlatformOutputable
We can now get the Platform from the DynFlags inside an SDoc, so we no longer need to pass the Platform in.
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/CgBindery.lhs18
-rw-r--r--compiler/codeGen/CgCon.lhs3
-rw-r--r--compiler/codeGen/CgInfoTbls.hs5
-rw-r--r--compiler/codeGen/StgCmmLayout.hs9
-rw-r--r--compiler/codeGen/StgCmmMonad.hs12
5 files changed, 20 insertions, 27 deletions
diff --git a/compiler/codeGen/CgBindery.lhs b/compiler/codeGen/CgBindery.lhs
index 06442dc004..0efc99d370 100644
--- a/compiler/codeGen/CgBindery.lhs
+++ b/compiler/codeGen/CgBindery.lhs
@@ -146,10 +146,10 @@ data StableLoc
-- be saved, so it makes sense to treat treat them as
-- having a stable location
-instance PlatformOutputable CgIdInfo where
- pprPlatform platform (CgIdInfo id _ vol stb _ _)
+instance Outputable CgIdInfo where
+ ppr (CgIdInfo id _ vol stb _ _)
-- TODO, pretty pring the tag info
- = ppr id <+> ptext (sLit "-->") <+> vcat [ppr vol, pprPlatform platform stb]
+ = ppr id <+> ptext (sLit "-->") <+> vcat [ppr vol, ppr stb]
instance Outputable VolatileLoc where
ppr NoVolatileLoc = empty
@@ -157,12 +157,12 @@ instance Outputable VolatileLoc where
ppr (VirHpLoc v) = ptext (sLit "vh") <+> ppr v
ppr (VirNodeLoc v) = ptext (sLit "vn") <+> ppr v
-instance PlatformOutputable StableLoc where
- pprPlatform _ NoStableLoc = empty
- pprPlatform _ VoidLoc = ptext (sLit "void")
- pprPlatform _ (VirStkLoc v) = ptext (sLit "vs") <+> ppr v
- pprPlatform _ (VirStkLNE v) = ptext (sLit "lne") <+> ppr v
- pprPlatform platform (StableLoc a) = ptext (sLit "amode") <+> pprPlatform platform a
+instance Outputable StableLoc where
+ ppr NoStableLoc = empty
+ ppr VoidLoc = ptext (sLit "void")
+ ppr (VirStkLoc v) = ptext (sLit "vs") <+> ppr v
+ ppr (VirStkLNE v) = ptext (sLit "lne") <+> ppr v
+ ppr (StableLoc a) = ptext (sLit "amode") <+> ppr a
\end{code}
%************************************************************************
diff --git a/compiler/codeGen/CgCon.lhs b/compiler/codeGen/CgCon.lhs
index 9ad8d13b5f..aff5e468ca 100644
--- a/compiler/codeGen/CgCon.lhs
+++ b/compiler/codeGen/CgCon.lhs
@@ -78,7 +78,6 @@ cgTopRhsCon id con args
; amodes <- getArgAmodes args
; let
- platform = targetPlatform dflags
name = idName id
lf_info = mkConLFInfo con
closure_label = mkClosureLabel name $ idCafInfo id
@@ -92,7 +91,7 @@ cgTopRhsCon id con args
payload = map get_lit amodes_w_offsets
get_lit (CmmLit lit, _offset) = lit
- get_lit other = pprPanic "CgCon.get_lit" (pprPlatform platform other)
+ get_lit other = pprPanic "CgCon.get_lit" (ppr other)
-- NB1: amodes_w_offsets is sorted into ptrs first, then non-ptrs
-- NB2: all the amodes should be Lits!
diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs
index 1e80616887..6c77255a62 100644
--- a/compiler/codeGen/CgInfoTbls.hs
+++ b/compiler/codeGen/CgInfoTbls.hs
@@ -45,7 +45,6 @@ import Unique
import StaticFlags
import Constants
-import DynFlags
import Util
import Outputable
@@ -168,8 +167,6 @@ is not present in the list (it is always assumed).
-}
mkStackLayout :: FCode [Maybe LocalReg]
mkStackLayout = do
- dflags <- getDynFlags
- let platform = targetPlatform dflags
StackUsage { realSp = real_sp,
frameSp = frame_sp } <- getStkUsage
binds <- getLiveStackBindings
@@ -179,7 +176,7 @@ mkStackLayout = do
| (offset, b) <- binds]
WARN( not (all (\bind -> fst bind >= 0) rel_binds),
- pprPlatform platform binds $$ pprPlatform platform rel_binds $$
+ ppr binds $$ ppr rel_binds $$
ppr frame_size $$ ppr real_sp $$ ppr frame_sp )
return $ stack_layout rel_binds frame_size
diff --git a/compiler/codeGen/StgCmmLayout.hs b/compiler/codeGen/StgCmmLayout.hs
index c97c3d47cd..87e6d9f9dd 100644
--- a/compiler/codeGen/StgCmmLayout.hs
+++ b/compiler/codeGen/StgCmmLayout.hs
@@ -151,11 +151,9 @@ direct_call :: String -> CLabel -> RepArity -> [CmmExpr] -> [ArgRep] -> FCode ()
direct_call caller lbl arity args reps
| debugIsOn && arity > length reps -- Too few args
= do -- Caller should ensure that there enough args!
- dflags <- getDynFlags
- let platform = targetPlatform dflags
pprPanic "direct_call" (text caller <+> ppr arity
- <+> pprPlatform platform lbl <+> ppr (length reps)
- <+> pprPlatform platform args <+> ppr reps )
+ <+> ppr lbl <+> ppr (length reps)
+ <+> ppr args <+> ppr reps )
| null rest_reps -- Precisely the right number of arguments
= emitCall (NativeDirectCall, NativeReturn) target args
@@ -177,9 +175,8 @@ direct_call caller lbl arity args reps
slow_call :: CmmExpr -> [CmmExpr] -> [ArgRep] -> FCode ()
slow_call fun args reps
= do dflags <- getDynFlags
- let platform = targetPlatform dflags
call <- getCode $ direct_call "slow_call" (mkRtsApFastLabel rts_fun) arity args reps
- emit $ mkComment $ mkFastString ("slow_call for " ++ showSDoc dflags (pprPlatform platform fun) ++
+ emit $ mkComment $ mkFastString ("slow_call for " ++ showSDoc dflags (ppr fun) ++
" with pat " ++ unpackFS rts_fun)
emit (mkAssign nodeReg fun <*> call)
where
diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs
index 71457c530c..4eea38e22c 100644
--- a/compiler/codeGen/StgCmmMonad.hs
+++ b/compiler/codeGen/StgCmmMonad.hs
@@ -197,13 +197,13 @@ data CgLoc
-- To tail-call it, assign to these locals,
-- and branch to the block id
-instance PlatformOutputable CgIdInfo where
- pprPlatform platform (CgIdInfo { cg_id = id, cg_loc = loc })
- = ppr id <+> ptext (sLit "-->") <+> pprPlatform platform loc
+instance Outputable CgIdInfo where
+ ppr (CgIdInfo { cg_id = id, cg_loc = loc })
+ = ppr id <+> ptext (sLit "-->") <+> ppr loc
-instance PlatformOutputable CgLoc where
- pprPlatform platform (CmmLoc e) = ptext (sLit "cmm") <+> pprPlatform platform e
- pprPlatform _ (LneLoc b rs) = ptext (sLit "lne") <+> ppr b <+> ppr rs
+instance Outputable CgLoc where
+ ppr (CmmLoc e) = ptext (sLit "cmm") <+> ppr e
+ ppr (LneLoc b rs) = ptext (sLit "lne") <+> ppr b <+> ppr rs
-- Sequel tells what to do with the result of this expression