From patchwork Sun Sep 18 09:07:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Torbjorn SVENSSON X-Patchwork-Id: 1678971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=E6EDnckU; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MVhnK2P56z1yp7 for ; Sun, 18 Sep 2022 19:08:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED0F6382A7CA for ; Sun, 18 Sep 2022 09:08:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED0F6382A7CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663492125; bh=b+K+ZdpXE4k2eWRt0P+ZJqWyN9wJ4z9ntzOxHSLB80Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=E6EDnckUh5tDYZ/rD4ok3+gUt9aqE+yHAAWeHbIQkTQX5j5nVJPWQ3fjExlg/ZLvt Q+ooLLt9ErkKjEJfpsUJOZ9VIgJ6JO0g7VYpjzC1F43/SqQJjJq8XZLsMTSD0k090B t/2KbCH2tvqmAgbCAcdocJTXMBJxRTl20I+XaHOg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 32602382B1B3 for ; Sun, 18 Sep 2022 09:08:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32602382B1B3 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28HNP6Xd022592 for ; Sun, 18 Sep 2022 11:08:22 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3jn6atcjwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 18 Sep 2022 11:08:22 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 36FDD10002A for ; Sun, 18 Sep 2022 11:08:21 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 41DAC215120 for ; Sun, 18 Sep 2022 11:08:21 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.75.127.46) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Sun, 18 Sep 2022 11:08:18 +0200 To: Subject: [PATCH] Improve sorry message for -fzero-call-used-regs Date: Sun, 18 Sep 2022 11:07:09 +0200 Message-ID: <20220918090708.4014343-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-18_06,2022-09-16_01,2022-06-22_01 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Gcc-patches?= From: Torbjorn SVENSSON Reply-To: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= Cc: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" When the -fzero-call-used-regs command line option is used with an unsupported value, indicate that it's a value problem instead of an option problem. Without the patch, the error is: In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5: gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo': gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: '-fzero-call-used-regs' not supported on this target 10 | } | ^ With the patch, the error would be like this: In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5: gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo': gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: Argument 'all-arg' is not supported for '-fzero-call-used-regs' on this target 10 | } | ^ 2022-09-18 Torbjörn SVENSSON gcc/ChangeLog: * targhooks.cc (default_zero_call_used_regs): Improve sorry message. Signed-off-by: Torbjörn SVENSSON --- gcc/targhooks.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc index b15ae19bcb6..8bfbc1d18f6 100644 --- a/gcc/targhooks.cc +++ b/gcc/targhooks.cc @@ -93,6 +93,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple.h" #include "cfgloop.h" #include "tree-vectorizer.h" +#include "options.h" bool default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, @@ -1181,9 +1182,21 @@ default_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs) static bool issued_error; if (!issued_error) { + const char *name = NULL; + for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL; + ++i) + if (flag_zero_call_used_regs == zero_call_used_regs_opts[i].flag) + { + name = zero_call_used_regs_opts[i].name; + break; + } + + if (!name) + name = ""; + issued_error = true; - sorry ("%qs not supported on this target", - "-fzero-call-used-regs"); + sorry ("Argument %qs is not supported for %qs on this target", + name, "-fzero-call-used-regs"); } }