X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftypewalk.c;h=7466b6ecf49b802c273c2a079a9f02dcc7cf6cab;hb=2158510961e84fb11e9195c200335f2314e49055;hp=3a545b6fb3c6b3571d158861ac107c14b554836a;hpb=2bc2dd4bd4f64982e9c5d2f1ea70d63d0eb10044;p=libfirm diff --git a/ir/tr/typewalk.c b/ir/tr/typewalk.c index 3a545b6fb..7466b6ecf 100644 --- a/ir/tr/typewalk.c +++ b/ir/tr/typewalk.c @@ -60,7 +60,7 @@ static void walk_initializer(ir_initializer_t *initializer, 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; @@ -70,7 +70,7 @@ static void walk_initializer(ir_initializer_t *initializer, 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); @@ -243,7 +243,8 @@ static void irn_type_walker( /** 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) { +static void start_type_walk(ir_node *node, void *ctx) +{ type_walk_env *env = ctx; type_walk_func *pre; type_walk_func *post; @@ -257,10 +258,12 @@ static void start_type_walk(ir_node *node, void *ctx) { } /* walker: walks over all types */ -void type_walk(type_walk_func *pre, type_walk_func *post, void *env) { +void type_walk(type_walk_func *pre, type_walk_func *post, void *env) +{ int 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); @@ -268,9 +271,11 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env) { } 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) { +void type_walk_prog(type_walk_func *pre, type_walk_func *post, void *env) +{ int i, n_irgs = get_irp_n_irgs(); type_or_ent cont; @@ -282,13 +287,13 @@ void type_walk_prog(type_walk_func *pre, type_walk_func *post, void *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); } } @@ -319,6 +324,7 @@ void type_walk_irg(ir_graph *irg, 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); @@ -329,6 +335,7 @@ void type_walk_irg(ir_graph *irg, 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, @@ -410,6 +417,7 @@ void type_walk_super2sub(type_walk_func *pre, type_or_ent cont; int 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); @@ -417,15 +425,14 @@ void type_walk_super2sub(type_walk_func *pre, 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; @@ -490,12 +497,12 @@ type_walk_super_2(type_or_ent tore, } } -void type_walk_super(type_walk_func *pre, - type_walk_func *post, - void *env) { +void type_walk_super(type_walk_func *pre, type_walk_func *post, void *env) +{ int 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); @@ -503,16 +510,14 @@ void type_walk_super(type_walk_func *pre, 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; @@ -549,6 +554,7 @@ void class_walk_super2sub(class_walk_func *pre, int 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); @@ -560,6 +566,7 @@ void class_walk_super2sub(class_walk_func *pre, class_walk_s2s_2(tp, pre, post, env); } } + irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED); }