public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Share clobbers of hard registers...
@ 2004-01-19 20:48 Jan Hubicka
  2004-01-19 21:27 ` Richard Henderson
  2004-02-05 10:18 ` Josef Zlomek
  0 siblings, 2 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-01-19 20:48 UTC (permalink / raw)
  To: gcc-patches

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 {

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-01-19 20:48 Share clobbers of hard registers Jan Hubicka
@ 2004-01-19 21:27 ` Richard Henderson
  2004-02-05 10:18 ` Josef Zlomek
  1 sibling, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2004-01-19 21:27 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On Mon, Jan 19, 2004 at 09:48:59PM +0100, Jan Hubicka wrote:
> 	* 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.

I guess this is ok.  It does seem like it'd save some memory
if nothing else.


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-01-19 20:48 Share clobbers of hard registers Jan Hubicka
  2004-01-19 21:27 ` Richard Henderson
@ 2004-02-05 10:18 ` Josef Zlomek
  2004-02-05 10:38   ` Jan Hubicka
                     ` (2 more replies)
  1 sibling, 3 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-05 10:18 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

> 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 :)

This caused PR/13938 and probably PR/13893 too.
Reverting this patch fixes it.

The problem in PR/13938 is that clobber in 

(insn 57 17 59 1 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg/v:DF 9 st(1) [orig:59 x ] [59])))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 17 (insn_list 48 (insn_list 51 (nil))))
    (expr_list:REG_DEAD (reg/v:DF 9 st(1) [orig:59 x ] [59])
        (expr_list:REG_UNUSED (reg/v:DF 9 st(1) [orig:59 x ] [59])
            (nil))))

is shared with

(insn 89 23 90 3 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg:DF 8 st)))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 23 (insn_list 85 (insn_list 88 (nil))))
    (expr_list:REG_DEAD (reg:DF 8 st)
        (nil)))

but in the first insn there should be
(clobber (reg/v:DF 9 st(1)))
instead of
(clobber (reg:DF 9 st(1)))

Above you mention sharing clobbers only for flags register.

> 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 {

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:18 ` Josef Zlomek
@ 2004-02-05 10:38   ` Jan Hubicka
  2004-02-05 10:53     ` Josef Zlomek
  2004-02-21 13:45     ` Jan Hubicka
  2004-02-05 10:42   ` Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...) Josef Zlomek
  2004-02-21 13:45   ` Share clobbers of hard registers Josef Zlomek
  2 siblings, 2 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-05 10:38 UTC (permalink / raw)
  To: Josef Zlomek; +Cc: Jan Hubicka, gcc-patches

> > 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 :)
> 
> This caused PR/13938 and probably PR/13893 too.
> Reverting this patch fixes it.
> 
> The problem in PR/13938 is that clobber in 
> 
> (insn 57 17 59 1 (parallel [
>             (set (mem:DI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -16 [0xfffffff0])) [0 S8 A8])
>                 (fix:DI (reg/v:DF 9 st(1) [orig:59 x ] [59])))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -2 [0xfffffffe])) [0 S2 A8]))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -4 [0xfffffffc])) [0 S2 A8]))
>             (clobber (reg:DF 9 st(1)))
>         ]) 146 {fix_truncdi_memory} (insn_list 17 (insn_list 48 (insn_list 51 (nil))))
>     (expr_list:REG_DEAD (reg/v:DF 9 st(1) [orig:59 x ] [59])
>         (expr_list:REG_UNUSED (reg/v:DF 9 st(1) [orig:59 x ] [59])
>             (nil))))
> 
> is shared with
> 
> (insn 89 23 90 3 (parallel [
>             (set (mem:DI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -16 [0xfffffff0])) [0 S8 A8])
>                 (fix:DI (reg:DF 8 st)))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -2 [0xfffffffe])) [0 S2 A8]))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -4 [0xfffffffc])) [0 S2 A8]))
>             (clobber (reg:DF 9 st(1)))
>         ]) 146 {fix_truncdi_memory} (insn_list 23 (insn_list 85 (insn_list 88 (nil))))
>     (expr_list:REG_DEAD (reg:DF 8 st)
>         (nil)))
> 
> but in the first insn there should be
> (clobber (reg/v:DF 9 st(1)))
> instead of
> (clobber (reg:DF 9 st(1)))

Hmm, what it makes difference on whether it is REG/v or REG?

Honza

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...)
  2004-02-05 10:18 ` Josef Zlomek
  2004-02-05 10:38   ` Jan Hubicka
@ 2004-02-05 10:42   ` Josef Zlomek
  2004-02-05 11:34     ` Josef Zlomek
  2004-02-21 13:45     ` Josef Zlomek
  2004-02-21 13:45   ` Share clobbers of hard registers Josef Zlomek
  2 siblings, 2 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-05 10:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

