gcc/
* basic-block.h (profile_status): Eliminate macro.
* cfgbuild.c (find_many_sub_basic_blocks): Eliminate use of
profile_status macro in favor of profile_status_for_fn, making
use of cfun explicit.
* cfghooks.c (account_profile_record): Likewise.
* cfgloopanal.c (single_likely_exit):
* cfgrtl.c (rtl_verify_edges, rtl_account_profile_record): Likewise.
* graphite.c (graphite_finalize):
* internal-fn.c (ubsan_expand_si_overflow_addsub_check,
ubsan_expand_si_overflow_neg_check,
ubsan_expand_si_overflow_mul_check): Likewise.
* ipa-split.c (consider_split, execute_split_functions):
* loop-unroll.c (decide_peel_simple):
* optabs.c (emit_cmp_and_jump_insn_1):
* predict.c (maybe_hot_edge_p, probably_never_executed,
predictable_edge_p, probability_reliable_p, gimple_predict_edge,
tree_estimate_probability_driver, estimate_bb_frequencies,
compute_function_frequency, rebuild_frequencies): Likewise.
* profile.c (compute_branch_probabilities): Likewise.
* tree-cfg.c (gimple_account_profile_record): Likewise.
* tree-inline.c (optimize_inline_calls): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205825
138bc75d-0d04-0410-961f-
82ee72b054a4
+2013-12-09 David Malcolm <dmalcolm@redhat.com>
+
+ * basic-block.h (profile_status): Eliminate macro.
+
+ * cfgbuild.c (find_many_sub_basic_blocks): Eliminate use of
+ profile_status macro in favor of profile_status_for_fn, making
+ use of cfun explicit.
+ * cfghooks.c (account_profile_record): Likewise.
+ * cfgloopanal.c (single_likely_exit):
+ * cfgrtl.c (rtl_verify_edges, rtl_account_profile_record): Likewise.
+ * graphite.c (graphite_finalize):
+ * internal-fn.c (ubsan_expand_si_overflow_addsub_check,
+ ubsan_expand_si_overflow_neg_check,
+ ubsan_expand_si_overflow_mul_check): Likewise.
+ * ipa-split.c (consider_split, execute_split_functions):
+ * loop-unroll.c (decide_peel_simple):
+ * optabs.c (emit_cmp_and_jump_insn_1):
+ * predict.c (maybe_hot_edge_p, probably_never_executed,
+ predictable_edge_p, probability_reliable_p, gimple_predict_edge,
+ tree_estimate_probability_driver, estimate_bb_frequencies,
+ compute_function_frequency, rebuild_frequencies): Likewise.
+ * profile.c (compute_branch_probabilities): Likewise.
+ * tree-cfg.c (gimple_account_profile_record): Likewise.
+ * tree-inline.c (optimize_inline_calls): Likewise.
+
2013-12-09 David Malcolm <dmalcolm@redhat.com>
* basic-block.h (label_to_block_map): Eliminate macro.
/* Defines for textual backward source compatibility. */
#define last_basic_block (cfun->cfg->x_last_basic_block)
-#define profile_status (cfun->cfg->x_profile_status)
/* For iterating over basic blocks. */
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
/* Update branch probabilities. Expect only (un)conditional jumps
to be created with only the forward edges. */
- if (profile_status != PROFILE_ABSENT)
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT)
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
{
edge e;
FOR_ALL_BB (bb)
{
if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
- && profile_status != PROFILE_ABSENT)
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT)
{
sum = 0;
FOR_EACH_EDGE (e, ei, bb->succs)
record->num_mismatched_count_out[after_pass]++;
}
if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun)
- && profile_status != PROFILE_ABSENT)
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT)
{
sum = 0;
FOR_EACH_EDGE (e, ei, bb->preds)
ruled out by this test. The static branch prediction algorithm
will not assign such a low probability to conditionals for usual
reasons. */
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& ex->probability < 5 && !ex->count)
continue;
if (!found)
&& any_condjump_p (BB_END (bb)))
{
if (XINT (note, 0) != BRANCH_EDGE (bb)->probability
- && profile_status != PROFILE_ABSENT)
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT)
{
error ("verify_flow_info: REG_BR_PROB does not match cfg %i %i",
XINT (note, 0), BRANCH_EDGE (bb)->probability);
{
record->size[after_pass]
+= insn_rtx_cost (PATTERN (insn), false);
- if (profile_status == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
record->time[after_pass]
+= insn_rtx_cost (PATTERN (insn), true) * bb->count;
- else if (profile_status == PROFILE_GUESSED)
+ else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
record->time[after_pass]
+= insn_rtx_cost (PATTERN (insn), true) * bb->frequency;
}
{
scev_reset ();
cleanup_tree_cfg ();
- profile_status = PROFILE_ABSENT;
+ profile_status_for_fn (cfun) = PROFILE_ABSENT;
release_recorded_exits ();
tree_estimate_probability ();
}
if (maybe_expand_insn (icode, 4, ops))
{
last = get_last_insn ();
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& JUMP_P (last)
&& any_condjump_p (last)
&& !find_reg_note (last, REG_BR_PROB, 0))
if (maybe_expand_insn (icode, 3, ops))
{
last = get_last_insn ();
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& JUMP_P (last)
&& any_condjump_p (last)
&& !find_reg_note (last, REG_BR_PROB, 0))
if (maybe_expand_insn (icode, 4, ops))
{
last = get_last_insn ();
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& JUMP_P (last)
&& any_condjump_p (last)
&& !find_reg_note (last, REG_BR_PROB, 0))
a loop, enable splitting since inlining code skipping the loop
is likely noticeable win. */
if (back_edge
- && profile_status != PROFILE_READ
+ && profile_status_for_fn (cfun) != PROFILE_READ
&& incoming_freq < ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency)
{
if (dump_file && (dump_flags & TDF_DETAILS))
/* We enforce splitting after loop headers when profile info is not
available. */
- if (profile_status != PROFILE_READ)
+ if (profile_status_for_fn (cfun) != PROFILE_READ)
mark_dfs_back_edges ();
/* Initialize bitmap to track forbidden calls. */
also branch from branch prediction POV (and probably better reason
to not unroll/peel). */
if (num_loop_branches (loop) > 1
- && profile_status != PROFILE_READ)
+ && profile_status_for_fn (cfun) != PROFILE_READ)
{
if (dump_file)
fprintf (dump_file, ";; Not peeling, contains branches\n");
insn = emit_jump_insn (GEN_FCN (icode) (test, XEXP (test, 0),
XEXP (test, 1), label));
if (prob != -1
- && profile_status != PROFILE_ABSENT
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT
&& insn
&& JUMP_P (insn)
&& any_condjump_p (insn)
bool
maybe_hot_edge_p (edge e)
{
- if (profile_status == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
return maybe_hot_count_p (cfun, e->count);
return maybe_hot_frequency_p (cfun, EDGE_FREQUENCY (e));
}
gcov_type count, int frequency)
{
gcc_checking_assert (fun);
- if (profile_status_for_fn (fun) == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
{
int unlikely_count_fraction = PARAM_VALUE (UNLIKELY_BB_COUNT_FRACTION);
if (count * unlikely_count_fraction >= profile_info->runs)
bool
predictable_edge_p (edge e)
{
- if (profile_status == PROFILE_ABSENT)
+ if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
return false;
if ((e->probability
<= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100)
static bool
probability_reliable_p (int prob)
{
- return (profile_status == PROFILE_READ
- || (profile_status == PROFILE_GUESSED
+ return (profile_status_for_fn (cfun) == PROFILE_READ
+ || (profile_status_for_fn (cfun) == PROFILE_GUESSED
&& (prob <= HITRATE (1) || prob >= HITRATE (99))));
}
void
gimple_predict_edge (edge e, enum br_predictor predictor, int probability)
{
- gcc_assert (profile_status != PROFILE_GUESSED);
+ gcc_assert (profile_status_for_fn (cfun) != PROFILE_GUESSED);
if ((e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun) && EDGE_COUNT (e->src->succs) >
1)
&& flag_guess_branch_prob && optimize)
loop_optimizer_finalize ();
if (dump_file && (dump_flags & TDF_DETAILS))
gimple_dump_cfg (dump_file, dump_flags);
- if (profile_status == PROFILE_ABSENT)
- profile_status = PROFILE_GUESSED;
+ if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
+ profile_status_for_fn (cfun) = PROFILE_GUESSED;
return 0;
}
\f
basic_block bb;
sreal freq_max;
- if (force || profile_status != PROFILE_READ || !counts_to_freqs ())
+ if (force || profile_status_for_fn (cfun) != PROFILE_READ || !counts_to_freqs ())
{
static int real_values_initialized = 0;
if (DECL_STATIC_DESTRUCTOR (current_function_decl))
node->only_called_at_exit = true;
- if (profile_status != PROFILE_READ)
+ if (profile_status_for_fn (cfun) != PROFILE_READ)
{
int flags = flags_from_decl_or_type (current_function_decl);
if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
count_max = MAX (bb->count, count_max);
- if (profile_status == PROFILE_GUESSED
- || (profile_status == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
+ if (profile_status_for_fn (cfun) == PROFILE_GUESSED
+ || (profile_status_for_fn (cfun) == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
{
loop_optimizer_init (0);
add_noreturn_fake_exit_edges ();
remove_fake_exit_edges ();
loop_optimizer_finalize ();
}
- else if (profile_status == PROFILE_READ)
+ else if (profile_status_for_fn (cfun) == PROFILE_READ)
counts_to_freqs ();
else
gcc_unreachable ();
give all abnormals frequency of 0, otherwise distribute the
frequency over abnormals (this is the case of noreturn
calls). */
- else if (profile_status == PROFILE_ABSENT)
+ else if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
{
int total = 0;
}
}
counts_to_freqs ();
- profile_status = PROFILE_READ;
+ profile_status_for_fn (cfun) = PROFILE_READ;
compute_function_frequency ();
if (dump_file)
{
record->size[after_pass]
+= estimate_num_insns (gsi_stmt (i), &eni_size_weights);
- if (profile_status == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
record->time[after_pass]
+= estimate_num_insns (gsi_stmt (i),
&eni_time_weights) * bb->count;
- else if (profile_status == PROFILE_GUESSED)
+ else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
record->time[after_pass]
+= estimate_num_insns (gsi_stmt (i),
&eni_time_weights) * bb->frequency;
| TODO_cleanup_cfg
| (gimple_in_ssa_p (cfun) ? TODO_remove_unused_locals : 0)
| (gimple_in_ssa_p (cfun) ? TODO_update_address_taken : 0)
- | (profile_status != PROFILE_ABSENT ? TODO_rebuild_frequencies : 0));
+ | (profile_status_for_fn (cfun) != PROFILE_ABSENT
+ ? TODO_rebuild_frequencies : 0));
}
/* Passed to walk_tree. Copies the node pointed to, if appropriate. */