/*
- * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
#endif
#include "irnode_t.h"
-#include "irgraph_t.h" /* visited flag */
+#include "irgraph_t.h"
#include "irprog.h"
#include "irgwalk.h"
#include "irhooks.h"
#include "ircgcons.h"
+#include "entity_t.h"
+#include "error.h"
#include "pset_new.h"
#include "array.h"
{
assert(is_ir_node(node));
+#ifdef INTERPROCEDURAL_VIEW
if (get_interprocedural_view()) {
pset_new_t irg_set;
pset_new_iterator_t iter;
irg_walk_cg(node, visited, &irg_set, pre, post, env);
pset_new_destroy(&irg_set);
} else {
- set_using_visited(current_ir_graph);
+#endif
+ set_using_irn_visited(current_ir_graph);
inc_irg_visited(current_ir_graph);
nodes_touched = irg_walk_2(node, pre, post, env);
- clear_using_visited(current_ir_graph);
+ clear_using_irn_visited(current_ir_graph);
+#ifdef INTERPROCEDURAL_VIEW
}
+#endif
return;
}
if (get_interprocedural_view()) {
assert(0 && "This is not yet implemented.");
} else {
- set_using_visited(current_ir_graph);
+ set_using_irn_visited(current_ir_graph);
inc_irg_visited(current_ir_graph);
nodes_touched = irg_walk_in_or_dep_2(node, pre, post, env);
- clear_using_visited(current_ir_graph);
+ clear_using_irn_visited(current_ir_graph);
}
return;
}
return;
}
-
+#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;
set_interprocedural_view(rem_view);
current_ir_graph = rem;
}
+#endif
/***************************************************************************/
void *env;
} walk_env;
+static void walk_initializer(ir_initializer_t *initializer, walk_env *env)
+{
+ switch(initializer->kind) {
+ case IR_INITIALIZER_CONST:
+ irg_walk(initializer->consti.value, env->pre, env->post, env->env);
+ return;
+ case IR_INITIALIZER_TARVAL:
+ case IR_INITIALIZER_NULL:
+ return;
+
+ case IR_INITIALIZER_COMPOUND: {
+ size_t i;
+ for(i = 0; i < initializer->compound.n_initializers; ++i) {
+ ir_initializer_t *subinitializer
+ = initializer->compound.initializers[i];
+ walk_initializer(subinitializer, env);
+ }
+ return;
+ }
+ }
+ panic("invalid initializer found");
+}
+
/**
* Walk to all constant expressions in this entity.
*/
walk_env *my_env = (walk_env *)env;
if (get_entity_variability(ent) != variability_uninitialized) {
- if (is_atomic_entity(ent)) {
+ 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);