From patchwork Thu Aug 17 09:49:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 110305 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1958691qge; Thu, 17 Aug 2017 02:51:00 -0700 (PDT) X-Received: by 10.84.224.197 with SMTP id k5mr3086121pln.195.1502963460767; Thu, 17 Aug 2017 02:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502963460; cv=none; d=google.com; s=arc-20160816; b=zPQsj/AEDgL8h7lkU826e1kVsHQpkiNPm3ONQG9UjbuUa02fAPCzUSyIT3EOGALBpZ n2g8kVTFpIL/VJ3ITGoAzuUEwfawb6i1wcMDmqFQuKyM2Xy0T1lDOtB7N/6G03HfZXr8 oNXEm0vImIGQPU+vQs2WhbBV+H+QUYiVp6Ro6BEbff6OIS0S/F3Wm7x0Nf1/LqKA6GW8 VWKR/dVGKDxIMKycm8JSv/66swTxw8gMvPcLa+u/+OpvvyU40bI8SYbPp9zj/L1tsi6i QRYsfs3d76V4/CtveYUZIQg+bHUVxXM65HRVR+dAHZ6zO+QiDd7ebUr0Z/9qTdoVGvQb iOXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=28ukr4kGErdw4Qprarj9Q8x2aedt2ox5icZwjiOySzw=; b=ALjvVUe0vrPhYD4oX3u2LoerEBiJNzv908IS8Gmh9/yBviDMH/Chj1k4hPr+iwEMK+ e666Qz2p4KdooLz1GVDVWRR5d5u+8eZo2vGfj3AuGdMfUnhcIYpblVYBRL8b9wG6tmJt yYuCPRqlxtIC5AzEh2l5T+q+iUVHFSs0fV7bWpcwf+hDfi0CeGTP2bJ9ANsFFMB7l5Am 3y6ZY2Xp8/0bOTnm2BRFidYe8vT9WvPPf273bJj8zAbWodoEDIh2/vR0gZkzJL7QKl3E iP91diBjdZCbbJivtOPMwBH5NuZanvOnpkjrEgMNPVbu+PpKE+PLm7TOKB4B9Uq1VtPb g6nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=srOu+Lkd; spf=pass (google.com: domain of gcc-patches-return-460487-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460487-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w74si1885976pfi.469.2017.08.17.02.51.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2017 02:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-460487-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=srOu+Lkd; spf=pass (google.com: domain of gcc-patches-return-460487-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460487-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=twkY1rpioTESmm+iWlRptp4NkZFGs7MrcaCPotpUB6AYCcP115nLj uVfRJ+dtIt2aY2CC+IBxzWHravueGWsep73AJwbqWCEFxpkllxwaUdT7WYvy3Q2j 4AAhGZXIGNkL4NN6s8HrkF7oiRnOt5G/RQKsSd23v69TnhxNPQ5WWU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=tb79tQlNdyqX1DJazvTXuCTwa50=; b=srOu+LkdWtxGWJeTd5JU VpSL4wjoIhyhfjUuPCL5XCQA3AoqK9MHgMx4zzMlSXNX7F8Mpe953DTQdDIFgcNj lTSsaveNufi77leM2MhWzA7Za4BOop9BjfgzWYCMmkMf5nXj+wSayotEYxK/pc5Q QmHvWXWZYVAQ3ez5PYbHbu4= Received: (qmail 102770 invoked by alias); 17 Aug 2017 09:50:03 -0000 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 Received: (qmail 102416 invoked by uid 89); 17 Aug 2017 09:50:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Aug 2017 09:49:59 +0000 Received: by mail-wr0-f169.google.com with SMTP id y96so35444283wrc.1 for ; Thu, 17 Aug 2017 02:49:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=28ukr4kGErdw4Qprarj9Q8x2aedt2ox5icZwjiOySzw=; b=gK5oJSNszm7ixZPD3GnzLGZ21cTwXc9Uzs2GNk4cTINx4gD+egF5TRZh9kufa+j1km GCCm6JtbwPiPXYgz70s41+OAsjVQHJgbRJeLyt+NKjjSqB4dIkCzDVwB0Y3zhXgWwukf H14ruDp5igR4PRom1C/ole4CfV0Pev23igMorsM3SM1D5Jq4qLJSC+5qa6cbEi39RLpw vQvdg8TEFNvibCf8IoSW9xR8nc1InpKIRT0sMf2K2HeJu0BnUR/XNeup/lDc8F71zXed i95d4xlkk9PshslnQMGGem2VixSoshzd+YiCLoHwKdSvKBdTmTEAV7wdgoKGnyAxWf9g CrZQ== X-Gm-Message-State: AHYfb5hJyGc9SjPL2UOBsVKAeTUlvmm1rwmLTv9Opo1znYKxUG5VyMZN 9qCninN2hlU+wR9Rm2lU/w== X-Received: by 10.223.161.131 with SMTP id u3mr2853511wru.44.1502963396751; Thu, 17 Aug 2017 02:49:56 -0700 (PDT) Received: from localhost (92.40.248.210.threembb.co.uk. [92.40.248.210]) by smtp.gmail.com with ESMTPSA id 23sm3335125wrz.8.2017.08.17.02.49.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Aug 2017 02:49:56 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Improve ECF_NOTHROW flags for direct internal functions Date: Thu, 17 Aug 2017 10:49:54 +0100 Message-ID: <87k222frr1.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Internal functions that map directly to an optab can only throw an exception for -fnon-call-exceptions. This patch handles that in internal_fn_flags, in a similar way to ATTR_*NOTHROW in builtins.def. (Functions that don't throw even for flag_non_call_exceptions should be explicitly marked ECF_NOTHROW in internal-fn.def.) Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard 2017-08-17 Richard Sandiford gcc/ * internal-fn.h (internal_fn_flags): Just declare and move the actual implementation out-of-line to... * internal-fn.c (internal_fn_flags): ...here. Set ECF_NOTHROW for directly-mapped internal functions if !flag_non_call_exceptions. Index: gcc/internal-fn.h =================================================================== --- gcc/internal-fn.h 2017-02-23 19:54:03.000000000 +0000 +++ gcc/internal-fn.h 2017-08-17 09:05:37.459968561 +0100 @@ -107,15 +107,7 @@ internal_fn_name (enum internal_fn fn) return internal_fn_name_array[(int) fn]; } -/* Return the ECF_* flags for function FN. */ - -extern const int internal_fn_flags_array[]; - -static inline int -internal_fn_flags (enum internal_fn fn) -{ - return internal_fn_flags_array[(int) fn]; -} +extern int internal_fn_flags (enum internal_fn fn); /* Return fnspec for function FN. */ Index: gcc/internal-fn.c =================================================================== --- gcc/internal-fn.c 2017-08-10 14:36:07.453493083 +0100 +++ gcc/internal-fn.c 2017-08-17 09:05:37.459968561 +0100 @@ -2814,3 +2814,18 @@ expand_PHI (internal_fn, gcall *) { gcc_unreachable (); } + +/* Return the ECF_* flags for function FN. */ + +int +internal_fn_flags (enum internal_fn fn) +{ + int flags = internal_fn_flags_array[(int) fn]; + /* Functions that map to optabs can only throw a catchable exception + when non-call exceptions are enabled. The non-call exceptions in + these cases will typically come from things like IEEE exceptions, + divide by zero errors and SEGVs. */ + if (direct_internal_fn_p (fn) && !flag_non_call_exceptions) + flags |= ECF_NOTHROW; + return flags; +}