From patchwork Thu May 27 09:59:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Earnshaw X-Patchwork-Id: 1484527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: 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=b/MgL0ZU; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FrNbG1GbDz9sTD for ; Thu, 27 May 2021 19:59:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B7086384601D; Thu, 27 May 2021 09:59:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7086384601D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1622109588; bh=W9xzapvfHRrV1FnhJ1K1iMaAax7AruQIEgzUlT8bgc8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=b/MgL0ZUleqBdBZZB1ue76QgKVGRQXhT+9efsZyoxOfRk7RFMy6P9nWv+lb1YFbp9 loYs6ZcsCb3CAys8lkyFO5CeoAFX42a6vnmuMFGtTLxwlXNROTzi6XitB9Pbf56D6/ l6iQr3qi+Y12Hc7OHB3M3zVzz86f3iIaMhlO9KE8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 72BC23857026 for ; Thu, 27 May 2021 09:59:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 72BC23857026 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 BC95113A1; Thu, 27 May 2021 02:59:45 -0700 (PDT) Received: from e126323.arm.com (unknown [10.57.7.111]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3DC6F3F73D; Thu, 27 May 2021 02:59:45 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [committed] arm: Remove use of opts_set in arm_configure_build_target [PR100767] Date: Thu, 27 May 2021 10:59:35 +0100 Message-Id: <20210527095935.3381950-1-rearnsha@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Richard Earnshaw via Gcc-patches From: Richard Earnshaw Reply-To: Richard Earnshaw Cc: Richard Earnshaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The variable global_options_set is a reflection of which options have been explicitly set from the command line in the structure global_options. But it doesn't describe the contents of a cl_target_option. cl_target_option is a set of options to apply and once configured should represent a viable set of options without needing to know which were explicitly set by the user. Unfortunately arm_configure_build_target was incorrectly conflating the two. Fortunately, however, we do not really need to know this since the various override_options functions should have sanitized the target_options values before constructing a cl_target_option structure. It is safe, therefore, to simply drop this parameter to arm_configure_build_target and rely on checking that various string parameters are non-null before dereferencing them. gcc: PR target/100767 * config/arm/arm.c (arm_configure_build_target): Remove parameter opts_set, directly check opts parameters for being non-null. (arm_option_restore): Update call to arm_configure_build_target. (arm_option_override): Likewise. (arm_can_inline_p): Likewise. (arm_valid_target_attribute_tree): Likewise. * config/arm/arm-c.c (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (arm_configure_build_target): Adjust prototype. --- gcc/config/arm/arm-c.c | 3 +-- gcc/config/arm/arm-protos.h | 3 +-- gcc/config/arm/arm.c | 23 ++++++++++------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c index 7f97b843f92..ae2139c4bfa 100644 --- a/gcc/config/arm/arm-c.c +++ b/gcc/config/arm/arm-c.c @@ -408,8 +408,7 @@ arm_pragma_target_parse (tree args, tree pop_target) target_option_current_node, but not handle_pragma_target. */ target_option_current_node = cur_tree; arm_configure_build_target (&arm_active_target, - TREE_TARGET_OPTION (cur_tree), - &global_options_set, false); + TREE_TARGET_OPTION (cur_tree), false); } /* Update macros if target_node changes. The global state will be restored diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index ffccaa77377..9b1f61394ad 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -243,8 +243,7 @@ extern bool arm_change_mode_p (tree); extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *, struct gcc_options *); extern void arm_configure_build_target (struct arm_build_target *, - struct cl_target_option *, - struct gcc_options *, bool); + struct cl_target_option *, bool); extern void arm_option_reconfigure_globals (void); extern void arm_options_perform_arch_sanity_checks (void); extern void arm_pr_long_calls (struct cpp_reader *); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 9377aaef342..7b37e1b602c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3054,9 +3054,10 @@ arm_override_options_after_change (void) /* Implement TARGET_OPTION_RESTORE. */ static void arm_option_restore (struct gcc_options */* opts */, - struct gcc_options *opts_set, struct cl_target_option *ptr) + struct gcc_options */* opts_set */, + struct cl_target_option *ptr) { - arm_configure_build_target (&arm_active_target, ptr, opts_set, false); + arm_configure_build_target (&arm_active_target, ptr, false); } /* Reset options between modes that the user has specified. */ @@ -3179,7 +3180,6 @@ static sbitmap isa_quirkbits; void arm_configure_build_target (struct arm_build_target *target, struct cl_target_option *opts, - struct gcc_options *opts_set, bool warn_compatible) { const cpu_option *arm_selected_tune = NULL; @@ -3194,7 +3194,7 @@ arm_configure_build_target (struct arm_build_target *target, target->core_name = NULL; target->arch_name = NULL; - if (opts_set->x_arm_arch_string) + if (opts->x_arm_arch_string) { arm_selected_arch = arm_parse_arch_option_name (all_architectures, "-march", @@ -3202,7 +3202,7 @@ arm_configure_build_target (struct arm_build_target *target, arch_opts = strchr (opts->x_arm_arch_string, '+'); } - if (opts_set->x_arm_cpu_string) + if (opts->x_arm_cpu_string) { arm_selected_cpu = arm_parse_cpu_option_name (all_cores, "-mcpu", opts->x_arm_cpu_string); @@ -3212,7 +3212,7 @@ arm_configure_build_target (struct arm_build_target *target, options for tuning. */ } - if (opts_set->x_arm_tune_string) + if (opts->x_arm_tune_string) { arm_selected_tune = arm_parse_cpu_option_name (all_cores, "-mtune", opts->x_arm_tune_string); @@ -3476,8 +3476,7 @@ arm_option_override (void) } cl_target_option_save (&opts, &global_options, &global_options_set); - arm_configure_build_target (&arm_active_target, &opts, &global_options_set, - true); + arm_configure_build_target (&arm_active_target, &opts, true); #ifdef SUBTARGET_OVERRIDE_OPTIONS SUBTARGET_OVERRIDE_OPTIONS; @@ -32982,10 +32981,8 @@ arm_can_inline_p (tree caller, tree callee) caller_target.isa = sbitmap_alloc (isa_num_bits); callee_target.isa = sbitmap_alloc (isa_num_bits); - arm_configure_build_target (&caller_target, caller_opts, &global_options_set, - false); - arm_configure_build_target (&callee_target, callee_opts, &global_options_set, - false); + arm_configure_build_target (&caller_target, caller_opts, false); + arm_configure_build_target (&callee_target, callee_opts, false); if (!bitmap_subset_p (callee_target.isa, caller_target.isa)) can_inline = false; @@ -33121,7 +33118,7 @@ arm_valid_target_attribute_tree (tree args, struct gcc_options *opts, return NULL_TREE; cl_target_option_save (&cl_opts, opts, opts_set); - arm_configure_build_target (&arm_active_target, &cl_opts, opts_set, false); + arm_configure_build_target (&arm_active_target, &cl_opts, false); arm_option_check_internal (opts); /* Do any overrides, such as global options arch=xxx. We do this since arm_active_target was overridden. */