From patchwork Sat Aug 28 15:27:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 62912 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 18CACB7119 for ; Sun, 29 Aug 2010 01:27:52 +1000 (EST) Received: (qmail 32193 invoked by alias); 28 Aug 2010 15:27:49 -0000 Received: (qmail 32181 invoked by uid 22791); 28 Aug 2010 15:27:48 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 Aug 2010 15:27:42 +0000 Received: (qmail 5936 invoked from network); 28 Aug 2010 15:27:39 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Aug 2010 15:27:39 -0000 Date: Sat, 28 Aug 2010 08:27:39 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: dj@redhat.com Subject: [m32c] hookize FUNCTION_ARG &co. Message-ID: <20100828152738.GB16898@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) 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 This patch hookizes FUNCTION_ARG and related macros for the m32c backend. Another straightforward conversion. Tested with m32c-elf. I plan to check this in under the obvious rule after waiting a week for comments. -Nathan * config/m32c/m32c-protos.h (m32c_function_arg): Delete. (m32c_function_arg_advance): Delete. * config/m32c/m32c.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/m32c/m32c.c (m32c_function_arg): Make static. Adjust comments. Take a const_tree and a bool. Declare. (m32c_function_arg_advance): Likewise. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h index 3ebaa08..89d857f 100644 --- a/gcc/config/m32c/m32c-protos.h +++ b/gcc/config/m32c/m32c-protos.h @@ -46,12 +46,6 @@ int m32c_regno_ok_for_base_p (int); int m32c_trampoline_alignment (void); int m32c_trampoline_size (void); -#if defined(RTX_CODE) && defined(TREE_CODE) - -rtx m32c_function_arg (CUMULATIVE_ARGS *, MM, tree, int); - -#endif - #ifdef RTX_CODE int m32c_cannot_change_mode_class (MM, MM, int); @@ -98,7 +92,6 @@ int m32c_split_psi_p (rtx *); #ifdef TREE_CODE -void m32c_function_arg_advance (CUMULATIVE_ARGS *, MM, tree, int); tree m32c_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); void m32c_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); bool m32c_promote_function_return (const_tree); diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 34e814a..baacf17 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -73,8 +73,12 @@ static bool m32c_fixed_condition_code_regs (unsigned int *, unsigned int *); static struct machine_function *m32c_init_machine_status (void); static void m32c_insert_attributes (tree, tree *); static bool m32c_legitimate_address_p (enum machine_mode, rtx, bool); +static rtx m32_function_arg (CUMULATIVE_ARGS *, enum machine_mode + const_tree, bool); static bool m32c_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); +static void m32c_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); static bool m32c_promote_prototypes (const_tree); static int m32c_pushm_popm (Push_Pop_Type); static bool m32c_strict_argument_naming (CUMULATIVE_ARGS *); @@ -1467,10 +1471,11 @@ m32c_push_rounding (int n) /* Passing Arguments in Registers */ -/* Implements FUNCTION_ARG. Arguments are passed partly in registers, - partly on stack. If our function returns a struct, a pointer to a - buffer for it is at the top of the stack (last thing pushed). The - first few real arguments may be in registers as follows: +/* Implements TARGET_FUNCTION_ARG. Arguments are passed partly in + registers, partly on stack. If our function returns a struct, a + pointer to a buffer for it is at the top of the stack (last thing + pushed). The first few real arguments may be in registers as + follows: R8C/M16C: arg1 in r1 if it's QI or HI (else it's pushed on stack) arg2 in r2 if it's HI (else pushed on stack) @@ -1483,9 +1488,11 @@ m32c_push_rounding (int n) Note that when arg1 doesn't fit in r1, arg2 may still be passed in r2 if it fits. */ -rtx +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG m32c_function_arg +static rtx m32c_function_arg (CUMULATIVE_ARGS * ca, - enum machine_mode mode, tree type, int named) + enum machine_mode mode, const_tree type, bool named) { /* Can return a reg, parallel, or 0 for stack */ rtx rv = NULL_RTX; @@ -1558,15 +1565,17 @@ m32c_init_cumulative_args (CUMULATIVE_ARGS * ca, ca->parm_num = 1; } -/* Implements FUNCTION_ARG_ADVANCE. force_mem is set for functions - returning structures, so we always reset that. Otherwise, we only - need to know the sequence number of the argument to know what to do - with it. */ -void +/* Implements TARGET_FUNCTION_ARG_ADVANCE. force_mem is set for + functions returning structures, so we always reset that. Otherwise, + we only need to know the sequence number of the argument to know what + to do with it. */ +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE m32c_function_arg_advance +static void m32c_function_arg_advance (CUMULATIVE_ARGS * ca, enum machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, - int named ATTRIBUTE_UNUSED) + const_tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) { if (ca->force_mem) ca->force_mem = 0; diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h index 781d68c..c3775f0 100644 --- a/gcc/config/m32c/m32c.h +++ b/gcc/config/m32c/m32c.h @@ -505,9 +505,6 @@ enum reg_class /* Passing Arguments in Registers */ -#define FUNCTION_ARG(CA,MODE,TYPE,NAMED) \ - m32c_function_arg (&(CA),MODE,TYPE,NAMED) - typedef struct m32c_cumulative_args { /* For address of return value buffer (structures are returned by @@ -523,8 +520,6 @@ typedef struct m32c_cumulative_args #define CUMULATIVE_ARGS m32c_cumulative_args #define INIT_CUMULATIVE_ARGS(CA,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \ m32c_init_cumulative_args (&(CA),FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) -#define FUNCTION_ARG_ADVANCE(CA,MODE,TYPE,NAMED) \ - m32c_function_arg_advance (&(CA),MODE,TYPE,NAMED) #define FUNCTION_ARG_BOUNDARY(MODE,TYPE) (TARGET_A16 ? 8 : 16) #define FUNCTION_ARG_REGNO_P(r) m32c_function_arg_regno_p (r)