This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples] fix walk_gimple_omp_for
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: dnovillo at google dot com, gcc-patches at gcc dot gnu dot org, jakub at redhat dot com
- Date: Tue, 27 May 2008 19:54:06 -0400
- Subject: [tuples] fix walk_gimple_omp_for
Well, waddaya know. We can build libgomp, and results don't look
terrible.
I'm taking a look at ICE's while testing libgomp.
walk_gimple_omp_for wasn't converted. This patch fixes that.
There's one distinct failure in gomp.exp, and that failure is also
causing the one ICE left in libgomp.exp. I'm looking into it.
Of course, there are also some execution errors in libgomp.exp, but
Jakub said he'd look at those :).
Yay, the light at the end of the tunnel.
* tree-nested.c (walk_omp_for): Rename to...
(walk_gimple_omp_for): Enable and convert to tuples.
(convert_nonlocal_reference_stmt): Enable call to walk_gimple_omp_for.
(convert_local_reference_stmt): Same.
* gimple.c (walk_gimple_op): Remove fixme note.
Index: tree-nested.c
===================================================================
--- tree-nested.c (revision 136058)
+++ tree-nested.c (working copy)
@@ -558,8 +558,6 @@ walk_function (walk_stmt_fn callback_stm
walk_body (callback_stmt, callback_op, info, gimple_body (info->context));
}
-/* FIXME tuples */
-#if 0
/* Invoke CALLBACK on a GIMPLE_OMP_FOR's init, cond, incr and pre-body. */
static void
@@ -570,77 +568,49 @@ walk_gimple_omp_for (gimple for_stmt,
struct walk_stmt_info wi;
gimple_seq seq;
gimple empty;
+ tree t;
- tree walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
- struct walk_stmt_info *);
- tree walk_gimple_stmt (gimple, walk_stmt_fn, walk_tree_fn,
- struct walk_stmt_info *);
+ walk_body (callback_stmt, callback_op, info, gimple_omp_for_pre_body (for_stmt));
empty = gimple_build_nop ();
- gimple_seq_init (&seq);
+ seq = NULL;
gimple_seq_add_stmt (&seq, empty);
memset (&wi, 0, sizeof (wi));
wi.info = info;
- wi.gsi = gsi_last (list);
+ wi.gsi = gsi_last (seq);
- walk_gimple_seq (gimple_omp_for_pre_body (for_stmt),
- callback_stmt, callback_op, &wi);
-
-}
-
-/* Invoke CALLBACK on OMP_FOR init, cond, incr and pre-body. */
-
-static void
-walk_omp_for (walk_tree_fn callback, struct nesting_info *info, tree for_stmt)
-{
- struct walk_stmt_info wi;
- tree t, list = NULL, empty;
-
- walk_body (callback, info, &OMP_FOR_PRE_BODY (for_stmt));
-
- empty = build_empty_stmt ();
- append_to_statement_list_force (empty, &list);
- memset (&wi, 0, sizeof (wi));
- wi.callback = callback;
- wi.info = info;
- wi.tsi = tsi_last (list);
-
- t = OMP_FOR_INIT (for_stmt);
- gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- SET_EXPR_LOCUS (empty, EXPR_LOCUS (t));
+ gimple_set_location (empty, gimple_location (for_stmt));
wi.val_only = false;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 0), callback, &wi, NULL);
+ walk_tree (gimple_omp_for_index_ptr (for_stmt), callback_op, &wi, NULL);
wi.val_only = true;
wi.is_lhs = false;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 1), callback, &wi, NULL);
+ walk_tree (gimple_omp_for_initial_ptr (for_stmt), callback_op, &wi, NULL);
- t = OMP_FOR_COND (for_stmt);
- gcc_assert (COMPARISON_CLASS_P (t));
- SET_EXPR_LOCUS (empty, EXPR_LOCUS (t));
- wi.val_only = false;
- walk_tree (&TREE_OPERAND (t, 0), callback, &wi, NULL);
wi.val_only = true;
wi.is_lhs = false;
- walk_tree (&TREE_OPERAND (t, 1), callback, &wi, NULL);
+ walk_tree (gimple_omp_for_final_ptr (for_stmt), callback_op, &wi, NULL);
- t = OMP_FOR_INCR (for_stmt);
+ t = gimple_omp_for_incr (for_stmt);
gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT);
- SET_EXPR_LOCUS (empty, EXPR_LOCUS (t));
+ gimple_set_location (empty, *EXPR_LOCUS (gimple_omp_for_incr (for_stmt)));
wi.val_only = false;
- walk_tree (&GIMPLE_STMT_OPERAND (t, 0), callback, &wi, NULL);
+ walk_tree (&GIMPLE_STMT_OPERAND (t, 0), callback_op, &wi, NULL);
t = GIMPLE_STMT_OPERAND (t, 1);
gcc_assert (BINARY_CLASS_P (t));
wi.val_only = false;
- walk_tree (&TREE_OPERAND (t, 0), callback, &wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 0), callback_op, &wi, NULL);
wi.val_only = true;
wi.is_lhs = false;
- walk_tree (&TREE_OPERAND (t, 1), callback, &wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 1), callback_op, &wi, NULL);
/* Remove empty statement added above from the end of statement list. */
- tsi_delink (&wi.tsi);
- append_to_statement_list (list, &OMP_FOR_PRE_BODY (for_stmt));
+ gsi_remove (&wi.gsi, true);
+ {
+ gimple_seq pre_body = gimple_omp_for_pre_body (for_stmt);
+ gimple_seq_add_seq (&pre_body, seq);
+ gimple_omp_for_set_pre_body (for_stmt, pre_body);
+ }
}
-#endif
/* Similarly for ROOT and all functions nested underneath, depth first. */
@@ -1145,11 +1115,8 @@ convert_nonlocal_reference_stmt (gimple_
case GIMPLE_OMP_FOR:
save_suppress = info->suppress_expansion;
convert_nonlocal_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi);
- /* FIXME tuples */
-#if 0
- walk_gimple_omp_for (stmt, convert_nonlocal_reference,
+ walk_gimple_omp_for (stmt, convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info);
-#endif
walk_body (convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info, gimple_omp_body (stmt));
info->suppress_expansion = save_suppress;
@@ -1492,11 +1459,8 @@ convert_local_reference_stmt (gimple_stm
case GIMPLE_OMP_FOR:
save_suppress = info->suppress_expansion;
convert_local_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi);
- /* FIXME tuples */
-#if 0
walk_gimple_omp_for (stmt, convert_local_reference_stmt,
convert_local_reference_op, info);
-#endif
walk_body (convert_local_reference_stmt, convert_local_reference_op,
info, gimple_omp_body (stmt));
info->suppress_expansion = save_suppress;
Index: gimple.c
===================================================================
--- gimple.c (revision 136058)
+++ gimple.c (working copy)
@@ -1439,8 +1439,6 @@ walk_gimple_op (gimple stmt, walk_tree_f
break;
case GIMPLE_OMP_FOR:
- /* FIXME tuples */
- /* This may need adjusting because of Jakub's code. */
ret = walk_tree (gimple_omp_for_clauses_ptr (stmt), callback_op, wi,
pset);
if (ret)