summaryrefslogtreecommitdiff
path: root/compiler/coreSyn
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2015-09-25 18:00:19 +0200
committerBen Gamari <ben@smart-cactus.org>2015-11-23 17:47:41 +0100
commit7aaeaf81ea95c36fe1dc4da449cf6092a792fd09 (patch)
tree79703e6d9db2f81507272d9efd1a5952b17c7924 /compiler/coreSyn
parentbb249aa749c82590823855e970bcc1c4d4b23523 (diff)
downloadhaskell-7aaeaf81ea95c36fe1dc4da449cf6092a792fd09.tar.gz
Support multiple debug output levels
We now only strip block information from DebugBlocks when compiling with `-g1`, intended to be used when only minimal debug information is desired. `-g2` is assumed when `-g` is passed without any integer argument. Differential Revision: https://phabricator.haskell.org/D1281
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r--compiler/coreSyn/CoreLint.hs6
-rw-r--r--compiler/coreSyn/CorePrep.hs2
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index d9116a6f9b..10a93e5281 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -1914,13 +1914,13 @@ lintAnnots pname pass guts = do
return nguts
-- | Run the given pass without annotations. This means that we both
--- remove the @Opt_Debug@ flag from the environment as well as all
+-- set the debugLevel setting to 0 in the environment as well as all
-- annotations from incoming modules.
withoutAnnots :: (ModGuts -> CoreM ModGuts) -> ModGuts -> CoreM ModGuts
withoutAnnots pass guts = do
-- Remove debug flag from environment.
dflags <- getDynFlags
- let removeFlag env = env{hsc_dflags = gopt_unset dflags Opt_Debug}
+ let removeFlag env = env{ hsc_dflags = dflags{ debugLevel = 0} }
withoutFlag corem =
liftIO =<< runCoreM <$> fmap removeFlag getHscEnv <*> getRuleBase <*>
getUniqueSupplyM <*> getModule <*>
@@ -1929,7 +1929,7 @@ withoutAnnots pass guts = do
pure corem
-- Nuke existing ticks in module.
-- TODO: Ticks in unfoldings. Maybe change unfolding so it removes
- -- them in absence of @Opt_Debug@?
+ -- them in absence of debugLevel > 0.
let nukeTicks = stripTicksE (not . tickishIsCode)
nukeAnnotsBind :: CoreBind -> CoreBind
nukeAnnotsBind bind = case bind of
diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs
index e49ece43d2..fdf25d60d9 100644
--- a/compiler/coreSyn/CorePrep.hs
+++ b/compiler/coreSyn/CorePrep.hs
@@ -221,7 +221,7 @@ mkDataConWorkers dflags mod_loc data_tycons
-- If we want to generate debug info, we put a source note on the
-- worker. This is useful, especially for heap profiling.
tick_it name
- | not (gopt Opt_Debug dflags) = id
+ | debugLevel dflags == 0 = id
| RealSrcSpan span <- nameSrcSpan name = tick span
| Just file <- ml_hs_file mod_loc = tick (span1 file)
| otherwise = tick (span1 "???")