OSDN Git Service

2011-03-03 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Mar 2011 12:08:21 +0000 (12:08 +0000)
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Mar 2011 12:08:21 +0000 (12:08 +0000)
* config/s390/s390.c (s390_function_value): Rename to ...
(s390_function_and_libcall_value): ... this.
(s390_function_value): New function.
(s390_libcall_value): New function.
(TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Define target
hooks.
* config/s390/s390.h (FUNCTION_VALUE, LIBCALL_VALUE): Remove
target macro definitions.
* config/s390/s390-protos.h (s390_function_value): Remove prototype.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170649 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.c
gcc/config/s390/s390.h

index 0c8c51f..ede6eea 100644 (file)
@@ -1,3 +1,15 @@
+2011-03-03  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+       * config/s390/s390.c (s390_function_value): Rename to ...
+       (s390_function_and_libcall_value): ... this.
+       (s390_function_value): New function.
+       (s390_libcall_value): New function.
+       (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Define target
+       hooks.
+       * config/s390/s390.h (FUNCTION_VALUE, LIBCALL_VALUE): Remove
+       target macro definitions.
+       * config/s390/s390-protos.h (s390_function_value): Remove prototype.
+
 2011-03-02  Joseph Myers  <joseph@codesourcery.com>
 
        * config/i386/freebsd64.h (CC1_SPEC): Define.
index 619d0e5..9464879 100644 (file)
@@ -111,9 +111,3 @@ extern int s390_branch_condition_mask (rtx);
 extern int s390_compare_and_branch_condition_mask (rtx);
 
 #endif /* RTX_CODE */
-
-#ifdef TREE_CODE
-#ifdef RTX_CODE
-extern rtx s390_function_value (const_tree, const_tree, enum machine_mode);
-#endif /* RTX_CODE */
-#endif /* TREE_CODE */
index a8c8bd9..f43b376 100644 (file)
@@ -8687,17 +8687,23 @@ s390_promote_function_mode (const_tree type, enum machine_mode mode,
   return mode;
 }
 
-/* Define where to return a (scalar) value of type TYPE.
-   If TYPE is null, define where to return a (scalar)
+/* Define where to return a (scalar) value of type RET_TYPE.
+   If RET_TYPE is null, define where to return a (scalar)
    value of mode MODE from a libcall.  */
 
-rtx
-s390_function_value (const_tree type, const_tree fn, enum machine_mode mode)
+static rtx
+s390_function_and_libcall_value (enum machine_mode mode,
+                                const_tree ret_type,
+                                const_tree fntype_or_decl,
+                                bool outgoing ATTRIBUTE_UNUSED)
 {
-  if (type)
+  /* For normal functions perform the promotion as
+     promote_function_mode would do.  */
+  if (ret_type)
     {
-      int unsignedp = TYPE_UNSIGNED (type);
-      mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp, fn, 1);
+      int unsignedp = TYPE_UNSIGNED (ret_type);
+      mode = promote_function_mode (ret_type, mode, &unsignedp,
+                                   fntype_or_decl, 1);
     }
 
   gcc_assert (GET_MODE_CLASS (mode) == MODE_INT || SCALAR_FLOAT_MODE_P (mode));
@@ -8710,6 +8716,10 @@ s390_function_value (const_tree type, const_tree fn, enum machine_mode mode)
     return gen_rtx_REG (mode, 2);
   else if (GET_MODE_SIZE (mode) == 2 * UNITS_PER_LONG)
     {
+      /* This case is triggered when returning a 64 bit value with
+        -m31 -mzarch.  Although the value would fit into a single
+        register it has to be forced into a 32 bit register pair in
+        order to match the ABI.  */
       rtvec p = rtvec_alloc (2);
 
       RTVEC_ELT (p, 0)
@@ -8723,6 +8733,26 @@ s390_function_value (const_tree type, const_tree fn, enum machine_mode mode)
   gcc_unreachable ();
 }
 
+/* Define where to return a scalar return value of type RET_TYPE.  */
+
+static rtx
+s390_function_value (const_tree ret_type, const_tree fn_decl_or_type,
+                    bool outgoing)
+{
+  return s390_function_and_libcall_value (TYPE_MODE (ret_type), ret_type,
+                                         fn_decl_or_type, outgoing);
+}
+
+/* Define where to return a scalar libcall return value of mode
+   MODE.  */
+
+static rtx
+s390_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED)
+{
+  return s390_function_and_libcall_value (mode, NULL_TREE,
+                                         NULL_TREE, true);
+}
+
 
 /* Create and return the va_list datatype.
 
@@ -10694,6 +10724,10 @@ s390_loop_unroll_adjust (unsigned nunroll, struct loop *loop)
 #define TARGET_FUNCTION_ARG s390_function_arg
 #undef TARGET_FUNCTION_ARG_ADVANCE
 #define TARGET_FUNCTION_ARG_ADVANCE s390_function_arg_advance
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE s390_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE s390_libcall_value
 
 #undef TARGET_FIXED_CONDITION_CODE_REGS
 #define TARGET_FIXED_CONDITION_CODE_REGS s390_fixed_condition_code_regs
index abf4efc..105f5aa 100644 (file)
@@ -688,14 +688,6 @@ CUMULATIVE_ARGS;
   (N) == 16 || (N) == 17 || (TARGET_64BIT && ((N) == 18 || (N) == 19)))
 
 
-/* Scalar return values.  */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
-  s390_function_value ((VALTYPE), (FUNC), VOIDmode)
-
-#define LIBCALL_VALUE(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)