[FR30] PR16641: Check FRAME_POINTER_REGNUM not frame_pointer_rtx

Roger Sayle roger@eyesopen.com
Sun Apr 16 15:12:00 GMT 2006


This is the first in a series of patches to resolve some problems
in the FR30 backend.  I started investigating a middle-end regression
and the rabbit hole just kept getting deeper and deeper.

The following patch resolves PR target/16641.  The problem is that
fr30's GO_IF_LEGITIMATE_ADDRESS incorrectly using a pointer comparison
against stack_pointer_rtx and frame_pointer_rtx to identify the
stack pointer and frame pointer registers respectively.  This currently
runs foul of regrename/reload.  The solution is to instead check that
the RTX is a REG and its REGNO is either STACK_POINTER_REGNUM or
FRAME_POINTER_REGNUM respectively.

The following patch has been tested by building a cross compiler to
fr30-elf, which manages to build libgcc with the current series of
patches, but fails with various ICEs without.

Ok for mainline?



2006-04-16  Roger Sayle  <roger@eyesopen.com>

	PR target/16641
	* config/fr30/fr30.h (GO_IF_LEGITIMATE_ADDRESS): Check REGNO for
	STACK_POINTER_RTX and FRAME_POINTER_RTX instead of comparing the
	rtx to stack_pointer_rtx or frame_pointer_rtx directly.


Index: fr30.h
===================================================================
*** fr30.h	(revision 112972)
--- fr30.h	(working copy)
*************** do										\
*** 842,854 ****
          goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && XEXP (X, 0) == stack_pointer_rtx				\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))		\
  	goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && XEXP (X, 0) == frame_pointer_rtx				\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4))	\
          goto LABEL;							\
--- 842,856 ----
          goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && GET_CODE (XEXP (X, 0)) == REG				\
!           && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM		\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))		\
  	goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && GET_CODE (XEXP (X, 0)) == REG				\
!           && REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM		\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4))	\
          goto LABEL;							\
*************** do										\
*** 862,876 ****
          goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && XEXP (X, 0) == stack_pointer_rtx				\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))		\
  	goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && GET_CODE (XEXP (X, 0)) == REG \
!           && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \
!            || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM) \
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4))	\
          goto LABEL;							\
--- 864,879 ----
          goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && GET_CODE (XEXP (X, 0)) == REG				\
!           && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM		\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))		\
  	goto LABEL;							\
        if (GET_CODE (X) == PLUS						\
  	  && ((MODE) == SImode || (MODE) == SFmode)			\
! 	  && GET_CODE (XEXP (X, 0)) == REG				\
!           && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM		\
! 	      || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM)		\
  	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
  	  && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4))	\
          goto LABEL;							\


Roger
--



More information about the Gcc-patches mailing list