Add flags -fno-specialise, -fno-float-in, and document them
authorsimonpj@microsoft.com <unknown>
Tue, 20 Oct 2009 07:42:29 +0000 (07:42 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 20 Oct 2009 07:42:29 +0000 (07:42 +0000)
It turned out that we lacked flags to switch off these two passes,
so I added them.

compiler/main/DynFlags.hs
docs/users_guide/flags.xml
docs/users_guide/using.xml

index 3188658..adee723 100644 (file)
@@ -263,6 +263,8 @@ data DynFlag
    -- optimisation opts
    | Opt_Strictness
    | Opt_FullLaziness
+   | Opt_FloatIn
+   | Opt_Specialise
    | Opt_StaticArgumentTransformation
    | Opt_CSE
    | Opt_LiberateCase
@@ -890,6 +892,8 @@ optLevelFlags
     , ([1,2],   Opt_Strictness)
     , ([1,2],   Opt_CSE)
     , ([1,2],   Opt_FullLaziness)
+    , ([1,2],   Opt_Specialise)
+    , ([1,2],   Opt_FloatIn)
 
     , ([2],     Opt_LiberateCase)
     , ([2],     Opt_SpecConstr)
@@ -1051,6 +1055,8 @@ getCoreToDo dflags
     max_iter      = maxSimplIterations dflags
     strictness    = dopt Opt_Strictness dflags
     full_laziness = dopt Opt_FullLaziness dflags
+    do_specialise = dopt Opt_Specialise dflags
+    do_float_in   = dopt Opt_FloatIn dflags
     cse           = dopt Opt_CSE dflags
     spec_constr   = dopt Opt_SpecConstr dflags
     liberate_case = dopt Opt_LiberateCase dflags
@@ -1125,7 +1131,7 @@ getCoreToDo dflags
 
         -- Specialisation is best done before full laziness
         -- so that overloaded functions have all their dictionary lambdas manifest
-        CoreDoSpecialising,
+        runWhen do_specialise CoreDoSpecialising,
 
         runWhen full_laziness (CoreDoFloatOutwards constantsOnlyFloatOutSwitches),
                -- Was: gentleFloatOutSwitches  
@@ -1136,7 +1142,7 @@ getCoreToDo dflags
                --          rewrite's allocation by 19%, and made  0.0% difference
                --          to any other nofib benchmark
 
-        CoreDoFloatInwards,
+        runWhen do_float_in CoreDoFloatInwards,
 
         simpl_phases,
 
@@ -1177,7 +1183,7 @@ getCoreToDo dflags
                 -- succeed in commoning up things floated out by full laziness.
                 -- CSE used to rely on the no-shadowing invariant, but it doesn't any more
 
-        CoreDoFloatInwards,
+        runWhen do_float_in CoreDoFloatInwards,
 
         maybe_rule_check 0,
 
@@ -1689,6 +1695,8 @@ fFlags = [
   ( "warn-wrong-do-bind",               Opt_WarnWrongDoBind, const Supported ),
   ( "print-explicit-foralls",           Opt_PrintExplicitForalls, const Supported ),
   ( "strictness",                       Opt_Strictness, const Supported ),
+  ( "specialise",                       Opt_Specialise, const Supported ),
+  ( "float-in",                         Opt_FloatIn, const Supported ),
   ( "static-argument-transformation",   Opt_StaticArgumentTransformation, const Supported ),
   ( "full-laziness",                    Opt_FullLaziness, const Supported ),
   ( "liberate-case",                    Opt_LiberateCase, const Supported ),
index afec9bd..5eb6025 100644 (file)
            </row>
 
            <row>
+             <entry><option>-fspecialise</option></entry>
+             <entry>Turn on specialisation of overloaded functions. Implied by <option>-O</option>.</entry>
+             <entry>dynamic</entry>
+             <entry>-fno-specialise</entry>
+           </row>
+
+           <row>
              <entry><option>-ffull-laziness</option></entry>
              <entry>Turn on full laziness (floating bindings outwards). Implied by <option>-O</option>.</entry>
              <entry>dynamic</entry>
            </row>
 
            <row>
-             <entry><option>-frewrite-rules</option></entry>
+             <entry><option>-ffloat-in</option></entry>
+             <entry>Turn on the float-in transformation. Implied by <option>-O</option>.</entry>
+             <entry>dynamic</entry>
+             <entry>-fno-float-in</entry>
+           </row>
+
+           <row>
+             <entry><option>-fenable-rewrite-rules</option></entry>
              <entry>Switch on all rewrite rules (including rules
              generated by automatic specialisation of overloaded functions).
              Implied by <option>-O</option>. </entry>
              <entry>dynamic</entry>
-             <entry><option>-fno-rewrite-rules</option></entry>
+             <entry><option>-fno-enable-rewrite-rules</option></entry>
            </row>
 
            <row>
index 5ad34fa..eb6b0c0 100644 (file)
@@ -1667,6 +1667,26 @@ f "2"    = 2
 
        <varlistentry>
          <term>
+            <option>-fno-float-in</option>
+            <indexterm><primary><option>-fno-float-in</option></primary></indexterm>
+          </term>
+         <listitem>
+           <para>Turns off the float-in transformation.</para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
+         <term>
+            <option>-fno-specialise</option>
+            <indexterm><primary><option>-fno-specialise</option></primary></indexterm>
+          </term>
+         <listitem>
+           <para>Turns off the automatic specialisation of overloaded functions.</para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
+         <term>
             <option>-fspec-constr</option>
             <indexterm><primary><option>-fspec-constr</option></primary></indexterm>
           </term>