From patchwork Tue Oct 8 15:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1173387 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510475-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mrjzqxHW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46ngz62Ws6z9s7T for ; Wed, 9 Oct 2019 02:20:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:in-reply-to:message-id:date:mime-version :content-type; q=dns; s=default; b=vDkfkxt6K9GoxoAY7B9n3cHsDa/mG VCOc61KLkTjaIE8grfEYoPQNCCZMZ8XCbSq6shSY2sOzaRHaeh0Ee2xWAY/OnwOY 0okNO/+GGPIIZLMGsrsagzyVPnytEvjtxL/LsDC8Iy8LUyWuUZl0uXUG157H6WDz sTSwxXuLUNAYoY= 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:to :from:subject:in-reply-to:message-id:date:mime-version :content-type; s=default; bh=HOAtTOBOuAAfI+cOIPU59V0HNJs=; b=mrj zqxHWY8mSM7U8wht+Alj6tMMaUCyusdrXDdMX8iTUSsrg0tPiqmK1YxVopTJyUoV y/Jnj463gXl1psz9/ryrhVboBA9JdxDHBuHwyHzXuJ9Xs/Eesukg5WXf9bXQkejO inYsBnxApA5RHQ80aaqUdN5lwlPxRh3rh6yirhPQ= Received: (qmail 99271 invoked by alias); 8 Oct 2019 15:20:40 -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 99205 invoked by uid 89); 8 Oct 2019 15:20:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 15:20:37 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3BA0D1570 for ; Tue, 8 Oct 2019 08:20:36 -0700 (PDT) Received: from [10.2.206.37] (e107157-lin.cambridge.arm.com [10.2.206.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 016A03F68E for ; Tue, 8 Oct 2019 08:20:35 -0700 (PDT) To: gcc-patches From: "Andre Vieira (lists)" Subject: [Patch 1/2][ipa] Add target hook to sanitize cloned declaration's attributes In-Reply-To: Message-ID: <78b498f6-b5bd-1a59-5ec7-1883e31ea633@arm.com> Date: Tue, 8 Oct 2019 16:20:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, This patch adds a new target hook called TARGET_HOOK_SANITIZE_CLONE_ATTRIBUTES. This hook is meant to give each target the ability to sanitize a cloned's declaration attribute list. Is this OK for trunk? Cheers, Andre gcc/ChangeLog: 2019-10-08 Andre Vieira * ipa-cp.c(create_specialized_node): Call new target hook when creating a new node. * target.def(sanitize_clone_attributes): New target hook. * targhooks.c(default_sanitize_clone_attributes): New. * targhooks.h(default_sanitize_clone_attributes): New. * doc/tm.texi.in: Document new target hook. * doc/tm.texi: Regenerated diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index a86c210d4fe390bd0356b6e50ba7c6c34a36239a..5c1149ccf47576d8d803d1ab712f6f1b9342d74c 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12039,6 +12039,11 @@ If defined, this function returns an appropriate alignment in bits for an atomic ISO C11 requires atomic compound assignments that may raise floating-point exceptions to raise exceptions corresponding to the arithmetic operation whose result was successfully stored in a compare-and-exchange sequence. This requires code equivalent to calls to @code{feholdexcept}, @code{feclearexcept} and @code{feupdateenv} to be generated at appropriate points in the compare-and-exchange sequence. This hook should set @code{*@var{hold}} to an expression equivalent to the call to @code{feholdexcept}, @code{*@var{clear}} to an expression equivalent to the call to @code{feclearexcept} and @code{*@var{update}} to an expression equivalent to the call to @code{feupdateenv}. The three expressions are @code{NULL_TREE} on entry to the hook and may be left as @code{NULL_TREE} if no code is required in a particular place. The default implementation leaves all three expressions as @code{NULL_TREE}. The @code{__atomic_feraiseexcept} function from @code{libatomic} may be of use as part of the code generated in @code{*@var{update}}. @end deftypefn +@deftypefn {Target Hook} void TARGET_SANITIZE_CLONE_ATTRIBUTES (struct cgraph_node *@var{}) +This target hook sanitizes the cloned @code{*@var{node}} declaration +attributes. +@end deftypefn + @deftypefn {Target Hook} void TARGET_RECORD_OFFLOAD_SYMBOL (tree) Used when offloaded functions are seen in the compilation unit and no named sections are available. It is called once for each symbol that must be diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 06dfcda35abea7396c288a59c38ee4ef57c6fef6..f4ef164a595ca1c2e286a7d26020b63b4c966728 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -8134,6 +8134,8 @@ and the associated definitions of those functions. @hook TARGET_ATOMIC_ASSIGN_EXPAND_FENV +@hook TARGET_SANITIZE_CLONE_ATTRIBUTES + @hook TARGET_RECORD_OFFLOAD_SYMBOL @hook TARGET_OFFLOAD_OPTIONS diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index b4fb74e097e2c9f80aa38f8e150be593200d9bdf..9c2154fa78d59873243fc7d7717fb9cab83101ac 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -124,6 +124,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-ccp.h" #include "stringpool.h" #include "attribs.h" +#include "target.h" template class ipcp_value; @@ -4017,6 +4018,9 @@ create_specialized_node (struct cgraph_node *node, ipcp_discover_new_direct_edges (new_node, known_csts, known_contexts, aggvals); callers.release (); + + targetm.sanitize_clone_attributes (new_node); + return new_node; } diff --git a/gcc/target.def b/gcc/target.def index f9446fa05a22c79154c2ef36d3d8aea48a5efcc6..18301565e5131fa8b2f194bc73aa0c55d30cb9ef 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -6582,6 +6582,13 @@ DEFHOOK void, (tree *hold, tree *clear, tree *update), default_atomic_assign_expand_fenv) +DEFHOOK +(sanitize_clone_attributes, +"This target hook sanitizes the cloned @code{*@var{node}} declaration\n\ +attributes.", +void, (struct cgraph_node *), +default_sanitize_clone_attributes) + /* Leave the boolean fields at the end. */ /* True if we can create zeroed data by switching to a BSS section diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 5aba67660f85406b9fd475e75a3cc65b0d1952f5..0191d0ed36eb60fc79bf718b9782ef6c99c77fc4 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -284,4 +284,6 @@ extern rtx default_speculation_safe_value (machine_mode, rtx, rtx, rtx); extern void default_remove_extra_call_preserved_regs (rtx_insn *, HARD_REG_SET *); +extern void default_sanitize_clone_attributes (struct cgraph_node *); + #endif /* GCC_TARGHOOKS_H */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index ed77afb1da57e59bc0725dc0d6fac477391bae03..35d2114956bd27f250335d918d0b3d81d962472b 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -2120,6 +2120,12 @@ default_atomic_assign_expand_fenv (tree *, tree *, tree *) { } +/* Default implementation of TARGET_SANITIZE_CLONE_ATTRIBUTES. */ + +void default_sanitize_clone_attributes (struct cgraph_node *node) +{ +} + #ifndef PAD_VARARGS_DOWN #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN #endif