From patchwork Fri Oct 8 13:58:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 67207 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 7D595B70CB for ; Sat, 9 Oct 2010 01:00:18 +1100 (EST) Received: (qmail 9015 invoked by alias); 8 Oct 2010 13:58:55 -0000 Received: (qmail 8754 invoked by uid 22791); 8 Oct 2010 13:58:50 -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:42 +0000 Received: (qmail 31136 invoked from network); 8 Oct 2010 13:58:40 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Oct 2010 13:58:40 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: ni1d@arrl.net Subject: [pdp11] hookize FUNCTION_ARG &co. Date: Fri, 8 Oct 2010 09:58:38 -0400 Message-Id: <1286546318-17636-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 pdp11 backend. Nothing special here. Not entirely sure what target to use to test this, but the changes are trivial. I plan to commit this under the obvious rule after waiting a week for comments/approval. * config/pdp11/pdp11.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/pdp11/pdp11.c (pdp11_function_arg): New function. (pdp11_function_arg_advance): New function. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. --- gcc/config/pdp11/pdp11.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ gcc/config/pdp11/pdp11.h | 34 -------------------------------- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 2812e95..651b0cc 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -157,6 +157,10 @@ static rtx pdp11_function_value (const_tree, const_tree, bool); static rtx pdp11_libcall_value (enum machine_mode, const_rtx); static bool pdp11_function_value_regno_p (const unsigned int); static void pdp11_trampoline_init (rtx, tree, rtx); +static rtx pdp11_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static void pdp11_function_arg_advance (CUMULATIVE_ARGS *, + enum machine_mode, const_tree, bool); /* Initialize the GCC target structure. */ #undef TARGET_ASM_BYTE_OP @@ -189,6 +193,11 @@ static void pdp11_trampoline_init (rtx, tree, rtx); #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS pdp11_rtx_costs +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG pdp11_function_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE pdp11_function_arg_advance + #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY pdp11_return_in_memory @@ -1834,3 +1843,42 @@ pdp11_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) emit_move_insn (mem, GEN_INT (0x0058)); emit_move_insn (mem, fnaddr); } + +/* Worker function for TARGET_FUNCTION_ARG. + + Determine where to put an argument 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). */ + +static rtx +pdp11_function_arg (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) +{ + return NULL_RTX; +} + +/* Worker function for TARGET_FUNCTION_ARG_ADVANCE. + + 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 +pdp11_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + *cum += (mode != BLKmode + ? GET_MODE_SIZE (mode) + : int_size_in_bytes (type)); +} diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index a1a96a1..2904acd 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -468,40 +468,6 @@ extern int current_first_parm_offset; #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) += ((MODE) != BLKmode \ - ? (GET_MODE_SIZE (MODE)) \ - : (int_size_in_bytes (TYPE)))) - -/* Determine where to put an argument 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) 0 - -/* Define where a function finds its arguments. - This would be different from FUNCTION_ARG if we had register windows. */ -/* -#define FUNCTION_INCOMING_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. */