From patchwork Tue Aug 31 16:43:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 63292 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 E0698B714B for ; Wed, 1 Sep 2010 02:44:09 +1000 (EST) Received: (qmail 26077 invoked by alias); 31 Aug 2010 16:44:07 -0000 Received: (qmail 26064 invoked by uid 22791); 31 Aug 2010 16:44:05 -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; Tue, 31 Aug 2010 16:43:59 +0000 Received: (qmail 583 invoked from network); 31 Aug 2010 16:43:57 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 31 Aug 2010 16:43:57 -0000 Date: Tue, 31 Aug 2010 09:43:57 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: richard.earnshaw@arm.com Subject: [arm] hookize FUNCTION_ARG &co. Message-ID: <20100831164357.GA16898@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 arm backend. There's the almost-standard assortment of const-ization hunks scattered throughout. Tested on arm-eabi, no new non-format related errors. I plan to commit this as obvious after waiting a week for comments. -Nathan * config/arm/arm-protos.h (arm_function_arg_advance): Delete. (arm_function_arg): Delete. (arm_needs_doubleword_align): Take a const_tree. * config/arm/arm.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/arm/arm.c (aapcs_select_call_coproc): Take a const_tree. (aapcs_layout_arg, arm_needs_doubleword_align): Likewise. (arm_function_arg): Make static. Take a const_tree and a bool. (arm_function_arg_advance): Likewise. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index cd29ef1..79c11e2 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -153,13 +153,10 @@ extern unsigned int arm_sync_loop_insns (rtx , rtx *); extern bool arm_output_addr_const_extra (FILE *, rtx); #if defined TREE_CODE -extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); -extern void arm_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, - tree, bool); extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree); extern bool arm_pad_arg_upward (enum machine_mode, const_tree); extern bool arm_pad_reg_upward (enum machine_mode, tree, int); -extern bool arm_needs_doubleword_align (enum machine_mode, tree); +extern bool arm_needs_doubleword_align (enum machine_mode, const_tree); #endif extern int arm_apply_result_size (void); extern rtx aapcs_libcall_value (enum machine_mode); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 5ed16a8..203404f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -164,6 +164,10 @@ static void emit_constant_insn (rtx cond, rtx pattern); static rtx emit_set_insn (rtx, rtx); static int arm_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, tree, bool); +static rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static void arm_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree, const_tree); static int aapcs_select_return_coproc (const_tree, const_tree); @@ -377,6 +381,10 @@ static const struct attribute_spec arm_attribute_table[] = #define TARGET_PASS_BY_REFERENCE arm_pass_by_reference #undef TARGET_ARG_PARTIAL_BYTES #define TARGET_ARG_PARTIAL_BYTES arm_arg_partial_bytes +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG arm_function_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE arm_function_arg_advance #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS arm_setup_incoming_varargs @@ -4181,7 +4189,7 @@ static struct static int aapcs_select_call_coproc (CUMULATIVE_ARGS *pcum, enum machine_mode mode, - tree type) + const_tree type) { int i; @@ -4293,7 +4301,7 @@ aapcs_libcall_value (enum machine_mode mode) numbers referred to here are those in the AAPCS. */ static void aapcs_layout_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { int nregs, nregs2; int ncrn; @@ -4458,7 +4466,7 @@ arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype, /* Return true if mode/type need doubleword alignment. */ bool -arm_needs_doubleword_align (enum machine_mode mode, tree type) +arm_needs_doubleword_align (enum machine_mode mode, const_tree type) { return (GET_MODE_ALIGNMENT (mode) > PARM_BOUNDARY || (type && TYPE_ALIGN (type) > PARM_BOUNDARY)); @@ -4476,11 +4484,17 @@ arm_needs_doubleword_align (enum machine_mode mode, tree type) 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). */ + (otherwise it is an extra parameter matching an ellipsis). -rtx + On the ARM, normally the first 16 bytes are passed in registers r0-r3; all + other arguments are passed on the stack. If (NAMED == 0) (which happens + only in assign_parms, since TARGET_SETUP_INCOMING_VARARGS is + defined), say it is passed in the stack (function_prologue will + indeed make it pass in the stack if necessary). */ + +static rtx arm_function_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { int nregs; @@ -4553,9 +4567,13 @@ arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode, return 0; } -void +/* Update the data in PCUM 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 arm_function_arg_advance (CUMULATIVE_ARGS *pcum, enum machine_mode mode, - tree type, bool named) + const_tree type, bool named) { if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL) { diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 9730417..5b66510 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1737,27 +1737,6 @@ typedef struct MACHMODE aapcs_vfp_rmode; } 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). - - On the ARM, normally the first 16 bytes are passed in registers r0-r3; all - other arguments are passed on the stack. If (NAMED == 0) (which happens - only in assign_parms, since TARGET_SETUP_INCOMING_VARARGS is - defined), say it is passed in the stack (function_prologue will - indeed make it pass in the stack if necessary). */ -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - arm_function_arg (&(CUM), (MODE), (TYPE), (NAMED)) - #define FUNCTION_ARG_PADDING(MODE, TYPE) \ (arm_pad_arg_upward (MODE, TYPE) ? upward : downward) @@ -1776,12 +1755,6 @@ typedef struct #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ arm_init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL)) -/* 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) \ - arm_function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED)) - /* If defined, a C expression that gives the alignment boundary, in bits, of an argument with the specified mode and type. If it is not defined, `PARM_BOUNDARY' is used for all arguments. */