Makefile.in (tree-inline.o): Add $(TARGET_H) and $(INTEGRATE_H) dependencies.
authorRichard Guenther <rguenther@suse.de>
Fri, 24 Aug 2007 09:44:04 +0000 (09:44 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 24 Aug 2007 09:44:04 +0000 (09:44 +0000)
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

gcc/ChangeLog
gcc/c-objc-common.c
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.h
gcc/cp/cp-tree.h
gcc/cp/tree.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/tree-inline.c

index adca8881442c2c763dcdd25dba6e1a4b83ddc8af..43baaaa36a5d658ee4b280e415f5f19a4ef0796b 100644 (file)
@@ -1,3 +1,18 @@
+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
index efd576fd5be079cb6f71eb8e4b65127cddafbd04..746e1196923b06410d345bb7a8a3e99ff91d00dc 100644 (file)
@@ -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
index 6e5a358f436c0f0ca07208bb966caa89d8b99ec8..5bc2266397ccfd4ee1547526c90983598462f7e3 100644 (file)
@@ -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
index e67b847f4216142fd765ce816593a2965b34dbdf..8c8f93377de800d77d81f10a94f29a5dc674720d 100644 (file)
@@ -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
index 5aea98bb801047acb0c717741a93824a31bd2b90..6d5f81ba1cbe61a65a27d71cfdd3ac1fea6484a3 100644 (file)
@@ -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);
index 9c80fba30d60201e9fe11f0e46c7dce2c4a1e2df..c77cc871c63488746246025ce103760f695456ff 100644 (file)
@@ -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
index 05d8f4b74ba079ec79f6ddff66bd35a1ea6bca1a..66a65a6c21e716ef0f1bcf7b2157de0ac2fd6aa3 100644 (file)
@@ -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, \
 }
 
index 56680c94082c75b5ffb0388465395c269d955265..8653e3abff3fff8a55a9cfd89fd670ab9fc22c55 100644 (file)
@@ -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.  */
index a25371c05eef1d33b5656068bcd225c632f39fcf..338e931c6bc787ac7613c206fc0b934028f961ce 100644 (file)
@@ -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);
 };
 
index a24f70d056290555f87ce1f8f30366c05d20f7b0..2b7ab9e39ac111a54751c0b26dbd11787bc17712 100644 (file)
@@ -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);