From patchwork Fri Sep 3 15:07:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anatoly Sokolov X-Patchwork-Id: 63689 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 464AEB7166 for ; Sat, 4 Sep 2010 01:07:53 +1000 (EST) Received: (qmail 15517 invoked by alias); 3 Sep 2010 15:07:46 -0000 Received: (qmail 15420 invoked by uid 22791); 3 Sep 2010 15:07:43 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=AWL, BAYES_00, KAM_THEBAT, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from contrabass.post.ru (HELO contrabass.post.ru) (85.21.78.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Sep 2010 15:07:33 +0000 Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id CB928AAA1; Fri, 3 Sep 2010 19:07:30 +0400 (MSD) Received: from [93.80.226.53] (account aesok@post.ru HELO Vista.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPA id 252341104; Fri, 03 Sep 2010 19:07:30 +0400 Date: Fri, 3 Sep 2010 19:07:41 +0400 From: Anatoly Sokolov Message-ID: <1557246000.20100903190741@post.ru> To: gcc-patches@gcc.gnu.org CC: nickc@redhat.com Subject: [M32R] Hookize FUNCTION_VALUE, LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P MIME-Version: 1.0 X-IsSubscribed: yes 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 Hello. This patch removes obsolete FUNCTION_VALUE, LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P macros from M32R back end in the GCC and introduces equivalent TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE and TARGET_FUNCTION_VALUE_REGNO_P target hooks.  Regression tested on m32r-unknown-elf. OK to install? * config/m32r/m32r.c (m32r_function_value, m32r_libcall_value, m32r_function_value_regno_p): New functions. (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Declare. * config/m32r/m32r.h: (FUNCTION_VALUE, LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove. Anatoly. Index: gcc/config/m32r/m32r.c =================================================================== --- gcc/config/m32r/m32r.c (revision 163821) +++ gcc/config/m32r/m32r.c (working copy) @@ -82,6 +82,9 @@ static void m32r_encode_section_info (tree, rtx, int); static bool m32r_in_small_data_p (const_tree); static bool m32r_return_in_memory (const_tree, const_tree); +static rtx m32r_function_value (const_tree, const_tree, bool); +static rtx m32r_libcall_value (enum machine_mode, const_rtx); +static bool m32r_function_value_regno_p (const unsigned int); static void m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); static void init_idents (void); @@ -158,6 +161,14 @@ #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY m32r_return_in_memory + +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE m32r_function_value +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE m32r_libcall_value +#undef TARGET_FUNCTION_VALUE_REGNO_P +#define TARGET_FUNCTION_VALUE_REGNO_P m32r_function_value_regno_p + #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS m32r_setup_incoming_varargs #undef TARGET_MUST_PASS_IN_STACK @@ -1246,6 +1257,35 @@ return m32r_pass_by_reference (NULL, TYPE_MODE (type), type, false); } +/* Worker function for TARGET_FUNCTION_VALUE. */ + +static rtx +m32r_function_value (const_tree valtype, + const_tree fn_decl_or_type ATTRIBUTE_UNUSED, + bool outgoing ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (TYPE_MODE (valtype), 0); +} + +/* Worker function for TARGET_LIBCALL_VALUE. */ + +static rtx +m32r_libcall_value (enum machine_mode mode, + const_rtx fun ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (mode, 0); +} + +/* Worker function for TARGET_FUNCTION_VALUE_REGNO_P. + + ??? What about r1 in DI/DF values. */ + +static bool +m32r_function_value_regno_p (const unsigned int regno) +{ + return (regno == 0); +} + /* Do any needed setup for a variadic function. For the M32R, we must create a register parameter block, and then copy any anonymous arguments in registers to memory. Index: gcc/config/m32r/m32r.h =================================================================== --- gcc/config/m32r/m32r.h (revision 163821) +++ gcc/config/m32r/m32r.h (working copy) @@ -855,21 +855,6 @@ /* Function results. */ -/* Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - 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), 0) - -/* 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, 0) - -/* 1 if N is a possible register number for a function value - as seen by the caller. */ -/* ??? What about r1 in DI/DF values. */ -#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) - /* Tell GCC to use TARGET_RETURN_IN_MEMORY. */ #define DEFAULT_PCC_STRUCT_RETURN 0