From e66f1a09b0571c6982fb221ee13cf2417e00e874 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Tue, 16 Jan 2007 10:40:40 +0000 Subject: [PATCH] use inside_block_walk and inside_irg_walk flaks to ensure no double walks are started [r8528] --- ir/ir/irgwalk.c | 11 ++++++++++- ir/ir/irgwalk_blk.c | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ir/ir/irgwalk.c b/ir/ir/irgwalk.c index 439964d1b..56a53c56b 100644 --- a/ir/ir/irgwalk.c +++ b/ir/ir/irgwalk.c @@ -260,8 +260,11 @@ void irg_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void *env) irg_walk_cg(node, visited, irg_set, pre, post, env); eset_destroy(irg_set); } else { + assert(! inside_irg_walk(current_ir_graph)); /* we must not already be inside an irg walk */ + set_inside_irg_walk(current_ir_graph); inc_irg_visited(current_ir_graph); nodes_touched = irg_walk_2(node, pre, post, env); + clear_inside_irg_walk(current_ir_graph); } return; } @@ -412,8 +415,11 @@ void irg_walk_in_or_dep(ir_node *node, irg_walk_func *pre, irg_walk_func *post, if (get_interprocedural_view()) { assert(0 && "This is not yet implemented."); } else { + assert(! inside_irg_walk(current_ir_graph)); /* we must not already be inside an irg walk */ + set_inside_irg_walk(current_ir_graph); inc_irg_visited(current_ir_graph); nodes_touched = irg_walk_in_or_dep_2(node, pre, post, env); + clear_inside_irg_walk(current_ir_graph); } return; } @@ -598,8 +604,10 @@ void irg_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void assert(node); assert(!get_interprocedural_view()); /* interprocedural_view not implemented, because it * interleaves with irg_walk */ + assert(! inside_irg_walk(current_ir_graph)); /* we must not already be in a block walk */ inc_irg_block_visited(current_ir_graph); - if (is_no_Block(node)) block = get_nodes_block(node); else block = node; + set_inside_block_walk(current_ir_graph); + block = is_Block(node) ? node : get_nodes_block(node); assert(get_irn_op(block) == op_Block); irg_block_walk_2(block, pre, post, env); @@ -624,6 +632,7 @@ void irg_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void } } + clear_inside_block_walk(current_ir_graph); return; } diff --git a/ir/ir/irgwalk_blk.c b/ir/ir/irgwalk_blk.c index aa3bae363..0de8e9613 100644 --- a/ir/ir/irgwalk_blk.c +++ b/ir/ir/irgwalk_blk.c @@ -346,6 +346,9 @@ do_irg_walk_blk(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void *en int old_view = get_interprocedural_view(); block_entry_t *entry; + assert(! inside_irg_walk(irg)); /* we must not already be inside an irg walk */ + set_inside_irg_walk(irg); + /* switch off interprocedural view */ set_interprocedural_view(0); @@ -375,6 +378,7 @@ do_irg_walk_blk(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void *en obstack_free(&blks.obst, NULL); set_interprocedural_view(old_view); + clear_inside_irg_walk(irg); } void irg_walk_blkwise_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void *env) -- 2.20.1