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]

-fcrossjumping and -floop-optimize


Hi,
this patch adds two new switches to enable/disable optimizations

Bootstrapped/regtested i386.

Mon Mar 18 21:04:59 CET 2002  Jan Hubicka  <jh@suse.cz>
	* toplev.c (flag_loop_optimize, flag_crossjumping):
	New static variables.
	(rest_of_compilation): Conditionalize crossjumping and
	loop optimizer.
	(parse_options_and_default_flags): Default loop_optimize and
	crossjumping.
	(lang_independent_options): Add -fcrossjumping and -floop-optimize
	* invoke.texi (crossjumping, loop-optimize): Document.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.597
diff -c -3 -p -r1.597 toplev.c
*** toplev.c	2002/03/17 20:41:35	1.597
--- toplev.c	2002/03/18 19:50:09
*************** int flag_syntax_only = 0;
*** 616,621 ****
--- 616,629 ----
  
  static int flag_gcse;
  
+ /* Nonzero means perform loop optimizer.  */
+ 
+ static int flag_loop_optimize;
+ 
+ /* Nonzero means perform crossjumping.  */
+ 
+ static int flag_crossjumping;
+ 
  /* Nonzero means to use global dataflow analysis to eliminate
     useless null pointer tests.  */
  
*************** static const lang_independent_options f_
*** 1023,1028 ****
--- 1031,1040 ----
     N_("Perform enhanced load motion during global subexpression elimination") },
    {"gcse-sm", &flag_gcse_sm, 1,
     N_("Perform store motion after global subexpression elimination") },
+   {"loop-optimize", &flag_loop_optimize, 1,
+    N_("Perform the loop optimizations") },
+   {"crossjumping", &flag_crossjumping, 1,
+    N_("Perform the crossjumping") },
    {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
     N_("Run CSE pass after loop optimizations") },
    {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
*************** rest_of_compilation (decl)
*** 2864,2870 ****
  
    /* Move constant computations out of loops.  */
  
!   if (optimize > 0)
      {
        timevar_push (TV_LOOP);
        delete_dead_jumptables ();
--- 2876,2882 ----
  
    /* Move constant computations out of loops.  */
  
!   if (optimize > 0 && flag_loop_optimize)
      {
        timevar_push (TV_LOOP);
        delete_dead_jumptables ();
*************** rest_of_compilation (decl)
*** 3262,3268 ****
    if (optimize)
      {
        life_analysis (insns, rtl_dump_file, PROP_FINAL);
!       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_CROSSJUMP | CLEANUP_UPDATE_LIFE);
  
        /* This is kind of a heuristic.  We need to run combine_stack_adjustments
           even for machines with possibly nonzero RETURN_POPS_ARGS
--- 3274,3281 ----
    if (optimize)
      {
        life_analysis (insns, rtl_dump_file, PROP_FINAL);
!       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
! 		   | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
  
        /* This is kind of a heuristic.  We need to run combine_stack_adjustments
           even for machines with possibly nonzero RETURN_POPS_ARGS
*************** rest_of_compilation (decl)
*** 3368,3374 ****
  	 and insn splitting possibly introduced more crossjumping
  	 oppurtuntities.  */
        cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
! 		   | CLEANUP_CROSSJUMP);
        if (flag_reorder_blocks)
  	{
  	  reorder_basic_blocks ();
--- 3381,3387 ----
  	 and insn splitting possibly introduced more crossjumping
  	 oppurtuntities.  */
        cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
! 		   | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
        if (flag_reorder_blocks)
  	{
  	  reorder_basic_blocks ();
*************** parse_options_and_default_flags (argc, a
*** 4663,4668 ****
--- 4676,4683 ----
  #endif
        flag_guess_branch_prob = 1;
        flag_cprop_registers = 1;
+       flag_loop_optimize = 1;
+       flag_crossjumping = 1;
      }
  
    if (optimize >= 2)
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/doc/invoke.texi,v
retrieving revision 1.129
diff -c -3 -p -r1.129 invoke.texi
*** invoke.texi	2002/03/14 23:31:50	1.129
--- invoke.texi	2002/03/18 19:50:17
*************** in the following sections.
*** 266,272 ****
  -fdelayed-branch  -fdelete-null-pointer-checks @gol
  -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
  -fforce-addr  -fforce-mem  -ffunction-sections @gol
! -fgcse  -fgcse-lm  -fgcse-sm @gol
  -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
  -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
  -fmove-all-movables  -fno-default-inline  -fno-defer-pop @gol
--- 266,272 ----
  -fdelayed-branch  -fdelete-null-pointer-checks @gol
  -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
  -fforce-addr  -fforce-mem  -ffunction-sections @gol
! -fgcse  -fgcse-lm  -fgcse-sm -floop-optimize -fcrossjumping @gol
  -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
  -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
  -fmove-all-movables  -fno-default-inline  -fno-defer-pop @gol
*************** When @option{-fgcse-sm} is enabled, A st
*** 3493,3498 ****
--- 3493,3509 ----
  subexpression elimination.  This pass will attempt to move stores out of loops.
  When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
  can be changed to a load before the loop and a store after the loop.
+ 
+ @item -floop-optimize
+ @opindex floop-optimize
+ Perform loop optimizations: move constant expressions out of loops, simplify
+ exit test condition and optionally do strength-reduction and loop unrolling as
+ well.
+ 
+ @item -fcrossjumping
+ @opindex crossjumping
+ Perform cross-jumping that unify equivalent code and save code size. The
+ resulting code may or may not perform better than without cross-jumping.
  
  @item -fdelete-null-pointer-checks
  @opindex fdelete-null-pointer-checks


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