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]

Re: [PATCH] mudflap: remove usage of builtin_frame_address


Hi,

references:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00804.html

Here a simple solution for the builtin_frame_address problem. In fact much
simpler than what I described in my last email. With that patch the back end
can define INITIAL_FRAME_ADDRESS_RTX which is used by expand_builtin_frame_address
as the base for the first frame. For further steps DYNAMIC_CHAIN_ADDRESS will be
used as before.

This patch fixes the pass45-frag.c regression on s390 (31bit).

Bootstrapped and regtested on i386, s390, s390x.

OK? If yes I will resubmit it with the respective changes to gcc documentation.

Bye,

-Andreas-


2005-01-14  Andreas Krebbel  <krebbel1@de.ibm.com>

	* gcc/builtins.c (expand_builtin_frame_address): Use 
	INITIAL_FRAME_ADDRESS_RTX instead of hard_frame_pointer_rtx if defined.
	* config/s390/s390.h (INITIAL_FRAME_ADDRESS_RTX): Define new macro.
	(DYNAMIC_CHAIN_ADDRESS): Remove the case for the initial frame.


Index: gcc/builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.413
diff -p -c -r1.413 builtins.c
*** gcc/builtins.c	12 Jan 2005 06:45:35 -0000	1.413
--- gcc/builtins.c	14 Jan 2005 13:46:07 -0000
*************** expand_builtin_frame_address (tree fndec
*** 4146,4156 ****
        return const0_rtx;
      }
    else
!     {
        rtx tem
  	= expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl),
  				      tree_low_cst (TREE_VALUE (arglist), 1),
! 				      hard_frame_pointer_rtx);
  
        /* Some ports cannot access arbitrary stack frames.  */
        if (tem == NULL)
--- 4146,4162 ----
        return const0_rtx;
      }
    else
!     { 
! #ifdef INITIAL_FRAME_ADDRESS_RTX
!       rtx initial_frame_address_rtx = INITIAL_FRAME_ADDRESS_RTX;
! #else
!       rtx initial_frame_address_rtx = hard_frame_pointer_rtx;
! #endif
! 
        rtx tem
  	= expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl),
  				      tree_low_cst (TREE_VALUE (arglist), 1),
! 				      initial_frame_address_rtx);
  
        /* Some ports cannot access arbitrary stack frames.  */
        if (tem == NULL)
Index: gcc/config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.131
diff -p -c -r1.131 s390.h
*** gcc/config/s390/s390.h	30 Dec 2004 03:08:05 -0000	1.131
--- gcc/config/s390/s390.h	14 Jan 2005 13:46:09 -0000
*************** extern int current_function_outgoing_arg
*** 612,617 ****
--- 612,622 ----
     the argument area.  */
  #define FIRST_PARM_OFFSET(FNDECL) 0
  
+ #define INITIAL_FRAME_ADDRESS_RTX                                               \
+   (TARGET_PACKED_STACK ?                                                        \
+    plus_constant (arg_pointer_rtx, -UNITS_PER_WORD) :                           \
+    plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET))
+ 
  /* The return address of the current frame is retrieved
     from the initial value of register RETURN_REGNUM.
     For frames farther back, we use the stack slot where
*************** extern int current_function_outgoing_arg
*** 619,629 ****
  
  #define DYNAMIC_CHAIN_ADDRESS(FRAME)                                            \
    (TARGET_PACKED_STACK ?                                                        \
!     ((FRAME) != hard_frame_pointer_rtx ?                                        \
!      plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) :           \
!      plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)) :                        \
!      ((FRAME) != hard_frame_pointer_rtx ? (FRAME) :				\
!       plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET)))
  
  #define RETURN_ADDR_RTX(COUNT, FRAME)						\
    s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
--- 624,630 ----
  
  #define DYNAMIC_CHAIN_ADDRESS(FRAME)                                            \
    (TARGET_PACKED_STACK ?                                                        \
!    plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) : (FRAME))
  
  #define RETURN_ADDR_RTX(COUNT, FRAME)						\
    s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))


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