From patchwork Thu Dec 15 16:07:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 88190 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp882384qgi; Thu, 15 Dec 2016 08:10:43 -0800 (PST) X-Received: by 10.84.216.6 with SMTP id m6mr4111814pli.130.1481818243385; Thu, 15 Dec 2016 08:10:43 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e92si3143696pld.136.2016.12.15.08.10.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Dec 2016 08:10:43 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444532-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; spf=pass (google.com: domain of gcc-patches-return-444532-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444532-patch=linaro.org@gcc.gnu.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 :subject:to:references:message-id:date:mime-version:in-reply-to :content-type; q=dns; s=default; b=eHmvNHTqprkIQg7lHxHUF+A6nlhIC tWUP6lMmpZuX6PNCUy2qUEChkLbZXmu+E9GP2niTe2vLX5l7tgtIpfqTl/yi6UWR QVcNbQVj6b/wW0YicnOcaW7JjZ7mekB+RVPLlMwfWSJBmnA3mWv4nVp976enYA8N WcUqD90adr43E4= 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 :subject:to:references:message-id:date:mime-version:in-reply-to :content-type; s=default; bh=tQsDsSdBd1twU34kF5BNhYoU3/g=; b=Nqz Co0eVaiMfMD2XZfrz88fFhjXNY539jKOdt2IGZiePRtWhNXA0eiXdEvpVoRutEB1 07OzZBmWdfzPaPuU4WscEQuacZoKMmSswH/YaGHJ2mUg8raxTUkQz8RzBE/8iD1e Fr8BixF5VPaDUex44ImVwYBIBj96JJ6HMVr15r6M= Received: (qmail 42873 invoked by alias); 15 Dec 2016 16:07:53 -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 42763 invoked by uid 89); 15 Dec 2016 16:07:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=collector, apparent, xxx X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Dec 2016 16:07:48 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5101F1516; Thu, 15 Dec 2016 08:07:47 -0800 (PST) Received: from e105689-lin.cambridge.arm.com (e105689-lin.cambridge.arm.com [10.2.207.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 025FA3F445 for ; Thu, 15 Dec 2016 08:07:46 -0800 (PST) From: "Richard Earnshaw (lists)" Subject: [PATCH 18/21] [arm] Use cl_target_options for configuring the active target. To: gcc-patches@gcc.gnu.org References: Message-ID: Date: Thu, 15 Dec 2016 16:07:45 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: It now becomes apparent that it would be better to use the the cl_target_options as the basis for calling arm_configure_build_target; it already contains exactly the same fields that we need. I chose not to rewrite the earlier patches as that would make the progression of changes seem less logical than it currently is, with several early changes having no immediate justification. * arm-protos.h (arm_configure_build_target): Change second argument to cl_target_options. * arm.c (arm_configure_build_target): Likewise. (arm_option_restore): Update accordingly. (arm_option_override): Create the target_option_default_node before calling arm_configure_build_target. Use it in call of latter. Resynchronize after all other overrides have been calculated. (arm_valid_target_attribute_tree): Use the target options for reconfiguration. Resynchronize after performing override checks. * arm-c.c (arm_pragma_target_parse): Use target optiosn from cur_tree to reconfigure the build target. --- gcc/config/arm/arm-c.c | 3 ++- gcc/config/arm/arm-protos.h | 2 +- gcc/config/arm/arm.c | 36 ++++++++++++++++++++++++------------ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c index 9dd9a8d..b57af69 100644 --- a/gcc/config/arm/arm-c.c +++ b/gcc/config/arm/arm-c.c @@ -243,7 +243,8 @@ arm_pragma_target_parse (tree args, tree pop_target) /* handle_pragma_pop_options and handle_pragma_reset_options will set target_option_current_node, but not handle_pragma_target. */ target_option_current_node = cur_tree; - arm_configure_build_target (&arm_active_target, &global_options, + arm_configure_build_target (&arm_active_target, + TREE_TARGET_OPTION (cur_tree), &global_options_set, false); } diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index da3484f..d418ca9 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -225,7 +225,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 gcc_options *, + struct cl_target_option *, struct gcc_options *, bool); extern void arm_pr_long_calls (struct cpp_reader *); extern void arm_pr_no_long_calls (struct cpp_reader *); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 676c78b..df520e5 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -2936,16 +2936,17 @@ arm_override_options_after_change_1 (struct gcc_options *opts) static void arm_override_options_after_change (void) { - arm_configure_build_target (&arm_active_target, &global_options, + arm_configure_build_target (&arm_active_target, + TREE_TARGET_OPTION (target_option_default_node), &global_options_set, false); arm_override_options_after_change_1 (&global_options); } static void -arm_option_restore (struct gcc_options *opts, struct cl_target_option *ptr) +arm_option_restore (struct gcc_options *, struct cl_target_option *ptr) { - arm_configure_build_target (&arm_active_target, opts, &global_options_set, + arm_configure_build_target (&arm_active_target, ptr, &global_options_set, false); } @@ -3070,7 +3071,7 @@ static sbitmap isa_quirkbits; architecture have been specified, but the two are not identical. */ void arm_configure_build_target (struct arm_build_target *target, - struct gcc_options *opts, + struct cl_target_option *opts, struct gcc_options *opts_set, bool warn_compatible) { @@ -3306,7 +3307,13 @@ arm_option_override (void) gcc_assert (ok); } - arm_configure_build_target (&arm_active_target, &global_options, + /* Create the default target_options structure. We need this early + to configure the overall build target. */ + target_option_default_node = target_option_current_node + = build_target_option_node (&global_options); + + arm_configure_build_target (&arm_active_target, + TREE_TARGET_OPTION (target_option_default_node), &global_options_set, true); #ifdef SUBTARGET_OVERRIDE_OPTIONS @@ -3657,14 +3664,12 @@ arm_option_override (void) arm_option_check_internal (&global_options); arm_option_params_internal (); + /* Resynchronize the saved target options. */ + cl_target_option_save (TREE_TARGET_OPTION (target_option_default_node), + &global_options); /* Register global variables with the garbage collector. */ arm_add_gc_roots (); - /* Save the initial options in case the user does function specific - options or #pragma target. */ - target_option_default_node = target_option_current_node - = build_target_option_node (&global_options); - /* Init initial mode for testing. */ thumb_flipper = TARGET_THUMB; } @@ -30326,15 +30331,22 @@ tree arm_valid_target_attribute_tree (tree args, struct gcc_options *opts, struct gcc_options *opts_set) { + tree t; + if (!arm_valid_target_attribute_rec (args, opts)) return NULL_TREE; - arm_configure_build_target (&arm_active_target, opts, opts_set, false); + t = build_target_option_node (opts); + arm_configure_build_target (&arm_active_target, TREE_TARGET_OPTION (t), + opts_set, false); arm_option_check_internal (opts); /* Do any overrides, such as global options arch=xxx. */ arm_option_override_internal (opts, opts_set); - return build_target_option_node (opts); + /* Resynchronize the saved target options. */ + cl_target_option_save (TREE_TARGET_OPTION (t), opts); + + return t; } static void