From patchwork Fri Oct 8 13:58:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 67213 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 E38DAB70CD for ; Sat, 9 Oct 2010 01:01:11 +1100 (EST) Received: (qmail 9827 invoked by alias); 8 Oct 2010 13:59:10 -0000 Received: (qmail 9552 invoked by uid 22791); 8 Oct 2010 13:59:07 -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:57 +0000 Received: (qmail 31523 invoked from network); 8 Oct 2010 13:58:55 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Oct 2010 13:58:55 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Subject: [h8300] hookize FUNCTION_ARG &co. Date: Fri, 8 Oct 2010 09:58:54 -0400 Message-Id: <1286546334-17863-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 h8300 backend. Nothing special here. Tested by inspection with cross to h8300-elf. I plan to commit this under the obvious rule after waiting a week for comments/approval. * config/h8300/h8300-protos.h (function_arg): Delete. * config/h8300/h8300.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/h8300/h8300.c (function_arg): Rename to... (h8300_function_arg): ...this. Make static. Take a const_tree and a bool. (h8300_function_arg_advance): New function. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. --- gcc/config/h8300/h8300-protos.h | 2 -- gcc/config/h8300/h8300.c | 31 +++++++++++++++++++++++++++---- gcc/config/h8300/h8300.h | 29 ----------------------------- 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index 7bf8ba3..676b3b7 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -89,8 +89,6 @@ extern int h8300_ldm_stm_parallel (rtvec, int, int); #endif /* RTX_CODE */ #ifdef TREE_CODE -extern struct rtx_def *function_arg (CUMULATIVE_ARGS *, - enum machine_mode, tree, int); extern int h8300_funcvec_function_p (tree); extern int h8300_eightbit_data_p (tree); extern int h8300_tiny_data_p (tree); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 551e354..23689a2 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1096,11 +1096,14 @@ h8300_pr_saveall (struct cpp_reader *pfile ATTRIBUTE_UNUSED) /* If the next function argument with MODE and TYPE is to be passed in a register, return a reg RTX for the hard register in which to pass the argument. CUM represents the state after the last argument. - If the argument is to be pushed, NULL_RTX is returned. */ + If the argument is to be pushed, NULL_RTX is returned. -rtx -function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) + On the H8/300 all normal args are pushed, unless -mquickcall in which + case the first 3 arguments are passed in registers. */ + +static rtx +h8300_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named) { static const char *const hand_list[] = { "__main", @@ -1164,6 +1167,20 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, return result; } + +/* 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.) */ + +static void +h8300_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + cum->nbytes += (mode != BLKmode + ? (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD + : (int_size_in_bytes (type) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD); +} + /* Compute the cost of an and insn. */ @@ -5916,6 +5933,12 @@ h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt) #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY h8300_return_in_memory +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG h8300_function_arg + +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE h8300_function_arg_advance + #undef TARGET_MACHINE_DEPENDENT_REORG #define TARGET_MACHINE_DEPENDENT_REORG h8300_reorg diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 7d7437f..1df8f36 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -610,35 +610,6 @@ struct cum_arg #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ ((CUM).nbytes = 0, (CUM).libcall = LIBNAME) -/* 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).nbytes += ((MODE) != BLKmode \ - ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \ - : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD)) - -/* Define where to put the arguments to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). */ - -/* On the H8/300 all normal args are pushed, unless -mquickcall in which - case the first 3 arguments are passed in registers. - See function `function_arg'. */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - function_arg (&CUM, MODE, TYPE, NAMED) - /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */