Commit e6416b30 by Jan Hubicka Committed by Jan Hubicka

cgraph.h (cgraph_optimize_for_size_p): Declare.

	* cgraph.h (cgraph_optimize_for_size_p): Declare.
	* ipa-cp.c (ipcp_insert_stage): Use cgraph_optimize_for_size_p.
	* predict.c (cgraph_optimize_for_size_p): Break out from ...
	(optimize_function_for_size_p) ... here.

From-SVN: r172711
parent be7f7822
2011-04-19 Jan Hubicka <jh@suse.cz>
* cgraph.h (cgraph_optimize_for_size_p): Declare.
* ipa-cp.c (ipcp_insert_stage): Use cgraph_optimize_for_size_p.
* predict.c (cgraph_optimize_for_size_p): Break out from ...
(optimize_function_for_size_p) ... here.
2011-04-19 Richard Guenther <rguenther@suse.de> 2011-04-19 Richard Guenther <rguenther@suse.de>
PR lto/48207 PR lto/48207
......
...@@ -656,6 +656,7 @@ bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *); ...@@ -656,6 +656,7 @@ bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *);
/* In predict.c */ /* In predict.c */
bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e); bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
bool cgraph_optimize_for_size_p (struct cgraph_node *);
/* In varpool.c */ /* In varpool.c */
extern GTY(()) struct varpool_node *varpool_nodes_queue; extern GTY(()) struct varpool_node *varpool_nodes_queue;
......
...@@ -1410,7 +1410,7 @@ ipcp_insert_stage (void) ...@@ -1410,7 +1410,7 @@ ipcp_insert_stage (void)
if (new_size + growth > max_new_size) if (new_size + growth > max_new_size)
break; break;
if (growth if (growth
&& optimize_function_for_size_p (DECL_STRUCT_FUNCTION (node->decl))) && cgraph_optimize_for_size_p (node))
{ {
if (dump_file) if (dump_file)
fprintf (dump_file, "Not versioning, cold code would grow"); fprintf (dump_file, "Not versioning, cold code would grow");
......
...@@ -196,7 +196,9 @@ maybe_hot_edge_p (edge e) ...@@ -196,7 +196,9 @@ maybe_hot_edge_p (edge e)
return maybe_hot_frequency_p (EDGE_FREQUENCY (e)); return maybe_hot_frequency_p (EDGE_FREQUENCY (e));
} }
/* Return true in case BB is probably never executed. */ /* Return true in case BB is probably never executed. */
bool bool
probably_never_executed_bb_p (const_basic_block bb) probably_never_executed_bb_p (const_basic_block bb)
{ {
...@@ -209,24 +211,31 @@ probably_never_executed_bb_p (const_basic_block bb) ...@@ -209,24 +211,31 @@ probably_never_executed_bb_p (const_basic_block bb)
return false; return false;
} }
/* Return true when current function should always be optimized for size. */ /* Return true if NODE should be optimized for size. */
bool bool
optimize_function_for_size_p (struct function *fun) cgraph_optimize_for_size_p (struct cgraph_node *node)
{ {
struct cgraph_node *node;
if (optimize_size) if (optimize_size)
return true; return true;
if (!fun || !fun->decl)
return false;
node = cgraph_get_node (fun->decl);
if (node && (node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)) if (node && (node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED))
return true; return true;
else else
return false; return false;
} }
/* Return true when current function should always be optimized for size. */
bool
optimize_function_for_size_p (struct function *fun)
{
if (optimize_size)
return true;
if (!fun || !fun->decl)
return false;
return cgraph_optimize_for_size_p (cgraph_get_node (fun->decl));
}
/* Return true when current function should always be optimized for speed. */ /* Return true when current function should always be optimized for speed. */
bool bool
......
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