# ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
# endif
# include "irgwalk.h" /* for irg_walk_func */
+# include "irprog.h" /* for get_irp_main_irg */
# include "xmalloc.h"
# ifndef TRUE
set_irn_visited (node, walk_env->visited);
}
+ if (op_NoMem == get_irn_op (node)) {
+ /* We don't want to see it it if it's not memory */
+ return;
+ }
+
+ if (iro_Proj == op) {
+ /* We don't want to see proj nodes at all --- skip over them */
+ in = get_Proj_pred (node);
+
+ irg_walk_mem_node (in, walk_env);
+
+ return;
+ }
+
+ /* execute the 'pre' function */
if (NULL != walk_env->pre) {
walk_env->pre (node, walk_env->env);
}
irg_walk_mem_node (in, walk_env);
} break;
- case (iro_Proj): {
- in = get_Proj_pred (node);
-
- irg_walk_mem_node (in, walk_env);
- } break;
case (iro_Phi): {
int i;
int n_ins = get_irn_arity (node);
irg_walk_mem_node (in, walk_env);
} break;
+ case (iro_Block): {
+ /* End Block ONLY */
+ int i;
+ int n_ins = get_irn_arity (node);
+
+ for (i = 0; i < n_ins; i ++) {
+ ir_node *ret = get_irn_n (node, i);
+
+ irg_walk_mem_node (ret, walk_env);
+ }
+ } break;
default: {
+ fprintf (stderr, "%s: not handled: node[%li].op = %s\n",
+ __FUNCTION__,
+ get_irn_node_nr (node),
+ get_op_name (get_irn_op (node)));
+
assert (0 && "something not handled");
}
}
+ /* execute the 'post' function */
if (NULL != walk_env->post) {
walk_env->post (node, walk_env->env);
}
irg_walk_func *pre, irg_walk_func *post,
void *env)
{
- int i;
- ir_node *ret = NULL;
- ir_node *end = get_irg_end_block (graph);
- int n_ins;
+ ir_node *end_block = get_irg_end_block (graph);
walk_mem_env_t *walk_env = (walk_mem_env_t*) xmalloc (sizeof (walk_mem_env_t));
assert (! get_irg_is_mem_visited (graph));
walk_env->post = post;
walk_env->env = env;
- /* 'graph' is not actually being visited right now, but it should be reported that way */
+ /* 'graph' is not actually being visited right now, so make sure it is reported that way */
assert (get_irg_is_mem_visited (graph));
- /* all return nodes */
- n_ins = get_irn_arity (end);
- for (i = 0; i < n_ins; i ++) {
- ret = get_irn_n (end, i);
-
- irg_walk_mem_node (ret, walk_env);
- }
-
+ /*
+ The ins of the end BLOCK are either 'return's (regular exits) or
+ 'ProjX'/'Raise's (exception exits). We only walk over the
+ 'return' nodes, assuming that all memory-changing nodes are found
+ from there on.
+ */
+ irg_walk_mem_node (end_block, walk_env);
/*
The end NODE sometimes has some more ins. not sure whether we need to walk them.
*/
/*
$Log$
+ Revision 1.6 2004/12/02 16:17:51 beck
+ fixed config.h include
+
+ Revision 1.5 2004/11/19 10:35:20 liekweg
+ also test for NoMem
+
+ Revision 1.4 2004/11/18 16:35:11 liekweg
+ Do not touch Proj nodes at all
+
+ Revision 1.3 2004/11/04 14:57:12 liekweg
+ fixed end block handling
+
Revision 1.2 2004/10/22 14:41:12 liekweg
execute 'pre' for a change. Also, add CVS log