introduce IR_RESOURCE_TYPE_VISITED
authorMatthias Braun <matze@braunis.de>
Thu, 4 Feb 2010 20:27:31 +0000 (20:27 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 4 Feb 2010 20:27:31 +0000 (20:27 +0000)
[r27044]

include/libfirm/irgraph.h
ir/tr/typewalk.c

index aae5d54..96413f1 100644 (file)
@@ -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. */
index 3a545b6..c4aa436 100644 (file)
@@ -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);
 }