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]

Share clobbers of hard registers...


Hi,
while thinking about what impact new i386 backend may have on compile
times, I run across idea to share clobbers of flags register.  This
change RTL sharing rules, but I don't know of anything that might break.
On combine.i it reduce amount of clobbers produced from 2700 to 111, but
overall it has relatively small impact on compile times.  It also reduce
size of insn-emit.o :)

Bootstrapped/regtested i686-pc-gnu-linux, does this look like good idea
for mainline?

2004-01-19  Jan Hubicka  <jh@suse.cz>
	* emit-rtl.c (verify_rtx_sharing, copy_insn_1,
	emit_copy_of_insn_after, emit_copy_of_insn_after): Clobbers
	containing hard regs are shared.
	(gen_hard_reg_clobber): New function.
	(hard_reg_clobbers): New array.
	* genemit.c (gen_exp): Use gen_hard_reg_clobber.
	(copy_rtx): Do not copy clobbers containing hard regs.
	* rtl.h (gen_hard_reg_clobber): Declare.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.366
diff -c -3 -p -r1.366 emit-rtl.c
*** emit-rtl.c	17 Jan 2004 22:14:17 -0000	1.366
--- emit-rtl.c	19 Jan 2004 17:37:59 -0000
*************** verify_rtx_sharing (rtx orig, rtx insn)
*** 2231,2238 ****
      case PC:
      case CC0:
      case SCRATCH:
-       /* SCRATCH must be shared because they represent distinct values.  */
        return;
  
      case CONST:
        /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
--- 2231,2242 ----
      case PC:
      case CC0:
      case SCRATCH:
        return;
+       /* SCRATCH must be shared because they represent distinct values.  */
+     case CLOBBER:
+       if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
+ 	return;
+       break;
  
      case CONST:
        /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
*************** repeat:
*** 2527,2532 ****
--- 2531,2540 ----
      case SCRATCH:
        /* SCRATCH must be shared because they represent distinct values.  */
        return;
+     case CLOBBER:
+       if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
+ 	return;
+       break;
  
      case CONST:
        /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
*************** copy_insn_1 (rtx orig)
*** 5020,5025 ****
--- 5028,5037 ----
      case CC0:
      case ADDRESSOF:
        return orig;
+     case CLOBBER:
+       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
+ 	return orig;
+       break;
  
      case SCRATCH:
        for (i = 0; i < copy_insn_n_scratches; i++)
*************** emit_copy_of_insn_after (rtx insn, rtx a
*** 5534,5539 ****
--- 5546,5562 ----
      }
    INSN_CODE (new) = INSN_CODE (insn);
    return new;
+ }
+ 
+ static GTY((deletable(""))) rtx hard_reg_clobbers [NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
+ rtx
+ gen_hard_reg_clobber (enum machine_mode mode, unsigned int regno)
+ {
+   if (hard_reg_clobbers[mode][regno])
+     return hard_reg_clobbers[mode][regno];
+   else
+     return (hard_reg_clobbers[mode][regno] =
+ 	    gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (mode, regno)));
  }
  
  #include "gt-emit-rtl.h"
Index: genemit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genemit.c,v
retrieving revision 1.86
diff -c -3 -p -r1.86 genemit.c
*** genemit.c	21 Dec 2003 14:08:33 -0000	1.86
--- genemit.c	19 Jan 2004 17:37:59 -0000
*************** gen_exp (rtx x, enum rtx_code subroutine
*** 217,222 ****
--- 217,230 ----
      case PC:
        printf ("pc_rtx");
        return;
+     case CLOBBER:
+       if (REG_P (XEXP (x, 0)))
+ 	{
+ 	  printf ("gen_hard_reg_clobber (%smode, %i)", GET_MODE_NAME (GET_MODE (XEXP (x, 0))),
+ 			  			     REGNO (XEXP (x, 0)));
+ 	  return;
+ 	}
+       break;
  
      case CC0:
        printf ("cc0_rtx");
Index: rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.c,v
retrieving revision 1.130
diff -c -3 -p -r1.130 rtl.c
*** rtl.c	22 Dec 2003 07:42:37 -0000	1.130
--- rtl.c	19 Jan 2004 17:37:59 -0000
*************** copy_rtx (rtx orig)
*** 224,229 ****
--- 224,233 ----
        /* SCRATCH must be shared because they represent distinct values.  */
      case ADDRESSOF:
        return orig;
+     case CLOBBER:
+       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
+ 	return orig;
+       break;
  
      case CONST:
        /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.449
diff -c -3 -p -r1.449 rtl.h
*** rtl.h	17 Jan 2004 22:14:17 -0000	1.449
--- rtl.h	19 Jan 2004 17:38:00 -0000
*************** extern void end_alias_analysis (void);
*** 2308,2313 ****
--- 2308,2314 ----
  extern rtx addr_side_effect_eval (rtx, int, int);
  extern bool memory_modified_in_insn_p (rtx, rtx);
  extern rtx find_base_term (rtx);
+ extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
  
  /* In sibcall.c */
  typedef enum {


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