Commit 8ccda8bc by Eric Botcazou Committed by Eric Botcazou

cgraph.h (cgraph_node::get_fun): Declare.

	* cgraph.h (cgraph_node::get_fun): Declare.
	* cgraph.c (cgraph_node::get_fun): New method.
	* ipa-inline.c (can_inline_edge_p): Use it.

From-SVN: r215968
parent 2f77200b
2014-10-07 Eric Botcazou <ebotcazou@adacore.com> 2014-10-07 Eric Botcazou <ebotcazou@adacore.com>
* cgraph.h (cgraph_node::get_fun): Declare.
* cgraph.c (cgraph_node::get_fun): New method.
* ipa-inline.c (can_inline_edge_p): Use it.
2014-10-07 Eric Botcazou <ebotcazou@adacore.com>
* lto-opts.c (lto_write_options): Handle -fmath-errno, -fsigned-zeros * lto-opts.c (lto_write_options): Handle -fmath-errno, -fsigned-zeros
and -ftrapping-math. and -ftrapping-math.
* lto-wrapper.c (merge_and_complain): Likewise. * lto-wrapper.c (merge_and_complain): Likewise.
...@@ -2992,6 +2992,23 @@ cgraph_node::get_body (void) ...@@ -2992,6 +2992,23 @@ cgraph_node::get_body (void)
return true; return true;
} }
/* Return the DECL_STRUCT_FUNCTION of the function. */
struct function *
cgraph_node::get_fun (void)
{
cgraph_node *node = this;
struct function *fun = DECL_STRUCT_FUNCTION (node->decl);
while (!fun && node->clone_of)
{
node = node->clone_of;
fun = DECL_STRUCT_FUNCTION (node->decl);
}
return fun;
}
/* Verify if the type of the argument matches that of the function /* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch, declaration. If we cannot verify this or there is a mismatch,
return false. */ return false. */
......
...@@ -919,6 +919,9 @@ public: ...@@ -919,6 +919,9 @@ public:
are free'd in final.c via free_after_compilation(). */ are free'd in final.c via free_after_compilation(). */
void release_body (bool keep_arguments = false); void release_body (bool keep_arguments = false);
/* Return the DECL_STRUCT_FUNCTION of the function. */
struct function *get_fun (void);
/* cgraph_node is no longer nested function; update cgraph accordingly. */ /* cgraph_node is no longer nested function; update cgraph accordingly. */
void unnest (void); void unnest (void);
......
...@@ -273,15 +273,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -273,15 +273,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
tree caller_tree = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (e->caller->decl); tree caller_tree = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (e->caller->decl);
tree callee_tree tree callee_tree
= callee ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (callee->decl) : NULL; = callee ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (callee->decl) : NULL;
struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl); struct function *caller_fun = e->caller->get_fun ();
struct function *callee_cfun struct function *callee_fun = callee ? callee->get_fun () : NULL;
= callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL;
if (!caller_cfun && e->caller->clone_of)
caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl);
if (!callee_cfun && callee && callee->clone_of)
callee_cfun = DECL_STRUCT_FUNCTION (callee->clone_of->decl);
gcc_assert (e->inline_failed); gcc_assert (e->inline_failed);
...@@ -296,7 +289,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -296,7 +289,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
inlinable = false; inlinable = false;
} }
else if (!inline_summary (callee)->inlinable else if (!inline_summary (callee)->inlinable
|| (caller_cfun && fn_contains_cilk_spawn_p (caller_cfun))) || (caller_fun && fn_contains_cilk_spawn_p (caller_fun)))
{ {
e->inline_failed = CIF_FUNCTION_NOT_INLINABLE; e->inline_failed = CIF_FUNCTION_NOT_INLINABLE;
inlinable = false; inlinable = false;
...@@ -333,8 +326,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -333,8 +326,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
caller cannot. caller cannot.
FIXME: this is obviously wrong for LTO where STRUCT_FUNCTION is missing. FIXME: this is obviously wrong for LTO where STRUCT_FUNCTION is missing.
Move the flag into cgraph node or mirror it in the inline summary. */ Move the flag into cgraph node or mirror it in the inline summary. */
else if (callee_cfun && callee_cfun->can_throw_non_call_exceptions else if (callee_fun && callee_fun->can_throw_non_call_exceptions
&& !(caller_cfun && caller_cfun->can_throw_non_call_exceptions)) && !(caller_fun && caller_fun->can_throw_non_call_exceptions))
{ {
e->inline_failed = CIF_NON_CALL_EXCEPTIONS; e->inline_failed = CIF_NON_CALL_EXCEPTIONS;
inlinable = false; inlinable = false;
......
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