This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tuples] walk_tree for tuples
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Diego Novillo <dnovillo at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org, chrismatthews at google dot com
- Date: Thu, 12 Jul 2007 14:59:14 -0400
- Subject: Re: [tuples] walk_tree for tuples
- References: <20070712162118.GA16637@redhat.com> <46966780.8050707@google.com>
On Thu, Jul 12, 2007 at 01:40:16PM -0400, Diego Novillo wrote:
> On 7/12/07 12:21 PM, Aldy Hernandez wrote:
> > We need to be able to walk the trees (leaves) inside tuples so we can
> > call check_pointer_types_r on the body of a function. We'll probably
> > need this functionality in other parts of the compiler. This patch
> > introduces the equivalent walk_tree_seq and walk_tree_tuple.
>
> walk_seq_ops and walk_tuple_ops?
>
> The trees are all operands. In the future these may not be trees.
Done.
* gimple-ir.c (walk_seq_ops): Rename from walk_tree_seq.
(walk_tuple_ops): Rename from walk_tree_tuple.
* gimple-ir.h, gimplify.c, gimple-ir.c: Rename all calls to
walk_tree_seq and walk_tree_tuple accordingly.
Index: gimple-ir.c
===================================================================
--- gimple-ir.c (revision 126593)
+++ gimple-ir.c (working copy)
@@ -780,23 +780,23 @@ gs_add (gimple gs, gs_seq seq)
game. */
void
-walk_tree_seq (gs_seq seq, walk_tree_fn func, void *data,
- struct pointer_set_t *pset)
+walk_seq_ops (gs_seq seq, walk_tree_fn func, void *data,
+ struct pointer_set_t *pset)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_tree_tuple (gsi_stmt (gsi), func, data, pset);
+ walk_tuple_ops (gsi_stmt (gsi), func, data, pset);
}
-/* Helper function of walk_tree_seq. Walks one tuple's trees. The
- arguments are as in walk_tree_seq, except GS is the tuple to
+/* Helper function of walk_seq_ops. Walks one tuple's trees. The
+ arguments are as in walk_seq_ops, except GS is the tuple to
walk. */
#define WALKIT(__this) leaf = (__this), walk_tree (&leaf, func, data, pset)
void
-walk_tree_tuple (gimple gs, walk_tree_fn func, void *data,
- struct pointer_set_t *pset)
+walk_tuple_ops (gimple gs, walk_tree_fn func, void *data,
+ struct pointer_set_t *pset)
{
unsigned int i;
tree leaf;
@@ -824,7 +824,7 @@ walk_tree_tuple (gimple gs, walk_tree_fn
case GS_BIND:
WALKIT (gs_bind_vars (gs));
- walk_tree_seq (gs_bind_body (gs), func, data, pset);
+ walk_seq_ops (gs_bind_body (gs), func, data, pset);
break;
case GS_CALL:
@@ -837,7 +837,7 @@ walk_tree_tuple (gimple gs, walk_tree_fn
case GS_CATCH:
WALKIT (gs_catch_types (gs));
- walk_tree_tuple (gs_catch_handler (gs), func, data, pset);
+ walk_tuple_ops (gs_catch_handler (gs), func, data, pset);
break;
case GS_COND:
@@ -849,7 +849,7 @@ walk_tree_tuple (gimple gs, walk_tree_fn
case GS_EH_FILTER:
WALKIT (gs_eh_filter_types (gs));
- walk_tree_tuple (gs_eh_filter_failure (gs), func, data, pset);
+ walk_tuple_ops (gs_eh_filter_failure (gs), func, data, pset);
break;
case GS_GOTO:
@@ -875,12 +875,12 @@ walk_tree_tuple (gimple gs, walk_tree_fn
break;
case GS_TRY:
- walk_tree_tuple (gs_try_eval (gs), func, data, pset);
- walk_tree_tuple (gs_try_cleanup (gs), func, data, pset);
+ walk_tuple_ops (gs_try_eval (gs), func, data, pset);
+ walk_tuple_ops (gs_try_cleanup (gs), func, data, pset);
break;
case GS_OMP_CRITICAL:
- walk_tree_seq (gs_omp_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_body (gs), func, data, pset);
WALKIT (gs_omp_critical_name (gs));
break;
@@ -889,33 +889,33 @@ walk_tree_tuple (gimple gs, walk_tree_fn
case GS_OMP_MASTER:
case GS_OMP_ORDERED:
case GS_OMP_SECTION:
- walk_tree_seq (gs_omp_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_body (gs), func, data, pset);
break;
case GS_OMP_FOR:
- walk_tree_seq (gs_omp_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_body (gs), func, data, pset);
WALKIT (gs_omp_for_clauses (gs));
WALKIT (gs_omp_for_index (gs));
WALKIT (gs_omp_for_initial (gs));
WALKIT (gs_omp_for_final (gs));
WALKIT (gs_omp_for_incr (gs));
- walk_tree_seq (gs_omp_for_pre_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_for_pre_body (gs), func, data, pset);
break;
case GS_OMP_PARALLEL:
- walk_tree_seq (gs_omp_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_body (gs), func, data, pset);
WALKIT (gs_omp_parallel_clauses (gs));
WALKIT (gs_omp_parallel_child_fn (gs));
WALKIT (gs_omp_parallel_data_arg (gs));
break;
case GS_OMP_SECTIONS:
- walk_tree_seq (gs_omp_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_body (gs), func, data, pset);
WALKIT (gs_omp_sections_clauses (gs));
break;
case GS_OMP_SINGLE:
- walk_tree_seq (gs_omp_body (gs), func, data, pset);
+ walk_seq_ops (gs_omp_body (gs), func, data, pset);
WALKIT (gs_omp_single_clauses (gs));
break;
Index: gimple-ir.h
===================================================================
--- gimple-ir.h (revision 126593)
+++ gimple-ir.h (working copy)
@@ -400,10 +400,10 @@ extern enum gimple_statement_structure_e
extern void gs_add (gimple, gs_seq);
extern enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
extern void sort_case_labels (VEC(tree,heap) *);
-extern void walk_tree_tuple (gimple, walk_tree_fn, void *,
- struct pointer_set_t *);
-extern void walk_tree_seq (gs_seq, walk_tree_fn, void *,
- struct pointer_set_t *);
+extern void walk_tuple_ops (gimple, walk_tree_fn, void *,
+ struct pointer_set_t *);
+extern void walk_seq_ops (gs_seq, walk_tree_fn, void *,
+ struct pointer_set_t *);
extern const char *const gs_code_name[];
Index: gimplify.c
===================================================================
--- gimplify.c (revision 126593)
+++ gimplify.c (working copy)
@@ -6526,7 +6526,7 @@ gimplify_body (tree *body_p, gs_seq seq_
gcc_assert (gimplify_ctxp == NULL);
#ifdef ENABLE_CHECKING
- walk_tree_seq (seq_p, check_pointer_types_r, NULL, NULL);
+ walk_seq_ops (seq_p, check_pointer_types_r, NULL, NULL);
#endif
timevar_pop (TV_TREE_GIMPLIFY);