From patchwork Thu Aug 15 15:44:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 1147676 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-507070-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=foss.arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NSk6cUiz"; 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 468W3P5SD5z9sNm for ; Fri, 16 Aug 2019 01:44:31 +1000 (AEST) 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:message-id:date:mime-version:content-type; q=dns; s=default; b=CmYpyaM5GoNgxRe0bxVka/KgIasCSlNEDn3tiJ1mDpb937PDqV AFZMqKZzb3FRDnZk/UcYb1Jn9ZJNNql0w25V2/jTWptp5Az7Kms0srGmw60gZjJ/ whvuTn3Hw59V6M1+YmyPLIvVBW5gohw6bsJN/1eAoSqRzWpIehgi7pBq0= 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:message-id:date:mime-version:content-type; s= default; bh=agF1sTRClheB+tIjraomVZXVLiw=; b=NSk6cUizGqATjHToGy2x NtvCjtPcpmWT58oWzClW7o1nEqgKlYHZwlJZQE72RbRtJOHZONeI8qHUQejSFN4r GCsIkbFUnXKRwnViYn3sWDnUQcMqCb02dEfykqK4nuZe619+sWSOGkHUC9vtjzJl TDCK0F2xNoKRjwdyZ/pALyM= Received: (qmail 73363 invoked by alias); 15 Aug 2019 15:44:23 -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 73343 invoked by uid 89); 15 Aug 2019 15:44:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 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; Thu, 15 Aug 2019 15:44:15 +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 DE7E628 for ; Thu, 15 Aug 2019 08:44:13 -0700 (PDT) Received: from [10.2.206.47] (e120808-lin.cambridge.arm.com [10.2.206.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D38A3F706 for ; Thu, 15 Aug 2019 08:44:13 -0700 (PDT) To: "gcc-patches@gcc.gnu.org" From: Kyrill Tkachov Subject: [PATCH][gensupport] PR 91255: Do not error out immediately on set_attr_alternative with define_subst Message-ID: <12c86354-4874-e0bd-9599-39bad9398b74@foss.arm.com> Date: Thu, 15 Aug 2019 16:44:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 Hi all, I'm trying to add a define_subst use in the arm backend but am getting many build errors complaining about: `set_attr_alternative' is unsupported by `define_subst' Looking at the gensupport.c code it iterates over all define_insns and errors if any of them have set_attr_alternative. The usecase I'm targetting doesn't involve patterns with set_attr_alternative, so I would like to make the define_subst handling more robust to only error out if the define_subst is actually attempted on a set_attr_alternative. This patch produces the error only if the set_attr_alternative attr matches the subst name. This allows a build of the arm backend with a define_subst usage to succeed. Bootstrapped and tested on arm-none-linux-gnueabihf and x86_64-linux-gnu. Ok for trunk? Thanks, Kyrill 2019-08-15  Kyrylo Tkachov      PR other/91255     * gensupport.c (has_subst_attribute): Error out on set_attr_alternative     only if subst_name matches curr_attr string. diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 1aab7119901..c64f683bc5c 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -788,9 +788,10 @@ has_subst_attribute (class queue_elem *elem, class queue_elem *subst_elem) return false; case SET_ATTR_ALTERNATIVE: - error_at (elem->loc, - "%s: `set_attr_alternative' is unsupported by " - "`define_subst'", XSTR (elem->data, 0)); + if (strcmp (XSTR (cur_attr, 0), subst_name) == 0) + error_at (elem->loc, + "%s: `set_attr_alternative' is unsupported by " + "`define_subst'", XSTR (elem->data, 0)); return false;