Commit 18177c7e by Richard Guenther Committed by Richard Biener

Makefile.in (tree-inline.o): Add $(TARGET_H) and $(INTEGRATE_H) dependencies.

2007-08-24  Richard Guenther  <rguenther@suse.de>

	* Makefile.in (tree-inline.o): Add $(TARGET_H) and $(INTEGRATE_H)
	dependencies.
	* c-objc-common.c (c_cannot_inline_tree_fn): Remove.
	* langhooks.c (lhd_tree_inlining_cannot_inline_tree_fn): Likewise.
	* tree-inline.c (inlinable_function_p): Fold in common parts of
	the cannot_inline_tree_fn langhook.
	* langhooks-def.h (lhd_tree_inlining_cannot_inline_tree_fn): Remove.
	(LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN): Likewise.
	(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
	cannot_inline_tree_fn langhook.
	* langhooks.h (struct lang_hooks_for_tree_inlining): Remove
	cannot_inline_tree_fn member.

	cp/
	* tree.c (cp_cannot_inline_tree_fn): Remove.
	* cp-tree.h (cp_cannot_inline_tree_fn): Likewise.
	* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN):
	Remove define.

From-SVN: r127763
parent 9c219b9b
2007-08-24 Richard Guenther <rguenther@suse.de> 2007-08-24 Richard Guenther <rguenther@suse.de>
* Makefile.in (tree-inline.o): Add $(TARGET_H) and $(INTEGRATE_H)
dependencies.
* c-objc-common.c (c_cannot_inline_tree_fn): Remove.
* langhooks.c (lhd_tree_inlining_cannot_inline_tree_fn): Likewise.
* tree-inline.c (inlinable_function_p): Fold in common parts of
the cannot_inline_tree_fn langhook.
* langhooks-def.h (lhd_tree_inlining_cannot_inline_tree_fn): Remove.
(LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN): Likewise.
(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
cannot_inline_tree_fn langhook.
* langhooks.h (struct lang_hooks_for_tree_inlining): Remove
cannot_inline_tree_fn member.
2007-08-24 Richard Guenther <rguenther@suse.de>
* expr.c (get_inner_reference): Do computation of bitoffset * expr.c (get_inner_reference): Do computation of bitoffset
from offset in a way we can detect overflow reliably. from offset in a way we can detect overflow reliably.
......
...@@ -50,51 +50,6 @@ c_missing_noreturn_ok_p (tree decl) ...@@ -50,51 +50,6 @@ c_missing_noreturn_ok_p (tree decl)
return flag_hosted && MAIN_NAME_P (DECL_ASSEMBLER_NAME (decl)); return flag_hosted && MAIN_NAME_P (DECL_ASSEMBLER_NAME (decl));
} }
int
c_cannot_inline_tree_fn (tree *fnp)
{
tree fn = *fnp;
bool do_warning = (warn_inline
&& DECL_INLINE (fn)
&& DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn));
tree always_inline = lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn));
if (flag_really_no_inline && always_inline == NULL)
{
if (do_warning)
warning (OPT_Winline, "function %q+F can never be inlined because it "
"is suppressed using -fno-inline", fn);
goto cannot_inline;
}
/* Don't auto-inline anything that might not be bound within
this unit of translation. */
if (always_inline == NULL
&& !DECL_DECLARED_INLINE_P (fn)
&& !targetm.binds_local_p (fn))
{
if (do_warning)
warning (OPT_Winline, "function %q+F can never be inlined because it "
"might not be bound within this unit of translation", fn);
goto cannot_inline;
}
if (!function_attribute_inlinable_p (fn))
{
if (do_warning)
warning (OPT_Winline, "function %q+F can never be inlined because it "
"uses attributes conflicting with inlining", fn);
goto cannot_inline;
}
return 0;
cannot_inline:
DECL_UNINLINABLE (fn) = 1;
return 1;
}
/* Called from check_global_declarations. */ /* Called from check_global_declarations. */
bool bool
......
2007-08-24 Richard Guenther <rguenther@suse.de>
* tree.c (cp_cannot_inline_tree_fn): Remove.
* cp-tree.h (cp_cannot_inline_tree_fn): Likewise.
* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN):
Remove define.
2007-08-24 Jakub Jelinek <jakub@redhat.com> 2007-08-24 Jakub Jelinek <jakub@redhat.com>
PR c++/32567 PR c++/32567
......
...@@ -104,9 +104,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t, ...@@ -104,9 +104,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#undef LANG_HOOKS_ATTRIBUTE_TABLE #undef LANG_HOOKS_ATTRIBUTE_TABLE
#define LANG_HOOKS_ATTRIBUTE_TABLE cxx_attribute_table #define LANG_HOOKS_ATTRIBUTE_TABLE cxx_attribute_table
#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
cp_cannot_inline_tree_fn
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P #undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
......
...@@ -4741,7 +4741,6 @@ extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, ...@@ -4741,7 +4741,6 @@ extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
walk_tree_1 (a, b, c, d, cp_walk_subtrees) walk_tree_1 (a, b, c, d, cp_walk_subtrees)
#define cp_walk_tree_without_duplicates(a,b,c) \ #define cp_walk_tree_without_duplicates(a,b,c) \
walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees) walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees)
extern int cp_cannot_inline_tree_fn (tree*);
extern tree fold_if_not_in_template (tree); extern tree fold_if_not_in_template (tree);
extern tree rvalue (tree); extern tree rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree); extern tree convert_bitfield_to_declared_type (tree);
......
...@@ -2398,58 +2398,6 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func, ...@@ -2398,58 +2398,6 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
#undef WALK_SUBTREE #undef WALK_SUBTREE
} }
/* Decide whether there are language-specific reasons to not inline a
function as a tree. */
int
cp_cannot_inline_tree_fn (tree* fnp)
{
tree fn = *fnp;
/* We can inline a template instantiation only if it's fully
instantiated. */
if (DECL_TEMPLATE_INFO (fn)
&& TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
{
/* Don't instantiate functions that are not going to be
inlined. */
if (!DECL_INLINE (DECL_TEMPLATE_RESULT
(template_for_substitution (fn))))
return 1;
fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0, /*undefined_ok=*/0);
if (TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
return 1;
}
if (flag_really_no_inline
&& lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
return 1;
/* Don't auto-inline functions that might be replaced at link-time
with an alternative definition. */
if (!DECL_DECLARED_INLINE_P (fn) && DECL_REPLACEABLE_P (fn))
{
DECL_UNINLINABLE (fn) = 1;
return 1;
}
if (varargs_function_p (fn))
{
DECL_UNINLINABLE (fn) = 1;
return 1;
}
if (! function_attribute_inlinable_p (fn))
{
DECL_UNINLINABLE (fn) = 1;
return 1;
}
return 0;
}
/* Like save_expr, but for C++. */ /* Like save_expr, but for C++. */
tree tree
......
...@@ -68,7 +68,6 @@ extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *); ...@@ -68,7 +68,6 @@ extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
extern tree lhd_builtin_function (tree decl); extern tree lhd_builtin_function (tree decl);
/* Declarations of default tree inlining hooks. */ /* Declarations of default tree inlining hooks. */
extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *);
extern void lhd_initialize_diagnostics (struct diagnostic_context *); extern void lhd_initialize_diagnostics (struct diagnostic_context *);
extern tree lhd_callgraph_analyze_expr (tree *, int *, tree); extern tree lhd_callgraph_analyze_expr (tree *, int *, tree);
...@@ -131,13 +130,10 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, ...@@ -131,13 +130,10 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL
/* Tree inlining hooks. */ /* Tree inlining hooks. */
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
lhd_tree_inlining_cannot_inline_tree_fn
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \ #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
hook_bool_tree_tree_false hook_bool_tree_tree_false
#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \ #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \ LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
} }
......
...@@ -276,20 +276,6 @@ lhd_types_compatible_p (tree x, tree y) ...@@ -276,20 +276,6 @@ lhd_types_compatible_p (tree x, tree y)
return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y); return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
} }
/* lang_hooks.tree_inlining.cannot_inline_tree_fn is called to
determine whether there are language-specific reasons for not
inlining a given function. */
int
lhd_tree_inlining_cannot_inline_tree_fn (tree *fnp)
{
if (flag_really_no_inline
&& lookup_attribute ("always_inline", DECL_ATTRIBUTES (*fnp)) == NULL)
return 1;
return 0;
}
/* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree /* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree
nodes. Returns nonzero if it does not want the usual dumping of the nodes. Returns nonzero if it does not want the usual dumping of the
second argument. */ second argument. */
......
...@@ -35,7 +35,6 @@ typedef void (*lang_print_tree_hook) (FILE *, tree, int indent); ...@@ -35,7 +35,6 @@ typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
struct lang_hooks_for_tree_inlining struct lang_hooks_for_tree_inlining
{ {
int (*cannot_inline_tree_fn) (tree *);
bool (*var_mod_type_p) (tree, tree); bool (*var_mod_type_p) (tree, tree);
}; };
......
...@@ -51,6 +51,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -51,6 +51,8 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-prop.h" #include "ipa-prop.h"
#include "value-prof.h" #include "value-prof.h"
#include "tree-pass.h" #include "tree-pass.h"
#include "target.h"
#include "integrate.h"
/* I'm not real happy about this, but we need to handle gimple and /* I'm not real happy about this, but we need to handle gimple and
non-gimple trees. */ non-gimple trees. */
...@@ -1848,18 +1850,44 @@ static bool ...@@ -1848,18 +1850,44 @@ static bool
inlinable_function_p (tree fn) inlinable_function_p (tree fn)
{ {
bool inlinable = true; bool inlinable = true;
bool do_warning;
tree always_inline;
/* If we've already decided this function shouldn't be inlined, /* If we've already decided this function shouldn't be inlined,
there's no need to check again. */ there's no need to check again. */
if (DECL_UNINLINABLE (fn)) if (DECL_UNINLINABLE (fn))
return false; return false;
/* See if there is any language-specific reason it cannot be /* We only warn for functions declared `inline' by the user. */
inlined. (It is important that this hook be called early because do_warning = (warn_inline
in C++ it may result in template instantiation.) && DECL_INLINE (fn)
If the function is not inlinable for language-specific reasons, && DECL_DECLARED_INLINE_P (fn)
it is left up to the langhook to explain why. */ && !DECL_IN_SYSTEM_HEADER (fn));
inlinable = !lang_hooks.tree_inlining.cannot_inline_tree_fn (&fn);
always_inline = lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn));
if (flag_really_no_inline
&& always_inline == NULL)
{
if (do_warning)
warning (OPT_Winline, "function %q+F can never be inlined because it "
"is suppressed using -fno-inline", fn);
inlinable = false;
}
/* Don't auto-inline anything that might not be bound within
this unit of translation. */
else if (!DECL_DECLARED_INLINE_P (fn)
&& DECL_REPLACEABLE_P (fn))
inlinable = false;
else if (!function_attribute_inlinable_p (fn))
{
if (do_warning)
warning (OPT_Winline, "function %q+F can never be inlined because it "
"uses attributes conflicting with inlining", fn);
inlinable = false;
}
/* If we don't have the function body available, we can't inline it. /* If we don't have the function body available, we can't inline it.
However, this should not be recorded since we also get here for However, this should not be recorded since we also get here for
...@@ -1893,14 +1921,8 @@ inlinable_function_p (tree fn) ...@@ -1893,14 +1921,8 @@ inlinable_function_p (tree fn)
about functions that would for example call alloca. But since about functions that would for example call alloca. But since
this a property of the function, just one warning is enough. this a property of the function, just one warning is enough.
As a bonus we can now give more details about the reason why a As a bonus we can now give more details about the reason why a
function is not inlinable. function is not inlinable. */
We only warn for functions declared `inline' by the user. */ if (always_inline)
bool do_warning = (warn_inline
&& DECL_INLINE (fn)
&& DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn));
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
sorry (inline_forbidden_reason, fn); sorry (inline_forbidden_reason, fn);
else if (do_warning) else if (do_warning)
warning (OPT_Winline, inline_forbidden_reason, fn); warning (OPT_Winline, inline_forbidden_reason, fn);
......
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