Allow more than 3 simplifier iterations to be run in phase 0
[ghc-hetmet.git] / compiler / main / DynFlags.hs
index 9becbb4..c8e999a 100644 (file)
@@ -126,6 +126,7 @@ data DynFlag
    | Opt_D_dump_rn
    | Opt_D_dump_simpl
    | Opt_D_dump_simpl_iterations
+   | Opt_D_dump_simpl_phases
    | Opt_D_dump_spec
    | Opt_D_dump_prep
    | Opt_D_dump_stg
@@ -272,6 +273,7 @@ data DynFlag
    | Opt_BreakOnException
    | Opt_BreakOnError
    | Opt_PrintEvldWithShow
+   | Opt_PrintBindContents
    | Opt_GenManifest
    | Opt_EmbedManifest
    | Opt_RunCPSZ
@@ -536,7 +538,8 @@ defaultDynFlags =
             Opt_DoAsmMangling,
 
             Opt_GenManifest,
-            Opt_EmbedManifest
+            Opt_EmbedManifest,
+            Opt_PrintBindContents
             ]
             ++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
                     -- The default -O0 options
@@ -845,7 +848,7 @@ getCoreToDo dflags
                -- Phase 0: allow all Ids to be inlined now
                -- This gets foldr inlined before strictness analysis
 
-          MaxSimplifierIterations 3
+          MaxSimplifierIterations (max max_iter 3)
                -- At least 3 iterations because otherwise we land up with
                -- huge dead expressions because of an infelicity in the 
                -- simpifier.   
@@ -899,10 +902,15 @@ getCoreToDo dflags
 
        runWhen spec_constr CoreDoSpecConstr,
 
+       case rule_check of { Just pat -> CoreDoRuleCheck 0 pat; Nothing -> CoreDoNothing },
+
        -- Final clean-up simplification:
        CoreDoSimplify (SimplPhase 0) [
          MaxSimplifierIterations max_iter
-       ]
+       ],
+
+       case rule_check of { Just pat -> CoreDoRuleCheck 0 pat; Nothing -> CoreDoNothing }
+
      ]
 
 -- -----------------------------------------------------------------------------
@@ -1072,6 +1080,7 @@ dynamic_flags = [
   ,  ( "ddump-rn",              setDumpFlag Opt_D_dump_rn)
   ,  ( "ddump-simpl",           setDumpFlag Opt_D_dump_simpl)
   ,  ( "ddump-simpl-iterations", setDumpFlag Opt_D_dump_simpl_iterations)
+  ,  ( "ddump-simpl-phases",     setDumpFlag Opt_D_dump_simpl_phases)
   ,  ( "ddump-spec",            setDumpFlag Opt_D_dump_spec)
   ,  ( "ddump-prep",            setDumpFlag Opt_D_dump_prep)
   ,  ( "ddump-stg",             setDumpFlag Opt_D_dump_stg)
@@ -1135,7 +1144,7 @@ dynamic_flags = [
   ,  ( "fspec-threshold",          IntSuffix (\n -> upd (\dfs -> dfs{ specThreshold = n })))
   ,  ( "fliberate-case-threshold", IntSuffix (\n -> upd (\dfs -> dfs{ specThreshold = n })))
 
-  ,  ( "frule-check", SepArg (\s -> upd (\dfs -> dfs{ ruleCheck = Just s })))
+  ,  ( "frule-check",     SepArg (\s -> upd (\dfs -> dfs{ ruleCheck = Just s })))
   ,  ( "fcontext-stack"        , IntSuffix $ \n -> upd $ \dfs -> dfs{ ctxtStkDepth = n })
 
         ------ Compiler flags -----------------------------------------------
@@ -1210,6 +1219,7 @@ fFlags = [
   ( "break-on-exception",               Opt_BreakOnException ),
   ( "break-on-error",                   Opt_BreakOnError ),
   ( "print-evld-with-show",             Opt_PrintEvldWithShow ),
+  ( "print-bind-contents",              Opt_PrintBindContents ),
   ( "run-cps",                          Opt_RunCPSZ ),
   ( "convert-to-zipper-and-back",       Opt_ConvertToZipCfgAndBack),
   ( "vectorise",                        Opt_Vectorise ),