From patchwork Wed Nov 3 10:23:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 46980 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6C983857C64 for ; Wed, 3 Nov 2021 13:05:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 7AFA23858007 for ; Wed, 3 Nov 2021 13:03:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AFA23858007 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from smtp-out1.suse.de ([195.135.220.28]:46378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miDQj-0006VY-Lj for gcc-patches@gcc.gnu.org; Wed, 03 Nov 2021 06:23:46 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D31E721709; Wed, 3 Nov 2021 10:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1635935017; h=from:from:reply-to: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=vAiGijDicysx8nTGgVN48ZbcleE20RFymZ6JtS2yDKg=; b=qkwbhtG+DZO9P1IoMI+FosBwN4yYefdpBjQL8HzH3f/s9k+3JGU4ZHB9EC0F1z4+3dyK2/ x6WCCc2jotxIHQW5LV33L0BN81qwCZOizVAMTRe5IGQHJHvI4WjSGGIEaFxjcMFRahNz8d Ew9FUwh56IE1Z5yTivGOpaXdD57IZ3Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1635935017; h=from:from:reply-to: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=vAiGijDicysx8nTGgVN48ZbcleE20RFymZ6JtS2yDKg=; b=mOsVv8DnhlGMjtHlSJxfUA/aFY+65juZhPZZRxKz2kx80OA3Til6rN8lN7rj3eZDHEtsC3 xYuCb8fNHJ25KQAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A678113CE7; Wed, 3 Nov 2021 10:23:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Rl95JyljgmH0EAAAMHmgww (envelope-from ); Wed, 03 Nov 2021 10:23:37 +0000 Message-ID: <3de8365a-de30-e915-f122-d59f01ac4fa5@suse.cz> Date: Wed, 3 Nov 2021 11:23:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Rename predicate class to ipa_predicate To: gcc-patches@gcc.gnu.org Content-Language: en-US Received-SPF: pass client-ip=195.135.220.28; envelope-from=mliska@suse.cz; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Cc: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hello. The renaming patch fixes a -Wodr warning seen and reported in the PR. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. PR bootstrap/102828 gcc/ChangeLog: * ipa-fnsummary.c (edge_predicate_pool): Rename predicate class to ipa_predicate. (ipa_fn_summary::account_size_time): Likewise. (edge_set_predicate): Likewise. (set_hint_predicate): Likewise. (add_freqcounting_predicate): Likewise. (evaluate_conditions_for_known_args): Likewise. (evaluate_properties_for_edge): Likewise. (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (set_cond_stmt_execution_predicate): Likewise. (set_switch_stmt_execution_predicate): Likewise. (compute_bb_predicates): Likewise. (will_be_nonconstant_expr_predicate): Likewise. (will_be_nonconstant_predicate): Likewise. (phi_result_unknown_predicate): Likewise. (predicate_for_phi_result): Likewise. (analyze_function_body): Likewise. (compute_fn_summary): Likewise. (summarize_calls_size_and_time): Likewise. (estimate_calls_size_and_time): Likewise. (ipa_call_context::estimate_size_and_time): Likewise. (remap_edge_summaries): Likewise. (remap_freqcounting_predicate): Likewise. (ipa_merge_fn_summary_after_inlining): Likewise. (ipa_update_overall_fn_summary): Likewise. (read_ipa_call_summary): Likewise. (inline_read_section): Likewise. * ipa-fnsummary.h (struct ipa_freqcounting_predicate): Likewise. * ipa-predicate.c (predicate::add_clause): Likewise. (ipa_predicate::add_clause): Likewise. (predicate::or_with): Likewise. (ipa_predicate::or_with): Likewise. (predicate::evaluate): Likewise. (ipa_predicate::evaluate): Likewise. (predicate::probability): Likewise. (ipa_predicate::probability): Likewise. (dump_condition): Likewise. (dump_clause): Likewise. (predicate::dump): Likewise. (ipa_predicate::dump): Likewise. (predicate::debug): Likewise. (ipa_predicate::debug): Likewise. (predicate::remap_after_duplication): Likewise. (ipa_predicate::remap_after_duplication): Likewise. (predicate::remap_after_inlining): Likewise. (ipa_predicate::remap_after_inlining): Likewise. (predicate::stream_in): Likewise. (ipa_predicate::stream_in): Likewise. (predicate::stream_out): Likewise. (ipa_predicate::stream_out): Likewise. (add_condition): Likewise. * ipa-predicate.h (class predicate): Likewise. (class ipa_predicate): Likewise. (add_condition): Likewise. --- gcc/ipa-fnsummary.c | 234 ++++++++++++++++++++++---------------------- gcc/ipa-fnsummary.h | 11 ++- gcc/ipa-predicate.c | 101 ++++++++++--------- gcc/ipa-predicate.h | 65 ++++++------ 4 files changed, 208 insertions(+), 203 deletions(-) diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index ac6eec30af8..2cfa9a6d0e9 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -94,7 +94,7 @@ fast_function_summary *ipa_size_summaries; fast_call_summary *ipa_call_summaries; /* Edge predicates goes here. */ -static object_allocator edge_predicate_pool ("edge predicates"); +static object_allocator edge_predicate_pool ("edge predicates"); /* Dump IPA hints. */ @@ -162,14 +162,14 @@ ipa_dump_hints (FILE *f, ipa_hints hints) void ipa_fn_summary::account_size_time (int size, sreal time, - const predicate &exec_pred, - const predicate &nonconst_pred_in, + const ipa_predicate &exec_pred, + const ipa_predicate &nonconst_pred_in, bool call) { size_time_entry *e; bool found = false; int i; - predicate nonconst_pred; + ipa_predicate nonconst_pred; vec *table = call ? &call_size_time_table : &size_time_table; if (exec_pred == false) @@ -271,7 +271,7 @@ redirect_to_unreachable (struct cgraph_edge *e) /* Set predicate for edge E. */ static void -edge_set_predicate (struct cgraph_edge *e, predicate *predicate) +edge_set_predicate (struct cgraph_edge *e, ipa_predicate *predicate) { /* If the edge is determined to be never executed, redirect it to BUILTIN_UNREACHABLE to make it clear to IPA passes the call will @@ -301,7 +301,7 @@ edge_set_predicate (struct cgraph_edge *e, predicate *predicate) /* Set predicate for hint *P. */ static void -set_hint_predicate (predicate **p, predicate new_predicate) +set_hint_predicate (ipa_predicate **p, ipa_predicate new_predicate) { if (new_predicate == false || new_predicate == true) { @@ -324,7 +324,7 @@ set_hint_predicate (predicate **p, predicate new_predicate) static void add_freqcounting_predicate (vec **v, - const predicate &new_predicate, sreal add_freq, + const ipa_predicate &new_predicate, sreal add_freq, unsigned max_num_predicates) { if (new_predicate == false || new_predicate == true) @@ -372,8 +372,8 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, clause_t *ret_clause, clause_t *ret_nonspec_clause) { - clause_t clause = inline_p ? 0 : 1 << predicate::not_inlined_condition; - clause_t nonspec_clause = 1 << predicate::not_inlined_condition; + clause_t clause = inline_p ? 0 : 1 << ipa_predicate::not_inlined_condition; + clause_t nonspec_clause = 1 << ipa_predicate::not_inlined_condition; class ipa_fn_summary *info = ipa_fn_summaries->get (node); int i; struct condition *c; @@ -396,7 +396,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, if (c->agg_contents) { - if (c->code == predicate::changed + if (c->code == ipa_predicate::changed && !c->by_ref && (avals->safe_sval_at(c->operand_num) == error_mark_node)) continue; @@ -413,27 +413,28 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, else { val = avals->safe_sval_at (c->operand_num); - if (val && val == error_mark_node && c->code != predicate::changed) + if (val && val == error_mark_node + && c->code != ipa_predicate::changed) val = NULL_TREE; } if (!val - && (c->code == predicate::changed - || c->code == predicate::is_not_constant)) + && (c->code == ipa_predicate::changed + || c->code == ipa_predicate::is_not_constant)) { - clause |= 1 << (i + predicate::first_dynamic_condition); - nonspec_clause |= 1 << (i + predicate::first_dynamic_condition); + clause |= 1 << (i + ipa_predicate::first_dynamic_condition); + nonspec_clause |= 1 << (i + ipa_predicate::first_dynamic_condition); continue; } - if (c->code == predicate::changed) + if (c->code == ipa_predicate::changed) { - nonspec_clause |= 1 << (i + predicate::first_dynamic_condition); + nonspec_clause |= 1 << (i + ipa_predicate::first_dynamic_condition); continue; } - if (c->code == predicate::is_not_constant) + if (c->code == ipa_predicate::is_not_constant) { - nonspec_clause |= 1 << (i + predicate::first_dynamic_condition); + nonspec_clause |= 1 << (i + ipa_predicate::first_dynamic_condition); continue; } @@ -472,8 +473,9 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, continue; if (res && integer_onep (res)) { - clause |= 1 << (i + predicate::first_dynamic_condition); - nonspec_clause |= 1 << (i + predicate::first_dynamic_condition); + clause |= 1 << (i + ipa_predicate::first_dynamic_condition); + nonspec_clause + |= 1 << (i + ipa_predicate::first_dynamic_condition); continue; } } @@ -528,8 +530,8 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, } } - clause |= 1 << (i + predicate::first_dynamic_condition); - nonspec_clause |= 1 << (i + predicate::first_dynamic_condition); + clause |= 1 << (i + ipa_predicate::first_dynamic_condition); + nonspec_clause |= 1 << (i + ipa_predicate::first_dynamic_condition); } *ret_clause = clause; if (ret_nonspec_clause) @@ -587,7 +589,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, class ipa_edge_args *args; if (clause_ptr) - *clause_ptr = inline_p ? 0 : 1 << predicate::not_inlined_condition; + *clause_ptr = inline_p ? 0 : 1 << ipa_predicate::not_inlined_condition; if (ipa_node_params_sum && !e->call_stmt_cannot_inline_p @@ -785,7 +787,7 @@ remap_freqcounting_preds_after_dup (vec *v, int len = res->length(); for (int i = len - 1; i >= 0; i--) { - predicate new_predicate + ipa_predicate new_predicate = (*res)[i].predicate->remap_after_duplication (possible_truths); /* We do not want to free previous predicate; it is used by node origin. */ @@ -823,7 +825,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, int count = ipa_get_param_count (parms_info); int i, j; clause_t possible_truths; - predicate true_pred = true; + ipa_predicate true_pred = true; size_time_entry *e; int optimized_out_size = 0; bool inlined_to_p = false; @@ -860,8 +862,8 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, to be true. */ for (i = 0; src_info->size_time_table.iterate (i, &e); i++) { - predicate new_exec_pred; - predicate new_nonconst_pred; + ipa_predicate new_exec_pred; + ipa_predicate new_nonconst_pred; new_exec_pred = e->exec_predicate.remap_after_duplication (possible_truths); new_nonconst_pred = e->nonconst_predicate.remap_after_duplication @@ -877,7 +879,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, Also copy constantness arrays. */ for (edge = dst->callees; edge; edge = next) { - predicate new_predicate; + ipa_predicate new_predicate; class ipa_call_summary *es = ipa_call_summaries->get (edge); next = edge->next_callee; @@ -896,7 +898,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, Also copy constantness arrays. */ for (edge = dst->indirect_calls; edge; edge = next) { - predicate new_predicate; + ipa_predicate new_predicate; class ipa_call_summary *es = ipa_call_summaries->get (edge); next = edge->next_callee; @@ -944,13 +946,13 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, ipa_freqcounting_predicate *f; for (int i = 0; vec_safe_iterate (info->loop_iterations, i, &f); i++) { - predicate p = *f->predicate; + ipa_predicate p = *f->predicate; f->predicate = NULL; set_hint_predicate (&f->predicate, p); } for (int i = 0; vec_safe_iterate (info->loop_strides, i, &f); i++) { - predicate p = *f->predicate; + ipa_predicate p = *f->predicate; f->predicate = NULL; set_hint_predicate (&f->predicate, p); } @@ -1609,12 +1611,12 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi, if (this_code != ERROR_MARK && !dominated_by_p (CDI_POST_DOMINATORS, bb, e->dest)) { - predicate p + ipa_predicate p = add_condition (summary, params_summary, index, param_type, &aggpos, this_code, gimple_cond_rhs (last), param_ops); e->aux = edge_predicate_pool.allocate (); - *(predicate *) e->aux = p; + *(ipa_predicate *) e->aux = p; } } vec_free (param_ops); @@ -1646,11 +1648,11 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi, add_builtin_constant_p_parm (summary, index); FOR_EACH_EDGE (e, ei, bb->succs) if (e->flags & EDGE_FALSE_VALUE) { - predicate p = add_condition (summary, params_summary, index, + ipa_predicate p = add_condition (summary, params_summary, index, param_type, &aggpos, - predicate::is_not_constant, NULL_TREE); + ipa_predicate::is_not_constant, NULL_TREE); e->aux = edge_predicate_pool.allocate (); - *(predicate *) e->aux = p; + *(ipa_predicate *) e->aux = p; } } @@ -1701,7 +1703,7 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, FOR_EACH_EDGE (e, ei, bb->succs) { e->aux = edge_predicate_pool.allocate (); - *(predicate *) e->aux = false; + *(ipa_predicate *) e->aux = false; } e = gimple_switch_edge (cfun, last, 0); @@ -1718,7 +1720,7 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, tree cl = gimple_switch_label (last, case_idx); tree min = CASE_LOW (cl); tree max = CASE_HIGH (cl); - predicate p; + ipa_predicate p; e = gimple_switch_edge (cfun, last, case_idx); @@ -1742,15 +1744,15 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, &aggpos, EQ_EXPR, min, param_ops); else { - predicate p1, p2; + ipa_predicate p1, p2; p1 = add_condition (summary, params_summary, index, param_type, &aggpos, GE_EXPR, min, param_ops); p2 = add_condition (summary, params_summary,index, param_type, &aggpos, LE_EXPR, max, param_ops); p = p1 & p2; } - *(class predicate *) e->aux - = p.or_with (summary->conds, *(class predicate *) e->aux); + *(ipa_predicate *) e->aux + = p.or_with (summary->conds, *(ipa_predicate *) e->aux); /* If there are too many disjoint case ranges, predicate for default case might become too complicated. So add a limit here. */ @@ -1796,13 +1798,13 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, e = gimple_switch_edge (cfun, last, 0); if (bound_count > bound_limit) { - *(class predicate *) e->aux = true; + *(ipa_predicate *) e->aux = true; vec_free (param_ops); return; } - predicate p_seg = true; - predicate p_all = false; + ipa_predicate p_seg = true; + ipa_predicate p_all = false; if (vr_type != VR_RANGE) { @@ -1857,8 +1859,8 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi, } p_all = p_all.or_with (summary->conds, p_seg); - *(class predicate *) e->aux - = p_all.or_with (summary->conds, *(class predicate *) e->aux); + *(ipa_predicate *) e->aux + = p_all.or_with (summary->conds, *(ipa_predicate *) e->aux); vec_free (param_ops); } @@ -1886,7 +1888,7 @@ compute_bb_predicates (struct ipa_func_body_info *fbi, /* Entry block is always executable. */ ENTRY_BLOCK_PTR_FOR_FN (my_function)->aux = edge_predicate_pool.allocate (); - *(predicate *) ENTRY_BLOCK_PTR_FOR_FN (my_function)->aux = true; + *(ipa_predicate *) ENTRY_BLOCK_PTR_FOR_FN (my_function)->aux = true; /* A simple dataflow propagation of predicates forward in the CFG. TODO: work in reverse postorder. */ @@ -1895,17 +1897,17 @@ compute_bb_predicates (struct ipa_func_body_info *fbi, done = true; FOR_EACH_BB_FN (bb, my_function) { - predicate p = false; + ipa_predicate p = false; edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) { if (e->src->aux) { - predicate this_bb_predicate - = *(predicate *) e->src->aux; + ipa_predicate this_bb_predicate + = *(ipa_predicate *) e->src->aux; if (e->aux) - this_bb_predicate &= (*(class predicate *) e->aux); + this_bb_predicate &= (*(ipa_predicate *) e->aux); p = p.or_with (summary->conds, this_bb_predicate); if (p == true) break; @@ -1919,18 +1921,18 @@ compute_bb_predicates (struct ipa_func_body_info *fbi, { done = false; bb->aux = edge_predicate_pool.allocate (); - *((predicate *) bb->aux) = p; + *((ipa_predicate *) bb->aux) = p; } - else if (p != *(predicate *) bb->aux) + else if (p != *(ipa_predicate *) bb->aux) { /* This OR operation is needed to ensure monotonous data flow in the case we hit the limit on number of clauses and the and/or operations above give approximate answers. */ - p = p.or_with (summary->conds, *(predicate *)bb->aux); - if (p != *(predicate *) bb->aux) + p = p.or_with (summary->conds, *(ipa_predicate *)bb->aux); + if (p != *(ipa_predicate *)bb->aux) { done = false; - *((predicate *) bb->aux) = p; + *((ipa_predicate *)bb->aux) = p; } } @@ -1950,15 +1952,16 @@ compute_bb_predicates (struct ipa_func_body_info *fbi, { done = false; pdom_bb->aux = edge_predicate_pool.allocate (); - *((predicate *) pdom_bb->aux) = p; + *((ipa_predicate *)pdom_bb->aux) = p; } - else if (p != *(predicate *) pdom_bb->aux) + else if (p != *(ipa_predicate *)pdom_bb->aux) { - p = p.or_with (summary->conds, *(predicate *)pdom_bb->aux); - if (p != *(predicate *) pdom_bb->aux) + p = p.or_with (summary->conds, + *(ipa_predicate *)pdom_bb->aux); + if (p != *(ipa_predicate *)pdom_bb->aux) { done = false; - *((predicate *) pdom_bb->aux) = p; + *((ipa_predicate *)pdom_bb->aux) = p; } } } @@ -1970,12 +1973,12 @@ compute_bb_predicates (struct ipa_func_body_info *fbi, /* Return predicate specifying when the STMT might have result that is not a compile time constant. */ -static predicate +static ipa_predicate will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi, class ipa_fn_summary *summary, class ipa_node_params *params_summary, tree expr, - vec nonconstant_names) + vec nonconstant_names) { tree parm; int index; @@ -1986,14 +1989,14 @@ will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi, parm = unmodified_parm (fbi, NULL, expr, NULL); if (parm && (index = ipa_get_param_decl_index (fbi->info, parm)) >= 0) return add_condition (summary, params_summary, index, TREE_TYPE (parm), NULL, - predicate::changed, NULL_TREE); + ipa_predicate::changed, NULL_TREE); if (is_gimple_min_invariant (expr)) return false; if (TREE_CODE (expr) == SSA_NAME) return nonconstant_names[SSA_NAME_VERSION (expr)]; if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr)) { - predicate p1 + ipa_predicate p1 = will_be_nonconstant_expr_predicate (fbi, summary, params_summary, TREE_OPERAND (expr, 0), @@ -2001,7 +2004,7 @@ will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi, if (p1 == true) return p1; - predicate p2 + ipa_predicate p2 = will_be_nonconstant_expr_predicate (fbi, summary, params_summary, TREE_OPERAND (expr, 1), @@ -2010,7 +2013,7 @@ will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi, } else if (TREE_CODE (expr) == COND_EXPR) { - predicate p1 + ipa_predicate p1 = will_be_nonconstant_expr_predicate (fbi, summary, params_summary, TREE_OPERAND (expr, 0), @@ -2018,7 +2021,7 @@ will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi, if (p1 == true) return p1; - predicate p2 + ipa_predicate p2 = will_be_nonconstant_expr_predicate (fbi, summary, params_summary, TREE_OPERAND (expr, 1), @@ -2046,18 +2049,18 @@ will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi, /* Return predicate specifying when the STMT might have result that is not a compile time constant. */ -static predicate +static ipa_predicate will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, class ipa_fn_summary *summary, class ipa_node_params *params_summary, gimple *stmt, - vec nonconstant_names) + vec nonconstant_names) { - predicate p = true; + ipa_predicate p = true; ssa_op_iter iter; tree use; tree param_type = NULL_TREE; - predicate op_non_const; + ipa_predicate op_non_const; bool is_load; int base_index; struct agg_position_info aggpos; @@ -2109,7 +2112,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, op_non_const = add_condition (summary, params_summary, base_index, param_type, &aggpos, - predicate::changed, NULL_TREE); + ipa_predicate::changed, NULL_TREE); else op_non_const = false; FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) @@ -2122,7 +2125,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi, if (index != base_index) p = add_condition (summary, params_summary, index, TREE_TYPE (parm), NULL, - predicate::changed, NULL_TREE); + ipa_predicate::changed, NULL_TREE); else continue; } @@ -2315,8 +2318,8 @@ phi_result_unknown_predicate (ipa_func_body_info *fbi, ipa_fn_summary *summary, class ipa_node_params *params_summary, basic_block bb, - predicate *p, - vec nonconstant_names) + ipa_predicate *p, + vec nonconstant_names) { edge e; edge_iterator ei; @@ -2374,8 +2377,8 @@ phi_result_unknown_predicate (ipa_func_body_info *fbi, static void predicate_for_phi_result (class ipa_fn_summary *summary, gphi *phi, - predicate *p, - vec nonconstant_names) + ipa_predicate *p, + vec nonconstant_names) { unsigned i; @@ -2607,9 +2610,9 @@ analyze_function_body (struct cgraph_node *node, bool early) class ipa_fn_summary *info = ipa_fn_summaries->get_create (node); ipa_node_params *params_summary = early ? NULL : ipa_node_params_sum->get (node); - predicate bb_predicate; + ipa_predicate bb_predicate; struct ipa_func_body_info fbi; - vec nonconstant_names = vNULL; + vec nonconstant_names = vNULL; int nblocks, n; int *order; gimple *fix_builtin_expect_stmt; @@ -2664,7 +2667,7 @@ analyze_function_body (struct cgraph_node *node, bool early) bb_predicate = true; info->account_size_time (0, 0, bb_predicate, bb_predicate); - bb_predicate = predicate::not_inlined (); + bb_predicate = ipa_predicate::not_inlined (); info->account_size_time (opt_for_fn (node->decl, param_uninlined_function_insns) * ipa_fn_summary::size_scale, @@ -2695,7 +2698,7 @@ analyze_function_body (struct cgraph_node *node, bool early) if (fbi.info) { if (bb->aux) - bb_predicate = *(predicate *) bb->aux; + bb_predicate = *(ipa_predicate *)bb->aux; else bb_predicate = false; } @@ -2710,7 +2713,7 @@ analyze_function_body (struct cgraph_node *node, bool early) if (fbi.info && nonconstant_names.exists ()) { - predicate phi_predicate; + ipa_predicate phi_predicate; bool first_phi = true; for (gphi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi); @@ -2743,7 +2746,7 @@ analyze_function_body (struct cgraph_node *node, bool early) int this_size = estimate_num_insns (stmt, &eni_size_weights); int this_time = estimate_num_insns (stmt, &eni_time_weights); int prob; - predicate will_be_nonconstant; + ipa_predicate will_be_nonconstant; /* This relation stmt should be folded after we remove __builtin_expect call. Adjust the cost here. */ @@ -2776,7 +2779,7 @@ analyze_function_body (struct cgraph_node *node, bool early) && gimple_call_lhs (stmt) && TREE_CODE (gimple_call_lhs (stmt)) == SSA_NAME) { - predicate false_p = false; + ipa_predicate false_p = false; nonconstant_names[SSA_NAME_VERSION (gimple_call_lhs (stmt))] = false_p; } @@ -2853,7 +2856,7 @@ analyze_function_body (struct cgraph_node *node, bool early) if (prob == 2 && dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "\t\tWill be eliminated by inlining\n"); - class predicate p = bb_predicate & will_be_nonconstant; + ipa_predicate p = bb_predicate & will_be_nonconstant; /* We can ignore statement when we proved it is never going to happen, but we cannot do that for call statements @@ -2872,7 +2875,8 @@ analyze_function_body (struct cgraph_node *node, bool early) { if (prob) { - predicate ip = bb_predicate & predicate::not_inlined (); + ipa_predicate ip + = bb_predicate & ipa_predicate::not_inlined (); info->account_size_time (this_size * prob, (final_time * prob) / 2, ip, p); @@ -2902,7 +2906,7 @@ analyze_function_body (struct cgraph_node *node, bool early) || TREE_CODE (op) == ARRAY_RANGE_REF) && TREE_CODE (TREE_OPERAND (op, 1)) == SSA_NAME) { - predicate p = bb_predicate; + ipa_predicate p = bb_predicate; if (fbi.info) p = p & will_be_nonconstant_expr_predicate (&fbi, info, params_summary, @@ -2939,7 +2943,7 @@ analyze_function_body (struct cgraph_node *node, bool early) scev_initialize (); for (auto loop : loops_list (cfun, 0)) { - predicate loop_iterations = true; + ipa_predicate loop_iterations = true; sreal header_freq; edge ex; unsigned int j; @@ -2950,13 +2954,13 @@ analyze_function_body (struct cgraph_node *node, bool early) profile_count phdr_count = loop_preheader_edge (loop)->count (); sreal phdr_freq = phdr_count.to_sreal_scale (entry_count); - bb_predicate = *(predicate *) loop->header->aux; + bb_predicate = *(ipa_predicate *)loop->header->aux; auto_vec exits = get_loop_exit_edges (loop); FOR_EACH_VEC_ELT (exits, j, ex) if (number_of_iterations_exit (loop, ex, &niter_desc, false) && !is_gimple_min_invariant (niter_desc.niter)) { - predicate will_be_nonconstant + ipa_predicate will_be_nonconstant = will_be_nonconstant_expr_predicate (&fbi, info, params_summary, niter_desc.niter, @@ -2977,7 +2981,7 @@ analyze_function_body (struct cgraph_node *node, bool early) for (loop = loops_for_fn (cfun)->tree_root->inner; loop != NULL; loop = loop->next) { - predicate loop_stride = true; + ipa_predicate loop_stride = true; basic_block *body = get_loop_body (loop); profile_count phdr_count = loop_preheader_edge (loop)->count (); sreal phdr_freq = phdr_count.to_sreal_scale (entry_count); @@ -2987,7 +2991,7 @@ analyze_function_body (struct cgraph_node *node, bool early) if (!body[i]->aux) continue; - bb_predicate = *(predicate *) body[i]->aux; + bb_predicate = *(ipa_predicate *)body[i]->aux; for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi)) { @@ -3007,7 +3011,7 @@ analyze_function_body (struct cgraph_node *node, bool early) || is_gimple_min_invariant (iv.step)) continue; - predicate will_be_nonconstant + ipa_predicate will_be_nonconstant = will_be_nonconstant_expr_predicate (&fbi, info, params_summary, iv.step, @@ -3031,12 +3035,12 @@ analyze_function_body (struct cgraph_node *node, bool early) edge_iterator ei; if (bb->aux) - edge_predicate_pool.remove ((predicate *)bb->aux); + edge_predicate_pool.remove ((ipa_predicate *)bb->aux); bb->aux = NULL; FOR_EACH_EDGE (e, ei, bb->succs) { if (e->aux) - edge_predicate_pool.remove ((predicate *) e->aux); + edge_predicate_pool.remove ((ipa_predicate *)e->aux); e->aux = NULL; } } @@ -3092,7 +3096,7 @@ compute_fn_summary (struct cgraph_node *node, bool early) if (node->thunk) { ipa_call_summary *es = ipa_call_summaries->get_create (node->callees); - predicate t = true; + ipa_predicate t = true; node->can_change_signature = false; es->call_stmt_size = eni_size_weights.call_cost; @@ -3102,7 +3106,7 @@ compute_fn_summary (struct cgraph_node *node, bool early) param_uninlined_function_thunk_insns), opt_for_fn (node->decl, param_uninlined_function_thunk_time), t, t); - t = predicate::not_inlined (); + t = ipa_predicate::not_inlined (); info->account_size_time (2 * ipa_fn_summary::size_scale, 0, t, t); ipa_update_overall_fn_summary (node); size_info->self_size = size_info->size; @@ -3335,7 +3339,7 @@ summarize_calls_size_and_time (struct cgraph_node *node, estimate_edge_size_and_time (e, &size, NULL, &time, NULL, NULL); - struct predicate pred = true; + ipa_predicate pred = true; class ipa_call_summary *es = ipa_call_summaries->get (e); if (es->predicate) @@ -3348,7 +3352,7 @@ summarize_calls_size_and_time (struct cgraph_node *node, sreal time = 0; estimate_edge_size_and_time (e, &size, NULL, &time, NULL, NULL); - struct predicate pred = true; + ipa_predicate pred = true; class ipa_call_summary *es = ipa_call_summaries->get (e); if (es->predicate) @@ -3414,7 +3418,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, /* Build summary if it is absent. */ if (!sum->call_size_time_table.length ()) { - predicate true_pred = true; + ipa_predicate true_pred = true; sum->account_size_time (0, 0, true_pred, true_pred, true); summarize_calls_size_and_time (node, sum); } @@ -3712,8 +3716,8 @@ ipa_call_context::estimate_size_and_time (ipa_call_estimates *estimates, fprintf (dump_file, " Estimating body: %s\n" " Known to be false: ", m_node->dump_name ()); - for (i = predicate::not_inlined_condition; - i < (predicate::first_dynamic_condition + for (i = ipa_predicate::not_inlined_condition; + i < (ipa_predicate::first_dynamic_condition + (int) vec_safe_length (info->conds)); i++) if (!(m_possible_truths & (1 << i))) { @@ -3984,12 +3988,12 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, const vec &operand_map, const vec &offset_map, clause_t possible_truths, - predicate *toplev_predicate) + ipa_predicate *toplev_predicate) { struct cgraph_edge *e, *next; for (e = node->callees; e; e = next) { - predicate p; + ipa_predicate p; next = e->next_callee; if (e->inline_failed) @@ -4018,7 +4022,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, for (e = node->indirect_calls; e; e = next) { class ipa_call_summary *es = ipa_call_summaries->get (e); - predicate p; + ipa_predicate p; next = e->next_callee; remap_edge_params (inlined_edge, e); @@ -4045,13 +4049,13 @@ remap_freqcounting_predicate (class ipa_fn_summary *info, const vec &operand_map, const vec &offset_map, clause_t possible_truths, - predicate *toplev_predicate) + ipa_predicate *toplev_predicate) { ipa_freqcounting_predicate *fcp; for (int i = 0; vec_safe_iterate (v, i, &fcp); i++) { - predicate p + ipa_predicate p = fcp->predicate->remap_after_inlining (info, params_summary, callee_info, operand_map, offset_map, possible_truths, @@ -4075,7 +4079,7 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge) auto_vec operand_map; auto_vec offset_map; int i; - predicate toplev_predicate; + ipa_predicate toplev_predicate; class ipa_call_summary *es = ipa_call_summaries->get (edge); ipa_node_params *params_summary = (ipa_node_params_sum ? ipa_node_params_sum->get (to) : NULL); @@ -4139,13 +4143,13 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge) sreal freq = edge->sreal_frequency (); for (i = 0; callee_info->size_time_table.iterate (i, &e); i++) { - predicate p; + ipa_predicate p; p = e->exec_predicate.remap_after_inlining (info, params_summary, callee_info, operand_map, offset_map, clause, toplev_predicate); - predicate nonconstp; + ipa_predicate nonconstp; nonconstp = e->nonconst_predicate.remap_after_inlining (info, params_summary, callee_info, operand_map, @@ -4230,7 +4234,7 @@ ipa_update_overall_fn_summary (struct cgraph_node *node, bool reset) if (node->callees || node->indirect_calls) estimate_calls_size_and_time (node, &size_info->size, &info->min_size, &info->time, NULL, - ~(clause_t) (1 << predicate::false_condition), + ~(clause_t) (1 << ipa_predicate::false_condition), NULL); size_info->size = RDIV (size_info->size, ipa_fn_summary::size_scale); info->min_size = RDIV (info->min_size, ipa_fn_summary::size_scale); @@ -4318,7 +4322,7 @@ read_ipa_call_summary (class lto_input_block *ib, struct cgraph_edge *e, { class ipa_call_summary *es = prevails ? ipa_call_summaries->get_create (e) : NULL; - predicate p; + ipa_predicate p; int length, i; int size = streamer_read_uhwi (ib); @@ -4399,7 +4403,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, lto_symtab_encoder_t encoder; struct bitpack_d bp; struct cgraph_edge *e; - predicate p; + ipa_predicate p; index = streamer_read_uhwi (&ib); encoder = file_data->symtab_node_encoder; diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h index 78399b0b9bb..fdfbd660e70 100644 --- a/gcc/ipa-fnsummary.h +++ b/gcc/ipa-fnsummary.h @@ -76,11 +76,11 @@ class size_time_entry { public: /* Predicate for code to be executed. */ - predicate exec_predicate; + ipa_predicate exec_predicate; /* Predicate for value to be constant and optimized out in a specialized copy. When deciding on specialization this makes it possible to see how much the executed code paths will simplify. */ - predicate nonconst_predicate; + ipa_predicate nonconst_predicate; int size; sreal time; }; @@ -114,7 +114,7 @@ struct GTY(()) ipa_freqcounting_predicate /* The described event happens with this frequency... */ sreal freq; /* ...when this predicate evaluates to false. */ - class predicate * GTY((skip)) predicate; + ipa_predicate * GTY((skip)) predicate; }; /* Function inlining information. */ @@ -203,7 +203,8 @@ public: int scc_no; /* Record time and size under given predicates. */ - void account_size_time (int, sreal, const predicate &, const predicate &, + void account_size_time (int, sreal, const ipa_predicate &, + const ipa_predicate &, bool call = false); /* We keep values scaled up, so fractional sizes can be accounted. */ @@ -286,7 +287,7 @@ public: /* Default destructor. */ ~ipa_call_summary (); - class predicate *predicate; + ipa_predicate *predicate; /* Vector indexed by parameters. */ vec param; /* Estimated size and time of the call statement. */ diff --git a/gcc/ipa-predicate.c b/gcc/ipa-predicate.c index e4b11ec3ae3..48318cc6091 100644 --- a/gcc/ipa-predicate.c +++ b/gcc/ipa-predicate.c @@ -69,7 +69,7 @@ expr_eval_ops_equal_p (expr_eval_ops ops1, expr_eval_ops ops2) sane. */ void -predicate::add_clause (conditions conditions, clause_t new_clause) +ipa_predicate::add_clause (conditions conditions, clause_t new_clause) { int i; int i2; @@ -81,7 +81,7 @@ predicate::add_clause (conditions conditions, clause_t new_clause) return; /* False clause makes the whole predicate false. Kill the other variants. */ - if (new_clause == (1 << predicate::false_condition)) + if (new_clause == (1 << ipa_predicate::false_condition)) { *this = false; return; @@ -90,7 +90,7 @@ predicate::add_clause (conditions conditions, clause_t new_clause) return; /* No one should be silly enough to add false into nontrivial clauses. */ - gcc_checking_assert (!(new_clause & (1 << predicate::false_condition))); + gcc_checking_assert (!(new_clause & (1 << ipa_predicate::false_condition))); /* Look where to insert the new_clause. At the same time prune out new_clauses of P that are implied by the new new_clause and thus @@ -123,13 +123,13 @@ predicate::add_clause (conditions conditions, clause_t new_clause) /* Look for clauses that are obviously true. I.e. op0 == 5 || op0 != 5. */ if (conditions) - for (c1 = predicate::first_dynamic_condition; + for (c1 = ipa_predicate::first_dynamic_condition; c1 < num_conditions; c1++) { condition *cc1; if (!(new_clause & (1 << c1))) continue; - cc1 = &(*conditions)[c1 - predicate::first_dynamic_condition]; + cc1 = &(*conditions)[c1 - ipa_predicate::first_dynamic_condition]; /* We have no way to represent !changed and !is_not_constant and thus there is no point for looking for them. */ if (cc1->code == changed || cc1->code == is_not_constant) @@ -138,7 +138,7 @@ predicate::add_clause (conditions conditions, clause_t new_clause) if (new_clause & (1 << c2)) { condition *cc2 = - &(*conditions)[c2 - predicate::first_dynamic_condition]; + &(*conditions)[c2 - ipa_predicate::first_dynamic_condition]; if (cc1->operand_num == cc2->operand_num && vrp_operand_equal_p (cc1->val, cc2->val) && cc2->code != is_not_constant @@ -170,8 +170,8 @@ predicate::add_clause (conditions conditions, clause_t new_clause) /* Do THIS &= P. */ -predicate & -predicate::operator &= (const predicate &p) +ipa_predicate & +ipa_predicate::operator &= (const ipa_predicate &p) { /* Avoid busy work. */ if (p == false || *this == true) @@ -184,13 +184,13 @@ predicate::operator &= (const predicate &p) int i; - /* See how far predicates match. */ + /* See how far ipa_predicates match. */ for (i = 0; m_clause[i] && m_clause[i] == p.m_clause[i]; i++) { gcc_checking_assert (i < max_clauses); } - /* Combine the predicates rest. */ + /* Combine the ipa_predicates rest. */ for (; p.m_clause[i]; i++) { gcc_checking_assert (i < max_clauses); @@ -203,9 +203,9 @@ predicate::operator &= (const predicate &p) /* Return THIS | P2. */ -predicate -predicate::or_with (conditions conditions, - const predicate &p) const +ipa_predicate +ipa_predicate::or_with (conditions conditions, + const ipa_predicate &p) const { /* Avoid busy work. */ if (p == false || *this == true || *this == p) @@ -214,7 +214,7 @@ predicate::or_with (conditions conditions, return p; /* OK, combine the predicates. */ - predicate out = true; + ipa_predicate out = true; for (int i = 0; m_clause[i]; i++) for (int j = 0; p.m_clause[j]; j++) @@ -230,7 +230,7 @@ predicate::or_with (conditions conditions, if predicate P is known to be false. */ bool -predicate::evaluate (clause_t possible_truths) const +ipa_predicate::evaluate (clause_t possible_truths) const { int i; @@ -238,7 +238,7 @@ predicate::evaluate (clause_t possible_truths) const if (*this == true) return true; - gcc_assert (!(possible_truths & (1 << predicate::false_condition))); + gcc_assert (!(possible_truths & (1 << ipa_predicate::false_condition))); /* See if we can find clause we can disprove. */ for (i = 0; m_clause[i]; i++) @@ -254,7 +254,7 @@ predicate::evaluate (clause_t possible_truths) const instruction will be recomputed per invocation of the inlined call. */ int -predicate::probability (conditions conds, +ipa_predicate::probability (conditions conds, clause_t possible_truths, vec inline_param_summary) const { @@ -268,7 +268,7 @@ predicate::probability (conditions conds, if (*this == false) return 0; - gcc_assert (!(possible_truths & (1 << predicate::false_condition))); + gcc_assert (!(possible_truths & (1 << ipa_predicate::false_condition))); /* See if we can find clause we can disprove. */ for (i = 0; m_clause[i]; i++) @@ -285,11 +285,11 @@ predicate::probability (conditions conds, for (i2 = 0; i2 < num_conditions; i2++) if ((m_clause[i] & possible_truths) & (1 << i2)) { - if (i2 >= predicate::first_dynamic_condition) + if (i2 >= ipa_predicate::first_dynamic_condition) { condition *c = - &(*conds)[i2 - predicate::first_dynamic_condition]; - if (c->code == predicate::changed + &(*conds)[i2 - ipa_predicate::first_dynamic_condition]; + if (c->code == ipa_predicate::changed && (c->operand_num < (int) inline_param_summary.length ())) { @@ -318,13 +318,13 @@ void dump_condition (FILE *f, conditions conditions, int cond) { condition *c; - if (cond == predicate::false_condition) + if (cond == ipa_predicate::false_condition) fprintf (f, "false"); - else if (cond == predicate::not_inlined_condition) + else if (cond == ipa_predicate::not_inlined_condition) fprintf (f, "not inlined"); else { - c = &(*conditions)[cond - predicate::first_dynamic_condition]; + c = &(*conditions)[cond - ipa_predicate::first_dynamic_condition]; fprintf (f, "op%i", c->operand_num); if (c->agg_contents) fprintf (f, "[%soffset: " HOST_WIDE_INT_PRINT_DEC "]", @@ -406,12 +406,12 @@ dump_condition (FILE *f, conditions conditions, int cond) fprintf (f, ")"); } - if (c->code == predicate::is_not_constant) + if (c->code == ipa_predicate::is_not_constant) { fprintf (f, " not constant"); return; } - if (c->code == predicate::changed) + if (c->code == ipa_predicate::changed) { fprintf (f, " changed"); return; @@ -432,7 +432,7 @@ dump_clause (FILE *f, conditions conds, clause_t clause) fprintf (f, "("); if (!clause) fprintf (f, "true"); - for (i = 0; i < predicate::num_conditions; i++) + for (i = 0; i < ipa_predicate::num_conditions; i++) if (clause & (1 << i)) { if (found) @@ -445,10 +445,10 @@ dump_clause (FILE *f, conditions conds, clause_t clause) /* Dump THIS to F. CONDS a vector of conditions used when evaluating - predicates. When NL is true new line is output at the end of dump. */ + ipa_predicates. When NL is true new line is output at the end of dump. */ void -predicate::dump (FILE *f, conditions conds, bool nl) const +ipa_predicate::dump (FILE *f, conditions conds, bool nl) const { int i; if (*this == true) @@ -466,7 +466,7 @@ predicate::dump (FILE *f, conditions conds, bool nl) const void -predicate::debug (conditions conds) const +ipa_predicate::debug (conditions conds) const { dump (stderr, conds); } @@ -476,11 +476,11 @@ predicate::debug (conditions conds) const POSSIBLE_TRUTHS is clause of possible truths in the duplicated node, INFO is inline summary of the duplicated node. */ -predicate -predicate::remap_after_duplication (clause_t possible_truths) +ipa_predicate +ipa_predicate::remap_after_duplication (clause_t possible_truths) { int j; - predicate out = true; + ipa_predicate out = true; for (j = 0; m_clause[j]; j++) if (!(possible_truths & m_clause[j])) return false; @@ -503,26 +503,26 @@ predicate::remap_after_duplication (clause_t possible_truths) because they might not be preserved (and should be considered offset zero for other purposes). */ -predicate -predicate::remap_after_inlining (class ipa_fn_summary *info, +ipa_predicate +ipa_predicate::remap_after_inlining (class ipa_fn_summary *info, class ipa_node_params *params_summary, class ipa_fn_summary *callee_info, const vec &operand_map, const vec &offset_map, clause_t possible_truths, - const predicate &toplev_predicate) + const ipa_predicate &toplev_predicate) { int i; - predicate out = true; + ipa_predicate out = true; - /* True predicate is easy. */ + /* True ipa_predicate is easy. */ if (*this == true) return toplev_predicate; for (i = 0; m_clause[i]; i++) { clause_t clause = m_clause[i]; int cond; - predicate clause_predicate = false; + ipa_predicate clause_predicate = false; gcc_assert (i < max_clauses); @@ -530,16 +530,15 @@ predicate::remap_after_inlining (class ipa_fn_summary *info, /* Do we have condition we can't disprove? */ if (clause & possible_truths & (1 << cond)) { - predicate cond_predicate; + ipa_predicate cond_predicate; /* Work out if the condition can translate to predicate in the inlined function. */ - if (cond >= predicate::first_dynamic_condition) + if (cond >= ipa_predicate::first_dynamic_condition) { struct condition *c; - c = &(*callee_info->conds)[cond - - - predicate::first_dynamic_condition]; + int index = cond - ipa_predicate::first_dynamic_condition; + c = &(*callee_info->conds)[index]; /* See if we can remap condition operand to caller's operand. Otherwise give up. */ if (!operand_map.exists () @@ -576,7 +575,7 @@ predicate::remap_after_inlining (class ipa_fn_summary *info, /* Fixed conditions remains same, construct single condition predicate. */ else - cond_predicate = predicate::predicate_testing_cond (cond); + cond_predicate = ipa_predicate::predicate_testing_cond (cond); clause_predicate = clause_predicate.or_with (info->conds, cond_predicate); } @@ -590,7 +589,7 @@ predicate::remap_after_inlining (class ipa_fn_summary *info, /* Read predicate from IB. */ void -predicate::stream_in (class lto_input_block *ib) +ipa_predicate::stream_in (class lto_input_block *ib) { clause_t clause; int k = 0; @@ -611,7 +610,7 @@ predicate::stream_in (class lto_input_block *ib) /* Write predicate P to OB. */ void -predicate::stream_out (struct output_block *ob) +ipa_predicate::stream_out (struct output_block *ob) { int j; for (j = 0; m_clause[j]; j++) @@ -629,7 +628,7 @@ predicate::stream_out (struct output_block *ob) aggregate it is. It can be NULL, which means this not a load from an aggregate. */ -predicate +ipa_predicate add_condition (class ipa_fn_summary *summary, class ipa_node_params *params_summary, int operand_num, @@ -669,10 +668,10 @@ add_condition (class ipa_fn_summary *summary, && c->agg_contents == agg_contents && expr_eval_ops_equal_p (c->param_ops, param_ops) && (!agg_contents || (c->offset == offset && c->by_ref == by_ref))) - return predicate::predicate_testing_cond (i); + return ipa_predicate::predicate_testing_cond (i); } /* Too many conditions. Give up and return constant true. */ - if (i == predicate::num_conditions - predicate::first_dynamic_condition) + if (i == ipa_predicate::num_conditions - ipa_predicate::first_dynamic_condition) return true; new_cond.operand_num = operand_num; @@ -694,5 +693,5 @@ add_condition (class ipa_fn_summary *summary, vec_safe_push (summary->conds, new_cond); - return predicate::predicate_testing_cond (i); + return ipa_predicate::predicate_testing_cond (i); } diff --git a/gcc/ipa-predicate.h b/gcc/ipa-predicate.h index ac52b54aa36..190dcedc93f 100644 --- a/gcc/ipa-predicate.h +++ b/gcc/ipa-predicate.h @@ -111,7 +111,7 @@ typedef vec *conditions; is not. */ typedef uint32_t clause_t; -class predicate +class ipa_predicate { public: enum predicate_conditions @@ -138,7 +138,7 @@ public: /* Initialize predicate either to true of false depending on P. */ - inline predicate (bool p = true) + inline ipa_predicate (bool p = true) { if (p) /* True predicate. */ @@ -149,42 +149,42 @@ public: } /* Sanity check that we do not mix pointers to predicates with predicates. */ - inline predicate (predicate *) + inline ipa_predicate (ipa_predicate *) { gcc_unreachable (); } /* Return predicate testing condition I. */ - static inline predicate predicate_testing_cond (int i) + static inline ipa_predicate predicate_testing_cond (int i) { - class predicate p; + ipa_predicate p; p.set_to_cond (i + first_dynamic_condition); return p; } /* Return predicate testing that function was not inlined. */ - static predicate not_inlined (void) + static ipa_predicate not_inlined (void) { - class predicate p; + ipa_predicate p; p.set_to_cond (not_inlined_condition); return p; } - /* Compute logical and of predicates. */ - predicate & operator &= (const predicate &); - inline predicate operator &(const predicate &p) const + /* Compute logical and of ipa_predicates. */ + ipa_predicate & operator &= (const ipa_predicate &); + inline ipa_predicate operator &(const ipa_predicate &p) const { - predicate ret = *this; + ipa_predicate ret = *this; ret &= p; return ret; } - /* Compute logical or of predicates. This is not operator because + /* Compute logical or of ipa_predicates. This is not operator because extra parameter CONDITIONS is needed */ - predicate or_with (conditions, const predicate &) const; + ipa_predicate or_with (conditions, const ipa_predicate &) const; - /* Return true if predicates are known to be equal. */ - inline bool operator==(const predicate &p2) const + /* Return true if ipa_predicates are known to be equal. */ + inline bool operator==(const ipa_predicate &p2) const { int i; for (i = 0; m_clause[i]; i++) @@ -215,7 +215,7 @@ public: return false; } - inline bool operator!=(const predicate &p2) const + inline bool operator!=(const ipa_predicate &p2) const { return !(*this == p2); } @@ -236,18 +236,19 @@ public: void dump (FILE *f, conditions, bool nl=true) const; void DEBUG_FUNCTION debug (conditions) const; - /* Return predicate equal to THIS after duplication. */ - predicate remap_after_duplication (clause_t); + /* Return ipa_predicate equal to THIS after duplication. */ + ipa_predicate remap_after_duplication (clause_t); - /* Return predicate equal to THIS after inlining. */ - predicate remap_after_inlining (class ipa_fn_summary *, - class ipa_node_params *params_summary, - class ipa_fn_summary *, - const vec &, const vec &, - clause_t, const predicate &); + /* Return ipa_predicate equal to THIS after inlining. */ + ipa_predicate remap_after_inlining (class ipa_fn_summary *, + ipa_node_params *params_summary, + ipa_fn_summary *, + const vec &, + const vec &, + clause_t, const ipa_predicate &); - void stream_in (class lto_input_block *); - void stream_out (struct output_block *); + void stream_in (lto_input_block *); + void stream_out (output_block *); private: static const int max_clauses = 8; @@ -264,9 +265,9 @@ private: }; void dump_condition (FILE *f, conditions conditions, int cond); -predicate add_condition (class ipa_fn_summary *summary, - class ipa_node_params *params_summary, - int operand_num, - tree type, struct agg_position_info *aggpos, - enum tree_code code, tree val, - expr_eval_ops param_ops = NULL); +ipa_predicate add_condition (ipa_fn_summary *summary, + ipa_node_params *params_summary, + int operand_num, + tree type, struct agg_position_info *aggpos, + enum tree_code code, tree val, + expr_eval_ops param_ops = NULL);