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]

IA-64 fix for bad post-modify addresses


Under the right circumstances, gcc could generate an instruction like
	ld1 r40, [r41], f2
which is not valid, because post-modify increment values have to be a general
register.  The problem is that we forgot to check for this in the macro
LEGITIMATE_ADDRESS_DISP.  post-modify registers are treated like index
registers, so we need to define all of macros related to index registers
so that reload will then handle this correctly.

2000-09-25  Jim Wilson  <wilson@cygnus.com>

	* config/ia64/ia64.h (INDEX_REG_CLASS): Define to GENERAL_REGS.
	(REGNO_OK_FOR_INDEX_P): Define to REGNO_OK_FOR_BASE_P.
	(LEGITIMATE_ADDRESS_DISP): Use LEGITIMATE_ADDRESS_REG.
	(REG_OK_FOR_INDEX): Define to REG_OK_FOR_BASE_P.

Index: ia64.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64.h,v
retrieving revision 1.48
diff -p -r1.48 ia64.h
*** ia64.h	2000/09/25 13:03:20	1.48
--- ia64.h	2000/09/26 00:33:04
*************** enum reg_class
*** 978,985 ****
  /* A macro whose definition is the name of the class to which a valid index
     register must belong.  An index register is one used in an address where its
     value is either multiplied by a scale factor or added to another register
!    (as well as added to a displacement).  */
! #define INDEX_REG_CLASS NO_REGS
  
  /* A C expression which defines the machine-dependent operand constraint
     letters for register classes.  If CHAR is such a letter, the value should be
--- 978,985 ----
  /* A macro whose definition is the name of the class to which a valid index
     register must belong.  An index register is one used in an address where its
     value is either multiplied by a scale factor or added to another register
!    (as well as added to a displacement).  This is needed for POST_MODIFY.  */
! #define INDEX_REG_CLASS GENERAL_REGS
  
  /* A C expression which defines the machine-dependent operand constraint
     letters for register classes.  If CHAR is such a letter, the value should be
*************** enum reg_class
*** 1004,1011 ****
  
  /* A C expression which is nonzero if register number NUM is suitable for use
     as an index register in operand addresses.  It may be either a suitable hard
!    register or a pseudo register that has been allocated such a hard reg.  */
! #define REGNO_OK_FOR_INDEX_P(NUM) 0
  
  /* A C expression that places additional restrictions on the register class to
     use when it is necessary to copy value X into a register in class CLASS.
--- 1004,1012 ----
  
  /* A C expression which is nonzero if register number NUM is suitable for use
     as an index register in operand addresses.  It may be either a suitable hard
!    register or a pseudo register that has been allocated such a hard reg.
!    This is needed for POST_MODIFY.  */
! #define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM)
  
  /* A C expression that places additional restrictions on the register class to
     use when it is necessary to copy value X into a register in class CLASS.
*************** do {									\
*** 1743,1749 ****
  #define LEGITIMATE_ADDRESS_DISP(R, X)					\
    (GET_CODE (X) == PLUS							\
     && rtx_equal_p (R, XEXP (X, 0))					\
!    && (GET_CODE (XEXP (X, 1)) == REG					\
         || (GET_CODE (XEXP (X, 1)) == CONST_INT				\
  	   && INTVAL (XEXP (X, 1)) >= -256				\
  	   && INTVAL (XEXP (X, 1)) < 256)))
--- 1744,1750 ----
  #define LEGITIMATE_ADDRESS_DISP(R, X)					\
    (GET_CODE (X) == PLUS							\
     && rtx_equal_p (R, XEXP (X, 0))					\
!    && (LEGITIMATE_ADDRESS_REG (XEXP (X, 1))				\
         || (GET_CODE (XEXP (X, 1)) == CONST_INT				\
  	   && INTVAL (XEXP (X, 1)) >= -256				\
  	   && INTVAL (XEXP (X, 1)) < 256)))
*************** do {									\
*** 1774,1782 ****
  #endif
  
  /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
!    use as an index register.  */
  
! #define REG_OK_FOR_INDEX_P(X) 0
  
  /* A C compound statement that attempts to replace X with a valid memory
     address for an operand of mode MODE.
--- 1775,1783 ----
  #endif
  
  /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
!    use as an index register.  This is needed for POST_MODIFY.  */
  
! #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
  
  /* A C compound statement that attempts to replace X with a valid memory
     address for an operand of mode MODE.

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