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 RFC 2/3] Hookize PROMOTE_FUNCTION_MODE


This patch fixes ports to use promote_function_mode instead of
promote_mode.  (These ports would not compile after patch 1).

Paolo

2009-04-17  Paolo Bonzini  <bonzini@gnu.org>

	* config/s390/s390.c (s390_function_value): Receive fn, pass
	it to promote_function_mode instead of using promote_mode.
	* config/s390/s390.h (FUNCTION_VALUE, LIBCALL_VALUE):
	Pass FUNC to s390_function_value.
	* config/s390/s390-protos.h (s390_function_value):
	Add a tree.
	* config/iq2000/iq2000.c (iq2000_function_value): Use
	promote_function_mode.
	* config/picochip/picochip.c (picochip_function_value): Likewise.
	* config/mcore/mcore.c (mcore_function_value): Likewise.
	* config/score/score3.c (score3_function_value): Likewise.
	* config/score/score7.c (score7_function_value): Likewise.
	* config/mips/mips.c (mips_function_value): Receive fn, pass
	it to promote_function_mode instead of using promote_mode.
	* config/mips/mips.h (FUNCTION_VALUE, LIBCALL_VALUE):
	Pass FUNC to mips_function_value.
	* config/mips/mips-protos.h (mips_function_value):
	Add a tree.

Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c	(branch promote-function-mode)
+++ gcc/config/s390/s390.c	(working copy)
@@ -8310,12 +8310,12 @@ s390_return_in_memory (const_tree type, 
    value of mode MODE from a libcall.  */
 
 rtx
-s390_function_value (const_tree type, enum machine_mode mode)
+s390_function_value (const_tree type, const_tree fn, enum machine_mode mode)
 {
   if (type)
     {
       int unsignedp = TYPE_UNSIGNED (type);
-      mode = promote_mode (type, TYPE_MODE (type), &unsignedp, 1);
+      mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp, fn, 1);
     }
 
   gcc_assert (GET_MODE_CLASS (mode) == MODE_INT || SCALAR_FLOAT_MODE_P (mode));
Index: gcc/config/s390/s390.h
===================================================================
--- gcc/config/s390/s390.h	(branch promote-function-mode)
+++ gcc/config/s390/s390.h	(working copy)
@@ -695,10 +695,10 @@ CUMULATIVE_ARGS;
 /* Scalar return values.  */
 
 #define FUNCTION_VALUE(VALTYPE, FUNC) \
-  s390_function_value ((VALTYPE), VOIDmode)
+  s390_function_value ((VALTYPE), (FUNC), VOIDmode)
 
 #define LIBCALL_VALUE(MODE) \
-  s390_function_value (NULL, (MODE))
+  s390_function_value (NULL, NULL, (MODE))
 
 /* Only gpr 2 and fpr 0 are ever used as return registers.  */
 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 2 || (N) == 16)
Index: gcc/config/s390/s390-protos.h
===================================================================
--- gcc/config/s390/s390-protos.h	(branch promote-function-mode)
+++ gcc/config/s390/s390-protos.h	(working copy)
@@ -127,6 +127,6 @@ extern void s390_function_arg_advance (C
 				       tree, int);
 #ifdef RTX_CODE
 extern rtx s390_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-extern rtx s390_function_value (const_tree, enum machine_mode);
+extern rtx s390_function_value (const_tree, const_tree, enum machine_mode);
 #endif /* RTX_CODE */
 #endif /* TREE_CODE */
Index: gcc/config/iq2000/iq2000.c
===================================================================
--- gcc/config/iq2000/iq2000.c	(branch promote-function-mode)
+++ gcc/config/iq2000/iq2000.c	(working copy)
@@ -2202,15 +2202,14 @@ iq2000_select_section (tree decl, int re
    FUNC.  */
 
 rtx
-iq2000_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
+iq2000_function_value (const_tree valtype, const_tree func)
 {
   int reg = GP_RETURN;
   enum machine_mode mode = TYPE_MODE (valtype);
   int unsignedp = TYPE_UNSIGNED (valtype);
 
-  /* Since we define TARGET_PROMOTE_FUNCTION_RETURN that returns true,
-     we must promote the mode just as PROMOTE_MODE does.  */
-  mode = promote_mode (valtype, mode, &unsignedp, 1);
+  /* Since we promote return types, we must promote the mode here too.  */
+  mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
 
   return gen_rtx_REG (mode, reg);
 }
Index: gcc/config/picochip/picochip.c
===================================================================
--- gcc/config/picochip/picochip.c	(branch promote-function-mode)
+++ gcc/config/picochip/picochip.c	(working copy)
@@ -4171,7 +4171,7 @@ warn_of_byte_access (void)
 }
 
 rtx
