From patchwork Wed Apr 20 20:17:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 92315 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 A1746B6FD3 for ; Thu, 21 Apr 2011 06:18:18 +1000 (EST) Received: (qmail 5246 invoked by alias); 20 Apr 2011 20:18:16 -0000 Received: (qmail 5161 invoked by uid 22791); 20 Apr 2011 20:17:55 -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; Wed, 20 Apr 2011 20:17:41 +0000 Received: (qmail 5606 invoked from network); 20 Apr 2011 20:17:41 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 Apr 2011 20:17:41 -0000 Date: Wed, 20 Apr 2011 16:17:32 -0400 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: kkojima@gcc.gnu.org Subject: [PATCH] use build_function_type_list in the sh backend Message-ID: <20110420201732.GS6507@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 As $SUBJECT suggests. The only tricky bit is the initialization of `args' to NULL_TREEs so that we can safely pass all of the relevant args to build_function_type_list, regardless of whether the function type in question has that many args. Tested with cross to sh-elf. OK to commit? -Nathan * config/sh/sh.c (sh_media_init_builtins): Call build_function_type_list instead of build_function_type. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 78f6f0f..0f158d5 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -11222,6 +11222,7 @@ sh_media_init_builtins (void) else { int has_result = signature_args[signature][0] != 0; + tree args[3]; if ((signature_args[signature][1] & 8) && (((signature_args[signature][1] & 1) && TARGET_SHMEDIA32) @@ -11230,7 +11231,8 @@ sh_media_init_builtins (void) if (! TARGET_FPU_ANY && FLOAT_MODE_P (insn_data[d->icode].operand[0].mode)) continue; - type = void_list_node; + for (i = 0; i < (int) ARRAY_SIZE (args); i++) + args[i] = NULL_TREE; for (i = 3; ; i--) { int arg = signature_args[signature][i]; @@ -11248,9 +11250,10 @@ sh_media_init_builtins (void) arg_type = void_type_node; if (i == 0) break; - type = tree_cons (NULL_TREE, arg_type, type); + args[i-1] = arg_type; } - type = build_function_type (arg_type, type); + type = build_function_type_list (arg_type, args[0], args[1], + args[2], NULL_TREE); if (signature < SH_BLTIN_NUM_SHARED_SIGNATURES) shared[signature] = type; }