This patch fixes PR/13938 and PR/13893.

The problem is that clobber in 

(insn 57 17 59 1 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg/v:DF 9 st(1) [orig:59 x ] [59])))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 17 (insn_list 48 (insn_list 51 (nil))))
    (expr_list:REG_DEAD (reg/v:DF 9 st(1) [orig:59 x ] [59])
        (expr_list:REG_UNUSED (reg/v:DF 9 st(1) [orig:59 x ] [59])
            (nil))))

is shared with

(insn 89 23 90 3 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg:DF 8 st)))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 23 (insn_list 85 (insn_list 88 (nil))))
    (expr_list:REG_DEAD (reg:DF 8 st)
        (nil)))

but in the first insn there should be
(clobber (reg/v:DF 9 st(1)))
instead of
(clobber (reg:DF 9 st(1)))

This patch makes GCC to share only flag registers.

OK if it passes bootstrapping/regtesting?

Josef

2004-02-05  Josef Zlomek  <zlomekj@suse.cz>

	* emit-rtl.c (verify_rtx_sharing): Share only flag registers
	in clobber.
	(copy_rtx_if_shared_1): Likewise.
	(copy_insn_1): Likewise.
	(gen_hard_reg_clobber): Likewise.
	* rtl.c (copy_rtx): Likewise.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/emit-rtl.c,v
retrieving revision 1.375
diff -c -p -c -3 -p -r1.375 emit-rtl.c
*** emit-rtl.c	4 Feb 2004 06:12:50 -0000	1.375
--- emit-rtl.c	5 Feb 2004 10:29:54 -0000
*************** verify_rtx_sharing (rtx orig, rtx insn)
*** 2154,2160 ****
        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;
  
--- 2154,2161 ----
        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
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
  	return;
        break;
  
