-# include "irnode.h"
-# include "irgraph.h" /* visited flag */
-# include "irprog.h"
-# include "irgwalk.h"
-# include "typewalk.h"
-
-# include "eset.h"
-# include "array.h"
-
-/* walk over an interprocedural graph (callgraph). Visits only graphs in irg_set. */
-static void irg_walk_cg(ir_node * node, int visited, eset * irg_set,
- irg_walk_func *pre, irg_walk_func *post, void * env) {
- int i;
- ir_graph * rem = current_ir_graph;
- ir_node * pred;
-
- assert(node);
- if (get_irn_visited(node) >= visited) return;
-
- set_irn_visited(node, visited);
-
- pred = skip_Proj(node);
- if (get_irn_op(pred) == op_CallBegin
- || get_irn_op(pred) == op_EndReg
- || get_irn_op(pred) == op_EndExcept) {
- current_ir_graph = get_irn_irg(pred);
- }
-
- if (pre) pre(node, env);
-
- if (is_no_Block(node))
- irg_walk_cg(get_nodes_Block(node), visited, irg_set, pre, post, env);
-
- if (get_irn_op(node) == op_Block) { /* block */
- for (i = get_irn_arity(node) - 1; i >= 0; --i) {
- ir_node * exec = get_irn_n(node, i);
- ir_node * pred = skip_Proj(exec);
- if ((get_irn_op(pred) != op_CallBegin
- && get_irn_op(pred) != op_EndReg
- && get_irn_op(pred) != op_EndExcept)
- || eset_contains(irg_set, get_irn_irg(pred))) {
- irg_walk_cg(exec, visited, irg_set, pre, post, env);
- }
- }
- } else if (get_irn_op(node) == op_Filter) {
- for (i = get_irn_arity(node) - 1; i >= 0; --i) {
- ir_node * pred = get_irn_n(node, i);
- if (get_irn_op(pred) == op_Unknown || get_irn_op(pred) == op_Bad) {
- irg_walk_cg(pred, visited, irg_set, pre, post, env);
- } else {
- ir_node * exec;
- exec = skip_Proj(get_Block_cfgpred(get_nodes_Block(node), i));
- assert(get_irn_op(exec) == op_CallBegin
- || get_irn_op(exec) == op_EndReg
- || get_irn_op(exec) == op_EndExcept);
- if (eset_contains(irg_set, get_irn_irg(exec))) {
- current_ir_graph = get_irn_irg(exec);
- irg_walk_cg(pred, visited, irg_set, pre, post, env);
- current_ir_graph = rem;