summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.hs
diff options
context:
space:
mode:
authorLuke Maurer <maurerl@cs.uoregon.edu>2017-02-01 11:56:01 -0500
committerDavid Feuer <David.Feuer@gmail.com>2017-02-01 13:44:52 -0500
commit8d5cf8bf584fd4849917c29d82dcf46ee75dd035 (patch)
tree9d1b012562fd7ec1d1089b7d87e061884ba71f1c /compiler/utils/Outputable.hs
parent4fa439e3ee2822f893bd364a6cbfe410a0c1e29f (diff)
downloadhaskell-8d5cf8bf584fd4849917c29d82dcf46ee75dd035.tar.gz
Join points
This major patch implements Join Points, as described in https://ghc.haskell.org/trac/ghc/wiki/SequentCore. You have to read that page, and especially the paper it links to, to understand what's going on; but it is very cool. It's Luke Maurer's work, but done in close collaboration with Simon PJ. This Phab is a squash-merge of wip/join-points branch of http://github.com/lukemaurer/ghc. There are many, many interdependent changes. Reviewers: goldfire, mpickering, bgamari, simonmar, dfeuer, austin Subscribers: simonpj, dfeuer, mpickering, Mikolaj, thomie Differential Revision: https://phabricator.haskell.org/D2853
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r--compiler/utils/Outputable.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index 7d79f93bb2..3f94a68413 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -944,6 +944,19 @@ class Outputable a => OutputableBndr a where
-- prefix position of an application, thus (f a b) or ((+) x)
-- or infix position, thus (a `f` b) or (x + y)
+ pprNonRecBndrKeyword, pprRecBndrKeyword :: a -> SDoc
+ -- Print which keyword introduces the binder in Core code. This should be
+ -- "let" or "letrec" for a value but "join" or "joinrec" for a join point.
+ pprNonRecBndrKeyword _ = text "let"
+ pprRecBndrKeyword _ = text "letrec"
+
+ pprLamsOnLhs :: a -> Int
+ -- For a join point of join arity n, we want to print j = \x1 ... xn -> e
+ -- as "j x1 ... xn = e" to differentiate when a join point returns a
+ -- lambda (the first rendering looks like a nullary join point returning
+ -- an n-argument function).
+ pprLamsOnLhs _ = 0
+
{-
************************************************************************
* *