From patchwork Fri Aug 27 14:56:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 62858 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 35D62B7101 for ; Sat, 28 Aug 2010 00:56:59 +1000 (EST) Received: (qmail 10708 invoked by alias); 27 Aug 2010 14:56:56 -0000 Received: (qmail 10695 invoked by uid 22791); 27 Aug 2010 14:56:54 -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, 27 Aug 2010 14:56:49 +0000 Received: (qmail 32097 invoked from network); 27 Aug 2010 14:56:47 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Aug 2010 14:56:47 -0000 Date: Fri, 27 Aug 2010 07:56:47 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: bernds@codesourcery.com Subject: [bfin] hookize FUNCTION_ARG &co. Message-ID: <20100827145647.GU16898@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 The patch below hookizes FUNCTION_ARG and related macros for the bfin backend. Straightforward compared to i386/mips/rs6000. Tested by compiling for bfin-elf. I don't have a test board, so I can't say whether things still work, but the changes are pretty simple. I plan to commit this under the obvious rule after waiting a week for comments. -Nathan * config/bfin/bfin-protos.h (function_arg, function_arg_advance): Delete. * config/bfin/bfin.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/bfin/bfin.c (function_arg_advance): Rename to... (bfin_function_arg_advance): ...this. Make static. Take const_tree and bool arguments. (function_arg): Rename to... (bfin_function_arg): ...this. Make static. Take const_tree and bool arguments. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h index 4a9b7a1..e4c2665 100644 --- a/gcc/config/bfin/bfin-protos.h +++ b/gcc/config/bfin/bfin-protos.h @@ -65,8 +65,6 @@ #define Mmode enum machine_mode -extern rtx function_arg (CUMULATIVE_ARGS *, Mmode, tree, int); -extern void function_arg_advance (CUMULATIVE_ARGS *, Mmode, tree, int); extern bool function_arg_regno_p (int); extern const char *output_load_immediate (rtx *); diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index d0a1396..87861fb 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -1907,9 +1907,9 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, of mode MODE and data type TYPE. (TYPE is null for libcalls where that information may not be available.) */ -void -function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, - int named ATTRIBUTE_UNUSED) +static void +bfin_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) { int count, bytes, words; @@ -1946,9 +1946,9 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, NAMED is nonzero if this argument is a named parameter (otherwise it is an extra parameter matching an ellipsis). */ -struct rtx_def * -function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, - int named ATTRIBUTE_UNUSED) +static rtx +bfin_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) { int bytes = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode); @@ -6611,6 +6611,12 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, #undef TARGET_ARG_PARTIAL_BYTES #define TARGET_ARG_PARTIAL_BYTES bfin_arg_partial_bytes +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG bfin_function_arg + +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE bfin_function_arg_advance + #undef TARGET_PASS_BY_REFERENCE #define TARGET_PASS_BY_REFERENCE bfin_pass_by_reference diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index e6e2aae..5d1aca0 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -839,22 +839,6 @@ typedef struct { int call_cookie; /* Do special things for this call */ } CUMULATIVE_ARGS; -/* 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). */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - (function_arg (&CUM, MODE, TYPE, NAMED)) - #define FUNCTION_ARG_REGNO_P(REGNO) function_arg_regno_p (REGNO) @@ -864,12 +848,6 @@ typedef struct { #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT, N_NAMED_ARGS) \ (init_cumulative_args (&CUM, FNTYPE, 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) \ - (function_arg_advance (&CUM, MODE, TYPE, NAMED)) - /* 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;