Commit a6b1490d by Jan Hubicka Committed by Jan Hubicka

cgraph.c (symbol_table::create_edge): Use opt_for_fn.


	* cgraph.c (symbol_table::create_edge): Use opt_for_fn.
	(cgraph_node::cannot_return_p): Likewise.
	(cgraph_edge::cannot_lead_to_return_p): Likewise.
	(cgraph_edge::maybe_hot_p): Likewise.

From-SVN: r217667
parent 7525bb7d
2014-11-17 Jan Hubicka <hubicka@ucw.cz> 2014-11-17 Jan Hubicka <hubicka@ucw.cz>
* cgraph.c (symbol_table::create_edge): Use opt_for_fn.
(cgraph_node::cannot_return_p): Likewise.
(cgraph_edge::cannot_lead_to_return_p): Likewise.
(cgraph_edge::maybe_hot_p): Likewise.
2014-11-17 Jan Hubicka <hubicka@ucw.cz>
* predict.c (maybe_hot_frequency_p): Use opt_for_fn. * predict.c (maybe_hot_frequency_p): Use opt_for_fn.
(optimize_function_for_size_p): Likewise. (optimize_function_for_size_p): Likewise.
(probably_never_executed): Likewise; replace cfun by fun. (probably_never_executed): Likewise; replace cfun by fun.
...@@ -859,7 +859,8 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee, ...@@ -859,7 +859,8 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
edge->indirect_inlining_edge = 0; edge->indirect_inlining_edge = 0;
edge->speculative = false; edge->speculative = false;
edge->indirect_unknown_callee = indir_unknown_callee; edge->indirect_unknown_callee = indir_unknown_callee;
if (flag_devirtualize && call_stmt && DECL_STRUCT_FUNCTION (caller->decl)) if (opt_for_fn (edge->caller->decl, flag_devirtualize)
&& call_stmt && DECL_STRUCT_FUNCTION (caller->decl))
edge->in_polymorphic_cdtor edge->in_polymorphic_cdtor
= decl_maybe_in_construction_p (NULL, NULL, call_stmt, = decl_maybe_in_construction_p (NULL, NULL, call_stmt,
caller->decl); caller->decl);
...@@ -2374,7 +2375,7 @@ bool ...@@ -2374,7 +2375,7 @@ bool
cgraph_node::cannot_return_p (void) cgraph_node::cannot_return_p (void)
{ {
int flags = flags_from_decl_or_type (decl); int flags = flags_from_decl_or_type (decl);
if (!flag_exceptions) if (!opt_for_fn (decl, flag_exceptions))
return (flags & ECF_NORETURN) != 0; return (flags & ECF_NORETURN) != 0;
else else
return ((flags & (ECF_NORETURN | ECF_NOTHROW)) return ((flags & (ECF_NORETURN | ECF_NOTHROW))
...@@ -2394,7 +2395,7 @@ cgraph_edge::cannot_lead_to_return_p (void) ...@@ -2394,7 +2395,7 @@ cgraph_edge::cannot_lead_to_return_p (void)
if (indirect_unknown_callee) if (indirect_unknown_callee)
{ {
int flags = indirect_info->ecf_flags; int flags = indirect_info->ecf_flags;
if (!flag_exceptions) if (!opt_for_fn (caller->decl, flag_exceptions))
return (flags & ECF_NORETURN) != 0; return (flags & ECF_NORETURN) != 0;
else else
return ((flags & (ECF_NORETURN | ECF_NOTHROW)) return ((flags & (ECF_NORETURN | ECF_NOTHROW))
...@@ -2409,7 +2410,9 @@ cgraph_edge::cannot_lead_to_return_p (void) ...@@ -2409,7 +2410,9 @@ cgraph_edge::cannot_lead_to_return_p (void)
bool bool
cgraph_edge::maybe_hot_p (void) cgraph_edge::maybe_hot_p (void)
{ {
if (profile_info && flag_branch_probabilities /* TODO: Export profile_status from cfun->cfg to cgraph_node. */
if (profile_info
&& opt_for_fn (caller->decl, flag_branch_probabilities)
&& !maybe_hot_count_p (NULL, count)) && !maybe_hot_count_p (NULL, count))
return false; return false;
if (caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED if (caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
...@@ -2420,17 +2423,18 @@ cgraph_edge::maybe_hot_p (void) ...@@ -2420,17 +2423,18 @@ cgraph_edge::maybe_hot_p (void)
&& (callee && (callee
&& callee->frequency <= NODE_FREQUENCY_EXECUTED_ONCE)) && callee->frequency <= NODE_FREQUENCY_EXECUTED_ONCE))
return false; return false;
if (optimize_size) return false; if (opt_for_fn (caller->decl, optimize_size))
return false;
if (caller->frequency == NODE_FREQUENCY_HOT) if (caller->frequency == NODE_FREQUENCY_HOT)
return true; return true;
if (caller->frequency == NODE_FREQUENCY_EXECUTED_ONCE if (caller->frequency == NODE_FREQUENCY_EXECUTED_ONCE
&& frequency < CGRAPH_FREQ_BASE * 3 / 2) && frequency < CGRAPH_FREQ_BASE * 3 / 2)
return false; return false;
if (flag_guess_branch_prob) if (opt_for_fn (caller->decl, flag_guess_branch_prob))
{ {
if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0 if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0
|| frequency <= (CGRAPH_FREQ_BASE || frequency <= (CGRAPH_FREQ_BASE
/ PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))) / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
return false; return false;
} }
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment