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]

[FR30] Consider VIRTUAL_INCOMING_ARGS_REGNUM eliminable


The following patch fixes another ICE building libgcc on fr30-elf.
The problem is that the constraints on fr30.md's addsi_small_int
explicitly exclude the use of the frame pointer and arg pointer
registers, due to potential elimination issues.  Unfortunately, the
constraints as currently written allows VIRTUAL_INCOMING_ARGS which
later gets instantiated as the arg pointer, leading to an unrecognizable
insn.  The fix is to tighten the constraints to also exclude the other
frame related virtual registers.  This forces these additions to move
the problematic registers into a new pseudo, and then perform the
addition using a regular reg-reg addition.  Combine and reload fix
everything up later.

The following patch has been tested by building a cross-compiler to
fr30-elf on i686-pc-linux-gnu, where this is one of a series of
patches that allow us to build libgcc without problems.

Ok for mainline?



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

	* config/fr30/fr30.md (addsi_small_int): Use REGNO_PTR_FRAME_P to
	identify potentially eliminable registers to additionally catch
	VIRTUAL_INCOMING_ARGS_REGNUM.
	(addsi3): Update the conditions on when to use addsi_small_int.


Index: fr30.md
===================================================================
*** fr30.md	(revision 112972)
--- fr30.md	(working copy)
***************
*** 654,663 ****
      emit_insn (gen_addsi_regs (operands[0], operands[1], operands[2]));
    else if (GET_CODE (operands[2]) != CONST_INT)
      emit_insn (gen_addsi_big_int (operands[0], operands[1], operands[2]));
!   else if (   (REGNO (operands[1]) != FRAME_POINTER_REGNUM)
!            && (REGNO (operands[1]) != ARG_POINTER_REGNUM)
! 	   && (INTVAL (operands[2]) >= -16)
! 	   && (INTVAL (operands[2]) <= 15))
      emit_insn (gen_addsi_small_int (operands[0], operands[1], operands[2]));
    else
      emit_insn (gen_addsi_big_int (operands[0], operands[1], operands[2]));
--- 654,663 ----
      emit_insn (gen_addsi_regs (operands[0], operands[1], operands[2]));
    else if (GET_CODE (operands[2]) != CONST_INT)
      emit_insn (gen_addsi_big_int (operands[0], operands[1], operands[2]));
!   else if (INTVAL (operands[2]) >= -16
! 	   && INTVAL (operands[2]) <= 15
! 	   && (!REGNO_PTR_FRAME_P (REGNO (operands[1]))
! 	       || REGNO (operands[1]) == STACK_POINTER_REGNUM))
      emit_insn (gen_addsi_small_int (operands[0], operands[1], operands[2]));
    else
      emit_insn (gen_addsi_big_int (operands[0], operands[1], operands[2]));
***************
*** 680,687 ****
    [(set (match_operand:SI 0 "register_operand"              "=r,r")
  	(plus:SI (match_operand:SI 1 "register_operand"      "0,0")
  		 (match_operand:SI 2 "add_immediate_operand" "I,J")))]
!   "   (REGNO (operands[1]) != FRAME_POINTER_REGNUM)
!    && (REGNO (operands[1]) != ARG_POINTER_REGNUM)"
    "@
     addn	%2, %0
     addn2	%2, %0"
--- 680,687 ----
    [(set (match_operand:SI 0 "register_operand"              "=r,r")
  	(plus:SI (match_operand:SI 1 "register_operand"      "0,0")
  		 (match_operand:SI 2 "add_immediate_operand" "I,J")))]
!   "! REGNO_PTR_FRAME_P (REGNO (operands[1]))
!    || REGNO (operands[1]) == STACK_POINTER_REGNUM"
    "@
     addn	%2, %0
     addn2	%2, %0"


Roger
--


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