fast_call_summary <ipa_call_summary *, va_heap> *ipa_call_summaries;
/* Edge predicates goes here. */
-static object_allocator<predicate> edge_predicate_pool ("edge predicates");
+static object_allocator<ipa_predicate> edge_predicate_pool ("edge predicates");
/* Dump IPA 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<size_time_entry> *table = call ? &call_size_time_table : &size_time_table;
if (exec_pred == false)
/* 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
/* 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)
{
static void
add_freqcounting_predicate (vec<ipa_freqcounting_predicate, va_gc> **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)
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;
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;
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;
}
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;
}
}
}
}
- 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)
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
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. */
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;
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
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;
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;
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);
}
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);
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;
}
}
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);
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);
&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. */
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)
{
}
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);
}
/* 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. */
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;
{
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;
}
}
{
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;
}
}
}
/* 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<predicate> nonconstant_names)
+ vec<ipa_predicate> nonconstant_names)
{
tree parm;
int index;
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),
if (p1 == true)
return p1;
- predicate p2
+ ipa_predicate p2
= will_be_nonconstant_expr_predicate (fbi, summary,
params_summary,
TREE_OPERAND (expr, 1),
}
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),
if (p1 == true)
return p1;
- predicate p2
+ ipa_predicate p2
= will_be_nonconstant_expr_predicate (fbi, summary,
params_summary,
TREE_OPERAND (expr, 1),
/* 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<predicate> nonconstant_names)
+ vec<ipa_predicate> 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;
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)
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;
}
ipa_fn_summary *summary,
class ipa_node_params *params_summary,
basic_block bb,
- predicate *p,
- vec<predicate> nonconstant_names)
+ ipa_predicate *p,
+ vec<ipa_predicate> nonconstant_names)
{
edge e;
edge_iterator ei;
static void
predicate_for_phi_result (class ipa_fn_summary *summary, gphi *phi,
- predicate *p,
- vec<predicate> nonconstant_names)
+ ipa_predicate *p,
+ vec<ipa_predicate> nonconstant_names)
{
unsigned i;
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<predicate> nonconstant_names = vNULL;
+ vec<ipa_predicate> nonconstant_names = vNULL;
int nblocks, n;
int *order;
gimple *fix_builtin_expect_stmt;
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,
if (fbi.info)
{
if (bb->aux)
- bb_predicate = *(predicate *) bb->aux;
+ bb_predicate = *(ipa_predicate *)bb->aux;
else
bb_predicate = false;
}
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);
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. */
&& 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;
}
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
{
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);
|| 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,
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;
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<edge> 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,
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);
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))
{
|| 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,
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;
}
}
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;
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;
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)
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)
/* 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);
}
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)))
{
const vec<int> &operand_map,
const vec<HOST_WIDE_INT> &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)
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);
const vec<int> &operand_map,
const vec<HOST_WIDE_INT> &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,
auto_vec<int, 8> operand_map;
auto_vec<HOST_WIDE_INT, 8> 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);
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,
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);
{
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);
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;
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;
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;
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
/* 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)
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
/* 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)
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);
/* 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)
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++)
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;
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++)
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> inline_param_summary) const
{
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++)
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 ()))
{
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 "]",
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;
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)
/* 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)
void
-predicate::debug (conditions conds) const
+ipa_predicate::debug (conditions conds) const
{
dump (stderr, conds);
}
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;
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<int> &operand_map,
const vec<HOST_WIDE_INT> &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);
/* 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 ()
/* 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);
}
/* 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;
/* 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++)
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,
&& 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;
vec_safe_push (summary->conds, new_cond);
- return predicate::predicate_testing_cond (i);
+ return ipa_predicate::predicate_testing_cond (i);
}