Allow more than 3 simplifier iterations to be run in phase 0
[ghc-hetmet.git] / compiler / main / DynFlags.hs
index f8e9408..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
@@ -847,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.   
@@ -901,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 }
+
      ]
 
 -- -----------------------------------------------------------------------------
@@ -1074,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)
@@ -1137,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 -----------------------------------------------