/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
void irg_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
void *env)
{
- ir_reserve_resources(current_ir_graph, IR_RESOURCE_IRN_VISITED);
- inc_irg_visited(current_ir_graph);
- assert(current_ir_graph == get_irn_irg(node));
+ ir_graph *irg = get_irn_irg(node);
+ ir_graph *rem = current_ir_graph;
+
+ current_ir_graph = irg;
+ ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED);
+ inc_irg_visited(irg);
irg_walk_core(node, pre, post, env);
- ir_free_resources(current_ir_graph, IR_RESOURCE_IRN_VISITED);
+ ir_free_resources(irg, IR_RESOURCE_IRN_VISITED);
+ current_ir_graph = rem;
}
/*
current_ir_graph. */
void all_irg_walk(irg_walk_func *pre, irg_walk_func *post, void *env)
{
- int i, n;
+ size_t i, n;
ir_graph *irg;
for (i = 0, n = get_irp_n_irgs(); i < n; i++) {
{
switch (initializer->kind) {
case IR_INITIALIZER_CONST:
- irg_walk(initializer->consti.value, env->pre, env->post, env->env);
+ irg_walk(initializer->consti.value, env->pre, env->post, env->env);
return;
case IR_INITIALIZER_TARVAL:
case IR_INITIALIZER_NULL:
if (ent->initializer != NULL) {
walk_initializer(ent->initializer, my_env);
} else if (entity_has_compound_ent_values(ent)) {
- int i, n_vals = get_compound_ent_n_values(ent);
+ size_t i, n_vals = get_compound_ent_n_values(ent);
for (i = 0; i < n_vals; i++)
irg_walk(get_compound_ent_value(ent, i), my_env->pre, my_env->post, my_env->env);
/* Walks over all code in const_code_irg. */
void walk_const_code(irg_walk_func *pre, irg_walk_func *post, void *env)
{
- int i, j, n_types;
+ int j;
walk_env my_env;
ir_segment_t s;
+ size_t i;
+ size_t n_types;
ir_graph *rem = current_ir_graph;
current_ir_graph = get_const_code_irg();
my_env.env = env;
/* Walk all types that can contain constant entities. */
- for (s = IR_SEGMENT_FIRST; s <= IR_SEGMENT_LAST; s++)
+ for (s = IR_SEGMENT_FIRST; s <= IR_SEGMENT_LAST; ++s)
walk_types_entities(get_segment_type(s), &walk_entity, &my_env);
n_types = get_irp_n_types();
for (i = 0; i < n_types; i++)