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]

3.2 bootstrap broken on s390 (was: Re: [PATCH] Fix PR target/7784 (Sparc))


Hello,

this patch, recently committed to the 3.2 branch:

>2003-03-23  Eric Botcazou  <ebotcazou at libertysurf dot fr>
>
>        PR target/7784
>        * reload.c (find_reloads_address):  Handle
>        (PLUS (PLUS (REG) (REG)) (CONST_INT)) form for
>        all base registers.

breaks bootstrap on s390 with this ICE:

../../gcc-3_2/gcc/except.c: In function `remove_eh_handler':
../../gcc-3_2/gcc/except.c:411: could not split insn

(insn 125 417 420 (set (reg/v:DI 10 %r10 [64])
        (mem/s:DI (plus:SI (plus:SI (reg:SI 1 %r1 [67])
                    (const_int 16 [0x10]))
                (reg:SI 2 %r2)) [27 <variable>.bits S8 A64])) 52 {*movdi_31} (insn_list 417 (insn_list 121 (nil)))
    (expr_list:REG_DEAD (reg:SI 1 %r1 [67])
        (expr_list:REG_DEAD (reg:SI 2 %r2)
            (nil))))


The reason is that it exposes another bug in find_reloads_address
much earlier; this bug, which I fixed on mainline and 3.3 with

http://gcc.gnu.org/ml/gcc-patches/2003-01/msg01735.html

used to show up only in rare cases, but now breaks bootstrap :-(


I would suggest to backport my reload fix as well; with the
appended patch I can again bootstrap/regtest s390-ibm-linux
and s390x-ibm-linux. 

OK to install?



ChangeLog:

	* reload.c (maybe_memory_address_p): New function.
	(find_reloads_address): Use it instead of memory_address_p.

Index: gcc/reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.178.2.4.2.5
diff -c -p -r1.178.2.4.2.5 reload.c
*** gcc/reload.c	26 Mar 2003 07:58:44 -0000	1.178.2.4.2.5
--- gcc/reload.c	29 Mar 2003 15:33:10 -0000
*************** static int alternative_allows_memconst P
*** 257,262 ****
--- 257,263 ----
  static rtx find_reloads_toplev	PARAMS ((rtx, int, enum reload_type, int,
  					 int, rtx, int *));
  static rtx make_memloc		PARAMS ((rtx, int));
+ static int maybe_memory_address_p PARAMS ((enum machine_mode, rtx, rtx *));
  static int find_reloads_address	PARAMS ((enum machine_mode, rtx *, rtx, rtx *,
  				       int, enum reload_type, int, rtx));
  static rtx subst_reg_equivs	PARAMS ((rtx, rtx));
*************** make_memloc (ad, regno)
*** 4545,4550 ****
--- 4546,4572 ----
    return tem;
  }
  
+ /* Returns true if AD could be turned into a valid memory reference
+    to mode MODE by reloading the part pointed to by PART into a 
+    register.  */
+ 
+ static int
+ maybe_memory_address_p (mode, ad, part)
+      enum machine_mode mode;
+      rtx ad;
+      rtx *part;
+ {
+   int retv;
+   rtx tem = *part;
+   rtx reg = gen_rtx_REG (GET_MODE (tem), max_reg_num ());
+ 
+   *part = reg;
+   retv = memory_address_p (mode, ad);
+   *part = tem;
+ 
+   return retv;
+ }
+ 
  /* Record all reloads needed for handling memory address AD
     which appears in *LOC in a memory reference to mode MODE
     which itself is found in location  *MEMREFLOC.
*************** find_reloads_address (mode, memrefloc, a
*** 4842,4848 ****
  	   && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG
  	   && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER
  	   && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode)
! 	   && ! memory_address_p (mode, ad))
      {
        *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
  				plus_constant (XEXP (XEXP (ad, 0), 0),
--- 4864,4870 ----
  	   && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG
  	   && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER
  	   && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode)
! 	   && ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 1)))
      {
        *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
  				plus_constant (XEXP (XEXP (ad, 0), 0),
*************** find_reloads_address (mode, memrefloc, a
*** 4862,4868 ****
  	   && GET_CODE (XEXP (XEXP (ad, 0), 1)) == REG
  	   && REGNO (XEXP (XEXP (ad, 0), 1)) < FIRST_PSEUDO_REGISTER
  	   && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 1), mode)
! 	   && ! memory_address_p (mode, ad))
      {
        *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
  				XEXP (XEXP (ad, 0), 0),
--- 4884,4890 ----
  	   && GET_CODE (XEXP (XEXP (ad, 0), 1)) == REG
  	   && REGNO (XEXP (XEXP (ad, 0), 1)) < FIRST_PSEUDO_REGISTER
  	   && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 1), mode)
! 	   && ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 0)))
      {
        *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
  				XEXP (XEXP (ad, 0), 0),
-- 
  Dr. Ulrich Weigand
  weigand at informatik dot uni-erlangen dot de


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