From patchwork Thu Oct 28 20:44:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 69498 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 D63FAB70A5 for ; Fri, 29 Oct 2010 07:45:10 +1100 (EST) Received: (qmail 20977 invoked by alias); 28 Oct 2010 20:45:04 -0000 Received: (qmail 20871 invoked by uid 22791); 28 Oct 2010 20:45:01 -0000 X-SWARE-Spam-Status: No, hits=-1.8 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; Thu, 28 Oct 2010 20:44:56 +0000 Received: (qmail 22561 invoked from network); 28 Oct 2010 20:44:54 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Oct 2010 20:44:54 -0000 Date: Thu, 28 Oct 2010 16:44:52 -0400 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: eager@eagercon.com Subject: [microblaze] hookize FUNCTION_ARG &co. Message-ID: <20101028204451.GW6758@nightcrawler> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-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 hookize FUNCTION_ARG and related macros for the microblaze target. Not much different than the 30+ other targets that have gone before. Tested by inspection with a cross to microblaze-elf. I plan on committing this under the obvious rule after waiting a week for comments. -Nathan * config/microblaze/microblaze-protos.h (function_arg): Delete. (function_arg_advance): Delete. * config/microblaze/microblaze.h (FUNCTION_ARG_ADVANCE): Delete. (FUNCTION_ARG): Delete. * config/microblaze/microblaze.c (function_arg_advance): Rename to... (microblaze_function_arg_advance): ...this. Make static. Take a const_tree and a bool. (function-arg): Rename to... (microblaze_function_arg): ...this. Make static. Take a const_tree and a bool. (microblaze_expand_prologue): Call targetm.calls.function_arg and targetm.calls.function_arg_advance. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. Index: config/microblaze/microblaze-protos.h =================================================================== --- config/microblaze/microblaze-protos.h (revision 166032) +++ config/microblaze/microblaze-protos.h (working copy) @@ -52,12 +52,6 @@ extern void microblaze_declare_object (F extern void microblaze_asm_output_ident (FILE *, const char *); #endif /* RTX_CODE */ -#ifdef TREE_CODE -extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, - tree, int); -extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); -#endif /* TREE_CODE */ - /* Declare functions in microblaze-c.c. */ extern void microblaze_cpp_define (struct cpp_reader *); Index: config/microblaze/microblaze.c =================================================================== --- config/microblaze/microblaze.c (revision 166032) +++ config/microblaze/microblaze.c (working copy) @@ -1088,9 +1088,9 @@ init_cumulative_args (CUMULATIVE_ARGS * /* Advance the argument to the next argument position. */ -void -function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode, - tree type, int named ATTRIBUTE_UNUSED) +static void +microblaze_function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) { cum->arg_number++; switch (mode) @@ -1143,9 +1143,10 @@ function_arg_advance (CUMULATIVE_ARGS * /* Return an RTL expression containing the register for the given mode, or 0 if the argument is to be passed on the stack. */ -rtx -function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode, - tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) +static rtx +microblaze_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode, + const_tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) { rtx ret; int regbase = -1; @@ -2268,7 +2269,8 @@ microblaze_expand_prologue (void) passed_mode = Pmode; } - entry_parm = FUNCTION_ARG (args_so_far, passed_mode, passed_type, 1); + entry_parm = targetm.calls.function_arg (&args_so_far, passed_mode, + passed_type, true); if (entry_parm) { @@ -2288,7 +2290,8 @@ microblaze_expand_prologue (void) break; } - FUNCTION_ARG_ADVANCE (args_so_far, passed_mode, passed_type, 1); + targetm.calls.function_arg_advance (&args_so_far, passed_mode, + passed_type, true); next_arg = TREE_CHAIN (cur_arg); if (next_arg == 0) @@ -2302,7 +2305,8 @@ microblaze_expand_prologue (void) /* Split parallel insn into a sequence of insns. */ - next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1); + next_arg_reg = targetm.calls.function_arg (&args_so_far, VOIDmode, + void_type_node, true); if (next_arg_reg != 0 && GET_CODE (next_arg_reg) == PARALLEL) { rtvec adjust = XVEC (next_arg_reg, 0); @@ -2999,6 +3003,12 @@ microblaze_adjust_cost (rtx insn ATTRIBU #undef TARGET_ARG_PARTIAL_BYTES #define TARGET_ARG_PARTIAL_BYTES function_arg_partial_bytes +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG microblaze_function_arg + +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE microblaze_function_arg_advance + #undef TARGET_CAN_ELIMINATE #define TARGET_CAN_ELIMINATE microblaze_can_eliminate Index: config/microblaze/microblaze.h =================================================================== --- config/microblaze/microblaze.h (revision 166032) +++ config/microblaze/microblaze.h (working copy) @@ -500,12 +500,6 @@ typedef struct microblaze_args #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \ init_cumulative_args (&CUM, FNTYPE, LIBNAME) -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - function_arg_advance (&CUM, MODE, TYPE, NAMED) - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - function_arg( &CUM, MODE, TYPE, NAMED) - #define NO_PROFILE_COUNTERS 1 #define FUNCTION_PROFILER(FILE, LABELNO) { \