i386 return value promoting patch

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Sat Mar 25 14:29:00 GMT 2000


On i386 in the function calls, the return value is promoted by function itself
and then by the caller.  This is quite over curefull and completely disables
sibbling call optimizations on functions with promoted return values.

I hope it is safe to modify FUNCTION_VALUE to promote return type as other
ports does.

Sat Mar 25 23:16:35 CET 2000  Jan Hubicka  <jh@suse.cz>

	* i386.h (FUNCTION_VALUE, LIBCALL_VALUE): Promote return type.

*** i386.h.orig	Sat Mar 25 11:36:49 2000
--- i386.h	Sat Mar 25 23:07:34 2000
*************** enum reg_class
*** 1164,1177 ****
     If the precise function being called is known, FUNC is its FUNCTION_DECL;
     otherwise, FUNC is 0.  */
  #define FUNCTION_VALUE(VALTYPE, FUNC)  \
!    gen_rtx_REG (TYPE_MODE (VALTYPE), \
  		VALUE_REGNO (TYPE_MODE (VALTYPE)))
  
  /* Define how to find the value returned by a library function
     assuming the value has mode MODE.  */
  
  #define LIBCALL_VALUE(MODE) \
!   gen_rtx_REG (MODE, VALUE_REGNO (MODE))
  
  /* Define the size of the result block used for communication between
     untyped_call and untyped_return.  The block contains a DImode value
--- 1164,1182 ----
     If the precise function being called is known, FUNC is its FUNCTION_DECL;
     otherwise, FUNC is 0.  */
  #define FUNCTION_VALUE(VALTYPE, FUNC)  \
!    gen_rtx_REG (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_INT	\
! 		&& GET_MODE_SIZE (TYPE_MODE (VALTYPE)) < UNITS_PER_WORD	\
! 		? SImode : TYPE_MODE (VALTYPE),				\
  		VALUE_REGNO (TYPE_MODE (VALTYPE)))
  
  /* Define how to find the value returned by a library function
     assuming the value has mode MODE.  */
  
  #define LIBCALL_VALUE(MODE) \
!    gen_rtx_REG (GET_MODE_CLASS (MODE) == MODE_INT			\
! 		&& GET_MODE_SIZE (MODE) < UNITS_PER_WORD		\
! 		? SImode : MODE,					\
! 		VALUE_REGNO (MODE))
  
  /* Define the size of the result block used for communication between
     untyped_call and untyped_return.  The block contains a DImode value


More information about the Gcc-patches mailing list