Reload inheritance patch for PRE/POST INC/DEC

Toshiyasu Morita tm@netcom.com
Mon Jan 24 17:43:00 GMT 2000


This is my proposed patch for the bug I found in message:

http://gcc.gnu.org/ml/gcc-bugs/2000-01/msg00582.html

It required an additional patch to rtlanal.c because my toolchain is
generating weird RTXes with a clobber of nil when compiling mulsi3:

(insn:HI 35 33 37 (parallel[
            (set (reg:SF 26 fr2)
                (mem/s:SF (plus:SI (reg/v:SI 8 r8)
                        (reg:SI 1 r1))))
            (use (reg/v:PSI 48 fpscr))
            (clobber (scratch:SI))
            ] ) 157 {movsf_ie} (insn_list 30 (nil))
    (expr_list:REG_DEAD (reg:SI 1 r1)
        (expr_list:REG_UNUSED (scratch:SI )
            (nil))))

Anyway, the patch is included below.

Toshi


Mon Jan 24 17:14:31 PST 2000  Toshiyasu Morita  (toshi.morita@sega.com)

	* reload1.c (choose_reload_regs): Disallow reload inheritance if
        the insns has side effects.
        * rtlanal.c (side_effects_p): Handle null rtx pointers.

*** reload1.c.bak	Mon Jan 24 13:33:55 2000
--- reload1.c	Mon Jan 24 14:51:16 2000
*************** abort();
*** 6027,6033 ****
  			      || (GET_MODE_SIZE (reload_mode[r])
  				  > GET_MODE_SIZE (mode))
  			      || ! TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[r]],
! 						      i))
  			    reload_override_in[r] = reg_last_reload_reg[regno];
  			  else
  			    {
--- 6027,6039 ----
  			      || (GET_MODE_SIZE (reload_mode[r])
  				  > GET_MODE_SIZE (mode))
  			      || ! TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[r]],
! 						      i)
!                               /* If pseudo A is a register and pseudo B is on stack,
!                                  and pseudo A is copied to pseudo B, then reload inheritance
!                                  will try to substitute pseudo A's hard reg for pseudo B.
!                                  This does not work if the insn uses pseudo B in a post-inc
!                                  addressing mode, since it modifies pseudo A instead.  */
!                               || side_effects_p (insn))
  			    reload_override_in[r] = reg_last_reload_reg[regno];
  			  else
  			    {
*** rtlanal.c.bak	Mon Jan 24 16:39:31 2000
--- rtlanal.c	Mon Jan 24 16:10:25 2000
*************** side_effects_p (x)
*** 1558,1563 ****
--- 1558,1566 ----
  {
    register RTX_CODE code;
  
+   if (!x)
+     return 0;
+ 
    code = GET_CODE (x);
    switch (code)
      {





More information about the Gcc-patches mailing list