This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SPARC] Disable -fira-share-save-slots by default


The new save slot sharing algorithm has a documented limitation:

   Future work:

     In the fallback case we should iterate backwards across all possible
     modes for the save, choosing the largest available one instead of
     falling back to the smallest mode immediately.  (eg TF -> DF -> SF).

that is annoying for the SPARC when it comes to floating-point code because the 
floating-point registers are single (SF) but there is a fully-fledged support 
for double (DF) arithmetics in the architecture.  So saving registers on an 
individual basis really pessimizes here.  For example, the size of the object 
generated for the Ada unit a-nlcefu.ads at -O2 decreases from 96080 to 95088 
bytes when you pass -fno-ira-share-save-slots.

Experiments have shown that the impact on integer code is null in terms of code 
size and negligible in terms of stack usage (-fstack-usage reports 8/16 bytes 
increase for most functions).  Therefore this patch disables the option by 
default for the SPARC.  Boostrapped/regtested on SPARC/Solaris, applied on the 
mainline and 4.6 branch.


Jeff, I'd like to apply it to the 4.5 branch as well, but I need your patch:

2011-01-21  Jeff Law  <law@redhat.com>

	PR rtl-optimization/41619
	* caller-save.c (setup_save_areas): Break out code to determine
	which hard regs are live across calls by examining the reload chains
	so that it is always used.
	Eliminate code which checked REG_N_CALLS_CROSSED.

Do you have any objections to me backporting it to the branch?


2011-05-24  Eric Botcazou  <ebotcazou@adacore.com>

	* config/sparc/sparc.c (sparc_option_override): If not set by the user,
	force flag_ira_share_save_slots to 0.


-- 
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 174058)
+++ config/sparc/sparc.c	(working copy)
@@ -933,6 +933,12 @@ sparc_option_override (void)
 			  ? 64 : 32),
 			 global_options.x_param_values,
 			 global_options_set.x_param_values);
+
+  /* Disable save slot sharing for call-clobbered registers by default.
+     The IRA sharing algorithm works on single registers only and this
+     pessimizes for double floating-point registers.  */
+  if (!global_options_set.x_flag_ira_share_save_slots)
+    flag_ira_share_save_slots = 0;
 }
 
 /* Miscellaneous utilities.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]