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]

patch applied to sh port: wrap return address for TARGET_SH1


This fixes the execute/20030811-1.c failure.

2003-08-13  J"orn Rennecke <joern.rennecke@superh.com>

	* sh.c (sh_get_pr_initial_val): Always wrap in unspec for TARGET_SH1.
	* sh.md (load_ra): Change insn predicate to TARGET_SH1.

Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.233
diff -p -r1.233 sh.c
*** config/sh/sh.c	7 Aug 2003 22:40:07 -0000	1.233
--- config/sh/sh.c	13 Aug 2003 19:16:55 -0000
*************** sh_get_pr_initial_val (void)
*** 8865,8873 ****
       then, we end in trouble if we didn't use the register in the same
       basic block before.  So call get_hard_reg_initial_val now and wrap it
       in an unspec if we might need to replace it.  */
    val
      = get_hard_reg_initial_val (Pmode, TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG);
!   if (TARGET_SHCOMPACT && rtx_equal_function_value_matters)
      return gen_rtx_UNSPEC (SImode, gen_rtvec (1, val), UNSPEC_RA);
    return val;
  }
--- 8865,8877 ----
       then, we end in trouble if we didn't use the register in the same
       basic block before.  So call get_hard_reg_initial_val now and wrap it
       in an unspec if we might need to replace it.  */
+   /* ??? We also must do this for TARGET_SH1 in general, because otherwise
+      combine can put the pseudo returned by get_hard_reg_initial_val into
+      instructions that need a general purpose registers, which will fail to
+      be recognized when the pseudo becomes allocated to PR.  */
    val
      = get_hard_reg_initial_val (Pmode, TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG);
!   if (TARGET_SH1)
      return gen_rtx_UNSPEC (SImode, gen_rtvec (1, val), UNSPEC_RA);
    return val;
  }
Index: config/sh/sh.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
retrieving revision 1.156
diff -p -r1.156 sh.md
*** config/sh/sh.md	7 Aug 2003 22:40:07 -0000	1.156
--- config/sh/sh.md	13 Aug 2003 19:16:55 -0000
***************
*** 3475,3487 ****
  (define_insn_and_split "load_ra"
    [(set (match_operand:SI 0 "general_movdst_operand" "")
  	(unspec:SI [(match_operand 1 "register_operand" "")] UNSPEC_RA))]
!   "TARGET_SHCOMPACT"
    "#"
    "&& ! rtx_equal_function_value_matters"
    [(set (match_dup 0) (match_dup 1))]
    "
  {
!   if (current_function_has_nonlocal_label)
      operands[1] = gen_rtx_MEM (SImode, return_address_pointer_rtx);
  }")
  
--- 3475,3487 ----
  (define_insn_and_split "load_ra"
    [(set (match_operand:SI 0 "general_movdst_operand" "")
  	(unspec:SI [(match_operand 1 "register_operand" "")] UNSPEC_RA))]
!   "TARGET_SH1"
    "#"
    "&& ! rtx_equal_function_value_matters"
    [(set (match_dup 0) (match_dup 1))]
    "
  {
!   if (TARGET_SHCOMPACT && current_function_has_nonlocal_label)
      operands[1] = gen_rtx_MEM (SImode, return_address_pointer_rtx);
  }")
  


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