From patchwork Thu Mar 3 12:07:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 85258 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E1032B70A9 for ; Thu, 3 Mar 2011 23:07:41 +1100 (EST) Received: (qmail 26098 invoked by alias); 3 Mar 2011 12:07:39 -0000 Received: (qmail 26083 invoked by uid 22791); 3 Mar 2011 12:07:38 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.uk.ibm.com (HELO mtagate6.uk.ibm.com) (194.196.100.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Mar 2011 12:07:33 +0000 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p23C7UWv023871 for ; Thu, 3 Mar 2011 12:07:30 GMT Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p23C7gdk1396818 for ; Thu, 3 Mar 2011 12:07:42 GMT Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p23C7TwF027940 for ; Thu, 3 Mar 2011 05:07:29 -0700 Received: from bart (dyn-9-152-224-59.boeblingen.de.ibm.com [9.152.224.59]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p23C7SAQ027888 for ; Thu, 3 Mar 2011 05:07:28 -0700 Received: by bart (sSMTP sendmail emulation); Thu, 03 Mar 2011 13:07:28 +0100 From: "Andreas Krebbel" Date: Thu, 3 Mar 2011 13:07:28 +0100 To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Remove deprecated target macro FUNCTION_VALUE Message-ID: <20110303120728.GA4321@bart> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, this patch removes the use of the deprecated FUNCTION_VALUE macro in the S/390 back end. Bootstrapped on s390 and s390x. No regression. Committed to mainline. Bye, -Andreas- 2011-03-03 Andreas Krebbel * 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. Index: gcc/config/s390/s390.c =================================================================== --- gcc/config/s390/s390.c.orig +++ gcc/config/s390/s390.c @@ -8687,17 +8687,23 @@ s390_promote_function_mode (const_tree t 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) -{ - if (type) - { - int unsignedp = TYPE_UNSIGNED (type); - mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp, fn, 1); +static rtx +s390_function_and_libcall_value (enum machine_mode mode, + const_tree ret_type, + const_tree fntype_or_decl, + bool outgoing ATTRIBUTE_UNUSED) +{ + /* For normal functions perform the promotion as + promote_function_mode would do. */ + if (ret_type) + { + 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, co 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, co 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 nunrol #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: gcc/config/s390/s390.h =================================================================== --- gcc/config/s390/s390.h.orig +++ gcc/config/s390/s390.h @@ -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) Index: gcc/config/s390/s390-protos.h =================================================================== --- gcc/config/s390/s390-protos.h.orig +++ gcc/config/s390/s390-protos.h @@ -111,9 +111,3 @@ extern int s390_branch_condition_mask (r 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 */