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] fix __buitin_return_address(0) on m32r*-*-*-*


Hi Nick,

This patch is for __builtin_return_address(0).
Please apply it.

Please commit into 3.4-branch and mainline.

Regards,

Kazuhiro Inaoka

gcc/ChangeLog

2004-06-15 Kazuhiro Inaoka < inaoka dot kazuhiro at renesas dot com >

	* config/m32r/m32r.h (RETURN_ADDR_RTX): Define.
	(INCOMING_RETURN_ADDR_RTX): Define.
	* config/m32r/m32r-protos.h (m32r_return_addr): Added.
	* config/m32r/m32r.c (m32r_return_addr): Added.
	* config/m32r/m32r.md (get_pc): Changed for
	__builtin_return_address(0).
Index: m32r-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r-protos.h,v
retrieving revision 1.21.4.1
diff -c -r1.21.4.1 m32r-protos.h
*** m32r-protos.h	31 Jan 2004 06:18:26 -0000	1.21.4.1
--- m32r-protos.h	15 Jun 2004 02:22:01 -0000
***************
*** 58,63 ****
--- 58,64 ----
  extern int    m32r_hard_regno_rename_ok (unsigned int, unsigned int);
  extern int    m32r_legitimate_pic_operand_p (rtx);
  extern rtx    m32r_legitimize_pic_address (rtx, rtx);
+ extern rtx    m32r_return_addr (int);
  
  #ifdef HAVE_MACHINE_MODES
  extern int    call_address_operand (rtx, Mmode);
Index: m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.80.4.1
diff -c -r1.80.4.1 m32r.c
*** m32r.c	31 Jan 2004 06:18:26 -0000	1.80.4.1
--- m32r.c	15 Jun 2004 02:22:02 -0000
***************
*** 3037,3039 ****
--- 3037,3048 ----
  
    return 1;
  }
+ 
+ rtx
+ m32r_return_addr (int count)
+ {
+   if (count != 0)
+     return const0_rtx;
+   
+   return get_hard_reg_initial_val(Pmode, RETURN_ADDR_REGNUM);
+ }
Index: m32r.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.99.4.3
diff -c -r1.99.4.3 m32r.h
*** m32r.h	23 Apr 2004 17:07:29 -0000	1.99.4.3
--- m32r.h	15 Jun 2004 02:22:02 -0000
***************
*** 1310,1315 ****
--- 1310,1320 ----
  /* Generate calls to memcpy, memcmp and memset.  */
  #define TARGET_MEM_FUNCTIONS
  
+ #define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr(COUNT)
+ 
+ #define INCOMING_RETURN_ADDR_RTX \
+   gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
+ 
  /* Addressing modes, and classification of registers for them.  */
  
  /* Maximum number of registers that can appear in a valid memory address.  */
Index: m32r.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.md,v
retrieving revision 1.41.2.1
diff -c -r1.41.2.1 m32r.md
*** m32r.md	31 Jan 2004 06:18:26 -0000	1.41.2.1
--- m32r.md	15 Jun 2004 02:22:02 -0000
***************
*** 2722,2730 ****
    "*
  {
    if (INTVAL(operands[2]))
!     return \"bl.s .+4\;ld24 %0,%#%1\;add %0,lr\";
    else
!     return \"bl.s .+4\;seth %0,%#shigh(%1)\;add3 %0,%0,%#low(%1+4)\;add %0,lr\";}"
    [(set (attr "length") (if_then_else (ne (match_dup 2) (const_int 0))
                                        (const_int 8)
                                        (const_int 12)))])
--- 2722,2730 ----
    "*
  {
    if (INTVAL(operands[2]))
!     return \"bl.s .+4\;ld24 %0,%#%1\;add %0,lr\;ld lr,@sp\";
    else
!     return \"bl.s .+4\;seth %0,%#shigh(%1)\;add3 %0,%0,%#low(%1+4)\;add %0,lr\;ld lr,@sp\";}"
    [(set (attr "length") (if_then_else (ne (match_dup 2) (const_int 0))
                                        (const_int 8)
                                        (const_int 12)))])

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