From patchwork Sun Sep 26 07:23:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 65774 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 A2F18B70D8 for ; Sun, 26 Sep 2010 17:24:12 +1000 (EST) Received: (qmail 13550 invoked by alias); 26 Sep 2010 07:24:09 -0000 Received: (qmail 13541 invoked by uid 22791); 26 Sep 2010 07:24:07 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 26 Sep 2010 07:24:02 +0000 Received: by wyb35 with SMTP id 35so1131467wyb.20 for ; Sun, 26 Sep 2010 00:24:00 -0700 (PDT) Received: by 10.227.145.149 with SMTP id d21mr4744216wbv.149.1285485840493; Sun, 26 Sep 2010 00:24:00 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id e31sm3570228wbe.5.2010.09.26.00.23.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 26 Sep 2010 00:23:59 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [committed] Implement TARGET_BUILTIN_DECL for MIPS Date: Sun, 26 Sep 2010 08:23:54 +0100 Message-ID: <874oddc6id.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 Recent changes have brought to the fore the lack of TARGET_BUILTIN_DECL for MIPS. Tested on mips64octeon-linux-gnu and applied. Richard gcc/ * config/mips/mips.c (mips_builtin_decls): Declare. (mips_init_builtins): Store function declarations in mips_builtin_decls. (mips_builtin_decl): New function. (TARGET_BUILTIN_DECL): Define. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2010-09-26 08:05:58.000000000 +0100 +++ gcc/config/mips/mips.c 2010-09-26 08:15:01.000000000 +0100 @@ -13025,6 +13025,10 @@ static const struct mips_builtin_descrip DIRECT_NO_TARGET_BUILTIN (cache, MIPS_VOID_FTYPE_SI_CVPOINTER, cache) }; +/* Index I is the function declaration for mips_builtins[I], or null if the + function isn't defined on this target. */ +static GTY(()) tree mips_builtin_decls[ARRAY_SIZE (mips_builtins)]; + /* MODE is a vector mode whose elements have type TYPE. Return the type of the vector itself. */ @@ -13141,12 +13145,23 @@ mips_init_builtins (void) { d = &mips_builtins[i]; if (d->avail ()) - add_builtin_function (d->name, - mips_build_function_type (d->function_type), - i, BUILT_IN_MD, NULL, NULL); + mips_builtin_decls[i] + = add_builtin_function (d->name, + mips_build_function_type (d->function_type), + i, BUILT_IN_MD, NULL, NULL); } } +/* Implement TARGET_BUILTIN_DECL. */ + +static tree +mips_builtin_decl (unsigned int code, bool initialize_p ATTRIBUTE_UNUSED) +{ + if (code >= ARRAY_SIZE (mips_builtins)) + return error_mark_node; + return mips_builtin_decls[code]; +} + /* Take argument ARGNO from EXP's argument list and convert it into a form suitable for input operand OPNO of instruction ICODE. Return the value. */ @@ -16519,6 +16534,8 @@ #define TARGET_VECTORIZE_UNITS_PER_SIMD_ #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS mips_init_builtins +#undef TARGET_BUILTIN_DECL +#define TARGET_BUILTIN_DECL mips_builtin_decl #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN mips_expand_builtin