*************** repeat:
*** 2452,2458 ****
        /* 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;
  
--- 2453,2460 ----
        /* 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
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
  	return;
        break;
  
*************** copy_insn_1 (rtx orig)
*** 4949,4955 ****
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
  	return orig;
        break;
  
--- 4951,4959 ----
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0))
! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
  	return orig;
        break;
  
*************** static GTY((deletable(""))) rtx hard_reg
*** 5472,5478 ****
  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] =
--- 5476,5482 ----
  rtx
  gen_hard_reg_clobber (enum machine_mode mode, unsigned int regno)
  {
!   if (GET_MODE_CLASS (mode) == MODE_CC && hard_reg_clobbers[mode][regno])
      return hard_reg_clobbers[mode][regno];
    else
      return (hard_reg_clobbers[mode][regno] =
Index: rtl.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/rtl.c,v
retrieving revision 1.132
diff -c -p -c -3 -p -r1.132 rtl.c
*** rtl.c	21 Jan 2004 20:40:04 -0000	1.132
--- rtl.c	5 Feb 2004 10:30:48 -0000
*************** copy_rtx (rtx orig)
*** 225,231 ****
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
  	return orig;
        break;
  
--- 225,233 ----
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0))
! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
  	return orig;
        break;
  

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:38   ` Jan Hubicka
@ 2004-02-05 10:53     ` Josef Zlomek
  2004-02-05 10:56       ` Josef Zlomek
  2004-02-21 13:45       ` Josef Zlomek
  2004-02-21 13:45     ` Jan Hubicka
  1 sibling, 2 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-05 10:53 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, gcc-patches

> Hmm, what it makes difference on whether it is REG/v or REG?

Clobber is shared thus it is  different to REG_UNUSED note,
thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.

Josef

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:53     ` Josef Zlomek
@ 2004-02-05 10:56       ` Josef Zlomek
  2004-02-05 11:13         ` Jan Hubicka
                           ` (2 more replies)
  2004-02-21 13:45       ` Josef Zlomek
  1 sibling, 3 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-05 10:56 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, gcc-patches

> > Hmm, what it makes difference on whether it is REG/v or REG?
> 
> Clobber is shared thus it is  different to REG_UNUSED note,
> thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.

Maybe better fix would be write something like find_reg_notes but more
intelligent...

Josef

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:56       ` Josef Zlomek
@ 2004-02-05 11:13         ` Jan Hubicka
  2004-02-05 11:26           ` Jan Hubicka
  2004-02-21 13:45           ` Jan Hubicka
  2004-02-05 14:22         ` Roger Sayle
  2004-02-21 13:45         ` Josef Zlomek
  2 siblings, 2 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-05 11:13 UTC (permalink / raw)
  To: Josef Zlomek; +Cc: Jan Hubicka, Jan Hubicka, gcc-patches

> > > Hmm, what it makes difference on whether it is REG/v or REG?
> > 
> > Clobber is shared thus it is  different to REG_UNUSED note,
> > thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.
> 
> Maybe better fix would be write something like find_reg_notes but more
> intelligent...

This is interesting too, I wonder how the REG_UNUSED note can happen to
use different pseudo.  I am trying to look into it now.

Honza
> 
> Josef

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 11:13         ` Jan Hubicka
@ 2004-02-05 11:26           ` Jan Hubicka
  2004-02-06  8:56             ` Jim Wilson
  2004-02-21 13:45             ` Jan Hubicka
  2004-02-21 13:45           ` Jan Hubicka
  1 sibling, 2 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-05 11:26 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Josef Zlomek, Jan Hubicka, gcc-patches

> > > > Hmm, what it makes difference on whether it is REG/v or REG?
> > > 
> > > Clobber is shared thus it is  different to REG_UNUSED note,
> > > thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.
> > 
> > Maybe better fix would be write something like find_reg_notes but more
> > intelligent...
> 
> This is interesting too, I wonder how the REG_UNUSED note can happen to
> use different pseudo.  I am trying to look into it now.
Hi,
it looks like reg-stack is only place that is missdesigned enough to
modify internals of clobbers of hard registers.  This patch seems to fix
it, I am running full testing now.

2004-02-05  Jan Hubicka  <jh@suse.cz>
	* reg-stack.c (subst_stack_regs): Unshare clobbers before substitution.
Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v
retrieving revision 1.142
diff -c -3 -p -r1.142 reg-stack.c
*** reg-stack.c	2 Feb 2004 00:17:17 -0000	1.142
--- reg-stack.c	5 Feb 2004 11:24:56 -0000
*************** subst_stack_regs (rtx insn, stack regsta
*** 2236,2244 ****
  	for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
  	  {
  	    if (stack_regs_mentioned_p (XVECEXP (PATTERN (insn), 0, i)))
! 	      control_flow_insn_deleted
! 		|= subst_stack_regs_pat (insn, regstack,
! 					 XVECEXP (PATTERN (insn), 0, i));
  	  }
        else
  	control_flow_insn_deleted
--- 2236,2249 ----
  	for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
  	  {
  	    if (stack_regs_mentioned_p (XVECEXP (PATTERN (insn), 0, i)))
! 	      {
! 	        if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == CLOBBER)
! 	           XVECEXP (PATTERN (insn), 0, i)
! 		     = shallow_copy_rtx (XVECEXP (PATTERN (insn), 0, i));
! 		control_flow_insn_deleted
! 		  |= subst_stack_regs_pat (insn, regstack,
! 					   XVECEXP (PATTERN (insn), 0, i));
! 	      }
  	  }
        else
  	control_flow_insn_deleted

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...)
  2004-02-05 10:42   ` Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...) Josef Zlomek
@ 2004-02-05 11:34     ` Josef Zlomek
  2004-02-21 13:45       ` Josef Zlomek
  2004-02-21 13:45     ` Josef Zlomek
  1 sibling, 1 reply; 24+ messages in thread
From: Josef Zlomek @ 2004-02-05 11:34 UTC (permalink / raw)
  To: gcc-patches

> 2004-02-05  Josef Zlomek  <zlomekj@suse.cz>
> 
> 	* emit-rtl.c (verify_rtx_sharing): Share only flag registers
> 	in clobber.
> 	(copy_rtx_if_shared_1): Likewise.
> 	(copy_insn_1): Likewise.
> 	(gen_hard_reg_clobber): Likewise.
> 	* rtl.c (copy_rtx): Likewise.

Honza submitted a patch which fixes the PRs by fixing a bug in
reg-stack.c (http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00403.html)

Josef

> Index: emit-rtl.c
> ===================================================================
> RCS file: /cvs/gcc-cvs/gcc/gcc/emit-rtl.c,v
> retrieving revision 1.375
> diff -c -p -c -3 -p -r1.375 emit-rtl.c
> *** emit-rtl.c	4 Feb 2004 06:12:50 -0000	1.375
> --- emit-rtl.c	5 Feb 2004 10:29:54 -0000
> *************** verify_rtx_sharing (rtx orig, rtx insn)
> *** 2154,2160 ****
>         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;
>   
> --- 2154,2161 ----
>         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
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
>   	return;
>         break;
>   
> *************** repeat:
> *** 2452,2458 ****
>         /* 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;
>   
> --- 2453,2460 ----
>         /* 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
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
>   	return;
>         break;
>   
> *************** copy_insn_1 (rtx orig)
> *** 4949,4955 ****
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
>   	return orig;
>         break;
>   
> --- 4951,4959 ----
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0))
> ! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
>   	return orig;
>         break;
>   
> *************** static GTY((deletable(""))) rtx hard_reg
> *** 5472,5478 ****
>   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] =
> --- 5476,5482 ----
>   rtx
>   gen_hard_reg_clobber (enum machine_mode mode, unsigned int regno)
>   {
> !   if (GET_MODE_CLASS (mode) == MODE_CC && hard_reg_clobbers[mode][regno])
>       return hard_reg_clobbers[mode][regno];
>     else
>       return (hard_reg_clobbers[mode][regno] =
> Index: rtl.c
> ===================================================================
> RCS file: /cvs/gcc-cvs/gcc/gcc/rtl.c,v
> retrieving revision 1.132
> diff -c -p -c -3 -p -r1.132 rtl.c
> *** rtl.c	21 Jan 2004 20:40:04 -0000	1.132
> --- rtl.c	5 Feb 2004 10:30:48 -0000
> *************** copy_rtx (rtx orig)
> *** 225,231 ****
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
>   	return orig;
>         break;
>   
> --- 225,233 ----
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0))
> ! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
>   	return orig;
>         break;
>   

-- 
      Josef Zlomek
      zlomek@users.sf.net
      josef.zlomek@email.cz
      zlomj9am@artax.karlin.mff.cuni.cz
      http://zlomek.matfyz.cz/
      http://artax.karlin.mff.cuni.cz/~zlomj9am/
      ICQ: 152422432
      GPG fingerprint: 74E6 31D3 56D7 91FD 5A06  6BD5 96FF 99C4 25C0 EC0B

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:56       ` Josef Zlomek
  2004-02-05 11:13         ` Jan Hubicka
@ 2004-02-05 14:22         ` Roger Sayle
  2004-02-21 13:45           ` Roger Sayle
  2004-02-21 13:45         ` Josef Zlomek
  2 siblings, 1 reply; 24+ messages in thread
From: Roger Sayle @ 2004-02-05 14:22 UTC (permalink / raw)
  To: Josef Zlomek; +Cc: Jan Hubicka, gcc-patches


On Thu, 5 Feb 2004, Josef Zlomek wrote:
> > Clobber is shared thus it is  different to REG_UNUSED note,
> > thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.
>
> Maybe better fix would be write something like find_reg_notes but more
> intelligent...

Hi Josef and Jan,

I realise that there are several different patches for this problem
being circulated.  You may be interested in my proposed solution at
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00019.html

This is a variant of the more intelligent find_reg_notes idea, but
without any performance penalty.

Roger
--

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 11:26           ` Jan Hubicka
@ 2004-02-06  8:56             ` Jim Wilson
  2004-02-06  9:02               ` Jan Hubicka
  2004-02-21 13:45               ` Jim Wilson
  2004-02-21 13:45             ` Jan Hubicka
  1 sibling, 2 replies; 24+ messages in thread
From: Jim Wilson @ 2004-02-06  8:56 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Josef Zlomek, Jan Hubicka, gcc-patches

Jan Hubicka wrote:
> 	* reg-stack.c (subst_stack_regs): Unshare clobbers before substitution.

OK.

I see that copy_rtx_if_shared_1 in emit-rtl.c handles clobbers of a hard 
reg specially, it allows them to be shared.  Thus if reg-stack wants to 
modify a clobber of a hard-reg, it must unshare it first.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-06  8:56             ` Jim Wilson
@ 2004-02-06  9:02               ` Jan Hubicka
  2004-02-21 13:45                 ` Jan Hubicka
  2004-02-21 13:45               ` Jim Wilson
  1 sibling, 1 reply; 24+ messages in thread
From: Jan Hubicka @ 2004-02-06  9:02 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Jan Hubicka, Josef Zlomek, Jan Hubicka, gcc-patches

> Jan Hubicka wrote:
> >	* reg-stack.c (subst_stack_regs): Unshare clobbers before 
> >	substitution.
> 
> OK.
> 
> I see that copy_rtx_if_shared_1 in emit-rtl.c handles clobbers of a hard 
> reg specially, it allows them to be shared.  Thus if reg-stack wants to 
> modify a clobber of a hard-reg, it must unshare it first.

Yes, I've changed that recently to save memory usage of
(clobber flag_reg) expression present in about every i386 instruction in
hope that no one needs to change the hard register for another.
Reg-stack is hopefully the only exception.

Thanks
Honza
PS: Richard, if you changed mind about safety of the change, let me
know and I can revert the whole patch.  I will also make update to
sharing rules chaper of manual.
> -- 
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:38   ` Jan Hubicka
  2004-02-05 10:53     ` Josef Zlomek
@ 2004-02-21 13:45     ` Jan Hubicka
  1 sibling, 0 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Josef Zlomek; +Cc: Jan Hubicka, gcc-patches

> > 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 :)
> 
> This caused PR/13938 and probably PR/13893 too.
> Reverting this patch fixes it.
> 
> The problem in PR/13938 is that clobber in 
> 
> (insn 57 17 59 1 (parallel [
>             (set (mem:DI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -16 [0xfffffff0])) [0 S8 A8])
>                 (fix:DI (reg/v:DF 9 st(1) [orig:59 x ] [59])))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -2 [0xfffffffe])) [0 S2 A8]))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -4 [0xfffffffc])) [0 S2 A8]))
>             (clobber (reg:DF 9 st(1)))
>         ]) 146 {fix_truncdi_memory} (insn_list 17 (insn_list 48 (insn_list 51 (nil))))
>     (expr_list:REG_DEAD (reg/v:DF 9 st(1) [orig:59 x ] [59])
>         (expr_list:REG_UNUSED (reg/v:DF 9 st(1) [orig:59 x ] [59])
>             (nil))))
> 
> is shared with
> 
> (insn 89 23 90 3 (parallel [
>             (set (mem:DI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -16 [0xfffffff0])) [0 S8 A8])
>                 (fix:DI (reg:DF 8 st)))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -2 [0xfffffffe])) [0 S2 A8]))
>             (use (mem:HI (plus:SI (reg/f:SI 6 bp)
>                         (const_int -4 [0xfffffffc])) [0 S2 A8]))
>             (clobber (reg:DF 9 st(1)))
>         ]) 146 {fix_truncdi_memory} (insn_list 23 (insn_list 85 (insn_list 88 (nil))))
>     (expr_list:REG_DEAD (reg:DF 8 st)
>         (nil)))
> 
> but in the first insn there should be
> (clobber (reg/v:DF 9 st(1)))
> instead of
> (clobber (reg:DF 9 st(1)))

Hmm, what it makes difference on whether it is REG/v or REG?

Honza

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...)
  2004-02-05 11:34     ` Josef Zlomek
@ 2004-02-21 13:45       ` Josef Zlomek
  0 siblings, 0 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-21 13:45 UTC (permalink / raw)
  To: gcc-patches

> 2004-02-05  Josef Zlomek  <zlomekj@suse.cz>
> 
> 	* emit-rtl.c (verify_rtx_sharing): Share only flag registers
> 	in clobber.
> 	(copy_rtx_if_shared_1): Likewise.
> 	(copy_insn_1): Likewise.
> 	(gen_hard_reg_clobber): Likewise.
> 	* rtl.c (copy_rtx): Likewise.

Honza submitted a patch which fixes the PRs by fixing a bug in
reg-stack.c (http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00403.html)

Josef

> Index: emit-rtl.c
> ===================================================================
> RCS file: /cvs/gcc-cvs/gcc/gcc/emit-rtl.c,v
> retrieving revision 1.375
> diff -c -p -c -3 -p -r1.375 emit-rtl.c
> *** emit-rtl.c	4 Feb 2004 06:12:50 -0000	1.375
> --- emit-rtl.c	5 Feb 2004 10:29:54 -0000
> *************** verify_rtx_sharing (rtx orig, rtx insn)
> *** 2154,2160 ****
>         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;
>   
> --- 2154,2161 ----
>         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
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
>   	return;
>         break;
>   
> *************** repeat:
> *** 2452,2458 ****
>         /* 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;
>   
> --- 2453,2460 ----
>         /* 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
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
>   	return;
>         break;
>   
> *************** copy_insn_1 (rtx orig)
> *** 4949,4955 ****
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
>   	return orig;
>         break;
>   
> --- 4951,4959 ----
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0))
> ! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
>   	return orig;
>         break;
>   
> *************** static GTY((deletable(""))) rtx hard_reg
> *** 5472,5478 ****
>   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] =
> --- 5476,5482 ----
>   rtx
>   gen_hard_reg_clobber (enum machine_mode mode, unsigned int regno)
>   {
> !   if (GET_MODE_CLASS (mode) == MODE_CC && hard_reg_clobbers[mode][regno])
>       return hard_reg_clobbers[mode][regno];
>     else
>       return (hard_reg_clobbers[mode][regno] =
> Index: rtl.c
> ===================================================================
> RCS file: /cvs/gcc-cvs/gcc/gcc/rtl.c,v
> retrieving revision 1.132
> diff -c -p -c -3 -p -r1.132 rtl.c
> *** rtl.c	21 Jan 2004 20:40:04 -0000	1.132
> --- rtl.c	5 Feb 2004 10:30:48 -0000
> *************** copy_rtx (rtx orig)
> *** 225,231 ****
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
>   	return orig;
>         break;
>   
> --- 225,233 ----
>       case ADDRESSOF:
>         return orig;
>       case CLOBBER:
> !       if (REG_P (XEXP (orig, 0))
> ! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
> ! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
>   	return orig;
>         break;
>   

-- 
      Josef Zlomek
      zlomek@users.sf.net
      josef.zlomek@email.cz
      zlomj9am@artax.karlin.mff.cuni.cz
      http://zlomek.matfyz.cz/
      http://artax.karlin.mff.cuni.cz/~zlomj9am/
      ICQ: 152422432
      GPG fingerprint: 74E6 31D3 56D7 91FD 5A06  6BD5 96FF 99C4 25C0 EC0B

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 11:26           ` Jan Hubicka
  2004-02-06  8:56             ` Jim Wilson
@ 2004-02-21 13:45             ` Jan Hubicka
  1 sibling, 0 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Josef Zlomek, Jan Hubicka, gcc-patches

> > > > Hmm, what it makes difference on whether it is REG/v or REG?
> > > 
> > > Clobber is shared thus it is  different to REG_UNUSED note,
> > > thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.
> > 
> > Maybe better fix would be write something like find_reg_notes but more
> > intelligent...
> 
> This is interesting too, I wonder how the REG_UNUSED note can happen to
> use different pseudo.  I am trying to look into it now.
Hi,
it looks like reg-stack is only place that is missdesigned enough to
modify internals of clobbers of hard registers.  This patch seems to fix
it, I am running full testing now.

2004-02-05  Jan Hubicka  <jh@suse.cz>
	* reg-stack.c (subst_stack_regs): Unshare clobbers before substitution.
Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v
retrieving revision 1.142
diff -c -3 -p -r1.142 reg-stack.c
*** reg-stack.c	2 Feb 2004 00:17:17 -0000	1.142
--- reg-stack.c	5 Feb 2004 11:24:56 -0000
*************** subst_stack_regs (rtx insn, stack regsta
*** 2236,2244 ****
  	for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
  	  {
  	    if (stack_regs_mentioned_p (XVECEXP (PATTERN (insn), 0, i)))
! 	      control_flow_insn_deleted
! 		|= subst_stack_regs_pat (insn, regstack,
! 					 XVECEXP (PATTERN (insn), 0, i));
  	  }
        else
  	control_flow_insn_deleted
--- 2236,2249 ----
  	for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
  	  {
  	    if (stack_regs_mentioned_p (XVECEXP (PATTERN (insn), 0, i)))
! 	      {
! 	        if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == CLOBBER)
! 	           XVECEXP (PATTERN (insn), 0, i)
! 		     = shallow_copy_rtx (XVECEXP (PATTERN (insn), 0, i));
! 		control_flow_insn_deleted
! 		  |= subst_stack_regs_pat (insn, regstack,
! 					   XVECEXP (PATTERN (insn), 0, i));
! 	      }
  	  }
        else
  	control_flow_insn_deleted

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 11:13         ` Jan Hubicka
  2004-02-05 11:26           ` Jan Hubicka
@ 2004-02-21 13:45           ` Jan Hubicka
  1 sibling, 0 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Josef Zlomek; +Cc: Jan Hubicka, Jan Hubicka, gcc-patches

> > > Hmm, what it makes difference on whether it is REG/v or REG?
> > 
> > Clobber is shared thus it is  different to REG_UNUSED note,
> > thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.
> 
> Maybe better fix would be write something like find_reg_notes but more
> intelligent...

This is interesting too, I wonder how the REG_UNUSED note can happen to
use different pseudo.  I am trying to look into it now.

Honza
> 
> Josef

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:56       ` Josef Zlomek
  2004-02-05 11:13         ` Jan Hubicka
  2004-02-05 14:22         ` Roger Sayle
@ 2004-02-21 13:45         ` Josef Zlomek
  2 siblings, 0 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, gcc-patches

> > Hmm, what it makes difference on whether it is REG/v or REG?
> 
> Clobber is shared thus it is  different to REG_UNUSED note,
> thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.

Maybe better fix would be write something like find_reg_notes but more
intelligent...

Josef

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:18 ` Josef Zlomek
  2004-02-05 10:38   ` Jan Hubicka
  2004-02-05 10:42   ` Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...) Josef Zlomek
@ 2004-02-21 13:45   ` Josef Zlomek
  2 siblings, 0 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

> 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 :)

This caused PR/13938 and probably PR/13893 too.
Reverting this patch fixes it.

The problem in PR/13938 is that clobber in 

(insn 57 17 59 1 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg/v:DF 9 st(1) [orig:59 x ] [59])))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 17 (insn_list 48 (insn_list 51 (nil))))
    (expr_list:REG_DEAD (reg/v:DF 9 st(1) [orig:59 x ] [59])
        (expr_list:REG_UNUSED (reg/v:DF 9 st(1) [orig:59 x ] [59])
            (nil))))

is shared with

(insn 89 23 90 3 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg:DF 8 st)))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 23 (insn_list 85 (insn_list 88 (nil))))
    (expr_list:REG_DEAD (reg:DF 8 st)
        (nil)))

but in the first insn there should be
(clobber (reg/v:DF 9 st(1)))
instead of
(clobber (reg:DF 9 st(1)))

Above you mention sharing clobbers only for flags register.

> 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 {

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...)
  2004-02-05 10:42   ` Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...) Josef Zlomek
  2004-02-05 11:34     ` Josef Zlomek
@ 2004-02-21 13:45     ` Josef Zlomek
  1 sibling, 0 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-21 13:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

This patch fixes PR/13938 and PR/13893.

The problem is that clobber in 

(insn 57 17 59 1 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg/v:DF 9 st(1) [orig:59 x ] [59])))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 17 (insn_list 48 (insn_list 51 (nil))))
    (expr_list:REG_DEAD (reg/v:DF 9 st(1) [orig:59 x ] [59])
        (expr_list:REG_UNUSED (reg/v:DF 9 st(1) [orig:59 x ] [59])
            (nil))))

is shared with

(insn 89 23 90 3 (parallel [
            (set (mem:DI (plus:SI (reg/f:SI 6 bp)
                        (const_int -16 [0xfffffff0])) [0 S8 A8])
                (fix:DI (reg:DF 8 st)))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -2 [0xfffffffe])) [0 S2 A8]))
            (use (mem:HI (plus:SI (reg/f:SI 6 bp)
                        (const_int -4 [0xfffffffc])) [0 S2 A8]))
            (clobber (reg:DF 9 st(1)))
        ]) 146 {fix_truncdi_memory} (insn_list 23 (insn_list 85 (insn_list 88 (nil))))
    (expr_list:REG_DEAD (reg:DF 8 st)
        (nil)))

but in the first insn there should be
(clobber (reg/v:DF 9 st(1)))
instead of
(clobber (reg:DF 9 st(1)))

This patch makes GCC to share only flag registers.

OK if it passes bootstrapping/regtesting?

Josef

2004-02-05  Josef Zlomek  <zlomekj@suse.cz>

	* emit-rtl.c (verify_rtx_sharing): Share only flag registers
	in clobber.
	(copy_rtx_if_shared_1): Likewise.
	(copy_insn_1): Likewise.
	(gen_hard_reg_clobber): Likewise.
	* rtl.c (copy_rtx): Likewise.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/emit-rtl.c,v
retrieving revision 1.375
diff -c -p -c -3 -p -r1.375 emit-rtl.c
*** emit-rtl.c	4 Feb 2004 06:12:50 -0000	1.375
--- emit-rtl.c	5 Feb 2004 10:29:54 -0000
*************** verify_rtx_sharing (rtx orig, rtx insn)
*** 2154,2160 ****
        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;
  
--- 2154,2161 ----
        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
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
  	return;
        break;
  
*************** repeat:
*** 2452,2458 ****
        /* 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;
  
--- 2453,2460 ----
        /* 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
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_CC)
  	return;
        break;
  
*************** copy_insn_1 (rtx orig)
*** 4949,4955 ****
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
  	return orig;
        break;
  
--- 4951,4959 ----
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0))
! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
  	return orig;
        break;
  
*************** static GTY((deletable(""))) rtx hard_reg
*** 5472,5478 ****
  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] =
--- 5476,5482 ----
  rtx
  gen_hard_reg_clobber (enum machine_mode mode, unsigned int regno)
  {
!   if (GET_MODE_CLASS (mode) == MODE_CC && hard_reg_clobbers[mode][regno])
      return hard_reg_clobbers[mode][regno];
    else
      return (hard_reg_clobbers[mode][regno] =
Index: rtl.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/rtl.c,v
retrieving revision 1.132
diff -c -p -c -3 -p -r1.132 rtl.c
*** rtl.c	21 Jan 2004 20:40:04 -0000	1.132
--- rtl.c	5 Feb 2004 10:30:48 -0000
*************** copy_rtx (rtx orig)
*** 225,231 ****
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
  	return orig;
        break;
  
--- 225,233 ----
      case ADDRESSOF:
        return orig;
      case CLOBBER:
!       if (REG_P (XEXP (orig, 0))
! 	  && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
! 	  && GET_MODE_CLASS (GET_MODE (XEXP (orig, 0))) == MODE_CC)
  	return orig;
        break;
  

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 10:53     ` Josef Zlomek
  2004-02-05 10:56       ` Josef Zlomek
@ 2004-02-21 13:45       ` Josef Zlomek
  1 sibling, 0 replies; 24+ messages in thread
From: Josef Zlomek @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, gcc-patches

> Hmm, what it makes difference on whether it is REG/v or REG?

Clobber is shared thus it is  different to REG_UNUSED note,
thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.

Josef

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-06  8:56             ` Jim Wilson
  2004-02-06  9:02               ` Jan Hubicka
@ 2004-02-21 13:45               ` Jim Wilson
  1 sibling, 0 replies; 24+ messages in thread
From: Jim Wilson @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Josef Zlomek, Jan Hubicka, gcc-patches

Jan Hubicka wrote:
> 	* reg-stack.c (subst_stack_regs): Unshare clobbers before substitution.

OK.

I see that copy_rtx_if_shared_1 in emit-rtl.c handles clobbers of a hard 
reg specially, it allows them to be shared.  Thus if reg-stack wants to 
modify a clobber of a hard-reg, it must unshare it first.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-05 14:22         ` Roger Sayle
@ 2004-02-21 13:45           ` Roger Sayle
  0 siblings, 0 replies; 24+ messages in thread
From: Roger Sayle @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Josef Zlomek; +Cc: Jan Hubicka, gcc-patches


On Thu, 5 Feb 2004, Josef Zlomek wrote:
> > Clobber is shared thus it is  different to REG_UNUSED note,
> > thus find_reg_note on reg-stack.c:1413 and 1428 does not find a note.
>
> Maybe better fix would be write something like find_reg_notes but more
> intelligent...

Hi Josef and Jan,

I realise that there are several different patches for this problem
being circulated.  You may be interested in my proposed solution at
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00019.html

This is a variant of the more intelligent find_reg_notes idea, but
without any performance penalty.

Roger
--

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Share clobbers of hard registers...
  2004-02-06  9:02               ` Jan Hubicka
@ 2004-02-21 13:45                 ` Jan Hubicka
  0 siblings, 0 replies; 24+ messages in thread
From: Jan Hubicka @ 2004-02-21 13:45 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Jan Hubicka, Josef Zlomek, Jan Hubicka, gcc-patches

> Jan Hubicka wrote:
> >	* reg-stack.c (subst_stack_regs): Unshare clobbers before 
> >	substitution.
> 
> OK.
> 
> I see that copy_rtx_if_shared_1 in emit-rtl.c handles clobbers of a hard 
> reg specially, it allows them to be shared.  Thus if reg-stack wants to 
> modify a clobber of a hard-reg, it must unshare it first.

Yes, I've changed that recently to save memory usage of
(clobber flag_reg) expression present in about every i386 instruction in
hope that no one needs to change the hard register for another.
Reg-stack is hopefully the only exception.

Thanks
Honza
PS: Richard, if you changed mind about safety of the change, let me
know and I can revert the whole patch.  I will also make update to
sharing rules chaper of manual.
> -- 
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2004-02-06  9:02 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-19 20:48 Share clobbers of hard registers Jan Hubicka
2004-01-19 21:27 ` Richard Henderson
2004-02-05 10:18 ` Josef Zlomek
2004-02-05 10:38   ` Jan Hubicka
2004-02-05 10:53     ` Josef Zlomek
2004-02-05 10:56       ` Josef Zlomek
2004-02-05 11:13         ` Jan Hubicka
2004-02-05 11:26           ` Jan Hubicka
2004-02-06  8:56             ` Jim Wilson
2004-02-06  9:02               ` Jan Hubicka
2004-02-21 13:45                 ` Jan Hubicka
2004-02-21 13:45               ` Jim Wilson
2004-02-21 13:45             ` Jan Hubicka
2004-02-21 13:45           ` Jan Hubicka
2004-02-05 14:22         ` Roger Sayle
2004-02-21 13:45           ` Roger Sayle
2004-02-21 13:45         ` Josef Zlomek
2004-02-21 13:45       ` Josef Zlomek
2004-02-21 13:45     ` Jan Hubicka
2004-02-05 10:42   ` Fix PR/13938 and PR/13893 (Was: Share clobbers of hard registers...) Josef Zlomek
2004-02-05 11:34     ` Josef Zlomek
2004-02-21 13:45       ` Josef Zlomek
2004-02-21 13:45     ` Josef Zlomek
2004-02-21 13:45   ` Share clobbers of hard registers Josef Zlomek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).