tree.c (WALK_SUBTREE): Call walk_tree_1.
authorRichard Guenther <rguenther@suse.de>
Mon, 20 Aug 2007 11:19:22 +0000 (11:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 20 Aug 2007 11:19:22 +0000 (11:19 +0000)
2007-08-20  Richard Guenther  <rguenther@suse.de>

* tree.c (WALK_SUBTREE): Call walk_tree_1.
(walk_type_fields): Take lh parameter.
(walk_tree): Rename to ...
(walk_tree_1): ... this.  Do not call the walk_subtrees
langhook but the now passed callback.  Pass lh on recursion.
(walk_tree_without_duplicates): Rename to ...
(walk_tree_without_duplicates_1): ... this.  Take lh parameter
and call walk_tree_1.
* tree.h (walk_tree_lh): New typedef.
(walk_tree_1): Declare.
(walk_tree_without_duplicates_1): Likewise.
(walk_tree): New define to walk_tree_1 with NULL lh parameter.
(walk_tree_without_duplicates): New define to
walk_tree_without_duplicates_1 with NULL lh parameter.
* langhooks.c (lhd_tree_inlining_walk_subtrees): Remove.
* langhooks.h (lang_hooks_for_tree_inlining): Remove walk_subtrees
langhook.
* langhooks-def.h (lhd_tree_inlining_walk_subtrees): Remove.
(LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Likewise.
(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove walk_subtrees
initializer.

java/
* lang.c (java_tree_inlining_walk_subtrees): Remove.
(LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Remove.

cp/
* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES):
Remove define.
* tree.h (cp_walk_tree): New define to walk_tree_1 with
cp_walk_subtrees lh parameter.
(cp_walk_tree_without_duplicates): New define to
walk_tree_without_duplicates_1 with cp_walk_subtrees lh parameter.
* tree.c (count_trees): Call
cp_walk_tree_without_duplicates.
(verify_stmt_tree): Call cp_walk_tree.
(break_out_target_exprs): Likewise.
(WALK_SUBTREE): Likewise.
* cp-gimplify.c (cp_genericize): Likewise.
* cp-pt.c (find_parameter_packs_r): Likewise.
(uses_parameter_packs): Likewise.
(make_pack_expansion): Likewise.
(check_for_bare_parameter_packs): Likewise.
(for_each_template_parm): Likewise.
* decl.c (check_default_argument): Call
cp_walk_tree_without_duplicates.
* except.c (build_throw): Likewise.
* decl2.c (type_visibility): Likewise.
* semantics.c (expand_or_defer_fn): Likewise.
(finalize_nrv): Call cp_walk_tree.

From-SVN: r127642

18 files changed:
gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/cp-objcp-common.h
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/except.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/java/ChangeLog
gcc/java/lang.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/tree.c
gcc/tree.h

index 6f486f805adf9907fc90cbe4e8fd63fad6ebcb7f..2e090c1056bd457c481be10830e36f4d635a58b1 100644 (file)
@@ -1,3 +1,27 @@
+2007-08-20  Richard Guenther  <rguenther@suse.de>
+
+       * tree.c (WALK_SUBTREE): Call walk_tree_1.
+       (walk_type_fields): Take lh parameter.
+       (walk_tree): Rename to ...
+       (walk_tree_1): ... this.  Do not call the walk_subtrees
+       langhook but the now passed callback.  Pass lh on recursion.
+       (walk_tree_without_duplicates): Rename to ...
+       (walk_tree_without_duplicates_1): ... this.  Take lh parameter
+       and call walk_tree_1.
+       * tree.h (walk_tree_lh): New typedef.
+       (walk_tree_1): Declare.
+       (walk_tree_without_duplicates_1): Likewise.
+       (walk_tree): New define to walk_tree_1 with NULL lh parameter.
+       (walk_tree_without_duplicates): New define to
+       walk_tree_without_duplicates_1 with NULL lh parameter.
+       * langhooks.c (lhd_tree_inlining_walk_subtrees): Remove.
+       * langhooks.h (lang_hooks_for_tree_inlining): Remove walk_subtrees
+       langhook.
+       * langhooks-def.h (lhd_tree_inlining_walk_subtrees): Remove.
+       (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Likewise.
+       (LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove walk_subtrees
+       initializer.
+
 2007-08-20  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/30564
index b12b7853f9145da1bceda46f9da848f5b3e696ab..d9dbda9e988c958565d7fe1a81f8fd644674368a 100644 (file)
@@ -1,3 +1,29 @@
+2007-08-20  Richard Guenther  <rguenther@suse.de>
+
+       * cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES):
+       Remove define.
+       * tree.h (cp_walk_tree): New define to walk_tree_1 with
+       cp_walk_subtrees lh parameter.
+       (cp_walk_tree_without_duplicates): New define to
+       walk_tree_without_duplicates_1 with cp_walk_subtrees lh parameter.
+       * tree.c (count_trees): Call
+       cp_walk_tree_without_duplicates.
+       (verify_stmt_tree): Call cp_walk_tree.
+       (break_out_target_exprs): Likewise.
+       (WALK_SUBTREE): Likewise.
+       * cp-gimplify.c (cp_genericize): Likewise.
+       * cp-pt.c (find_parameter_packs_r): Likewise.
+       (uses_parameter_packs): Likewise.
+       (make_pack_expansion): Likewise.
+       (check_for_bare_parameter_packs): Likewise.
+       (for_each_template_parm): Likewise.
+       * decl.c (check_default_argument): Call
+       cp_walk_tree_without_duplicates.
+       * except.c (build_throw): Likewise.
+       * decl2.c (type_visibility): Likewise.
+       * semantics.c (expand_or_defer_fn): Likewise.
+       (finalize_nrv): Call cp_walk_tree.
+
 2007-08-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/33025
index c83fcae4822e4c2a8b07186870102755ada1b324..6fcc9b02e400a0f31c7717ff75a80aeb0eb23812 100644 (file)
@@ -746,7 +746,7 @@ cp_genericize (tree fndecl)
   /* We do want to see every occurrence of the parms, so we can't just use
      walk_tree's hash functionality.  */
   p_set = pointer_set_create ();
-  walk_tree (&DECL_SAVED_TREE (fndecl), cp_genericize_r, p_set, NULL);
+  cp_walk_tree (&DECL_SAVED_TREE (fndecl), cp_genericize_r, p_set, NULL);
   pointer_set_destroy (p_set);
 
   /* Do everything else.  */
index 2c6267a5beb18dedcca4296b7a45c79bd0589a13..9cff31b92ce4d87ab9c8a6850dab5b0c6f2a38ef 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_WALK_SUBTREES
-#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \
-  cp_walk_subtrees
 #undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
 #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
   cp_cannot_inline_tree_fn
index a80fbad1062ab858aafce9ae73c4d66f7608916e..c35bb9518b96408bc14891cd30574a7d4ee4d707 100644 (file)
@@ -4736,6 +4736,10 @@ extern void verify_stmt_tree                     (tree);
 extern linkage_kind decl_linkage               (tree);
 extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
                              void*, struct pointer_set_t*);
+#define cp_walk_tree(a,b,c,d) \
+       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 int cp_auto_var_in_fn_p                 (const_tree, const_tree);
 extern tree fold_if_not_in_template            (tree);
index 6172296d73f349a97967a84f55f85fa1f333711a..a890ee1292e69b0ce5350d69b30857e6419b16a6 100644 (file)
@@ -9061,8 +9061,7 @@ check_default_argument (tree decl, tree arg)
 
      The keyword `this' shall not be used in a default argument of a
      member function.  */
-  var = walk_tree_without_duplicates (&arg, local_variable_p_walkfn,
-                                     NULL);
+  var = cp_walk_tree_without_duplicates (&arg, local_variable_p_walkfn, NULL);
   if (var)
     {
       error ("default argument %qE uses local variable %qD", arg, var);
index d66b7311ce5e53f801886d7642279e74b2b7c82c..97a03c7eb6d36eb42e0c0f088b58b6170436b9fd 100644 (file)
@@ -1561,7 +1561,7 @@ static int
 type_visibility (tree type)
 {
   int vis = VISIBILITY_DEFAULT;
-  walk_tree_without_duplicates (&type, min_vis_r, &vis);
+  cp_walk_tree_without_duplicates (&type, min_vis_r, &vis);
   return vis;
 }
 
index b5c93b454e877ddfac130a301cd3f927a777c2bf..081dd0fa42211db2dd21439a79c56a7de4ec133c 100644 (file)
@@ -782,7 +782,7 @@ build_throw (tree exp)
             we don't have to do them during unwinding.  But first wrap
             them in MUST_NOT_THROW_EXPR, since they are run after the
             exception object is initialized.  */
-         walk_tree_without_duplicates (&temp_expr, wrap_cleanups_r, 0);
+         cp_walk_tree_without_duplicates (&temp_expr, wrap_cleanups_r, 0);
          exp = build2 (COMPOUND_EXPR, TREE_TYPE (exp), temp_expr, exp);
          exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
        }
index 76d35186f1e04f4e420eb183902f83845a85e693..3f218e6248a95bc456fbf203513001f0218fa6d7 100644 (file)
@@ -2391,7 +2391,7 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
   if (TYPE_P (t))
     {
       tree context = TYPE_CONTEXT (t);
-      walk_tree (&context, &find_parameter_packs_r, ppd, ppd->visited);
+      cp_walk_tree (&context, &find_parameter_packs_r, ppd, ppd->visited);
     }
 
   /* This switch statement will return immediately if we don't find a
@@ -2405,8 +2405,8 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
 
     case BOUND_TEMPLATE_TEMPLATE_PARM:
       /* Check the template arguments.  */
-      walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd, 
-                ppd->visited);
+      cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd, 
+                   ppd->visited);
 
       /* Dig out the underlying TEMPLATE_TEMPLATE_PARM.  */
       t = TYPE_TI_TEMPLATE (t);
@@ -2442,7 +2442,7 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
       if (TYPE_TEMPLATE_INFO (t))
         {
           tree args = TREE_VALUE (TYPE_TEMPLATE_INFO (t));
-          walk_tree (&args, &find_parameter_packs_r, ppd, ppd->visited);
+          cp_walk_tree (&args, &find_parameter_packs_r, ppd, ppd->visited);
         }
 
       *walk_subtrees = 0;
@@ -2462,8 +2462,8 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
       return NULL_TREE;
 
     case INTEGER_TYPE:
-      walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r, 
-                ppd, ppd->visited);
+      cp_walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r, 
+                   ppd, ppd->visited);
       *walk_subtrees = 0;
       return NULL_TREE;
 
@@ -2485,7 +2485,7 @@ uses_parameter_packs (tree t)
   struct find_parameter_pack_data ppd;
   ppd.parameter_packs = &parameter_packs;
   ppd.visited = pointer_set_create ();
-  walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
+  cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
   pointer_set_destroy (ppd.visited);
   return parameter_packs != NULL_TREE;
 }
@@ -2535,8 +2535,8 @@ make_pack_expansion (tree arg)
          class expansion.  */
       ppd.visited = pointer_set_create ();
       ppd.parameter_packs = &parameter_packs;
-      walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r, 
-                 &ppd, ppd.visited);
+      cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r, 
+                    &ppd, ppd.visited);
 
       if (parameter_packs == NULL_TREE)
         {
@@ -2553,8 +2553,8 @@ make_pack_expansion (tree arg)
             {
               /* Determine which parameter packs will be expanded in this
                  argument.  */
-              walk_tree (&TREE_VALUE (value), &find_parameter_packs_r, 
-                         &ppd, ppd.visited);
+              cp_walk_tree (&TREE_VALUE (value), &find_parameter_packs_r, 
+                            &ppd, ppd.visited);
             }
         }
 
@@ -2592,7 +2592,7 @@ make_pack_expansion (tree arg)
   /* Determine which parameter packs will be expanded.  */
   ppd.parameter_packs = &parameter_packs;
   ppd.visited = pointer_set_create ();
-  walk_tree (&arg, &find_parameter_packs_r, &ppd, ppd.visited);
+  cp_walk_tree (&arg, &find_parameter_packs_r, &ppd, ppd.visited);
   pointer_set_destroy (ppd.visited);
 
   /* Make sure we found some parameter packs.  */
@@ -2637,7 +2637,7 @@ check_for_bare_parameter_packs (tree t)
 
   ppd.parameter_packs = &parameter_packs;
   ppd.visited = pointer_set_create ();
-  walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
+  cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
   pointer_set_destroy (ppd.visited);
 
   if (parameter_packs) 
@@ -5896,10 +5896,10 @@ for_each_template_parm (tree t, tree_fn_t fn, void* data,
     pfd.visited = visited;
   else
     pfd.visited = pointer_set_create ();
-  result = walk_tree (&t,
-                     for_each_template_parm_r,
-                     &pfd,
-                     pfd.visited) != NULL_TREE;
+  result = cp_walk_tree (&t,
+                        for_each_template_parm_r,
+                        &pfd,
+                        pfd.visited) != NULL_TREE;
 
   /* Clean up.  */
   if (!visited)
index 9d0f9df05d2f483a3b2273d5489409b10b17b325..176e6bea11a694e5a8766f3fc37317e0b1d4b8bb 100644 (file)
@@ -3184,9 +3184,9 @@ expand_or_defer_fn (tree fn)
     }
 
   /* Replace AGGR_INIT_EXPRs with appropriate CALL_EXPRs.  */
-  walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
-                               simplify_aggr_init_exprs_r,
-                               NULL);
+  cp_walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
+                                  simplify_aggr_init_exprs_r,
+                                  NULL);
 
   /* If this is a constructor or destructor body, we have to clone
      it.  */
@@ -3336,7 +3336,7 @@ finalize_nrv (tree *tp, tree var, tree result)
   data.var = var;
   data.result = result;
   data.visited = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
-  walk_tree (tp, finalize_nrv_r, &data, 0);
+  cp_walk_tree (tp, finalize_nrv_r, &data, 0);
   htab_delete (data.visited);
 }
 \f
index 1d16f2c860aaf5ba70b6630579fecbd1831fcd4b..3edf39f263ef30456a9f06d6b8928f8ec41d9c80 100644 (file)
@@ -1282,7 +1282,7 @@ int
 count_trees (tree t)
 {
   int n_trees = 0;
-  walk_tree_without_duplicates (&t, count_trees_r, &n_trees);
+  cp_walk_tree_without_duplicates (&t, count_trees_r, &n_trees);
   return n_trees;
 }
 
@@ -1319,7 +1319,7 @@ verify_stmt_tree (tree t)
 {
   htab_t statements;
   statements = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
-  walk_tree (&t, verify_stmt_tree_r, &statements, NULL);
+  cp_walk_tree (&t, verify_stmt_tree_r, &statements, NULL);
   htab_delete (statements);
 }
 
@@ -1521,8 +1521,8 @@ break_out_target_exprs (tree t)
     target_remap = splay_tree_new (splay_tree_compare_pointers,
                                   /*splay_tree_delete_key_fn=*/NULL,
                                   /*splay_tree_delete_value_fn=*/NULL);
-  walk_tree (&t, bot_manip, target_remap, NULL);
-  walk_tree (&t, bot_replace, target_remap, NULL);
+  cp_walk_tree (&t, bot_manip, target_remap, NULL);
+  cp_walk_tree (&t, bot_replace, target_remap, NULL);
 
   if (!--target_remap_count)
     {
@@ -2290,7 +2290,7 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
 #define WALK_SUBTREE(NODE)                             \
   do                                                   \
     {                                                  \
-      result = walk_tree (&(NODE), func, data, pset);  \
+      result = cp_walk_tree (&(NODE), func, data, pset);       \
       if (result) goto out;                            \
     }                                                  \
   while (0)
index cd919b35acb5078984331606fd3cb383b61bbf3a..693053b0c07f20546211c7cdef73a387d941cc85 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-20  Richard Guenther  <rguenther@suse.de>
+
+       * lang.c (java_tree_inlining_walk_subtrees): Remove.
+       (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Remove.
+
 2007-08-17  Tom Tromey  <tromey@redhat.com>
 
        * typeck.c (find_method_in_interfaces): Update.
index ffb64d81223ac07cd7ea846feb18d776893da332..dc685eb75dca871667c0be057d64b750648b4489 100644 (file)
@@ -55,8 +55,6 @@ static int java_handle_option (size_t scode, const char *arg, int value);
 static void put_decl_string (const char *, int);
 static void put_decl_node (tree);
 static void java_print_error_function (diagnostic_context *, const char *);
-static tree java_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
-                                             void *, struct pointer_set_t *);
 static int merge_init_test_initialization (void * *, void *);
 static int inline_init_test_initialization (void * *, void *);
 static bool java_dump_tree (void *, tree);
@@ -188,9 +186,6 @@ struct language_function GTY(())
 #undef LANG_HOOKS_GIMPLIFY_EXPR
 #define LANG_HOOKS_GIMPLIFY_EXPR java_gimplify_expr
 
-#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
-#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES java_tree_inlining_walk_subtrees
-
 #undef LANG_HOOKS_DECL_OK_FOR_SIBCALL
 #define LANG_HOOKS_DECL_OK_FOR_SIBCALL java_decl_ok_for_sibcall
 
@@ -688,45 +683,6 @@ decl_constant_value (tree decl)
   return decl;
 }
 
-/* Walk the language specific tree nodes during inlining.  */
-
-static tree
-java_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
-                                 int *subtrees ATTRIBUTE_UNUSED,
-                                 walk_tree_fn func ATTRIBUTE_UNUSED,
-                                 void *data ATTRIBUTE_UNUSED,
-                                 struct pointer_set_t *pset ATTRIBUTE_UNUSED)
-{
-  enum tree_code code;
-  tree result;
-
-#define WALK_SUBTREE(NODE)                             \
-  do                                                   \
-    {                                                  \
-      result = walk_tree (&(NODE), func, data, pset);  \
-      if (result)                                      \
-       return result;                                  \
-    }                                                  \
-  while (0)
-
-  tree t = *tp;
-  if (!t)
-    return NULL_TREE;
-
-  code = TREE_CODE (t);
-  switch (code)
-    {
-    case BLOCK:
-      WALK_SUBTREE (BLOCK_EXPR_BODY (t));
-      return NULL_TREE;
-
-    default:
-      return NULL_TREE;
-    }
-
-  #undef WALK_SUBTREE
-}
-
 /* Every call to a static constructor has an associated boolean
    variable which is in the outermost scope of the calling method.
    This variable is used to avoid multiple calls to the static
index 41bf8e8363d6731fc8e404827ab2c7efde58a39a..074e615ba08cff3dfb33306b477b1987655f3b57 100644 (file)
@@ -68,8 +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 tree lhd_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
-                                            void *, struct pointer_set_t*);
 extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *);
 extern int lhd_tree_inlining_disregard_inline_limits (const_tree);
 extern int lhd_tree_inlining_auto_var_in_fn_p (const_tree, const_tree);
@@ -135,7 +133,6 @@ 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_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
 #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
   lhd_tree_inlining_cannot_inline_tree_fn
 #define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
@@ -146,7 +143,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
   hook_bool_tree_tree_false
 
 #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
-  LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
   LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
   LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, \
   LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P, \
index 1074615c72f7d945d59d8605be9b1b55ab7a9a19..8260b3135e3193df2ad0bad61e911f66c0066798 100644 (file)
@@ -276,27 +276,6 @@ lhd_types_compatible_p (tree x, tree y)
   return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
 }
 
-/* lang_hooks.tree_inlining.walk_subtrees is called by walk_tree()
-   after handling common cases, but before walking code-specific
-   sub-trees.  If this hook is overridden for a language, it should
-   handle language-specific tree codes, as well as language-specific
-   information associated to common tree codes.  If a tree node is
-   completely handled within this function, it should set *SUBTREES to
-   0, so that generic handling isn't attempted.  The generic handling
-   cannot deal with language-specific tree codes, so make sure it is
-   set properly.  Both SUBTREES and *SUBTREES is guaranteed to be
-   nonzero when the function is called.  */
-
-tree
-lhd_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
-                                int *subtrees ATTRIBUTE_UNUSED,
-                                walk_tree_fn func ATTRIBUTE_UNUSED,
-                                void *data ATTRIBUTE_UNUSED,
-                                struct pointer_set_t *pset ATTRIBUTE_UNUSED)
-{
-  return NULL_TREE;
-}
-
 /* lang_hooks.tree_inlining.cannot_inline_tree_fn is called to
    determine whether there are language-specific reasons for not
    inlining a given function.  */
index a62c6156670e7500d9ac4286033928365b6e63d0..299ec8f838ad4b59ef62ae964bc23f96cabf7f6b 100644 (file)
@@ -35,9 +35,6 @@ typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
 
 struct lang_hooks_for_tree_inlining
 {
-  tree (*walk_subtrees) (tree *, int *,
-                        tree (*) (tree *, int *, void *),
-                        void *, struct pointer_set_t*);
   int (*cannot_inline_tree_fn) (tree *);
   int (*disregard_inline_limits) (const_tree);
   int (*auto_var_in_fn_p) (const_tree, const_tree);
index b6b339cac07c6e0796035bfa4936cb53b0286b70..61f17de706deaccbfb443aff2af252e84a306b40 100644 (file)
@@ -8233,7 +8233,7 @@ num_ending_zeros (const_tree x)
 #define WALK_SUBTREE(NODE)                             \
   do                                                   \
     {                                                  \
-      result = walk_tree (&(NODE), func, data, pset);  \
+      result = walk_tree_1 (&(NODE), func, data, pset, lh);    \
       if (result)                                      \
        return result;                                  \
     }                                                  \
@@ -8245,7 +8245,7 @@ num_ending_zeros (const_tree x)
 
 static tree
 walk_type_fields (tree type, walk_tree_fn func, void *data,
-                 struct pointer_set_t *pset)
+                 struct pointer_set_t *pset, walk_tree_lh lh)
 {
   tree result = NULL_TREE;
 
@@ -8325,7 +8325,8 @@ walk_type_fields (tree type, walk_tree_fn func, void *data,
    and to avoid visiting a node more than once.  */
 
 tree
-walk_tree (tree *tp, walk_tree_fn func, void *data, struct pointer_set_t *pset)
+walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
+            struct pointer_set_t *pset, walk_tree_lh lh)
 {
   enum tree_code code;
   int walk_subtrees;
@@ -8372,10 +8373,12 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, struct pointer_set_t *pset)
        return NULL_TREE;
     }
 
-  result = lang_hooks.tree_inlining.walk_subtrees (tp, &walk_subtrees, func,
-                                                  data, pset);
-  if (result || !walk_subtrees)
-    return result;
+  if (lh)
+    {
+      result = (*lh) (tp, &walk_subtrees, func, data, pset);
+      if (result || !walk_subtrees)
+        return result;
+    }
 
   switch (code)
     {
@@ -8529,7 +8532,7 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, struct pointer_set_t *pset)
          if (result || !walk_subtrees)
            return result;
 
-         result = walk_type_fields (*type_p, func, data, pset);
+         result = walk_type_fields (*type_p, func, data, pset, lh);
          if (result)
            return result;
 
@@ -8594,7 +8597,7 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, struct pointer_set_t *pset)
        }
       /* If this is a type, walk the needed fields in the type.  */
       else if (TYPE_P (*tp))
-       return walk_type_fields (*tp, func, data, pset);
+       return walk_type_fields (*tp, func, data, pset, lh);
       break;
     }
 
@@ -8608,13 +8611,14 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, struct pointer_set_t *pset)
 /* Like walk_tree, but does not walk duplicate nodes more than once.  */
 
 tree
-walk_tree_without_duplicates (tree *tp, walk_tree_fn func, void *data)
+walk_tree_without_duplicates_1 (tree *tp, walk_tree_fn func, void *data,
+                               walk_tree_lh lh)
 {
   tree result;
   struct pointer_set_t *pset;
 
   pset = pointer_set_create ();
-  result = walk_tree (tp, func, data, pset);
+  result = walk_tree_1 (tp, func, data, pset, lh);
   pointer_set_destroy (pset);
   return result;
 }
index 7b62a161bbf84a55b294deaf2486b1c16dd5c732..b8e960b4640a8396381a7f9da808fdfb4f11a2eb 100644 (file)
@@ -5026,8 +5026,20 @@ struct pointer_set_t;
 /* The type of a callback function for walking over tree structure.  */
 
 typedef tree (*walk_tree_fn) (tree *, int *, void *);
-extern tree walk_tree (tree*, walk_tree_fn, void*, struct pointer_set_t*);
-extern tree walk_tree_without_duplicates (tree*, walk_tree_fn, void*);
+
+/* The type of a callback function that represents a custom walk_tree.  */
+
+typedef tree (*walk_tree_lh) (tree *, int *, tree (*) (tree *, int *, void *),
+                             void *, struct pointer_set_t*);
+
+extern tree walk_tree_1 (tree*, walk_tree_fn, void*, struct pointer_set_t*,
+                        walk_tree_lh);
+extern tree walk_tree_without_duplicates_1 (tree*, walk_tree_fn, void*,
+                                           walk_tree_lh);
+#define walk_tree(a,b,c,d) \
+       walk_tree_1 (a, b, c, d, NULL)
+#define walk_tree_without_duplicates(a,b,c) \
+       walk_tree_without_duplicates_1 (a, b, c, NULL)
 
 /* Assign the RTX to declaration.  */