public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: gcc-patches@gcc.gnu.org, joseph@codesourcery.com,
	polacek@redhat.com, jason@redhat.com, nathan@acm.org,
	richard.sandiford@arm.com
Subject: Re: [C][C++] Allow targets to check calls to BUILT_IN_MD functions
Date: Fri, 20 Sep 2019 22:52:00 -0000	[thread overview]
Message-ID: <58ef7e24-c392-b7b4-a479-f4b3ef71da97@redhat.com> (raw)
In-Reply-To: <mptd0fz3rlz.fsf@arm.com>

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  <richard.sandiford@arm.com>
> 
> 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

      reply	other threads:[~2019-09-20 22:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 14:49 Richard Sandiford
2019-09-20 22:52 ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58ef7e24-c392-b7b4-a479-f4b3ef71da97@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=nathan@acm.org \
    --cc=polacek@redhat.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).