From 3ddfc6a40d86f6619bf7837c25e8e0310cbf355b Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 16 Nov 2011 20:50:09 +0100 Subject: [PATCH] type list fixes 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 | 7 ------- include/libfirm/typerep.h | 5 ----- ir/be/bemain.c | 2 -- ir/ir/irprog.c | 9 --------- ir/ir/irprog_t.h | 7 +++++++ ir/tr/type.c | 6 ------ ir/tr/typewalk.c | 20 -------------------- 7 files changed, 7 insertions(+), 49 deletions(-) diff --git a/include/libfirm/irprog.h b/include/libfirm/irprog.h index 588c58b12..fc69d73a7 100644 --- a/include/libfirm/irprog.h +++ b/include/libfirm/irprog.h @@ -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 diff --git a/include/libfirm/typerep.h b/include/libfirm/typerep.h index a0936512e..cc65f917f 100644 --- a/include/libfirm/typerep.h +++ b/include/libfirm/typerep.h @@ -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 diff --git a/ir/be/bemain.c b/ir/be/bemain.c index fa5fab8c1..cd01bca57 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -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)); diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index bea24551d..e6abb6ed2 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -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) diff --git a/ir/ir/irprog_t.h b/ir/ir/irprog_t.h index 314779d00..15111a16f 100644 --- a/ir/ir/irprog_t.h +++ b/ir/ir/irprog_t.h @@ -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) diff --git a/ir/tr/type.c b/ir/tr/type.c index 2cf64992a..e6efea0b5 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -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); diff --git a/ir/tr/typewalk.c b/ir/tr/typewalk.c index 1c329345e..738a02b61 100644 --- a/ir/tr/typewalk.c +++ b/ir/tr/typewalk.c @@ -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, -- 2.20.1