* @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
current_ir_graph = rem;
}
-#endif
/**
* Insert all ir_graphs in irg_set, that are (transitive) reachable.
}
}
}
+#endif
/**
* specialized version of irg_walk_2, called if only pre callback exists
*
* @return number of visited nodes
*/
-static unsigned
-irg_walk_2(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void * env)
+unsigned irg_walk_2(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
+ void *env)
{
if (node->visited < current_ir_graph->visited) {
if (!post) return irg_walk_2_pre (node, pre, 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);
}
}
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();
my_env.env = env;
/* Walk all types that can contain constant entities. */
- for (i = 0; i < IR_SEGMENT_COUNT; i++)
- walk_types_entities(get_segment_type((ir_segment_t) i), &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);