type list fixes
authorMatthias Braun <matze@braunis.de>
Wed, 16 Nov 2011 19:50:09 +0000 (20:50 +0100)
committerMatthias Braun <matze@braunis.de>
Thu, 17 Nov 2011 15:37:12 +0000 (16:37 +0100)
Make sure all types are in the global type list, remove type_walk_prog
which was a strange alternative to type_walk attempting to not miss
types not in the global list.

include/libfirm/irprog.h
include/libfirm/typerep.h
ir/be/bemain.c
ir/ir/irprog.c
ir/ir/irprog_t.h
ir/tr/type.c
ir/tr/typewalk.c

index 588c58b..fc69d73 100644 (file)
@@ -185,13 +185,6 @@ FIRM_API ir_type *get_glob_type(void);
  */
 FIRM_API ir_type *get_tls_type(void);
 
-/** Adds type to the list of types in irp. */
-FIRM_API void add_irp_type(ir_type *typ);
-
-/** Removes type from the list of types, deallocates it and
-    shrinks the list by one. */
-FIRM_API void remove_irp_type(ir_type *typ);
-
 /**
  * Returns the number of all types in the irp.
  * @deprecated
index a093651..cc65f91 100644 (file)
@@ -2142,11 +2142,6 @@ typedef void class_walk_func(ir_type *clss, void *env);
  *  Does not touch frame types or types for value params ... */
 FIRM_API void type_walk(type_walk_func *pre, type_walk_func *post, void *env);
 
-/** Touches every type, entity, frame type, and value param type in
- *  unspecified order (also all segment types). */
-FIRM_API void type_walk_prog(type_walk_func *pre, type_walk_func *post,
-                             void *env);
-
 /** Walks over all type information reachable from an ir graph.
  *
  *  Walks over all type information reachable from irg, i.e., starts a
index fa5fab8..cd01bca 100644 (file)
@@ -368,8 +368,6 @@ static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle,
        env->pic_symbols_type     = new_type_struct(NEW_ID("$PIC_SYMBOLS_TYPE"));
        env->cup_name             = compilation_unit_name;
 
-       remove_irp_type(env->pic_trampolines_type);
-       remove_irp_type(env->pic_symbols_type);
        set_class_final(env->pic_trampolines_type, 1);
 
        memset(asm_constraint_flags, 0, sizeof(asm_constraint_flags));
index bea2455..e6abb6e 100644 (file)
@@ -79,8 +79,6 @@ static ir_prog *new_incomplete_ir_prog(void)
  */
 static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name)
 {
-       ir_segment_t s;
-
 #define IDENT(x)  new_id_from_chars(x, sizeof(x) - 1)
 
        irp->name = new_id_from_str(module_name);
@@ -92,11 +90,6 @@ static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name)
                = new_type_class(IDENT("Constructors"));
        irp->segment_types[IR_SEGMENT_DESTRUCTORS]
                = new_type_class(IDENT("Destructors"));
-       /* Remove these types from type list.  Must be treated differently than
-          other types. */
-       for (s = IR_SEGMENT_FIRST; s <= IR_SEGMENT_LAST; ++s) {
-               remove_irp_type(irp->segment_types[s]);
-       }
 
        /* Set these flags for debugging. */
        irp->segment_types[IR_SEGMENT_GLOBAL]->flags       |= tf_global_type;
@@ -186,8 +179,6 @@ void set_segment_type(ir_segment_t segment, ir_type *new_type)
 {
        assert(segment <= IR_SEGMENT_LAST);
        irp->segment_types[segment] = new_type;
-       /* segment types are not in the type list... */
-       remove_irp_type(new_type);
 }
 
 ir_type *(get_glob_type)(void)
index 314779d..15111a1 100644 (file)
@@ -160,6 +160,13 @@ void init_irprog_1(void);
 /** Completes ir_prog. */
 void init_irprog_2(void);
 
+/** Adds type to the list of types in irp. */
+FIRM_API void add_irp_type(ir_type *typ);
+
+/** Removes type from the list of types, deallocates it and
+    shrinks the list by one. */
+FIRM_API void remove_irp_type(ir_type *typ);
+
 /* Inline functions. */
 #define get_irp_n_irgs()                 get_irp_n_irgs_()
 #define get_irp_irg(pos)                 get_irp_irg_(pos)
index 2cf6499..e6efea0 100644 (file)
@@ -86,16 +86,13 @@ void ir_init_type(void)
        firm_none_type = new_type(tpop_none, mode_BAD, NULL);
        set_type_size_bytes(firm_none_type, 0);
        set_type_state (firm_none_type, layout_fixed);
-       remove_irp_type(firm_none_type);
 
        firm_code_type = new_type(tpop_code, mode_ANY, NULL);
        set_type_state(firm_code_type, layout_fixed);
-       remove_irp_type(firm_code_type);
 
        firm_unknown_type = new_type(tpop_unknown, mode_ANY, NULL);
        set_type_size_bytes(firm_unknown_type, 0);
        set_type_state (firm_unknown_type, layout_fixed);
-       remove_irp_type(firm_unknown_type);
 }
 
 void ir_finish_type(void)
@@ -1960,9 +1957,6 @@ ir_type *new_type_frame(void)
 
        res->flags |= tf_frame_type;
 
-       /* Remove type from type list.  Must be treated differently than other types. */
-       remove_irp_type(res);
-
        /* It is not possible to derive from the frame type. Set the final flag. */
        set_class_final(res, 1);
 
index 1c32934..738a02b 100644 (file)
@@ -273,26 +273,6 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env)
        irp_free_resources(irp, IRP_RESOURCE_TYPE_VISITED);
 }
 
-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);
-
-       for (i = 0; i < n_irgs; ++i) {
-               ir_graph *irg = get_irp_irg(i);
-               cont.typ = get_irg_frame_type(irg);
-               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)
-                       do_type_walk(cont, pre, post, env);
-       }
-}
-
 void type_walk_irg(ir_graph *irg,
                    type_walk_func *pre,
                    type_walk_func *post,