[committed, take 2] Re: [RHBZ#150115, s390] reload_out* patterns emit unrecognizable insn

Ulrich Weigand uweigand@de.ibm.com
Tue Mar 15 15:52:00 GMT 2005


Hello,

unfortunately this fix:

> 	* config/s390/s390.c (s390_secondary_output_reload_class): Adapt check
> 	for non-offsettable memory references to cope with outstanding reload
> 	replacements.
> 	* config/s390/s390.md ("reload_outti"): Call find_replacement to
> 	avoid losing outstanding address reloads.
> 	("reload_outdi", "reload_outdf"): Likewise.

broke Ada bootstrap.

The problem is that at the time secondary_output_reload_class is called,
the operand may not be a valid address at all, because for parts of the
operand reloads may have been pushed.  This caused problems because
secondary reloads were omitted.

This patch hopefully provides the proper fix by non insisting on a valid
address, but simply checking the 'shape' of the RTL so as to trigger if
and only if the operand will be a valid, but non-offsettable memory
reference after all outstanding reloads have been performed.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux on
mainline and 4.0 branch; applied to both.

Bye,
Ulrich

ChangeLog:

	* config/s390/s390.c (s390_secondary_output_reload_class): Adapt check
	for non-offsettable memory references to cope with outstanding reload
	replacements, take 2.

Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.218
diff -c -p -r1.218 s390.c
*** gcc/config/s390/s390.c	9 Mar 2005 22:05:14 -0000	1.218
--- gcc/config/s390/s390.c	14 Mar 2005 20:51:58 -0000
*************** enum reg_class
*** 2553,2568 ****
  s390_secondary_output_reload_class (enum reg_class class,
  				    enum machine_mode mode, rtx out)
  {
-   struct s390_address addr;
- 
    if ((TARGET_64BIT ? mode == TImode
                      : (mode == DImode || mode == DFmode))
        && reg_classes_intersect_p (GENERAL_REGS, class)
        && GET_CODE (out) == MEM
!       && s390_decompose_address (XEXP (out, 0), &addr)
!       && addr.base && addr.indx
!       && addr.disp && GET_CODE (addr.disp) == CONST_INT
!       && !DISP_IN_RANGE (INTVAL (addr.disp) + GET_MODE_SIZE (mode) - 1))
      return ADDR_REGS;
  
    if (reg_classes_intersect_p (CC_REGS, class))
--- 2553,2567 ----
  s390_secondary_output_reload_class (enum reg_class class,
  				    enum machine_mode mode, rtx out)
  {
    if ((TARGET_64BIT ? mode == TImode
                      : (mode == DImode || mode == DFmode))
        && reg_classes_intersect_p (GENERAL_REGS, class)
        && GET_CODE (out) == MEM
!       && GET_CODE (XEXP (out, 0)) == PLUS
!       && GET_CODE (XEXP (XEXP (out, 0), 0)) == PLUS
!       && GET_CODE (XEXP (XEXP (out, 0), 1)) == CONST_INT
!       && !DISP_IN_RANGE (INTVAL (XEXP (XEXP (out, 0), 1))
! 			 + GET_MODE_SIZE (mode) - 1))
      return ADDR_REGS;
  
    if (reg_classes_intersect_p (CC_REGS, class))

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com



More information about the Gcc-patches mailing list