summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-11-02 13:32:21 -0400
committerBen Gamari <ben@smart-cactus.org>2017-11-02 14:32:57 -0400
commitcbd6a4d05bf382641b108347218dfd534dc57558 (patch)
tree244989d829d0c191405b48655cfe6dd6babc16f9 /compiler
parent36f0cb74c5f7a0a8f3d164e580f293fa07106064 (diff)
downloadhaskell-cbd6a4d05bf382641b108347218dfd534dc57558.tar.gz
Introduce -dsuppress-stg-free-vars flag
This breaks out control over STG free variable list output from -dppr-debug into its own distinct flag. This makes it more discoverable and easier to change independently from other dump output. Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4140
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/DynFlags.hs3
-rw-r--r--compiler/stgSyn/StgSyn.hs9
2 files changed, 9 insertions, 3 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 904257e4d0..a421284779 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -563,6 +563,7 @@ data GeneralFlag
-- Except for uniques, as some simplifier phases introduce new
-- variables that have otherwise identical names.
| Opt_SuppressUniques
+ | Opt_SuppressStgFreeVars
| Opt_SuppressTicks -- Replaces Opt_PprShowTicks
-- temporary flags
@@ -2916,6 +2917,7 @@ dynamic_flags_deps = [
setGeneralFlag Opt_SuppressTypeApplications
setGeneralFlag Opt_SuppressIdInfo
setGeneralFlag Opt_SuppressTicks
+ setGeneralFlag Opt_SuppressStgFreeVars
setGeneralFlag Opt_SuppressTypeSignatures)
------ Debugging ----------------------------------------------------
@@ -3689,6 +3691,7 @@ dFlagsDeps = [
depFlagSpec' "ppr-ticks" Opt_PprShowTicks
(\turn_on -> useInstead "-d" "suppress-ticks" (not turn_on)),
flagSpec "suppress-ticks" Opt_SuppressTicks,
+ flagSpec "suppress-stg-free-vars" Opt_SuppressStgFreeVars,
flagSpec "suppress-coercions" Opt_SuppressCoercions,
flagSpec "suppress-idinfo" Opt_SuppressIdInfo,
flagSpec "suppress-unfoldings" Opt_SuppressUnfoldings,
diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs
index b31a8fce3b..330e2b409f 100644
--- a/compiler/stgSyn/StgSyn.hs
+++ b/compiler/stgSyn/StgSyn.hs
@@ -803,9 +803,11 @@ pprStgRhs :: (OutputableBndr bndr, Outputable bdee, Ord bdee)
-- special case
pprStgRhs (StgRhsClosure cc bi [free_var] upd_flag [{-no args-}] (StgApp func []))
- = hsep [ ppr cc,
+ = sdocWithDynFlags $ \dflags ->
+ hsep [ ppr cc,
pp_binder_info bi,
- brackets (whenPprDebug (ppr free_var)),
+ if not $ gopt Opt_SuppressStgFreeVars dflags
+ then brackets (ppr free_var) else empty,
text " \\", ppr upd_flag, ptext (sLit " [] "), ppr func ]
-- general case
@@ -813,7 +815,8 @@ pprStgRhs (StgRhsClosure cc bi free_vars upd_flag args body)
= sdocWithDynFlags $ \dflags ->
hang (hsep [if gopt Opt_SccProfilingOn dflags then ppr cc else empty,
pp_binder_info bi,
- whenPprDebug (brackets (interppSP free_vars)),
+ if not $ gopt Opt_SuppressStgFreeVars dflags
+ then brackets (interppSP free_vars) else empty,
char '\\' <> ppr upd_flag, brackets (interppSP args)])
4 (ppr body)