Add -Odph
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Tue, 20 May 2008 03:19:13 +0000 (03:19 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Tue, 20 May 2008 03:19:13 +0000 (03:19 +0000)
This is the optimisation level recommended when compiling DPH programs. At the
moment, it is equivalent to -O2 -fno-method-sharing -fdicts-cheap
-fmax-simplifier-iterations20 -fno-spec-constr-threshold.

compiler/main/DynFlags.hs

index d3019ee..f88d02c 100644 (file)
@@ -1186,6 +1186,7 @@ dynamic_flags = [
        ------ Optimisation flags ------------------------------------------
   ,  ( "O"     , NoArg (upd (setOptLevel 1)))
   ,  ( "Onot"  , NoArg (upd (setOptLevel 0))) -- deprecated
        ------ Optimisation flags ------------------------------------------
   ,  ( "O"     , NoArg (upd (setOptLevel 1)))
   ,  ( "Onot"  , NoArg (upd (setOptLevel 0))) -- deprecated
+  ,  ( "Odph"   , NoArg (upd setDPHOpt))
   ,  ( "O"     , OptIntSuffix (\mb_n -> upd (setOptLevel (mb_n `orElse` 1))))
                -- If the number is missing, use 1
 
   ,  ( "O"     , OptIntSuffix (\mb_n -> upd (setOptLevel (mb_n `orElse` 1))))
                -- If the number is missing, use 1
 
@@ -1581,6 +1582,24 @@ setOptLevel n dflags
        = updOptLevel n dflags
 
 
        = updOptLevel n dflags
 
 
+-- -Odph is equivalent to
+--
+--    -O2                               optimise as much as possible
+--    -fno-method-sharing               sharing specialisation defeats fusion
+--                                      sometimes
+--    -fdicts-cheap                     always inline dictionaries
+--    -fmax-simplifier-iterations20     this is necessary sometimes
+--    -fno-spec-constr-threshold        run SpecConstr even for big loops
+--
+setDPHOpt :: DynFlags -> DynFlags
+setDPHOpt dflags = setOptLevel 2 (dflags { maxSimplIterations  = 20
+                                         , specConstrThreshold = Nothing
+                                         })
+                   `dopt_set`   Opt_DictsCheap
+                   `dopt_unset` Opt_MethodSharing
+
+
+
 setMainIs :: String -> DynP ()
 setMainIs arg
   | not (null main_fn) && isLower (head main_fn)
 setMainIs :: String -> DynP ()
 setMainIs arg
   | not (null main_fn) && isLower (head main_fn)