summaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2008-06-02 18:36:49 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2008-06-02 16:36:49 +0000
commit3250d724898f2c4af583d67ba86c34193ba86a89 (patch)
tree9966e2434cb3b536d44ef7b732d765660efcb506 /gcc/predict.c
parent79711d26dbc325abf22d935cc248bcd59a06eb21 (diff)
downloadgcc-3250d724898f2c4af583d67ba86c34193ba86a89.tar.gz
predict.c (maybe_hot_frequency_p): Break out of...
* predict.c (maybe_hot_frequency_p): Break out of... (maybe_hot_bb_p): ... here. (maybe_hot_edge_p): New. * tree-ssa-coalesce.c (coalesce_cost_edge): Compute cost based on edge. * basic-block.h (maybe_hot_edge_p): Declare. From-SVN: r136282
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 41743331b9e..42852dcfcac 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -107,6 +107,22 @@ static const struct predictor_info predictor_info[]= {
};
#undef DEF_PREDICTOR
+/* Return TRUE if frequency FREQ is considered to be hot. */
+static bool
+maybe_hot_frequency_p (int freq)
+{
+ if (!profile_info || !flag_branch_probabilities)
+ {
+ if (cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
+ return false;
+ if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
+ return true;
+ }
+ if (freq < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
+ return false;
+ return true;
+}
+
/* Return true in case BB can be CPU intensive and should be optimized
for maximal performance. */
@@ -117,16 +133,20 @@ maybe_hot_bb_p (const_basic_block bb)
&& (bb->count
< profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
return false;
- if (!profile_info || !flag_branch_probabilities)
- {
- if (cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
- return false;
- if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
- return true;
- }
- if (bb->frequency < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
+ return maybe_hot_frequency_p (bb->frequency);
+}
+
+/* Return true in case BB can be CPU intensive and should be optimized
+ for maximal performance. */
+
+bool
+maybe_hot_edge_p (edge e)
+{
+ if (profile_info && flag_branch_probabilities
+ && (e->count
+ < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
return false;
- return true;
+ return maybe_hot_frequency_p (EDGE_FREQUENCY (e));
}
/* Return true in case BB is cold and should be optimized for size. */