/*
- * 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.
*
type_walk_func *pre, type_walk_func *post,
void *env)
{
- switch(initializer->kind) {
+ switch (initializer->kind) {
case IR_INITIALIZER_CONST:
irn_type_walker(initializer->consti.value, pre, post, env);
return;
case IR_INITIALIZER_COMPOUND: {
size_t i;
- for(i = 0; i < initializer->compound.n_initializers; ++i) {
+ for (i = 0; i < initializer->compound.n_initializers; ++i) {
ir_initializer_t *subinitializer
= initializer->compound.initializers[i];
walk_initializer(subinitializer, pre, post, env);
type_walk_func *post,
void *env)
{
- int i, n_types, n_mem;
+ size_t i, n_types, n_mem;
ir_entity *ent = NULL;
ir_type *tp = NULL;
ir_node *n;
if (ent->initializer != NULL) {
walk_initializer(ent->initializer, pre, post, env);
} else if (entity_has_compound_ent_values(ent)) {
- n_mem = get_compound_ent_n_values(ent);
+ size_t i, n_mem = get_compound_ent_n_values(ent);
for (i = 0; i < n_mem; ++i) {
n = get_compound_ent_value(ent, i);
irn_type_walker(n, pre, post, env);
/** Check whether node contains types or entities as an attribute.
If so start a walk over that information. */
-static void start_type_walk(ir_node *node, void *ctx) {
- type_walk_env *env = ctx;
+static void start_type_walk(ir_node *node, void *ctx)
+{
+ type_walk_env *env = (type_walk_env*)ctx;
type_walk_func *pre;
type_walk_func *post;
void *envi;
}
/* walker: walks over all types */
-void type_walk(type_walk_func *pre, type_walk_func *post, void *env) {
- int i, n_types = get_irp_n_types();
+void type_walk(type_walk_func *pre, type_walk_func *post, void *env)
+{
+ size_t i, n_types = get_irp_n_types();
type_or_ent cont;
+ irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED);
inc_master_type_visited();
for (i = 0; i < n_types; ++i) {
cont.typ = get_irp_type(i);
}
cont.typ = get_glob_type();
do_type_walk(cont, pre, post, env);
+ irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED);
}
-void type_walk_prog(type_walk_func *pre, type_walk_func *post, void *env) {
- int i, n_irgs = get_irp_n_irgs();
+void type_walk_prog(type_walk_func *pre, type_walk_func *post, void *env)
+{
+ size_t i, n_irgs = get_irp_n_irgs();
type_or_ent cont;
type_walk(pre, post, env);
do_type_walk(cont, pre, post, env);
cont.typ = get_method_value_param_type(get_entity_type(get_irg_entity(irg)));
- if(cont.typ)
+ if (cont.typ)
do_type_walk(cont, pre, post, env);
}
for (i = IR_SEGMENT_FIRST; i <= IR_SEGMENT_LAST; ++i) {
cont.typ = get_segment_type((ir_segment_t) i);
- if(cont.typ)
+ if (cont.typ)
do_type_walk(cont, pre, post, env);
}
}
Here we initially increase the flag. We only call do_type_walk that does
not increase the flag.
*/
+ irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED);
inc_master_type_visited();
irg_walk(get_irg_end(irg), start_type_walk, NULL, &type_env);
do_type_walk(cont, pre, post, env);
current_ir_graph = rem;
+ irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED);
}
static void type_walk_s2s_2(type_or_ent tore,
void *env)
{
type_or_ent cont;
- int i, n;
/* marked? */
switch (get_kind(tore.ent)) {
switch (get_type_tpop_code(tp)) {
case tpo_class:
{
+ size_t i, n;
+
n = get_class_n_supertypes(tp);
for (i = 0; i < n; ++i) {
cont.typ = get_class_supertype(tp, i);
void *env)
{
type_or_ent cont;
- int i, n_types = get_irp_n_types();
+ size_t i, n_types = get_irp_n_types();
+ irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED);
inc_master_type_visited();
cont.typ = get_glob_type();
type_walk_s2s_2(cont, pre, post, env);
cont.typ = get_irp_type(i);
type_walk_s2s_2(cont, pre, post, env);
}
+ irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED);
}
/*****************************************************************************/
-static void
-type_walk_super_2(type_or_ent tore,
- type_walk_func *pre,
- type_walk_func *post,
- void *env) {
+static void type_walk_super_2(type_or_ent tore, type_walk_func *pre,
+ type_walk_func *post, void *env)
+{
type_or_ent cont;
- int i, n;
/* marked? */
switch (get_kind(tore.ent)) {
switch (get_type_tpop_code(tp)) {
case tpo_class:
{
+ size_t i, n;
+
/* execute pre method */
if (pre)
pre(tore, env);
}
}
-void type_walk_super(type_walk_func *pre,
- type_walk_func *post,
- void *env) {
- int i, n_types = get_irp_n_types();
+void type_walk_super(type_walk_func *pre, type_walk_func *post, void *env)
+{
+ size_t i, n_types = get_irp_n_types();
type_or_ent cont;
+ irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED);
inc_master_type_visited();
cont.typ = get_glob_type();
type_walk_super_2(cont, pre, post, env);
cont.typ = get_irp_type(i);
type_walk_super_2(cont, pre, post, env);
}
+ irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED);
}
/*****************************************************************************/
-static void
-class_walk_s2s_2(ir_type *tp,
- class_walk_func *pre,
- class_walk_func *post,
- void *env)
+static void class_walk_s2s_2(ir_type *tp, class_walk_func *pre,
+ class_walk_func *post, void *env)
{
- int i, n;
+ size_t i, n;
/* marked? */
if (type_visited(tp)) return;
class_walk_func *post,
void *env)
{
- int i, n_types = get_irp_n_types();
+ size_t i, n_types = get_irp_n_types();
ir_type *tp;
+ irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED);
inc_master_type_visited();
for (i = 0; i < n_types; i++) {
tp = get_irp_type(i);
class_walk_s2s_2(tp, pre, post, env);
}
}
+ irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED);
}
entity_walk_func *doit,
void *env)
{
- int i, n;
+ size_t i, n;
switch (get_type_tpop_code(tp)) {
case tpo_class: