summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-24 09:44:04 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-24 09:44:04 +0000
commit7cc6d7a886ef8b0ed5f3a4fbeb21f4fe5b9e64b0 (patch)
tree5270dcc8ebfd36c501d57a40ccebba1e3b65b19e
parent85a32bdbf393185ef376c2bd4c797515df2609cb (diff)
downloadgcc-7cc6d7a886ef8b0ed5f3a4fbeb21f4fe5b9e64b0.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127763 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/c-objc-common.c45
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-objcp-common.h3
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/tree.c52
-rw-r--r--gcc/langhooks-def.h4
-rw-r--r--gcc/langhooks.c14
-rw-r--r--gcc/langhooks.h1
-rw-r--r--gcc/tree-inline.c50
10 files changed, 58 insertions, 134 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index adca8881442..43baaaa36a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,20 @@
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
from offset in a way we can detect overflow reliably.
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index efd576fd5be..746e1196923 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -50,51 +50,6 @@ c_missing_noreturn_ok_p (tree 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. */
bool
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6e5a358f436..5bc2266397c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+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>
PR c++/32567
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index e67b847f421..8c8f93377de 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -104,9 +104,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#undef LANG_HOOKS_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
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 5aea98bb801..6d5f81ba1cb 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4741,7 +4741,6 @@ extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
walk_tree_1 (a, b, c, d, cp_walk_subtrees)
#define cp_walk_tree_without_duplicates(a,b,c) \
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 rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9c80fba30d6..c77cc871c63 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2398,58 +2398,6 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
#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++. */
tree
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 05d8f4b74ba..66a65a6c21e 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -68,7 +68,6 @@ extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
extern tree lhd_builtin_function (tree decl);
/* 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 tree lhd_callgraph_analyze_expr (tree *, int *, tree);
@@ -131,13 +130,10 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL
/* 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 \
hook_bool_tree_tree_false
#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
- LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
}
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 56680c94082..8653e3abff3 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -276,20 +276,6 @@ lhd_types_compatible_p (tree x, tree 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
nodes. Returns nonzero if it does not want the usual dumping of the
second argument. */
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index a25371c05ee..338e931c6bc 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -35,7 +35,6 @@ typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
struct lang_hooks_for_tree_inlining
{
- int (*cannot_inline_tree_fn) (tree *);
bool (*var_mod_type_p) (tree, tree);
};
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a24f70d0562..2b7ab9e39ac 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -51,6 +51,8 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-prop.h"
#include "value-prof.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
non-gimple trees. */
@@ -1848,18 +1850,44 @@ static bool
inlinable_function_p (tree fn)
{
bool inlinable = true;
+ bool do_warning;
+ tree always_inline;
/* If we've already decided this function shouldn't be inlined,
there's no need to check again. */
if (DECL_UNINLINABLE (fn))
return false;
- /* See if there is any language-specific reason it cannot be
- inlined. (It is important that this hook be called early because
- in C++ it may result in template instantiation.)
- If the function is not inlinable for language-specific reasons,
- it is left up to the langhook to explain why. */
- inlinable = !lang_hooks.tree_inlining.cannot_inline_tree_fn (&fn);
+ /* We only warn for functions declared `inline' by the user. */
+ do_warning = (warn_inline
+ && DECL_INLINE (fn)
+ && DECL_DECLARED_INLINE_P (fn)
+ && !DECL_IN_SYSTEM_HEADER (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.
However, this should not be recorded since we also get here for
@@ -1893,14 +1921,8 @@ inlinable_function_p (tree fn)
about functions that would for example call alloca. But since
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
- function is not inlinable.
- We only warn for functions declared `inline' by the user. */
- 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)))
+ function is not inlinable. */
+ if (always_inline)
sorry (inline_forbidden_reason, fn);
else if (do_warning)
warning (OPT_Winline, inline_forbidden_reason, fn);