summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/Ppr.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-09 19:59:01 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-19 12:16:49 -0400
commit64f207566931469648e791df4f0f0384d45cddd0 (patch)
tree58e8a6e27d192368b1ddbc47e9bb89046b2a24a4 /compiler/GHC/Cmm/Ppr.hs
parentb03fd3bcd4ff14aed2942275c3b0db5392dc913c (diff)
downloadhaskell-64f207566931469648e791df4f0f0384d45cddd0.tar.gz
Refactoring: use Platform instead of DynFlags when possible
Metric Decrease: ManyConstructors T12707 T13035 T1969
Diffstat (limited to 'compiler/GHC/Cmm/Ppr.hs')
-rw-r--r--compiler/GHC/Cmm/Ppr.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/GHC/Cmm/Ppr.hs b/compiler/GHC/Cmm/Ppr.hs
index 9f02cdcace..324fc8f1b1 100644
--- a/compiler/GHC/Cmm/Ppr.hs
+++ b/compiler/GHC/Cmm/Ppr.hs
@@ -42,6 +42,8 @@ where
import GhcPrelude hiding (succ)
+import GHC.Platform
+import GHC.Driver.Session (targetPlatform)
import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.Cmm.Utils
@@ -67,7 +69,8 @@ instance Outputable CmmTopInfo where
instance Outputable (CmmNode e x) where
- ppr = pprNode
+ ppr e = sdocWithDynFlags $ \dflags ->
+ pprNode (targetPlatform dflags) e
instance Outputable Convention where
ppr = pprConvention
@@ -177,8 +180,8 @@ pprForeignTarget (PrimTarget op)
(mkFastString (show op))
Nothing ForeignLabelInThisPackage IsFunction))
-pprNode :: CmmNode e x -> SDoc
-pprNode node = pp_node <+> pp_debug
+pprNode :: Platform -> CmmNode e x -> SDoc
+pprNode platform node = pp_node <+> pp_debug
where
pp_node :: SDoc
pp_node = case node of
@@ -209,8 +212,7 @@ pprNode node = pp_node <+> pp_debug
-- rep[lv] = expr;
CmmStore lv expr -> rep <> brackets(ppr lv) <+> equals <+> ppr expr <> semi
where
- rep = sdocWithDynFlags $ \dflags ->
- ppr ( cmmExprType dflags expr )
+ rep = ppr ( cmmExprType platform expr )
-- call "ccall" foo(x, y)[r1, r2];
-- ToDo ppr volatile