From patchwork Sat Aug 28 15:39:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 62914 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 11397B711B for ; Sun, 29 Aug 2010 01:39:28 +1000 (EST) Received: (qmail 2518 invoked by alias); 28 Aug 2010 15:39:26 -0000 Received: (qmail 2506 invoked by uid 22791); 28 Aug 2010 15:39:24 -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:39:19 +0000 Received: (qmail 12683 invoked from network); 28 Aug 2010 15:39:17 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Aug 2010 15:39:17 -0000 Date: Sat, 28 Aug 2010 08:39:17 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: sterling@tensilica.com Subject: [xtensa] hookize FUNCTION_ARG &co. Message-ID: <20100828153917.GC16898@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 Xtensa backend. Nothing much to see here. Tested with xtensa-elf and comparing assembly before/after. I plan to commit this under the obvious rule after waiting a week for comments. -Nathan * config/xtensa/xtensa-protos.h (function_arg_advance): Delete. (function_arg): Delete. * config/xtensa/xtensa.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. (FUNCTION_INCOMING_ARG): Delete. * config/xtensa/xtensa.c (function_arg_advance): Rename to... (xtensa_function_arg_advance): ...this. Make static. Take a const_tree and a bool. (function_arg): Rename to... (xtensa_function_arg_1): ...this. Make static. Take a const_tree and a bool. (xtensa_function_arg, xtensa_function_incoming_arg): Nex functions. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. (TARGET_FUNCTION_INCOMING_ARG): Define. diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 729bc84..18c08d7 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -73,9 +73,6 @@ extern reg_class_t xtensa_secondary_reload (bool, rtx, reg_class_t, #endif /* RTX_CODE */ #ifdef TREE_CODE -extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree); -extern struct rtx_def *function_arg (CUMULATIVE_ARGS *, enum machine_mode, - tree, int); extern int function_arg_boundary (enum machine_mode, tree); #endif /* TREE_CODE */ diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 610a272..f81452a 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -140,6 +140,12 @@ static tree xtensa_build_builtin_va_list (void); static bool xtensa_return_in_memory (const_tree, const_tree); static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); +static void xtensa_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static rtx xtensa_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static rtx xtensa_function_incoming_arg (CUMULATIVE_ARGS *, + enum machine_mode, const_tree, bool); static rtx xtensa_function_value (const_tree, const_tree, bool); static void xtensa_init_builtins (void); static tree xtensa_fold_builtin (tree, int, tree *, bool); @@ -201,6 +207,12 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] = #define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true #undef TARGET_MUST_PASS_IN_STACK #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE xtensa_function_arg_advance +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG xtensa_function_arg +#undef TARGET_FUNCTION_INCOMING_ARG +#define TARGET_FUNCTION_INCOMING_ARG xtensa_function_incoming_arg #undef TARGET_EXPAND_BUILTIN_SAVEREGS #define TARGET_EXPAND_BUILTIN_SAVEREGS xtensa_builtin_saveregs @@ -1983,8 +1995,9 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, int incoming) /* Advance the argument to the next argument position. */ -void -function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type) +static void +xtensa_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) { int words, max; int *arg_words; @@ -2009,9 +2022,9 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type) or 0 if the argument is to be passed on the stack. INCOMING_P is nonzero if this is an incoming argument to the current function. */ -rtx -function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, - int incoming_p) +static rtx +xtensa_function_arg_1 (const CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool incoming_p) { int regbase, words, max; int *arg_words; @@ -2042,6 +2055,23 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, return gen_rtx_REG (mode, regno); } +/* Implement TARGET_FUNCTION_ARG. */ + +static rtx +xtensa_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + return xtensa_function_arg_1 (cum, mode, type, false); +} + +/* Implement TARGET_FUNCTION_INCOMING_ARG. */ + +static rtx +xtensa_function_incoming_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + return xtensa_function_arg_1 (cum, mode, type, true); +} int function_arg_boundary (enum machine_mode mode, tree type) diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 32819bc..153242a 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -618,18 +618,6 @@ typedef struct xtensa_args #define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \ init_cumulative_args (&CUM, 1) -/* 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) - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - function_arg (&CUM, MODE, TYPE, FALSE) - -#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ - function_arg (&CUM, MODE, TYPE, TRUE) - #define FUNCTION_ARG_BOUNDARY function_arg_boundary /* Profiling Xtensa code is typically done with the built-in profiling