X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgwalk.c;h=a7ca5ff577b780dc2db0fae2d97c18d153b85daa;hb=cf946e20e9cac9f8e42e7a1fc93886a75db7a80c;hp=732ae4e6e2b756ad1f1519770cc61d4d49556e4a;hpb=3e1337f622b15ca6edf9d40e588444bee3418ccd;p=libfirm diff --git a/ir/ir/irgwalk.c b/ir/ir/irgwalk.c index 732ae4e6e..a7ca5ff57 100644 --- a/ir/ir/irgwalk.c +++ b/ir/ir/irgwalk.c @@ -22,7 +22,7 @@ * @brief Functions for traversing ir graphs * @author Boris Boesler, Goetz Lindenmaier, Michael Beck * @version $Id$ - * @summary + * @brief * traverse an ir graph * - execute the pre function before recursion * - execute the post function after recursion @@ -43,13 +43,15 @@ #include "pset_new.h" #include "array.h" +#ifdef INTERPROCEDURAL_VIEW /** * Walk over an interprocedural graph (callgraph). * Visits only graphs in irg_set. */ static void irg_walk_cg(ir_node * node, ir_visited_t visited, pset_new_t *irg_set, irg_walk_func *pre, - irg_walk_func *post, void * env) { + irg_walk_func *post, void * env) +{ int i; ir_graph * rem = current_ir_graph; ir_node * pred; @@ -118,7 +120,6 @@ static void irg_walk_cg(ir_node * node, ir_visited_t visited, current_ir_graph = rem; } - /** * Insert all ir_graphs in irg_set, that are (transitive) reachable. */ @@ -135,6 +136,7 @@ static void collect_irgs(ir_node * node, pset_new_t *irg_set) { } } } +#endif /** * specialized version of irg_walk_2, called if only pre callback exists @@ -468,6 +470,7 @@ switch_irg(ir_node *n, int index) { return old_current; } +#ifdef INTERPROCEDURAL_VIEW static void cg_walk_2(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void * env) { @@ -493,7 +496,6 @@ cg_walk_2(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void * env) } } -#ifdef INTERPROCEDURAL_VIEW /* Walks all irgs in interprocedural view. Visits each node only once. */ void cg_walk(irg_walk_func *pre, irg_walk_func *post, void *env) { int i; @@ -696,17 +698,13 @@ static void walk_entity(ir_entity *ent, void *env) { walk_env *my_env = (walk_env *)env; - if (get_entity_variability(ent) != variability_uninitialized) { - if (ent->has_initializer) { - walk_initializer(ent->attr.initializer, my_env); - } else if (is_atomic_entity(ent)) { - irg_walk(get_atomic_ent_value(ent), my_env->pre, my_env->post, my_env->env); - } else { - int i, n_vals = get_compound_ent_n_values(ent); + 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); - for (i = 0; i < n_vals; i++) - irg_walk(get_compound_ent_value(ent, i), my_env->pre, my_env->post, my_env->env); - } + for (i = 0; i < n_vals; i++) + irg_walk(get_compound_ent_value(ent, i), my_env->pre, my_env->post, my_env->env); } } @@ -714,6 +712,7 @@ static void walk_entity(ir_entity *ent, void *env) void walk_const_code(irg_walk_func *pre, irg_walk_func *post, void *env) { int i, j, n_types; walk_env my_env; + ir_segment_t s; ir_graph *rem = current_ir_graph; current_ir_graph = get_const_code_irg(); @@ -724,7 +723,8 @@ void walk_const_code(irg_walk_func *pre, irg_walk_func *post, void *env) { my_env.env = env; /* Walk all types that can contain constant entities. */ - walk_types_entities(get_glob_type(), &walk_entity, &my_env); + 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++) walk_types_entities(get_irp_type(i), &walk_entity, &my_env);