From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60840 invoked by alias); 10 Jun 2016 16:56:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 60819 invoked by uid 89); 10 Jun 2016 16:56:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 10 Jun 2016 16:56:45 +0000 Received: by mail-wm0-f47.google.com with SMTP id k204so501122wmk.0 for ; Fri, 10 Jun 2016 09:56:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=WhFpgun6WXIZFt6dA3plKbk7WcrsbhbTJVqVTdfCjgc=; b=krG0ZemgLDKRXDEv5ZTWbBs2nvqR6dk5Kx7Ck0MK9CuLEBkF6X5UHlYzTEg0oLmynh niKOhB2EAkt8S1yF3RG5kDSxx3qBWtUHb4WZtQOQGUE9IJ2RG/07S7lgHBruIVH/IOK6 tb3fBRQAB/tOwiXwDSibINwnQRGXPJhZfZJzdwGTf202L3KrcMoGF1yDsUzArb00Btxp qJjnulpK+HbaiE45HEumJjY1ZvEuRnmKw/uCR6kguUO+BcqTgNEEFDp4yHFqCxT40M9I RYgFszY4nC0ts/WGVpysAjsIiyOZD+pVnvqd7gXtic/IGwOwhDE+mF2pHTU9lOEXoa3w SVSA== X-Gm-Message-State: ALyK8tL9DrC3rlf/CpOrNKDawltzbd4Ke9AJJ9R8gjvEMSQ8DsiFuDd/7GKau1bz92E4JQ== X-Received: by 10.28.63.134 with SMTP id m128mr15025wma.97.1465577802298; Fri, 10 Jun 2016 09:56:42 -0700 (PDT) Received: from localhost (host81-147-175-48.range81-147.btcentralplus.com. [81.147.175.48]) by smtp.gmail.com with ESMTPSA id r6sm31738wme.14.2016.06.10.09.56.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jun 2016 09:56:41 -0700 (PDT) From: Andrew Burgess To: gcc-patches@gcc.gnu.org Cc: Andrew Burgess Subject: [PATCH 1/2] gcc: Remove unneeded global flag. Date: Fri, 10 Jun 2016 16:56:00 -0000 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00828.txt.bz2 The global flag `user_defined_section_attribute' is set while parsing C code when the section attribute is encountered. The flag is set when anything has the section attribute applied to it, functions or data. The only place this global was used was within the gate function for partitioning blocks (pass_partition_blocks::gate), however, the partitioning is done during compilation, while the flag is set earlier, during the parsing. The flag is then cleared again during the final compilation pass. The result is that if any function or data has a section attribute then the flag will be set to true during the file parse pass. The first compiled function will then skip the partition-blocks pass, and the flag will be set back to false during the final-pass on the first function. After then, the flag is never set to true again. The guarding of the partition-blocks pass does not appear to be necessary, given that applying a section attribute correctly overrides the hot/cold section partitioning (this is taken care if in varasm.c). gcc/ChangeLog: * gcc/bb-reorder.c: Remove 'toplev.h' include. (pass_partition_blocks::gate): No longer check user_defined_section_attribute. * gcc/c-family/c-common.c (handle_section_attribute): No longer set user_defined_section_attribute. * gcc/final.c (rest_of_handle_final): Likewise. * gcc/toplev.c: Remove definition of user_defined_section_attribute. * gcc/toplev.h: Remove declaration of user_defined_section_attribute. --- gcc/ChangeLog | 12 ++++++++++++ gcc/bb-reorder.c | 4 +--- gcc/c-family/c-common.c | 2 -- gcc/final.c | 2 -- gcc/toplev.c | 5 ----- gcc/toplev.h | 5 ----- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 5fb60bd..04874da 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -106,7 +106,6 @@ #include "output.h" #include "expr.h" #include "params.h" -#include "toplev.h" /* user_defined_section_attribute */ #include "tree-pass.h" #include "cfgrtl.h" #include "cfganal.h" @@ -2889,8 +2888,7 @@ pass_partition_blocks::gate (function *fun) /* See gate_handle_reorder_blocks. We should not partition if we are going to omit the reordering. */ && optimize_function_for_speed_p (fun) - && !DECL_COMDAT_GROUP (current_function_decl) - && !user_defined_section_attribute); + && !DECL_COMDAT_GROUP (current_function_decl)); } unsigned diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 94005ff..66add18 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7617,8 +7617,6 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args, goto fail; } - user_defined_section_attribute = true; - if (!VAR_OR_FUNCTION_DECL_P (decl)) { error ("section attribute not allowed for %q+D", *node); diff --git a/gcc/final.c b/gcc/final.c index 5b04311..256ce34 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4454,8 +4454,6 @@ rest_of_handle_final (void) assemble_end_function (current_function_decl, fnname); - user_defined_section_attribute = false; - /* Free up reg info memory. */ free_reg_info (); diff --git a/gcc/toplev.c b/gcc/toplev.c index 543b8a3..868eecf 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -148,11 +148,6 @@ HOST_WIDE_INT random_seed; the support provided depends on the backend. */ rtx stack_limit_rtx; -/* True if the user has tagged the function with the 'section' - attribute. */ - -bool user_defined_section_attribute = false; - struct target_flag_state default_target_flag_state; #if SWITCHABLE_TARGET struct target_flag_state *this_target_flag_state = &default_target_flag_state; diff --git a/gcc/toplev.h b/gcc/toplev.h index 06923cf..f62a172 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -74,11 +74,6 @@ extern void target_reinit (void); /* A unique local time stamp, might be zero if none is available. */ extern unsigned local_tick; -/* True if the user has tagged the function with the 'section' - attribute. */ - -extern bool user_defined_section_attribute; - /* See toplev.c. */ extern int flag_rerun_cse_after_global_opts; -- 2.6.4