From 364a75f2257a590896017f5d0f373a6f15d374e9 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 4 Feb 2010 20:27:31 +0000 Subject: [PATCH] introduce IR_RESOURCE_TYPE_VISITED [r27044] --- include/libfirm/irgraph.h | 1 + ir/tr/typewalk.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/libfirm/irgraph.h b/include/libfirm/irgraph.h index aae5d5458..96413f1f7 100644 --- a/include/libfirm/irgraph.h +++ b/include/libfirm/irgraph.h @@ -521,6 +521,7 @@ enum ir_resources_enum_t { /* global (irp) resources */ IR_RESOURCE_ENTITY_LINK = 1 << 8, /**< IR-entity link fields are used. */ + IR_RESOURCE_TYPE_VISITED = 1 << 8, /**< type visited flags */ /* masks */ IR_RESOURCE_LOCAL_MASK = 0x00FF, /**< Mask for all local resources. */ diff --git a/ir/tr/typewalk.c b/ir/tr/typewalk.c index 3a545b6fb..c4aa43678 100644 --- a/ir/tr/typewalk.c +++ b/ir/tr/typewalk.c @@ -261,6 +261,7 @@ 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,6 +269,7 @@ 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) { @@ -319,6 +321,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 +332,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 +414,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,6 +422,7 @@ 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); } /*****************************************************************************/ @@ -496,6 +502,7 @@ void type_walk_super(type_walk_func *pre, 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,6 +510,7 @@ 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); } /*****************************************************************************/ @@ -549,6 +557,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 +569,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); } -- 2.20.1