Commit fede8efa by Jan Hubicka Committed by Jan Hubicka

ipa-utils.c (searchc): Use cgraph_function_or_thunk_node.


	* ipa-utils.c (searchc): Use cgraph_function_or_thunk_node.
	* ipa-pure-const.c (analyze_function): Aliases don't need analysis.
	(self_recursive_p): Use cgraph_function_node.
	(propagate_pure_const): Likewise.
	(propagate_nothrow): Likewise.
	* ipa-reference.c (ipa_reference_get_not_read_global): Use
	cgraph_function_node.
	(propagate_bits): Likewise.
	(propagate): Likewise.

From-SVN: r174895
parent 0127c76f
2011-06-10 Jan Hubicka <jh@suse.cz>
* ipa-utils.c (searchc): Use cgraph_function_or_thunk_node.
* ipa-pure-const.c (analyze_function): Aliases don't need analysis.
(self_recursive_p): Use cgraph_function_node.
(propagate_pure_const): Likewise.
(propagate_nothrow): Likewise.
* ipa-reference.c (ipa_reference_get_not_read_global): Use
cgraph_function_node.
(propagate_bits): Likewise.
(propagate): Likewise.
2011-06-10 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> 2011-06-10 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
Richard Earnshaw <rearnsha@arm.com> Richard Earnshaw <rearnsha@arm.com>
......
...@@ -735,7 +735,7 @@ analyze_function (struct cgraph_node *fn, bool ipa) ...@@ -735,7 +735,7 @@ analyze_function (struct cgraph_node *fn, bool ipa)
flags_from_decl_or_type (fn->decl), flags_from_decl_or_type (fn->decl),
cgraph_node_cannot_return (fn)); cgraph_node_cannot_return (fn));
if (fn->thunk.thunk_p) if (fn->thunk.thunk_p || fn->alias)
{ {
/* Thunk gets propagated through, so nothing interesting happens. */ /* Thunk gets propagated through, so nothing interesting happens. */
gcc_assert (ipa); gcc_assert (ipa);
...@@ -1070,14 +1070,16 @@ ignore_edge (struct cgraph_edge *e) ...@@ -1070,14 +1070,16 @@ ignore_edge (struct cgraph_edge *e)
return (!e->can_throw_external); return (!e->can_throw_external);
} }
/* Return true if NODE is self recursive function. */ /* Return true if NODE is self recursive function.
??? self recursive and indirectly recursive funcions should
be the same, so this function seems unnecesary. */
static bool static bool
self_recursive_p (struct cgraph_node *node) self_recursive_p (struct cgraph_node *node)
{ {
struct cgraph_edge *e; struct cgraph_edge *e;
for (e = node->callees; e; e = e->next_callee) for (e = node->callees; e; e = e->next_callee)
if (e->callee == node) if (cgraph_function_node (e->callee, NULL) == node)
return true; return true;
return false; return false;
} }
...@@ -1167,7 +1169,8 @@ propagate_pure_const (void) ...@@ -1167,7 +1169,8 @@ propagate_pure_const (void)
/* Now walk the edges and merge in callee properties. */ /* Now walk the edges and merge in callee properties. */
for (e = w->callees; e; e = e->next_callee) for (e = w->callees; e; e = e->next_callee)
{ {
struct cgraph_node *y = e->callee; enum availability avail;
struct cgraph_node *y = cgraph_function_node (e->callee, &avail);
enum pure_const_state_e edge_state = IPA_CONST; enum pure_const_state_e edge_state = IPA_CONST;
bool edge_looping = false; bool edge_looping = false;
...@@ -1178,7 +1181,7 @@ propagate_pure_const (void) ...@@ -1178,7 +1181,7 @@ propagate_pure_const (void)
cgraph_node_name (e->callee), cgraph_node_name (e->callee),
e->callee->uid); e->callee->uid);
} }
if (cgraph_function_body_availability (y) > AVAIL_OVERWRITABLE) if (avail > AVAIL_OVERWRITABLE)
{ {
funct_state y_l = get_function_state (y); funct_state y_l = get_function_state (y);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
...@@ -1396,9 +1399,10 @@ propagate_nothrow (void) ...@@ -1396,9 +1399,10 @@ propagate_nothrow (void)
for (e = w->callees; e; e = e->next_callee) for (e = w->callees; e; e = e->next_callee)
{ {
struct cgraph_node *y = e->callee; enum availability avail;
struct cgraph_node *y = cgraph_function_node (e->callee, &avail);
if (cgraph_function_body_availability (y) > AVAIL_OVERWRITABLE) if (avail > AVAIL_OVERWRITABLE)
{ {
funct_state y_l = get_function_state (y); funct_state y_l = get_function_state (y);
......
...@@ -196,7 +196,7 @@ ipa_reference_get_not_read_global (struct cgraph_node *fn) ...@@ -196,7 +196,7 @@ ipa_reference_get_not_read_global (struct cgraph_node *fn)
{ {
ipa_reference_optimization_summary_t info; ipa_reference_optimization_summary_t info;
info = get_reference_optimization_summary (fn); info = get_reference_optimization_summary (cgraph_function_node (fn, NULL));
if (info) if (info)
return info->statics_not_read; return info->statics_not_read;
else if (flags_from_decl_or_type (fn->decl) & ECF_LEAF) else if (flags_from_decl_or_type (fn->decl) & ECF_LEAF)
...@@ -301,16 +301,17 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x ...@@ -301,16 +301,17 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x
struct cgraph_edge *e; struct cgraph_edge *e;
for (e = x->callees; e; e = e->next_callee) for (e = x->callees; e; e = e->next_callee)
{ {
struct cgraph_node *y = e->callee;
enum availability avail; enum availability avail;
struct cgraph_node *y = cgraph_function_node (e->callee, &avail);
avail = cgraph_function_body_availability (e->callee); if (!y)
continue;
/* Only look into nodes we can propagate something. */ /* Only look into nodes we can propagate something. */
if (avail > AVAIL_OVERWRITABLE if (avail > AVAIL_OVERWRITABLE
|| (avail == AVAIL_OVERWRITABLE || (avail == AVAIL_OVERWRITABLE
&& (flags_from_decl_or_type (e->callee->decl) & ECF_LEAF))) && (flags_from_decl_or_type (y->decl) & ECF_LEAF)))
{ {
int flags = flags_from_decl_or_type (e->callee->decl); int flags = flags_from_decl_or_type (y->decl);
if (get_reference_vars_info (y)) if (get_reference_vars_info (y))
{ {
ipa_reference_vars_info_t y_info ipa_reference_vars_info_t y_info
...@@ -663,8 +664,12 @@ propagate (void) ...@@ -663,8 +664,12 @@ propagate (void)
read_write_all_from_decl (node, &read_all, &write_all); read_write_all_from_decl (node, &read_all, &write_all);
for (e = node->callees; e; e = e->next_callee) for (e = node->callees; e; e = e->next_callee)
if (cgraph_function_body_availability (e->callee) <= AVAIL_OVERWRITABLE) {
read_write_all_from_decl (e->callee, &read_all, &write_all); enum availability avail;
struct cgraph_node *callee = cgraph_function_node (e->callee, &avail);
if (!callee || avail <= AVAIL_OVERWRITABLE)
read_write_all_from_decl (callee, &read_all, &write_all);
}
for (ie = node->indirect_calls; ie; ie = ie->next_callee) for (ie = node->indirect_calls; ie; ie = ie->next_callee)
if (!(ie->indirect_info->ecf_flags & ECF_CONST)) if (!(ie->indirect_info->ecf_flags & ECF_CONST))
...@@ -696,8 +701,13 @@ propagate (void) ...@@ -696,8 +701,13 @@ propagate (void)
read_write_all_from_decl (w, &read_all, &write_all); read_write_all_from_decl (w, &read_all, &write_all);
for (e = w->callees; e; e = e->next_callee) for (e = w->callees; e; e = e->next_callee)
if (cgraph_function_body_availability (e->callee) <= AVAIL_OVERWRITABLE) {
read_write_all_from_decl (e->callee, &read_all, &write_all); enum availability avail;
struct cgraph_node *callee = cgraph_function_node (e->callee, &avail);
if (avail <= AVAIL_OVERWRITABLE)
read_write_all_from_decl (callee, &read_all, &write_all);
}
for (ie = w->indirect_calls; ie; ie = ie->next_callee) for (ie = w->indirect_calls; ie; ie = ie->next_callee)
if (!(ie->indirect_info->ecf_flags & ECF_CONST)) if (!(ie->indirect_info->ecf_flags & ECF_CONST))
......
...@@ -101,10 +101,10 @@ searchc (struct searchc_env* env, struct cgraph_node *v, ...@@ -101,10 +101,10 @@ searchc (struct searchc_env* env, struct cgraph_node *v,
for (edge = v->callees; edge; edge = edge->next_callee) for (edge = v->callees; edge; edge = edge->next_callee)
{ {
struct ipa_dfs_info * w_info; struct ipa_dfs_info * w_info;
struct cgraph_node *w = edge->callee; enum availability avail;
enum availability avail = cgraph_function_body_availability (w); struct cgraph_node *w = cgraph_function_or_thunk_node (edge->callee, &avail);
if (ignore_edge && ignore_edge (edge)) if (!w || (ignore_edge && ignore_edge (edge)))
continue; continue;
if (w->aux if (w->aux
......
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