From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100967 invoked by alias); 20 Sep 2019 22:52:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 100958 invoked by uid 89); 20 Sep 2019 22:52:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=cptreeh, nonoverloaded, UD:tm.texi.in, tmtexiin X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Sep 2019 22:52:26 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7117218C890D; Fri, 20 Sep 2019 22:52:25 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-52.rdu2.redhat.com [10.10.112.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD3E05D9C3; Fri, 20 Sep 2019 22:52:20 +0000 (UTC) Subject: Re: [C][C++] Allow targets to check calls to BUILT_IN_MD functions To: gcc-patches@gcc.gnu.org, joseph@codesourcery.com, polacek@redhat.com, jason@redhat.com, nathan@acm.org, richard.sandiford@arm.com References: From: Jeff Law Openpgp: preference=signencrypt Message-ID: <58ef7e24-c392-b7b4-a479-f4b3ef71da97@redhat.com> Date: Fri, 20 Sep 2019 22:52:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg01276.txt.bz2 On 9/17/19 8:49 AM, Richard Sandiford wrote: > For SVE, we'd like the frontends to check calls to target-specific > built-in functions in the same way that they already do for "normal" > builtins. This patch adds a target hook for that and extends > check_builtin_function_arguments accordingly. > > A slight complication is that when TARGET_RESOLVE_OVERLOADED_BUILTIN > has resolved an overload, it can use build_function_call_vec to build > the call to the underlying non-overloaded function decl. This in > turn coerces the arguments to the function type and then calls > check_builtin_function_arguments to check the final call. If the > target does find a problem in this final call, it can be useful > to refer to the original overloaded function decl in diagnostics, > since that's what the user wrote. The patch therefore passes the > original decl as a final optional parameter to build_function_call_vec. > > Tested on aarch64-linux-gnu and x86_64-linux-gnu. Also tested with the > follow-on SVE changes that make use of this. OK to install? > > Richard > > > 2019-09-17 Richard Sandiford > > gcc/ > * target.def (check_builtin_call): New target hook. > * doc/tm.texi.in (TARGET_CHECK_BUILTIN_CALL): New @hook. > * doc/tm.texi: Regenerate. > > gcc/c-family/ > * c-common.h (build_function_call_vec): Take the original > function decl as an optional final parameter. > (check_builtin_function_arguments): Take the original function decl. > * c-common.c (check_builtin_function_arguments): Likewise. > Handle all built-in functions, not just BUILT_IN_NORMAL ones. > Use targetm.check_builtin_call to check BUILT_IN_MD functions. > > gcc/c/ > * c-typeck.c (build_function_call_vec): Take the original function > decl as an optional final parameter. Pass all built-in calls to > check_builtin_function_arguments. > > gcc/cp/ > * cp-tree.h (build_cxx_call): Take the original function decl > as an optional final parameter. > (cp_build_function_call_vec): Likewise. > * call.c (build_cxx_call): Likewise. Pass all built-in calls to > check_builtin_function_arguments. > * typeck.c (build_function_call_vec): Take the original function > decl as an optional final parameter and pass it to > cp_build_function_call_vec. > (cp_build_function_call_vec): Take the original function > decl as an optional final parameter and pass it to build_cxx_call. LGTM. jeff