From patchwork Fri Oct 8 13:58:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 67214 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 06DF9B70B8 for ; Sat, 9 Oct 2010 01:01:27 +1100 (EST) Received: (qmail 10106 invoked by alias); 8 Oct 2010 13:59:14 -0000 Received: (qmail 9832 invoked by uid 22791); 8 Oct 2010 13:59:10 -0000 X-SWARE-Spam-Status: No, hits=-1.8 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:59:01 +0000 Received: (qmail 31540 invoked from network); 8 Oct 2010 13:58:59 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Oct 2010 13:58:59 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: nickc@redhat.com Subject: [mcore] hookize FUNCTION_ARG &co. Date: Fri, 8 Oct 2010 09:58:58 -0400 Message-Id: <1286546338-17925-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 mcore backend. Nothing special here. Tested by inspection with cross to mcore-elf. I plan to commit this under the obvious rule after waiting a week for comments/approval. * config/mcore/mcore-protos.h (mcore_function_arg): Delete. * config/mcore/mcore.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/mcore/mcore.c (mcore_function_arg): Declare. Make static. Take a const_tree and a bool. (mcore_function_arg_advance): New function. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. --- gcc/config/mcore/mcore-protos.h | 3 --- gcc/config/mcore/mcore.c | 26 ++++++++++++++++++++++---- gcc/config/mcore/mcore.h | 12 ------------ 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h index 2093f16..b9f8f33 100644 --- a/gcc/config/mcore/mcore-protos.h +++ b/gcc/config/mcore/mcore-protos.h @@ -65,8 +65,5 @@ extern int mcore_arith_S_operand (rtx); extern const char * mcore_output_move (rtx, rtx *, enum machine_mode); extern const char * mcore_output_movedouble (rtx *, enum machine_mode); extern int const_ok_for_mcore (HOST_WIDE_INT); -#ifdef TREE_CODE -extern rtx mcore_function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int); -#endif /* TREE_CODE */ #endif /* HAVE_MACHINE_MODES */ #endif /* RTX_CODE */ diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index ce58827..482de56 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -142,6 +142,12 @@ static bool mcore_return_in_memory (const_tree, const_tree); static int mcore_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, tree, bool); +static rtx mcore_function_arg (CUMULATIVE_ARGS *, + enum machine_mode, + const_tree, bool); +static void mcore_function_arg_advance (CUMULATIVE_ARGS *, + enum machine_mode, + const_tree, bool); static void mcore_asm_trampoline_template (FILE *); static void mcore_trampoline_init (rtx, tree, rtx); static void mcore_option_override (void); @@ -213,6 +219,10 @@ static const struct attribute_spec mcore_attribute_table[] = #define TARGET_PASS_BY_REFERENCE hook_pass_by_reference_must_pass_in_stack #undef TARGET_ARG_PARTIAL_BYTES #define TARGET_ARG_PARTIAL_BYTES mcore_arg_partial_bytes +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG mcore_function_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE mcore_function_arg_advance #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS mcore_setup_incoming_varargs @@ -2812,9 +2822,9 @@ mcore_function_value (const_tree valtype, const_tree func) NPARM_REGS words is at least partially passed in a register unless its data type forbids. */ -rtx -mcore_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, - tree type, int named) +static rtx +mcore_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named) { int arg_reg; @@ -2824,7 +2834,7 @@ mcore_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, if (targetm.calls.must_pass_in_stack (mode, type)) return 0; - arg_reg = ROUND_REG (cum, mode); + arg_reg = ROUND_REG (*cum, mode); if (arg_reg < NPARM_REGS) return handle_structs_in_regs (mode, type, FIRST_PARM_REG + arg_reg); @@ -2832,6 +2842,14 @@ mcore_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, return 0; } +static void +mcore_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + *cum = (ROUND_REG (*cum, mode) + + (int)named * mcore_num_arg_regs (mode, type)); +} + /* Returns the number of bytes of argument registers required to hold *part* of a parameter of machine mode MODE and type TYPE (which may be NULL if the type is not known). If the argument fits entirely in the argument diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index 11047c9..7fad696 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -565,18 +565,6 @@ extern const enum reg_class reg_class_from_letter[]; #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ ((CUM) = 0) -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be - available.) */ -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - ((CUM) = (ROUND_REG ((CUM), (MODE)) \ - + ((NAMED) * mcore_num_arg_regs (MODE, TYPE)))) \ - -/* Define where to put the arguments to a function. */ -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - mcore_function_arg (CUM, MODE, TYPE, NAMED) - /* Call the function profiler with a given profile label. */ #define FUNCTION_PROFILER(STREAM,LABELNO) \ { \