-picochip_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
+picochip_function_value (const_tree valtype, const_tree func,
                          bool outgoing ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = TYPE_MODE (valtype);
@@ -4179,7 +4179,7 @@ picochip_function_value (const_tree valt
 
   /* Since we define PROMOTE_FUNCTION_RETURN, we must promote the mode
      just as PROMOTE_MODE does.  */
-  mode = promote_mode (valtype, mode, &unsignedp, 1);
+  mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
 
   return gen_rtx_REG (mode, 0);
 
Index: gcc/config/mcore/mcore.c
===================================================================
--- gcc/config/mcore/mcore.c	(branch promote-function-mode)
+++ gcc/config/mcore/mcore.c	(working copy)
@@ -2724,14 +2724,15 @@ handle_structs_in_regs (enum machine_mod
 }
 
 rtx
-mcore_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
+mcore_function_value (const_tree valtype, const_tree func)
 {
   enum machine_mode mode;
   int unsigned_p;
   
   mode = TYPE_MODE (valtype);
 
-  mode = promote_mode (valtype, mode, &unsigned_p, 1);
+  /* Since we promote return types, we must promote the mode here too.  */
+  mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
   
   return handle_structs_in_regs (mode, valtype, FIRST_RET_REG);
 }
Index: gcc/config/score/score3.c
===================================================================
--- gcc/config/score/score3.c	(branch promote-function-mode)
+++ gcc/config/score/score3.c	(working copy)
@@ -865,15 +865,14 @@ score3_function_arg (const CUMULATIVE_AR
    VALTYPE is the return type and MODE is VOIDmode.  For libcalls,
    VALTYPE is null and MODE is the mode of the return value.  */
 rtx
-score3_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
-                       enum machine_mode mode)
+score3_function_value (tree valtype, tree func, enum machine_mode mode)
 {
   if (valtype)
     {
       int unsignedp;
       mode = TYPE_MODE (valtype);
       unsignedp = TYPE_UNSIGNED (valtype);
-      mode = promote_mode (valtype, mode, &unsignedp, 1);
+      mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
     }
   return gen_rtx_REG (mode, RT_REGNUM);
 }
Index: gcc/config/score/score7.c
===================================================================
--- gcc/config/score/score7.c	(branch promote-function-mode)
+++ gcc/config/score/score7.c	(working copy)
@@ -856,15 +856,14 @@ score7_function_arg (const CUMULATIVE_AR
    VALTYPE is the return type and MODE is VOIDmode.  For libcalls,
    VALTYPE is null and MODE is the mode of the return value.  */
 rtx
-score7_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
-                       enum machine_mode mode)
+score7_function_value (tree valtype, tree func, enum machine_mode mode)
 {
   if (valtype)
     {
       int unsignedp;
       mode = TYPE_MODE (valtype);
       unsignedp = TYPE_UNSIGNED (valtype);
-      mode = promote_mode (valtype, mode, &unsignedp, 1);
+      mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
     }
   return gen_rtx_REG (mode, RT_REGNUM);
 }
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(branch promote-function-mode)
+++ gcc/config/mips/mips.c	(working copy)
@@ -4919,7 +4919,7 @@ mips_return_fpr_pair (enum machine_mode 
    VALTYPE is null and MODE is the mode of the return value.  */
 
 rtx
-mips_function_value (const_tree valtype, enum machine_mode mode)
+mips_function_value (const_tree valtype, const_tree func, enum machine_mode mode)
 {
   if (valtype)
     {
@@ -4931,7 +4931,7 @@ mips_function_value (const_tree valtype,
 
-      /* Since TARGET_PROMOTE_FUNCTION_RETURN unconditionally returns true,
-	 we must promote the mode just as PROMOTE_MODE does.  */
-      mode = promote_mode (valtype, mode, &unsigned_p, 1);
+      /* Since TARGET_PROMOTE_FUNCTION_MODE unconditionally promotes,
+	 return values, promote the mode here too.  */
+      mode = promote_function_mode (valtype, mode, &unsigned_p, func, 1);
 
       /* Handle structures whose fields are returned in $f0/$f2.  */
       switch (mips_fpr_return_fields (valtype, fields))
Index: gcc/config/mips/mips-protos.h
===================================================================
--- gcc/config/mips/mips-protos.h	(branch promote-function-mode)
+++ gcc/config/mips/mips-protos.h	(working copy)
@@ -282,7 +282,7 @@ extern void mips_expand_prologue (void);
 extern void mips_expand_before_return (void);
 extern void mips_expand_epilogue (bool);
 extern bool mips_can_use_return_insn (void);
-extern rtx mips_function_value (const_tree, enum machine_mode);
+extern rtx mips_function_value (const_tree, const_tree, enum machine_mode);
 
 extern bool mips_cannot_change_mode_class (enum machine_mode,
 					   enum machine_mode, enum reg_class);
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(branch promote-function-mode)
+++ gcc/config/mips/mips.h	(working copy)
@@ -2156,10 +2156,10 @@ enum reg_class
 #define FP_ARG_LAST  (FP_ARG_FIRST + MAX_ARGS_IN_REGISTERS - 1)
 
 #define LIBCALL_VALUE(MODE) \
-  mips_function_value (NULL_TREE, MODE)
+  mips_function_value (NULL_TREE, NULL_TREE, MODE)
 
 #define FUNCTION_VALUE(VALTYPE, FUNC) \
-  mips_function_value (VALTYPE, VOIDmode)
+  mips_function_value (VALTYPE, FUNC, VOIDmode)
 
 /* 1 if N is a possible register number for a function value.
    On the MIPS, R2 R3 and F0 F2 are the only register thus used.


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