No documentation of -fsched-pressure-algorithm

Richard Sandiford rdsandiford@googlemail.com
Wed May 2 18:45:00 GMT 2012


Ian Lance Taylor <iant@google.com> writes:
> Richard Sandiford <rdsandiford@googlemail.com> writes:
>> Well, given the replies from you, Ian and Vlad (when reviewing the patch),
>> I feel once again in a minority of one here :-) but... I just don't
>> think we should be advertising this sort of stuff to users.  Not because
>> I'm trying to be cliquey, but because any time the user ends up having
>> to use stuff like this represents a failure on the part of the compiler.
>
> I think it's perfectly reasonable to have tuning knobs that are reserved
> for experts or people with too much time on their hands.  I just think
> that we already have a mechanism for that via --param.  For --param the
> docs say
>
>     The names of specific parameters, and the meaning of the values, are
>     tied to the internals of the compiler, and are subject to change
>     without notice in future releases.
>
> I think that is the kind of thing you are talking about.  I think that
> for compiler tuning knobs we should use the mechanism that already
> exists, rather than introducing a new mechanism of undocumented -f
> options.

OK, fair enough.  How does this patch look?  I tested it before I got
Richard E's message, but it still seems the weight of opinion is behind
--param.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Which I know
is meaningful because I forgot the PARAM_VALUE in the first cut and
got a bunch of extra ICEs.  I also tried the --param values out to
make sure that the right algorithm was being chosen, and that the
default was unchanged.  OK to install?

Richard


gcc/
	* doc/invoke.texi (sched-pressure-algorithm): Document new --param.
	* common.opt (fsched-pressure-algorithm=): Remove.
	* flag-types.h (sched_pressure_algorithm): Move to...
	* sched-int.h (sched_pressure_algorithm): ...here.
	* params.def (sched-pressure-algorithm): New param.
	* haifa-sched.c (sched_init): Use it to initialize sched_pressure.

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	2012-05-01 21:36:18.091969459 +0100
+++ gcc/doc/invoke.texi	2012-05-02 19:38:02.725960400 +0100
@@ -9329,6 +9329,17 @@ Set the maximum number of instructions e
 reassociated tree. This parameter overrides target dependent
 heuristics used by default if has non zero value.
 
+@item sched-pressure-algorithm
+Choose between the two available implementations of
+@option{-fsched-pressure}.  Algorithm 1 is the original implementation
+and is the more likely to prevent instructions from being reordered.
+Algorithm 2 was designed to be a compromise between the relatively
+conservative approach taken by algorithm 1 and the rather aggressive
+approach taken by the default scheduler.  It relies more heavily on
+having a regular register file and accurate register pressure classes.
+See @file{haifa-sched.c} in the GCC sources for more details.
+
+The default choice depends on the target.
 @end table
 @end table
 
Index: gcc/common.opt
===================================================================
--- gcc/common.opt	2012-05-01 21:36:18.092969459 +0100
+++ gcc/common.opt	2012-05-02 19:21:36.166989085 +0100
@@ -1665,19 +1665,6 @@ fsched-pressure
 Common Report Var(flag_sched_pressure) Init(0) Optimization
 Enable register pressure sensitive insn scheduling
 
-fsched-pressure-algorithm=
-Common Joined RejectNegative Enum(sched_pressure_algorithm) Var(flag_sched_pressure_algorithm) Init(SCHED_PRESSURE_WEIGHTED)
--fsched-pressure-algorithm=[weighted|model] Set the pressure-scheduling algorithm
-
-Enum
-Name(sched_pressure_algorithm) Type(enum sched_pressure_algorithm) UnknownError(unknown %<fsched-pressure%> algorithm %qs)
-
-EnumValue
-Enum(sched_pressure_algorithm) String(weighted) Value(SCHED_PRESSURE_WEIGHTED)
-
-EnumValue
-Enum(sched_pressure_algorithm) String(model) Value(SCHED_PRESSURE_MODEL)
-
 fsched-spec
 Common Report Var(flag_schedule_speculative) Init(1) Optimization
 Allow speculative motion of non-loads
Index: gcc/flag-types.h
===================================================================
--- gcc/flag-types.h	2012-05-01 21:36:18.093969459 +0100
+++ gcc/flag-types.h	2012-05-02 19:21:36.150989087 +0100
@@ -106,14 +106,6 @@ enum symbol_visibility
 };
 #endif
 
-/* The algorithm used to implement -fsched-pressure.  */
-enum sched_pressure_algorithm
-{
-  SCHED_PRESSURE_NONE,
-  SCHED_PRESSURE_WEIGHTED,
-  SCHED_PRESSURE_MODEL
-};
-
 /* The algorithm used for the integrated register allocator (IRA).  */
 enum ira_algorithm
 {
Index: gcc/sched-int.h
===================================================================
--- gcc/sched-int.h	2012-05-01 21:36:18.092969459 +0100
+++ gcc/sched-int.h	2012-05-02 19:21:36.166989085 +0100
@@ -37,6 +37,14 @@ #define GCC_SCHED_INT_H
 enum sched_pass_id_t { SCHED_PASS_UNKNOWN, SCHED_RGN_PASS, SCHED_EBB_PASS,
 		       SCHED_SMS_PASS, SCHED_SEL_PASS };
 
+/* The algorithm used to implement -fsched-pressure.  */
+enum sched_pressure_algorithm
+{
+  SCHED_PRESSURE_NONE,
+  SCHED_PRESSURE_WEIGHTED,
+  SCHED_PRESSURE_MODEL
+};
+
 typedef VEC (basic_block, heap) *bb_vec_t;
 typedef VEC (rtx, heap) *insn_vec_t;
 typedef VEC (rtx, heap) *rtx_vec_t;
Index: gcc/params.def
===================================================================
--- gcc/params.def	2012-05-01 21:36:18.092969459 +0100
+++ gcc/params.def	2012-05-02 19:21:36.175989085 +0100
@@ -979,6 +979,12 @@ DEFPARAM (PARAM_MAX_TRACKED_STRLENS,
 	  "track string lengths",
 	  1000, 0, 0)
 
+/* Keep this in sync with the sched_pressure_algorithm enum.  */
+DEFPARAM (PARAM_SCHED_PRESSURE_ALGORITHM,
+	  "sched-pressure-algorithm",
+	  "Which -fsched-pressure algorithm to apply",
+	  1, 1, 2)
+
 /*
 Local variables:
 mode:c
Index: gcc/haifa-sched.c
===================================================================
--- gcc/haifa-sched.c	2012-05-01 21:36:18.092969459 +0100
+++ gcc/haifa-sched.c	2012-05-02 19:21:36.148989087 +0100
@@ -6230,7 +6230,8 @@ sched_init (void)
   if (flag_sched_pressure
       && !reload_completed
       && common_sched_info->sched_pass_id == SCHED_RGN_PASS)
-    sched_pressure = flag_sched_pressure_algorithm;
+    sched_pressure = ((enum sched_pressure_algorithm)
+		      PARAM_VALUE (PARAM_SCHED_PRESSURE_ALGORITHM));
   else
     sched_pressure = SCHED_PRESSURE_NONE;
 



More information about the Gcc-patches mailing list