This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples][patch] walk_gimple_op skips walking function itself in CALL_EXPRs
- From: "Oleg Ryjkov" <olegr at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: "Diego Novillo" <dnovillo at google dot com>
- Date: Wed, 2 Apr 2008 10:59:57 -0700
- Subject: [tuples][patch] walk_gimple_op skips walking function itself in CALL_EXPRs
Hi,
Several fortran tests were failing because walk_gimple_op was not
walking over the function itself, i.e. in this call "bar ()", bar was
skipped.
This patch fixes it.
Tested on i686-linux, no new regressions, the tests that used to fail
in make_decl_rtl, now fail in ssa_operands_active (), because cfun is
not set, but Diego's patch should fix them.
Oleg
Index: ChangeLog.tuples
===================================================================
--- ChangeLog.tuples (revision 133842)
+++ ChangeLog.tuples (working copy)
@@ -1,3 +1,8 @@
+2008-04-02 Oleg Ryjkov <olegr@google.com>
+
+ * gimple.c (walk_gimple_op): Walk over function for CALL_EXPR.
+ * gimple.h (gimple_call_fn_ptr): New function.
+
2008-04-02 Rafael Espindola <espindola@google.com>
Merge with mainline @133527.
Index: gimple.c
===================================================================
--- gimple.c (revision 133842)
+++ gimple.c (working copy)
@@ -1309,6 +1309,11 @@ walk_gimple_op (gimple stmt, walk_tree_f
if (wi)
wi->is_lhs = false;
+ ret = walk_tree (gimple_call_fn_ptr (stmt), callback_op, wi, pset);
+
+ if (ret)
+ return ret;
+
for (i = 0; i < gimple_call_num_args (stmt); i++)
{
ret = walk_tree (gimple_call_arg_ptr (stmt, i), callback_op, wi,
Index: gimple.h
===================================================================
--- gimple.h (revision 133842)
+++ gimple.h (working copy)
@@ -1239,6 +1239,17 @@ gimple_call_fn (const_gimple gs)
}
+/* Return the pointer to the tree node representing the function called
+ by call statement GS. This may or may not be a FUNCTION_DECL node. */
+
+static inline tree *
+gimple_call_fn_ptr (const_gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ return gimple_op_ptr (gs, 1);
+}
+
+
/* Set FN to be the function called by call statement GS. */
static inline void