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]

Re: [patch] Enable -fweb and -frename-registers when unrolling


I don't like the fact that with this patch, there is no way to use
-funroll-loops without getting -fweb or -frename-registers.  I.e.  if
you run '-funroll-loops -fno-web' you still get the web pass run.  Here
is a patch that will leave the defaults the same (i.e.  -funroll-loops
will still turn on web and rename-registers by default) but it allows you
to use -fno-web or -fno-rename-registers with -funroll-loops if you want
to.

I haven't finished testing yet, but is this patch OK once testing is
done?

Steve Ellcey
sje@cup.hp.com


2005-07-15  Steve Ellcey  <sje@cup.hp.com>

	* common.opt (frename-registers): Initialize to 2.
	(fweb): Ditto.
	* toplev.c (AUTODETECT_FLAG_VAR_TRACKING): Rename to AUTODETECT_VALUE.
	(process_options): Only change flag_web and flag_rename_registers
	it not explicitly set by user.


*** gcc.orig/gcc/common.opt	Fri Jul 15 13:35:24 2005
--- gcc/gcc/common.opt	Fri Jul 15 13:35:02 2005
*************** Common Report Var(flag_regmove)
*** 662,668 ****
  Enables a register move optimization
  
  frename-registers
! Common Report Var(flag_rename_registers)
  Perform a register renaming optimization pass
  
  freorder-blocks
--- 662,668 ----
  Enables a register move optimization
  
  frename-registers
! Common Report Var(flag_rename_registers) Init(2)
  Perform a register renaming optimization pass
  
  freorder-blocks
*************** Common Report Var(flag_value_profile_tra
*** 999,1005 ****
  Use expression value profiles in optimizations
  
  fweb
! Common Report Var(flag_web) Init(0)
  Construct webs and split unrelated uses of single variable
  
  fwhole-program
--- 999,1005 ----
  Use expression value profiles in optimizations
  
  fweb
! Common Report Var(flag_web) Init(2)
  Construct webs and split unrelated uses of single variable
  
  fwhole-program
*** gcc.orig/gcc/toplev.c	Fri Jul 15 13:35:29 2005
--- gcc/gcc/toplev.c	Fri Jul 15 13:48:15 2005
*************** location_t unknown_location = { NULL, 0 
*** 145,151 ****
  
  /* Used to enable -fvar-tracking, -fweb and -frename-registers according
     to optimize and default_debug_hooks in process_options ().  */
! #define AUTODETECT_FLAG_VAR_TRACKING 2
  
  /* Current position in real source file.  */
  
--- 145,151 ----
  
  /* Used to enable -fvar-tracking, -fweb and -frename-registers according
     to optimize and default_debug_hooks in process_options ().  */
! #define AUTODETECT_VALUE 2
  
  /* Current position in real source file.  */
  
*************** rtx stack_limit_rtx;
*** 334,342 ****
  int flag_renumber_insns = 1;
  
  /* Nonzero if we should track variables.  When
!    flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
     to optimize, debug_info_level and debug_hooks in process_options ().  */
! int flag_var_tracking = AUTODETECT_FLAG_VAR_TRACKING;
  
  /* True if the user has tagged the function with the 'section'
     attribute.  */
--- 334,342 ----
  int flag_renumber_insns = 1;
  
  /* Nonzero if we should track variables.  When
!    flag_var_tracking == AUTODETECT_VALUE it will be set according
     to optimize, debug_info_level and debug_hooks in process_options ().  */
! int flag_var_tracking = AUTODETECT_VALUE;
  
  /* True if the user has tagged the function with the 'section'
     attribute.  */
*************** process_options (void)
*** 1530,1544 ****
    if (flag_unroll_all_loops)
      flag_unroll_loops = 1;
  
!   /* The loop unrolling code assumes that cse will be run after loop.
!      Also enable -fweb and -frename-registers that help scheduling
!      the unrolled loop.  */
    if (flag_unroll_loops || flag_peel_loops)
-     {
        flag_rerun_cse_after_loop = 1;
!       flag_web = 1;
!       flag_rename_registers = 1;
!     }
  
    /* If explicitly asked to run new loop optimizer, switch off the old
       one.  */
--- 1530,1545 ----
    if (flag_unroll_all_loops)
      flag_unroll_loops = 1;
  
!   /* The loop unrolling code assumes that cse will be run after loop.  */
    if (flag_unroll_loops || flag_peel_loops)
        flag_rerun_cse_after_loop = 1;
! 
!   /* If flag_web and flag_rename_registers are not already explicitly set,
!      set them now.  True if unrolling loops, false otherwise.  */
!   if (flag_web == AUTODETECT_VALUE)
!     flag_web = flag_unroll_loops || flag_peel_loops;
!   if (flag_rename_registers == AUTODETECT_VALUE)
!     flag_rename_registers = flag_unroll_loops || flag_peel_loops;
  
    /* If explicitly asked to run new loop optimizer, switch off the old
       one.  */
*************** process_options (void)
*** 1693,1703 ****
        flag_var_tracking = 0;
      }
  
!   if (flag_rename_registers == AUTODETECT_FLAG_VAR_TRACKING)
      flag_rename_registers = default_debug_hooks->var_location
  	    		    != do_nothing_debug_hooks.var_location;
  
!   if (flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING)
      flag_var_tracking = optimize >= 1;
  
    /* If auxiliary info generation is desired, open the output file.
--- 1694,1704 ----
        flag_var_tracking = 0;
      }
  
!   if (flag_rename_registers == AUTODETECT_VALUE)
      flag_rename_registers = default_debug_hooks->var_location
  	    		    != do_nothing_debug_hooks.var_location;
  
!   if (flag_var_tracking == AUTODETECT_VALUE)
      flag_var_tracking = optimize >= 1;
  
    /* If auxiliary info generation is desired, open the output file.


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