summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog25
-rw-r--r--gcc/basic-block.h1
-rw-r--r--gcc/cfgbuild.c2
-rw-r--r--gcc/cfghooks.c4
-rw-r--r--gcc/cfgloopanal.c2
-rw-r--r--gcc/cfgrtl.c6
-rw-r--r--gcc/graphite.c2
-rw-r--r--gcc/internal-fn.c6
-rw-r--r--gcc/ipa-split.c4
-rw-r--r--gcc/loop-unroll.c2
-rw-r--r--gcc/optabs.c2
-rw-r--r--gcc/predict.c26
-rw-r--r--gcc/profile.c4
-rw-r--r--gcc/tree-cfg.c4
-rw-r--r--gcc/tree-inline.c3
15 files changed, 59 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 502ded7e7c0..543a3f081e1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,30 @@
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.
* gimple.c (gimple_set_bb): Replace uses of label_to_block_map
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 4ab82890500..d000a432522 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -328,7 +328,6 @@ struct GTY(()) control_flow_graph {
/* 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) \
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 08534d4bdde..a0c2c66a72e 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -618,7 +618,7 @@ find_many_sub_basic_blocks (sbitmap blocks)
/* 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;
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 0cd6af0f012..ab1c15fb2c4 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -1411,7 +1411,7 @@ account_profile_record (struct profile_record *record, int after_pass)
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)
@@ -1426,7 +1426,7 @@ account_profile_record (struct profile_record *record, int after_pass)
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)
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 0cee6c68b28..2260f4b4baa 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -470,7 +470,7 @@ single_likely_exit (struct loop *loop)
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)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 772d939a26b..34fe4f37846 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2420,7 +2420,7 @@ rtl_verify_edges (void)
&& 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);
@@ -5011,10 +5011,10 @@ rtl_account_profile_record (basic_block bb, int after_pass,
{
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;
}
diff --git a/gcc/graphite.c b/gcc/graphite.c
index e46710ca939..a573ea74d19 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -245,7 +245,7 @@ graphite_finalize (bool need_cfg_cleanup_p)
{
scev_reset ();
cleanup_tree_cfg ();
- profile_status = PROFILE_ABSENT;
+ profile_status_for_fn (cfun) = PROFILE_ABSENT;
release_recorded_exits ();
tree_estimate_probability ();
}
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index fb1e5784b15..8c54d987a62 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -194,7 +194,7 @@ ubsan_expand_si_overflow_addsub_check (tree_code code, gimple stmt)
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))
@@ -285,7 +285,7 @@ ubsan_expand_si_overflow_neg_check (gimple stmt)
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))
@@ -364,7 +364,7 @@ ubsan_expand_si_overflow_mul_check (gimple stmt)
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))
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index eca86dab14a..f8fa0eee2e5 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -411,7 +411,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
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))
@@ -1585,7 +1585,7 @@ execute_split_functions (void)
/* 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. */
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 9910b4e1b43..d1c7b9cdfb3 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1371,7 +1371,7 @@ decide_peel_simple (struct loop *loop, int flags)
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");
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e035af18c61..5172bd41666 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4286,7 +4286,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob)
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)
diff --git a/gcc/predict.c b/gcc/predict.c
index 1dec4dc92c7..6bb1b2cfef1 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -224,7 +224,7 @@ cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
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));
}
@@ -239,7 +239,7 @@ probably_never_executed (struct function *fun,
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)
@@ -438,7 +438,7 @@ optimize_loop_nest_for_size_p (struct loop *loop)
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)
@@ -539,8 +539,8 @@ gimple_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
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))));
}
@@ -610,7 +610,7 @@ rtl_predict_edge (edge e, enum br_predictor predictor, int probability)
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)
@@ -2443,8 +2443,8 @@ tree_estimate_probability_driver (void)
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;
}
@@ -2954,7 +2954,7 @@ estimate_bb_frequencies (bool force)
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;
@@ -3030,7 +3030,7 @@ compute_function_frequency (void)
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))
@@ -3189,8 +3189,8 @@ rebuild_frequencies (void)
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 ();
@@ -3200,7 +3200,7 @@ rebuild_frequencies (void)
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 ();
diff --git a/gcc/profile.c b/gcc/profile.c
index 9aec3cb06b3..24c16aa5b95 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -797,7 +797,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
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;
@@ -825,7 +825,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
}
}
counts_to_freqs ();
- profile_status = PROFILE_READ;
+ profile_status_for_fn (cfun) = PROFILE_READ;
compute_function_frequency ();
if (dump_file)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f384b04eb54..57d648755f0 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7875,11 +7875,11 @@ gimple_account_profile_record (basic_block bb, int after_pass,
{
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;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 1d1bc1eacb1..fd7eedb8fb0 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4612,7 +4612,8 @@ optimize_inline_calls (tree fn)
| 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. */