From patchwork Tue Jun 18 00:11:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1948903 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GdA+JnOC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W36cN1zPLz20XQ for ; Tue, 18 Jun 2024 10:11:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 72072388207F for ; Tue, 18 Jun 2024 00:11:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 322C33858428 for ; Tue, 18 Jun 2024 00:11:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 322C33858428 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 322C33858428 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718669472; cv=none; b=fQSV0JxTC/UBAmMRqZqLhaWZssWB1GPxQ0Zs02pGVX4K7n9wOJrahsCR4W4bSPIkRR0WhLf++eQwf7XRW//WDKBcBs5XmRlbtEX6q0LUK+SSwwDYHywsEGINSltb+FjWOi1hf7ywJfPwEjnGg3smbtnHb+EfW6PH7tnsQ1UF/5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718669472; c=relaxed/simple; bh=dhdqqXUBC1SUD2NOzWkFxxYHFov+6fKFskJtcMADd+A=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=rUTUuAmY3uiRkDk9AndnJFvxRe3yJ4cb/NfcBzAj7fVKP4oGAbstwuJxUZ93eq2bzrsO2VVO4UKV7eT5I3yVDuJUxCZoQFDw+rHf+1B36OsEpn3hDZ3bz+Ys3kn4d8CAvG13shaJ2nVutrO/IXHRGOmwHF7AJFAo1wWAT01Ov5A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718669469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XRYP5AN6HzLaPpoKj6jXS9YvCzkpPADpiBCp09xD+FM=; b=GdA+JnOCIssMcZ8PhRPzRV6JsAsr/2u17Gno0mAxm7GulRryDmZsrLPrvBfkxNFM5xKG4y G1eG6T9Nen+KfJm6A1zUwUT1oquwnVE36+kF/HYQbgvQJw7GWtfDqBtZrz+pBU3oK5hfT5 E9DWyDErZLk9OJ/oB2GWvYoRIsu+sg0= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-648-VZNkXzljO-iLcRGkRV6OWQ-1; Mon, 17 Jun 2024 20:11:07 -0400 X-MC-Unique: VZNkXzljO-iLcRGkRV6OWQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D30A319560A7 for ; Tue, 18 Jun 2024 00:11:05 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.32.27]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 36C131956052; Tue, 18 Jun 2024 00:11:04 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH] function.h: eliminate macros "dom_computed" and "n_bbs_in_dom_tree" Date: Mon, 17 Jun 2024 20:11:03 -0400 Message-Id: <20240618001103.909278-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Be explicit when we use "cfun". No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. OK for trunk? gcc/ChangeLog: * dominance.cc (compute_dom_fast_query): Replace uses of "dom_computed" macro with explicit use of cfun. (compute_dom_fast_query_in_region): Likewise. (calculate_dominance_info): Likewise, also for macro "n_bbs_in_dom_tree". (calculate_dominance_info_for_region): Likewise for "dom_computed" macro. (get_immediate_dominator): Likewise. (set_immediate_dominator): Likewise. (get_dominated_by): Likewise. (redirect_immediate_dominators): Likewise. (nearest_common_dominator): Likewise. (dominated_by_p): Likewise. (bb_dom_dfs_in): Likewise. (bb_dom_dfs_out): Likewise. (recompute_dominator): Likewise. (iterate_fix_dominators): Likewise. (add_to_dominance_info): Likewise, also for macro "n_bbs_in_dom_tree". (delete_from_dominance_info): Likewise. (set_dom_info_availability): Likewise for "dom_computed" macro. * function.h (dom_computed): Delete macro. (n_bbs_in_dom_tree): Delete macro. Signed-off-by: David Malcolm --- gcc/dominance.cc | 70 +++++++++++++++++++++++++----------------------- gcc/function.h | 3 --- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/gcc/dominance.cc b/gcc/dominance.cc index 0357210ed27f..528b38caa9db 100644 --- a/gcc/dominance.cc +++ b/gcc/dominance.cc @@ -672,7 +672,7 @@ compute_dom_fast_query (enum cdi_direction dir) gcc_checking_assert (dom_info_available_p (dir)); - if (dom_computed[dir_index] == DOM_OK) + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) return; FOR_ALL_BB_FN (bb, cfun) @@ -681,7 +681,7 @@ compute_dom_fast_query (enum cdi_direction dir) assign_dfs_numbers (bb->dom[dir_index], &num); } - dom_computed[dir_index] = DOM_OK; + cfun->cfg->x_dom_computed[dir_index] = DOM_OK; } /* Analogous to the previous function but compute the data for reducible @@ -697,7 +697,7 @@ compute_dom_fast_query_in_region (enum cdi_direction dir, gcc_checking_assert (dom_info_available_p (dir)); - if (dom_computed[dir_index] == DOM_OK) + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) return; /* Assign dfs numbers for region nodes except for entry and exit nodes. */ @@ -708,7 +708,7 @@ compute_dom_fast_query_in_region (enum cdi_direction dir, assign_dfs_numbers (bb->dom[dir_index], &num); } - dom_computed[dir_index] = DOM_OK; + cfun->cfg->x_dom_computed[dir_index] = DOM_OK; } /* The main entry point into this module. DIR is set depending on whether @@ -721,7 +721,7 @@ calculate_dominance_info (cdi_direction dir, bool compute_fast_query) { unsigned int dir_index = dom_convert_dir_to_idx (dir); - if (dom_computed[dir_index] == DOM_OK) + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) { checking_verify_dominators (dir); return; @@ -730,14 +730,14 @@ calculate_dominance_info (cdi_direction dir, bool compute_fast_query) timevar_push (TV_DOMINANCE); if (!dom_info_available_p (dir)) { - gcc_assert (!n_bbs_in_dom_tree[dir_index]); + gcc_assert (!cfun->cfg->x_n_bbs_in_dom_tree[dir_index]); basic_block b; FOR_ALL_BB_FN (b, cfun) { b->dom[dir_index] = et_new_tree (b); } - n_bbs_in_dom_tree[dir_index] = n_basic_blocks_for_fn (cfun); + cfun->cfg->x_n_bbs_in_dom_tree[dir_index] = n_basic_blocks_for_fn (cfun); dom_info di (cfun, dir); di.calc_dfs_tree (); @@ -749,7 +749,7 @@ calculate_dominance_info (cdi_direction dir, bool compute_fast_query) et_set_father (b->dom[dir_index], d->dom[dir_index]); } - dom_computed[dir_index] = DOM_NO_FAST_QUERY; + cfun->cfg->x_dom_computed[dir_index] = DOM_NO_FAST_QUERY; } else checking_verify_dominators (dir); @@ -772,7 +772,7 @@ calculate_dominance_info_for_region (cdi_direction dir, basic_block bb; unsigned int i; - if (dom_computed[dir_index] == DOM_OK) + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) return; timevar_push (TV_DOMINANCE); @@ -791,7 +791,7 @@ calculate_dominance_info_for_region (cdi_direction dir, if (basic_block d = di.get_idom (bb)) et_set_father (bb->dom[dir_index], d->dom[dir_index]); - dom_computed[dir_index] = DOM_NO_FAST_QUERY; + cfun->cfg->x_dom_computed[dir_index] = DOM_NO_FAST_QUERY; compute_dom_fast_query_in_region (dir, region); timevar_pop (TV_DOMINANCE); @@ -858,7 +858,7 @@ get_immediate_dominator (enum cdi_direction dir, basic_block bb) unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *node = bb->dom[dir_index]; - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); if (!node->father) return NULL; @@ -875,7 +875,7 @@ set_immediate_dominator (enum cdi_direction dir, basic_block bb, unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *node = bb->dom[dir_index]; - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); if (node->father) { @@ -887,8 +887,8 @@ set_immediate_dominator (enum cdi_direction dir, basic_block bb, if (dominated_by) et_set_father (node, dominated_by->dom[dir_index]); - if (dom_computed[dir_index] == DOM_OK) - dom_computed[dir_index] = DOM_NO_FAST_QUERY; + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) + cfun->cfg->x_dom_computed[dir_index] = DOM_NO_FAST_QUERY; } /* Returns the list of basic blocks immediately dominated by BB, in the @@ -900,7 +900,7 @@ get_dominated_by (enum cdi_direction dir, basic_block bb) struct et_node *node = bb->dom[dir_index], *son = node->son, *ason; auto_vec bbs; - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); if (!son) return bbs; @@ -992,7 +992,7 @@ redirect_immediate_dominators (enum cdi_direction dir, basic_block bb, bb_node = bb->dom[dir_index]; to_node = to->dom[dir_index]; - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); if (!bb_node->son) return; @@ -1005,8 +1005,8 @@ redirect_immediate_dominators (enum cdi_direction dir, basic_block bb, et_set_father (son, to_node); } - if (dom_computed[dir_index] == DOM_OK) - dom_computed[dir_index] = DOM_NO_FAST_QUERY; + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) + cfun->cfg->x_dom_computed[dir_index] = DOM_NO_FAST_QUERY; } /* Find first basic block in the tree dominating both BB1 and BB2. */ @@ -1015,7 +1015,7 @@ nearest_common_dominator (enum cdi_direction dir, basic_block bb1, basic_block b { unsigned int dir_index = dom_convert_dir_to_idx (dir); - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); if (!bb1) return bb2; @@ -1127,9 +1127,9 @@ dominated_by_p (enum cdi_direction dir, const_basic_block bb1, const_basic_block unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *n1 = bb1->dom[dir_index], *n2 = bb2->dom[dir_index]; - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); - if (dom_computed[dir_index] == DOM_OK) + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) return (n1->dfs_num_in >= n2->dfs_num_in && n1->dfs_num_out <= n2->dfs_num_out); @@ -1144,7 +1144,7 @@ bb_dom_dfs_in (enum cdi_direction dir, basic_block bb) unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *n = bb->dom[dir_index]; - gcc_checking_assert (dom_computed[dir_index] == DOM_OK); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index] == DOM_OK); return n->dfs_num_in; } @@ -1156,7 +1156,7 @@ bb_dom_dfs_out (enum cdi_direction dir, basic_block bb) unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *n = bb->dom[dir_index]; - gcc_checking_assert (dom_computed[dir_index] == DOM_OK); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index] == DOM_OK); return n->dfs_num_out; } @@ -1207,7 +1207,7 @@ recompute_dominator (enum cdi_direction dir, basic_block bb) edge e; edge_iterator ei; - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); if (dir == CDI_DOMINATORS) { @@ -1409,7 +1409,8 @@ iterate_fix_dominators (enum cdi_direction dir, vec &bbs, problems would be unused, untested, and almost surely buggy. We keep the DIR argument for consistency with the rest of the dominator analysis interface. */ - gcc_checking_assert (dir == CDI_DOMINATORS && dom_computed[dir_index]); + gcc_checking_assert (dir == CDI_DOMINATORS + && cfun->cfg->x_dom_computed[dir_index]); /* The algorithm we use takes inspiration from the following papers, although the details are quite different from any of them: @@ -1558,14 +1559,15 @@ add_to_dominance_info (enum cdi_direction dir, basic_block bb) { unsigned int dir_index = dom_convert_dir_to_idx (dir); - gcc_checking_assert (dom_computed[dir_index] && !bb->dom[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index] + && !bb->dom[dir_index]); - n_bbs_in_dom_tree[dir_index]++; + cfun->cfg->x_n_bbs_in_dom_tree[dir_index]++; bb->dom[dir_index] = et_new_tree (bb); - if (dom_computed[dir_index] == DOM_OK) - dom_computed[dir_index] = DOM_NO_FAST_QUERY; + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) + cfun->cfg->x_dom_computed[dir_index] = DOM_NO_FAST_QUERY; } void @@ -1573,14 +1575,14 @@ delete_from_dominance_info (enum cdi_direction dir, basic_block bb) { unsigned int dir_index = dom_convert_dir_to_idx (dir); - gcc_checking_assert (dom_computed[dir_index]); + gcc_checking_assert (cfun->cfg->x_dom_computed[dir_index]); et_free_tree (bb->dom[dir_index]); bb->dom[dir_index] = NULL; - n_bbs_in_dom_tree[dir_index]--; + cfun->cfg->x_n_bbs_in_dom_tree[dir_index]--; - if (dom_computed[dir_index] == DOM_OK) - dom_computed[dir_index] = DOM_NO_FAST_QUERY; + if (cfun->cfg->x_dom_computed[dir_index] == DOM_OK) + cfun->cfg->x_dom_computed[dir_index] = DOM_NO_FAST_QUERY; } /* Returns the first son of BB in the dominator or postdominator tree @@ -1632,7 +1634,7 @@ set_dom_info_availability (enum cdi_direction dir, enum dom_state new_state) { unsigned int dir_index = dom_convert_dir_to_idx (dir); - dom_computed[dir_index] = new_state; + cfun->cfg->x_dom_computed[dir_index] = new_state; } /* Returns true if dominance information for direction DIR is available. */ diff --git a/gcc/function.h b/gcc/function.h index c0ba6cc1531a..e56de1195b5f 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -535,10 +535,7 @@ get_new_clique (function *fn) /* For backward compatibility... eventually these should all go away. */ #define current_function_funcdef_no (cfun->funcdef_no) - #define current_loops (cfun->x_current_loops) -#define dom_computed (cfun->cfg->x_dom_computed) -#define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree) #define VALUE_HISTOGRAMS(fun) (fun)->value_histograms /* A pointer to a function to create target specific, per-function