cgraphunit.c (cgraph_optimize_function): Always do optimize_inline_calls when there is always_inline callee.

* cgraphunit.c (cgraph_optimize_function):  Always do
	optimize_inline_calls when there is always_inline callee.
	(cgraph_decide_inlining): Fix formating.
	* tree-inline.c (inlinable_function_p): Do sorry for alwaysinline
	functions.
	(expand_call_inline): Likewise.
	* toplev.h (sorry): Fix prototype.

	* gcc.dg/always_inline.c: New test.
	* gcc.dg/debug/20031231-1.c: Fix.

From-SVN: r75781
This commit is contained in:
Jan Hubicka 2004-01-13 02:35:27 +01:00 committed by Jan Hubicka
parent 04cc79bb89
commit 2d3270129f
7 changed files with 57 additions and 11 deletions

View file

@ -1,3 +1,13 @@
2004-01-13 Jan Hubicka <jh@suse.cz>
* cgraphunit.c (cgraph_optimize_function): Always do
optimize_inline_calls when there is always_inline callee.
(cgraph_decide_inlining): Fix formating.
* tree-inline.c (inlinable_function_p): Do sorry for alwaysinline
functions.
(expand_call_inline): Likewise.
* toplev.h (sorry): Fix prototype.
2004-01-12 Roger Sayle <roger@eyesopen.com>
* builtins.c (expand_builtin_expect_jump): Simplify logic. Handle

View file

@ -481,7 +481,10 @@ cgraph_optimize_function (struct cgraph_node *node)
struct cgraph_edge *e;
for (e = node->callees; e; e = e->next_callee)
if (!e->inline_failed || warn_inline)
if (!e->inline_failed || warn_inline
|| (DECL_DECLARED_INLINE_P (e->callee->decl)
&& lookup_attribute ("always_inline",
DECL_ATTRIBUTES (e->callee->decl))))
break;
if (e)
optimize_inline_calls (decl);
@ -1178,10 +1181,10 @@ cgraph_decide_inlining (void)
cgraph_node_name (node->callees->caller),
node->callees->caller->global.insns);
}
if (cgraph_dump_file && node->global.cloned_times > 0)
fprintf (cgraph_dump_file,
" Inlined %i times for a net change of %+i insns.\n",
node->global.cloned_times, overall_insns - old_insns);
if (cgraph_dump_file && node->global.cloned_times > 0)
fprintf (cgraph_dump_file,
" Inlined %i times for a net change of %+i insns.\n",
node->global.cloned_times, overall_insns - old_insns);
for (y = 0; y < ninlined; y++)
inlined[y]->output = 0, node->aux = 0;
}

View file

@ -1,3 +1,8 @@
2004-01-13 Jan Hubicka <jh@suse.cz>
* gcc.dg/always_inline.c: New test.
* gcc.dg/debug/20031231-1.c: Fix.
2004-01-13 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/13474

View file

@ -0,0 +1,21 @@
/* { dg-do compile } */
/* { dg-options "-Winline -O2" } */
#include <stdarg.h>
inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" "" } */
void
q(void)
{
t(); /* { dg-error "called from here" "" } */
}
inline __attribute__ ((always_inline)) void
q2(void)
{ /* { dg-error "recursive" "" } */
q2(); /* { dg-error "called from here" "" } */
q2(); /* { dg-error "called from here" "" } */
}
inline __attribute__ ((always_inline)) void
e(int t, ...)
{ /* { dg-error "variable argument" "" } */
va_list q;
va_start (q, t);
}

View file

@ -12,7 +12,6 @@ void pp_c_string_literal (c_pretty_printer *, tree);
static __inline__ __attribute__((always_inline)) void
pp_c_shift_expression (c_pretty_printer *pp, tree e)
{
pp_c_shift_expression (pp,e);
}
static void

View file

@ -60,7 +60,7 @@ extern void error (const char *, ...);
extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
extern void pedwarn (const char *, ...);
extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void sorry (const char *, ...);
extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void rest_of_decl_compilation (tree, const char *, int, int);

View file

@ -1213,7 +1213,10 @@ inlinable_function_p (tree fn)
&& DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn));
if (do_warning)
if (lookup_attribute ("always_inline",
DECL_ATTRIBUTES (fn)))
sorry (inline_forbidden_reason, fn, fn);
else if (do_warning)
warning (inline_forbidden_reason, fn, fn);
inlinable = false;
@ -1330,9 +1333,14 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
inlining. */
if (!cgraph_inline_p (id->current_decl, fn, &reason))
{
if (warn_inline && DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn)
&& strlen (reason))
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
sorry ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
sorry ("called from here");
}
else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn)
&& strlen (reason))
{
warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
warning ("called from here");