shorten branches versus reg-stack

Jan Hubicka jh@suse.cz
Mon Jun 4 08:13:00 GMT 2001


Hi,
the shorten branches should be last pass. Reg-stack messes up the RTL, so it
must be last pass. This causes conflict that has bitten us several times.
Last time it hit me was in my branch prediction code for p4, that needs
insn_shuid initialized for each insn, but reg-stack introduces new
w/o those value set.

This patch should bit the bullet and do splitting before reg-stack and
call shorten_branches after fixing also the latent k6 codegen problem
where "loop" instruction can be generated with too long offset.

Mon Jun  4 17:09:49 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* toplev.c (rest_of_compilation): Run shorten_branches after regstack;
	split before regstack.
Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.460
diff -c -3 -p -r1.460 toplev.c
*** toplev.c	2001/05/20 06:26:37	1.460
--- toplev.c	2001/06/04 14:44:54
*************** rest_of_compilation (decl)
*** 3651,3668 ****
    convert_to_eh_region_ranges ();
  #endif
  
-   /* Shorten branches.
  
-      Note this must run before reg-stack because of death note (ab)use
-      in the ia32 backend.  */
-   timevar_push (TV_SHORTEN_BRANCH);
-   shorten_branches (get_insns ());
-   timevar_pop (TV_SHORTEN_BRANCH);
- 
  #ifdef STACK_REGS
    timevar_push (TV_REG_STACK);
    open_dump_file (DFI_stack, decl);
  
    reg_to_stack (insns, rtl_dump_file);
  
    close_dump_file (DFI_stack, print_rtl, insns);
--- 3651,3662 ----
    convert_to_eh_region_ranges ();
  #endif
  
  
  #ifdef STACK_REGS
    timevar_push (TV_REG_STACK);
    open_dump_file (DFI_stack, decl);
  
+   split_all_insns (0);
    reg_to_stack (insns, rtl_dump_file);
  
    close_dump_file (DFI_stack, print_rtl, insns);
*************** rest_of_compilation (decl)
*** 3672,3677 ****
--- 3666,3675 ----
  
    convert_to_eh_region_ranges ();
  #endif
+   /* Shorten branches.  */
+   timevar_push (TV_SHORTEN_BRANCH);
+   shorten_branches (get_insns ());
+   timevar_pop (TV_SHORTEN_BRANCH);
  
    current_function_nothrow = nothrow_function_p ();
    if (current_function_nothrow)



More information about the Gcc-patches mailing list