Commit df0fb997 authored by's avatar
Browse files

Re-adjust interaction between -ddump flags and force-recompilation

If you say -ddump-xx we effectively add -fforce-recomp, so that you
see your dump output.  But this works badly in --make mode, because
you get the ddump output for every module, which is probably not what
you want.  This patch forces recompilation with -ddump-X only in one-shot

Of course, this only affects people using -ddump options.
parent 4ec6ab05
......@@ -1366,7 +1366,7 @@ dynamic_flags = [
, Flag "dasm-lint" (NoArg (setDynFlag Opt_DoAsmLinting))
, Flag "dshow-passes"
(NoArg (do setDynFlag Opt_ForceRecomp
(NoArg (do forceRecompile
setVerbosity (Just 2)))
, Flag "dfaststring-stats" (NoArg (setDynFlag Opt_D_faststring_stats))
......@@ -1756,24 +1756,31 @@ unSetDynFlag f = upd (\dfs -> dopt_unset dfs f)
setDumpFlag :: DynFlag -> OptKind DynP
setDumpFlag dump_flag
| force_recomp = NoArg (setDynFlag Opt_ForceRecomp >> setDynFlag dump_flag)
| otherwise = NoArg (setDynFlag dump_flag)
= NoArg (setDynFlag dump_flag >> when want_recomp forceRecompile)
-- Whenver we -ddump, switch off the recompilation checker,
-- else you don't see the dump!
-- However, certain dumpy-things are really interested in what's going
-- Certain dumpy-things are really interested in what's going
-- on during recompilation checking, so in those cases we
-- don't want to turn it off.
force_recomp = dump_flag `notElem` [Opt_D_dump_if_trace,
want_recomp = dump_flag `notElem` [Opt_D_dump_if_trace,
forceRecompile :: DynP ()
-- Whenver we -ddump, force recompilation (by switching off the
-- recompilation checker), else you don't see the dump! However,
-- don't switch it off in --make mode, else *everything* gets
-- recompiled which probably isn't what you want
forceRecompile = do { dfs <- getCmdLineState
; when (force_recomp dfs) (setDynFlag Opt_ForceRecomp) }
force_recomp dfs = isOneShot (ghcMode dfs)
setVerboseCore2Core :: DynP ()
setVerboseCore2Core = do setDynFlag Opt_ForceRecomp
setDynFlag Opt_D_verbose_core2core
setVerboseCore2Core = do setDynFlag Opt_D_verbose_core2core
upd (\s -> s { shouldDumpSimplPhase = const True })
setDumpSimplPhases :: String -> DynP ()
setDumpSimplPhases s = do setDynFlag Opt_ForceRecomp
setDumpSimplPhases s = do forceRecompile
upd (\s -> s { shouldDumpSimplPhase = spec })
spec :: SimplifierMode -> Bool
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment