From patchwork Fri Oct 8 13:58:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 67210 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 F0F02B6EF7 for ; Sat, 9 Oct 2010 01:00:37 +1100 (EST) Received: (qmail 9356 invoked by alias); 8 Oct 2010 13:59:04 -0000 Received: (qmail 9059 invoked by uid 22791); 8 Oct 2010 13:58:57 -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; Fri, 08 Oct 2010 13:58:46 +0000 Received: (qmail 31456 invoked from network); 8 Oct 2010 13:58:44 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Oct 2010 13:58:44 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: dj@redhat.com Subject: [mep] hookize FUNCTION_ARG &co. Date: Fri, 8 Oct 2010 09:58:43 -0400 Message-Id: <1286546323-17698-1-git-send-email-froydnj@codesourcery.com> 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 The patch below hookizes FUNCTION_ARG and related macros for the mep backend. Nothing special here. Tested by inspection with cross to mep-elf. I plan to commit this under the obvious rule after waiting a week for comments/approval. * config/mep/mep-protos.h (mep_function_arg): Delete. (mep_function_arg_advance): Delete. * config/mep/mep.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/mep/mep.c (mep_function_arg): Make static. Take a const_tree and a bool. (mep_function_arg_advance): Likewise. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. --- gcc/config/mep/mep-protos.h | 2 -- gcc/config/mep/mep.c | 37 ++++++++++++++++++++++++++----------- gcc/config/mep/mep.h | 11 ----------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/gcc/config/mep/mep-protos.h b/gcc/config/mep/mep-protos.h index 4ab86b5..c8a0b9b 100644 --- a/gcc/config/mep/mep-protos.h +++ b/gcc/config/mep/mep-protos.h @@ -75,8 +75,6 @@ extern void mep_print_operand_address (FILE *, rtx); extern void mep_print_operand (FILE *, rtx, int); extern void mep_final_prescan_insn (rtx, rtx *, int); extern void mep_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree); -extern rtx mep_function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int); -extern void mep_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern bool mep_return_in_memory (const_tree, const_tree); extern rtx mep_function_value (tree, tree); extern rtx mep_libcall_value (enum machine_mode); diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 712abbe..daa56c8 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -216,6 +216,10 @@ static void mep_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); static bool mep_pass_by_reference (CUMULATIVE_ARGS * cum, enum machine_mode, const_tree, bool); +static rtx mep_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static void mep_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); static bool mep_vector_mode_supported_p (enum machine_mode); static bool mep_handle_option (size_t, const char *, int); static rtx mep_allocate_initial_value (rtx); @@ -3717,23 +3721,29 @@ mep_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype, pcum->vliw = 0; } -rtx -mep_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, - tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) +/* The ABI is thus: Arguments are in $1, $2, $3, $4, stack. Arguments + larger than 4 bytes are passed indirectly. Return value in 0, + unless bigger than 4 bytes, then the caller passes a pointer as the + first arg. For varargs, we copy $1..$4 to the stack. */ + +static rtx +mep_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) { /* VOIDmode is a signal for the backend to pass data to the call expander via the second operand to the call pattern. We use this to determine whether to use "jsr" or "jsrv". */ if (mode == VOIDmode) - return GEN_INT (cum.vliw); + return GEN_INT (cum->vliw); /* If we havn't run out of argument registers, return the next. */ - if (cum.nregs < 4) + if (cum->nregs < 4) { if (type && TARGET_IVC2 && VECTOR_TYPE_P (type)) - return gen_rtx_REG (mode, cum.nregs + 49); + return gen_rtx_REG (mode, cum->nregs + 49); else - return gen_rtx_REG (mode, cum.nregs + 1); + return gen_rtx_REG (mode, cum->nregs + 1); } /* Otherwise the argument goes on the stack. */ @@ -3762,10 +3772,11 @@ mep_pass_by_reference (CUMULATIVE_ARGS * cum ATTRIBUTE_UNUSED, return true; } -void -mep_arg_advance (CUMULATIVE_ARGS *pcum, - enum machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) +static void +mep_function_arg_advance (CUMULATIVE_ARGS *pcum, + enum machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) { pcum->nregs += 1; } @@ -7405,6 +7416,10 @@ mep_asm_init_sections (void) #define TARGET_SETUP_INCOMING_VARARGS mep_setup_incoming_varargs #undef TARGET_PASS_BY_REFERENCE #define TARGET_PASS_BY_REFERENCE mep_pass_by_reference +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG mep_function_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE mep_function_arg_advance #undef TARGET_VECTOR_MODE_SUPPORTED_P #define TARGET_VECTOR_MODE_SUPPORTED_P mep_vector_mode_supported_p #undef TARGET_HANDLE_OPTION diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h index ad2cf30..07f0c85 100644 --- a/gcc/config/mep/mep.h +++ b/gcc/config/mep/mep.h @@ -499,14 +499,6 @@ extern unsigned int mep_selected_isa; -/* The ABI is thus: Arguments are in $1, $2, $3, $4, stack. Arguments - larger than 4 bytes are passed indirectly. Return value in 0, - unless bigger than 4 bytes, then the caller passes a pointer as the - first arg. For varargs, we copy $1..$4 to the stack. */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - mep_function_arg (CUM, MODE, TYPE, NAMED) - #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1 typedef struct @@ -518,9 +510,6 @@ typedef struct #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ mep_init_cumulative_args (& (CUM), FNTYPE, LIBNAME, FNDECL) -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - mep_arg_advance (& (CUM), MODE, TYPE, NAMED) - #define FUNCTION_ARG_REGNO_P(REGNO) \ (((REGNO) >= 1 && (REGNO) <= 4) \ || ((REGNO) >= FIRST_CR_REGNO + 1 \