mips16/mips64 frame ptr to stack ptr

Nigel Stephens nigel@algor.co.uk
Mon Feb 23 04:22:00 GMT 1998


 > Can we detect this case and either generate the right length info
 > in the md file, or adjust it via INSN_ADJUST_LENGTH?
 > 
 > Jeff

That's an idea, how about the following.

	* config/mips/mips.h (ADJUST_COST): Protect if statement with
	brackets.
	(ADJUST_INSN_LENGTH): Adjust length of MIPS16 "lwu"
	instruction when using stack pointer as base register.

*** mips.h~	Tue Feb 17 12:17:03 1998
--- mips.h	Mon Feb 23 12:12:23 1998
*************** while (0)
*** 3699,3706 ****
     output-dependencies.  */
  
  #define ADJUST_COST(INSN,LINK,DEP_INSN,COST)				\
    if (REG_NOTE_KIND (LINK) != 0)					\
!     (COST) = 0; /* Anti or output dependence.  */
  
  /* Optionally define this if you have added predicates to
     `MACHINE.c'.  This macro is called within an initializer of an
--- 3699,3732 ----
     output-dependencies.  */
  
  #define ADJUST_COST(INSN,LINK,DEP_INSN,COST)				\
+ do {									\
    if (REG_NOTE_KIND (LINK) != 0)					\
!     (COST) = 0; /* Anti or output dependence.  */			\
! } while (0)
! 
! 
! /* MIPS16 cannot do a zero_extendsidi from memory using the stack
!    pointer as a base register, so we have to simulate it with extra
!    instructions, and adjust the instruction length appropriately.  A
!    better solution would be to catch this earlier and copy the stack
!    pointer into a general register.  */
! 
! #define ADJUST_INSN_LENGTH(INSN,LENGTH)					\
! do {									\
!   rtx ainsn;								\
!   if (TARGET_MIPS16 && TARGET_64BIT					\
!       && (ainsn = single_set (INSN))					\
!       && GET_CODE (SET_SRC (ainsn)) == ZERO_EXTEND			\
!       && GET_MODE (SET_SRC (ainsn)) == DImode				\
!       && GET_CODE (XEXP (SET_SRC (ainsn), 0)) == MEM			\
!       && GET_MODE (XEXP (SET_SRC (ainsn), 0)) == SImode			\
!       && GET_CODE (XEXP (XEXP (SET_SRC (ainsn), 0), 0)) == PLUS		\
!       && GET_CODE (XEXP (XEXP (XEXP (SET_SRC (ainsn), 0), 0, 0))) == REG \
!       && REGNO (XEXP (XEXP (XEXP (SET_SRC (ainsn), 0), 0, 0)))		\
!           == STACK_POINTER_REGNUM)					\
!     (LENGTH) = 5;							\
! } while (0)
! 
  
  /* Optionally define this if you have added predicates to
     `MACHINE.c'.  This macro is called within an initializer of an





More information about the Gcc mailing list