summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-05-15 14:09:46 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-05-23 16:16:36 +0000
commit68afbc28abd40a04408a3539828b7b0855cb6143 (patch)
treeb027e2ed8cf2ec764fcd7b01acd37a867becf3d8
parentffbe28e56aa382164525300fbc32d78eefd95e7d (diff)
downloadhaskell-wip/stg-to-cmm-simplify-debug.tar.gz
Make debug a `Bool` not an `Int` in `StgToCmmConfig`wip/stg-to-cmm-simplify-debug
We don't need any more resolution than this. Rename the field to `stgToCmmEmitDebugInfo` to indicate it is no longer conveying any "level" information.
-rw-r--r--compiler/GHC/Driver/Config/StgToCmm.hs2
-rw-r--r--compiler/GHC/StgToCmm/Config.hs4
-rw-r--r--compiler/GHC/StgToCmm/Monad.hs6
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Driver/Config/StgToCmm.hs b/compiler/GHC/Driver/Config/StgToCmm.hs
index b0b28bf158..38e8f6684d 100644
--- a/compiler/GHC/Driver/Config/StgToCmm.hs
+++ b/compiler/GHC/Driver/Config/StgToCmm.hs
@@ -22,7 +22,7 @@ initStgToCmmConfig dflags mod = StgToCmmConfig
, stgToCmmThisModule = mod
, stgToCmmTmpDir = tmpDir dflags
, stgToCmmContext = initSDocContext dflags defaultDumpStyle
- , stgToCmmDebugLevel = debugLevel dflags
+ , stgToCmmEmitDebugInfo = debugLevel dflags > 0
, stgToCmmBinBlobThresh = b_blob
, stgToCmmMaxInlAllocSize = maxInlineAllocSize dflags
-- ticky options
diff --git a/compiler/GHC/StgToCmm/Config.hs b/compiler/GHC/StgToCmm/Config.hs
index 01b3a3f319..f2bd349ae7 100644
--- a/compiler/GHC/StgToCmm/Config.hs
+++ b/compiler/GHC/StgToCmm/Config.hs
@@ -22,8 +22,8 @@ data StgToCmmConfig = StgToCmmConfig
-- Cmm/Parser.y which preloads it with a panic
, stgToCmmTmpDir :: !TempDir -- ^ Temp Dir for files used in compilation
, stgToCmmContext :: !SDocContext -- ^ Context for StgToCmm phase
- , stgToCmmDebugLevel :: !Int -- ^ The verbosity of debug messages
- , stgToCmmBinBlobThresh :: !(Maybe Word) -- ^ Threshold at which Binary literals (e.g. strings)
+ , stgToCmmEmitDebugInfo :: !Bool -- ^ Whether we wish to output debug information
+ , stgToCmmBinBlobThresh :: !(Maybe Word) -- ^ Threshold at which Binary literals (e.g. strings)
-- are either dumped to a file and a CmmFileEmbed literal
-- is emitted (over threshold), or become a CmmString
-- Literal (under or at threshold). CmmFileEmbed is only supported
diff --git a/compiler/GHC/StgToCmm/Monad.hs b/compiler/GHC/StgToCmm/Monad.hs
index 6aa0a2dd08..0c3fd1c68e 100644
--- a/compiler/GHC/StgToCmm/Monad.hs
+++ b/compiler/GHC/StgToCmm/Monad.hs
@@ -531,7 +531,7 @@ tickScope :: FCode a -> FCode a
tickScope code = do
cfg <- getStgToCmmConfig
fstate <- getFCodeState
- if stgToCmmDebugLevel cfg == 0 then code else do
+ if not $ stgToCmmEmitDebugInfo cfg then code else do
u <- newUnique
let scope' = SubScope u (fcs_tickscope fstate)
withFCodeState code fstate{ fcs_tickscope = scope' }
@@ -717,8 +717,8 @@ emitTick = emitCgStmt . CgStmt . CmmTick
emitUnwind :: [(GlobalReg, Maybe CmmExpr)] -> FCode ()
emitUnwind regs = do
- debug_level <- stgToCmmDebugLevel <$> getStgToCmmConfig
- when (debug_level > 0) $
+ debug <- stgToCmmEmitDebugInfo <$> getStgToCmmConfig
+ when debug $
emitCgStmt $ CgStmt $ CmmUnwind regs
emitAssign :: CmmReg -> CmmExpr -> FCode ()